/* ========= Reset & Base ========= */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
[hidden] { display: none !important; }
body {
    font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    background: #0a0a12;
    color: #e8e8f0;
    line-height: 1.5;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}
button { font: inherit; cursor: pointer; }
a { color: inherit; }

:root {
    --bg-deep: #08080f;
    --bg-card: rgba(255,255,255,0.04);
    --bg-card-hover: rgba(255,255,255,0.06);
    --border: rgba(255,255,255,0.10);
    --border-strong: rgba(255,255,255,0.20);
    --text: #e8e8f0;
    --text-dim: rgba(232,232,240,0.6);
    --text-mute: rgba(232,232,240,0.4);
    --accent: #7f5af0;
    --accent-2: #2cb67d;
    --danger: #ef4444;
    --success: #22c55e;
    --warn: #f59e0b;
    --radius: 16px;
    --shadow-glow: 0 10px 40px -10px rgba(127, 90, 240, 0.3);
}

.bg-layer {
    position: fixed; inset: 0; z-index: -1;
    background:
        radial-gradient(ellipse at 20% 10%, rgba(127,90,240,0.15), transparent 40%),
        radial-gradient(ellipse at 80% 90%, rgba(44,182,125,0.12), transparent 45%),
        linear-gradient(180deg, #08080f 0%, #0b0b18 100%);
}

.app { max-width: 1200px; margin: 0 auto; padding: 2rem 1.25rem 4rem; }

/* ========= Typography ========= */
h1, h2, h3 { margin: 0; font-weight: 800; letter-spacing: -0.02em; }
.gradient-text {
    background: linear-gradient(135deg, #c9b6ff 0%, #7f5af0 50%, #2cb67d 100%);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
}
.gradient-text-alt {
    background: linear-gradient(135deg, #ffffff 0%, #a78bfa 100%);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
}

/* ========= Hero / Landing ========= */
.hero { padding: 3.5rem 0 3rem; text-align: center; }
.hero-top {
    display: inline-flex; gap: 0.75rem; align-items: center;
    padding: 0.4rem 0.9rem; margin-bottom: 1.5rem;
    border: 1px solid var(--border); border-radius: 99px;
    background: rgba(255,255,255,0.03);
    font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--text-dim);
}
.logo-chip {
    display: inline-grid; place-items: center;
    width: 26px; height: 26px; border-radius: 8px;
    font-size: 0.75rem; font-weight: 800; letter-spacing: 0;
    color: #fff; background: linear-gradient(135deg, #7f5af0, #2cb67d);
}
.hero-tag { color: var(--text); }
.hero-title { font-size: clamp(2.25rem, 5vw, 4rem); line-height: 1.08; margin-bottom: 1.25rem; }
.hero-lead { max-width: 640px; margin: 0 auto; color: var(--text-dim); font-size: 1.125rem; }
.hero-lead strong { color: var(--text); }

/* ========= Theme cards ========= */
.theme-grid {
    display: grid; gap: 1.25rem;
    grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
    margin: 2rem 0 4rem;
}
.theme-card {
    position: relative; overflow: hidden;
    display: flex; flex-direction: column; justify-content: flex-end;
    aspect-ratio: 4 / 5;
    padding: 1.5rem;
    border: 1px solid var(--border); border-radius: var(--radius);
    background:
        linear-gradient(180deg, transparent 20%, rgba(0,0,0,0.55) 100%),
        radial-gradient(ellipse at top right, color-mix(in srgb, var(--card-accent) 40%, transparent) 0%, transparent 50%),
        linear-gradient(135deg, color-mix(in srgb, var(--card-color) 75%, black) 0%, color-mix(in srgb, var(--card-color) 20%, black) 100%);
    color: #fff;
    text-decoration: none;
    transition: transform .3s ease, box-shadow .3s ease, border-color .3s ease;
}
.theme-card:hover {
    transform: translateY(-6px) scale(1.02);
    border-color: var(--card-accent);
    box-shadow: 0 20px 50px -15px color-mix(in srgb, var(--card-color) 50%, transparent);
}
.theme-card__label {
    position: absolute; top: 1.25rem; left: 1.25rem;
    font-size: 0.7rem; letter-spacing: 0.2em; text-transform: uppercase;
    padding: 0.35rem 0.65rem; border: 1px solid rgba(255,255,255,0.3);
    border-radius: 99px; background: rgba(0,0,0,0.25); backdrop-filter: blur(6px);
}
.theme-card__art {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -55%);
    width: 55%; color: var(--card-accent);
    opacity: 0.85;
    transition: transform .4s ease;
}
.theme-card:hover .theme-card__art { transform: translate(-50%, -55%) scale(1.08) rotate(-3deg); }
.theme-card__glow {
    position: absolute; inset: -30%;
    background: radial-gradient(circle at center, color-mix(in srgb, var(--card-accent) 40%, transparent), transparent 60%);
    opacity: 0; transition: opacity .4s ease;
    pointer-events: none;
}
.theme-card:hover .theme-card__glow { opacity: 1; }
.theme-card__title { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.015em; margin-bottom: 0.35rem; }
.theme-card__cta {
    display: inline-flex; align-items: center; gap: 0.5rem;
    color: var(--card-accent); font-weight: 600;
}

/* ========= How-to ========= */
.how { margin: 4rem 0 1rem; }
.how h2 { font-size: 1.5rem; text-align: center; color: var(--text-dim); font-weight: 600; letter-spacing: 0.02em; margin-bottom: 1.5rem; }
.how-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.how-step {
    position: relative;
    padding: 1.5rem 1.25rem 1.25rem;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
}
.how-num {
    position: absolute; top: -18px; left: 1.25rem;
    display: inline-grid; place-items: center;
    width: 36px; height: 36px; border-radius: 10px;
    background: linear-gradient(135deg, #7f5af0, #2cb67d);
    font-size: 1rem; font-weight: 800; color: #fff;
    box-shadow: var(--shadow-glow);
}
.how-step p { margin: 0; color: var(--text-dim); font-size: 0.95rem; }
.how-step strong { color: var(--text); }

.footer {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 3rem; padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    color: var(--text-mute); font-size: 0.875rem;
}
.footer-join a { color: var(--accent); text-decoration: none; }

/* ========= Form / Play ========= */
.back-link {
    display: inline-block; margin-bottom: 1.5rem;
    color: var(--text-dim); text-decoration: none; font-size: 0.9rem;
    transition: color .2s;
}
.back-link:hover { color: var(--text); }
.form-hero { text-align: center; padding: 2rem 0 2.5rem; }
.form-hero h1 { font-size: clamp(2rem, 4vw, 3rem); margin-bottom: 0.75rem; }
.lead { color: var(--text-dim); }

.form-split {
    display: grid; gap: 1.25rem;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    max-width: 760px; margin: 0 auto;
}
.card-form {
    padding: 1.75rem;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex; flex-direction: column; gap: 1rem;
}
.card-form--primary {
    background: linear-gradient(180deg, rgba(127,90,240,0.12), rgba(127,90,240,0.02));
    border-color: rgba(127,90,240,0.3);
}
.card-form__header h2 { font-size: 1.35rem; margin-top: 0.5rem; }
.card-form__hint { margin: 0; color: var(--text-mute); font-size: 0.85rem; }

.pill {
    display: inline-block; font-size: 0.7rem; letter-spacing: 0.2em;
    padding: 0.3rem 0.6rem; border-radius: 99px;
    background: rgba(127,90,240,0.2); color: #c9b6ff;
    font-weight: 700;
}
.pill--alt { background: rgba(44,182,125,0.15); color: #86efac; }
.pill--solo { background: rgba(240, 180, 40, 0.15); color: #fcd34d; }

/* Solo divider */
.solo-divider {
    display: flex; align-items: center; gap: 1rem;
    max-width: 760px; margin: 2rem auto 1.5rem;
    color: var(--text-mute);
    font-size: 0.85rem; letter-spacing: 0.15em; text-transform: uppercase;
}
.solo-divider::before, .solo-divider::after {
    content: ''; flex: 1; height: 1px; background: var(--border);
}
.solo-divider span { padding: 0 0.5rem; }

/* Solo card */
.card-form--solo {
    max-width: 560px; margin: 0 auto;
    background: linear-gradient(180deg, rgba(240,180,40,0.1), rgba(240,180,40,0.02));
    border-color: rgba(240,180,40,0.3);
}

/* Difficulty radio pills */
.difficulty-group {
    display: flex; flex-direction: column; gap: 0.5rem;
    padding: 0; margin: 0; border: 0;
}
.difficulty-group legend {
    display: block; padding: 0; margin-bottom: 0.5rem;
}
.radio-pill {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.85rem 1rem;
    background: rgba(255,255,255,0.03);
    border: 2px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.radio-pill:hover { background: rgba(255,255,255,0.06); border-color: var(--border-strong); }
.radio-pill input[type="radio"] {
    width: 18px; height: 18px; accent-color: #f0b428;
    margin: 0;
}
.radio-pill span { font-weight: 600; }
.radio-pill small { color: var(--text-mute); font-size: 0.8rem; }
.radio-pill:has(input:checked) {
    border-color: #f0b428;
    background: rgba(240,180,40,0.1);
}

.btn-solo {
    background: linear-gradient(135deg, #f0b428, #d4941a);
    color: #1a1505;
    box-shadow: 0 8px 24px -8px rgba(240,180,40,0.55);
}
.btn-solo:hover { box-shadow: 0 12px 32px -8px rgba(240,180,40,0.75); }

.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field-label { font-size: 0.8rem; color: var(--text-dim); letter-spacing: 0.02em; }
.field input, .dialog input {
    padding: 0.85rem 1rem;
    background: rgba(0,0,0,0.3); border: 1px solid var(--border);
    border-radius: 10px; color: var(--text); font-size: 1rem;
    transition: border-color .2s, background .2s;
    outline: none;
}
.field input:focus, .dialog input:focus {
    border-color: var(--accent); background: rgba(0,0,0,0.5);
}

/* ========= Buttons ========= */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    padding: 0.85rem 1.25rem;
    border-radius: 12px; border: 1px solid transparent;
    font-weight: 700; font-size: 1rem; letter-spacing: -0.005em;
    text-decoration: none;
    transition: transform .15s, background .2s, border-color .2s, box-shadow .2s;
}
.btn:active { transform: scale(0.97); }
.btn-lg { padding: 1rem 1.25rem; font-size: 1.05rem; }
.btn-primary {
    background: linear-gradient(135deg, #7f5af0, #5f3fe0);
    color: #fff;
    box-shadow: 0 8px 24px -8px rgba(127,90,240,0.6);
}
.btn-primary:hover { box-shadow: 0 12px 32px -8px rgba(127,90,240,0.8); }
.btn-secondary {
    background: rgba(44,182,125,0.15); color: #86efac;
    border-color: rgba(44,182,125,0.35);
}
.btn-secondary:hover { background: rgba(44,182,125,0.25); }
.btn-ghost {
    background: transparent; color: var(--text-dim);
    border-color: var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-strong); }

/* ========= Dialog ========= */
.dialog { border: none; border-radius: var(--radius); padding: 0; background: transparent; color: inherit; }
.dialog::backdrop { background: rgba(0,0,0,0.7); backdrop-filter: blur(8px); }
.dialog-form {
    background: #151525; border: 1px solid var(--border);
    padding: 1.75rem; border-radius: var(--radius);
    display: flex; flex-direction: column; gap: 1rem;
    min-width: 300px;
}
.dialog-form h3 { margin-bottom: 0.5rem; }
.dialog-form label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.85rem; color: var(--text-dim); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.5rem; }

/* ========= Lobby ========= */
.lobby {
    text-align: center; padding: 3rem 1rem; max-width: 520px; margin: 0 auto;
}
.lobby-status {
    display: inline-flex; gap: 0.5rem; align-items: center;
    padding: 0.5rem 1rem; border-radius: 99px;
    background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fbbf24; font-size: 0.85rem; font-weight: 600;
    margin-bottom: 2rem;
}
.pulse-dot {
    width: 8px; height: 8px; border-radius: 50%; background: #fbbf24;
    animation: pulse 1.5s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(1.3); } }

.lobby h1 { font-size: 1.25rem; font-weight: 600; color: var(--text-dim); margin-bottom: 0.5rem; }
.match-code {
    font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace;
    font-size: clamp(3rem, 10vw, 5.5rem); font-weight: 900;
    letter-spacing: 0.15em;
    padding: 1.5rem 1rem;
    background: linear-gradient(135deg, rgba(127,90,240,0.15), rgba(44,182,125,0.08));
    border: 2px dashed var(--border-strong); border-radius: var(--radius);
    color: var(--text); cursor: pointer;
    margin: 1rem 0;
    transition: transform .2s, border-color .2s;
}
.match-code:hover { transform: scale(1.02); border-color: var(--accent); }

.lobby-info {
    margin-top: 2rem; padding: 1.25rem; border-radius: var(--radius);
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text-dim); font-size: 0.95rem;
}
.lobby-info .sub { color: var(--text-mute); font-size: 0.85rem; margin-bottom: 0; margin-top: 0.75rem; }

/* ========= Game ========= */
.game { min-height: calc(100vh - 4rem); display: flex; flex-direction: column; gap: 1.25rem; position: relative; }

.game-header {
    display: grid; grid-template-columns: 1fr auto 1fr;
    gap: 1rem; align-items: center;
    padding: 1rem 1.25rem;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
}
.player-panel {
    display: grid; grid-template-columns: auto 1fr auto;
    gap: 0.75rem 1rem; align-items: center;
    padding: 0.25rem;
    transition: transform .15s;
}
.player-panel--right { text-align: right; grid-template-columns: auto 1fr auto; direction: rtl; }
.player-panel--right > * { direction: ltr; }
.panel-name { font-weight: 700; font-size: 1rem; letter-spacing: -0.01em; }
.panel-lives { display: inline-flex; gap: 4px; align-items: center; }
.heart {
    display: block; width: 18px; height: 16px;
    background: #ef4444;
    -webkit-mask: var(--heart-mask, url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 21s-7-4.5-9.5-9a5.5 5.5 0 0 1 9.5-5 5.5 5.5 0 0 1 9.5 5C19 16.5 12 21 12 21z'/></svg>")) center/contain no-repeat;
            mask: var(--heart-mask, url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 21s-7-4.5-9.5-9a5.5 5.5 0 0 1 9.5-5 5.5 5.5 0 0 1 9.5 5C19 16.5 12 21 12 21z'/></svg>")) center/contain no-repeat;
    transition: opacity .35s, transform .35s, background .35s;
}
.heart.gone { opacity: 0.15; transform: scale(0.7); background: #555; }
.panel-score {
    min-width: 54px; padding: 0.25rem 0.75rem;
    background: rgba(255,255,255,0.06); border-radius: 8px;
    font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.1rem;
    text-align: center;
}

.player-panel.hit { animation: panel-hit .6s; }
@keyframes panel-hit {
    0%   { transform: translateX(0); }
    15%  { transform: translateX(-6px); filter: brightness(1.8); }
    30%  { transform: translateX(6px); }
    45%  { transform: translateX(-4px); }
    60%  { transform: translateX(0); }
}

.game-center {
    display: flex; flex-direction: column; align-items: center; gap: 0.35rem;
}
.round-indicator {
    font-size: 0.75rem; letter-spacing: 0.15em; text-transform: uppercase;
    color: var(--text-mute); font-weight: 700;
}
.timer-ring {
    position: relative; width: 62px; height: 62px;
}
.timer-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(255,255,255,0.08); stroke-width: 7; }
.ring-fg {
    fill: none; stroke: var(--accent); stroke-width: 7; stroke-linecap: round;
    transition: stroke-dashoffset .15s linear, stroke .2s;
}
.timer-ring.urgent .ring-fg { stroke: var(--danger); }
.timer-ring.urgent { animation: timer-pulse 1s infinite; }
@keyframes timer-pulse { 50% { transform: scale(1.08); } }
.timer-text {
    position: absolute; inset: 0; display: grid; place-items: center;
    font-weight: 800; font-size: 1.25rem; font-variant-numeric: tabular-nums;
}

/* ========= Question stage ========= */
.question-stage {
    flex: 1;
    display: flex; flex-direction: column; gap: 1.5rem;
    padding: 2rem 1.5rem;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    min-height: 380px;
}
.question-text {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    font-weight: 700; line-height: 1.35; text-align: center;
    letter-spacing: -0.015em;
    min-height: 90px;
    display: grid; place-items: center;
    padding: 0 1rem;
}
.question-text.intro { animation: q-in .45s ease; }
@keyframes q-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.answers {
    display: grid; gap: 0.75rem;
    grid-template-columns: repeat(2, 1fr);
}
.answer-btn {
    display: flex; gap: 0.85rem; align-items: center;
    padding: 1rem 1.25rem; min-height: 64px;
    background: rgba(255,255,255,0.04); border: 2px solid var(--border); border-radius: 14px;
    color: var(--text); text-align: left; font-size: 1rem; line-height: 1.35; font-weight: 500;
    transition: all .15s ease;
}
.answer-btn:not(:disabled):hover { background: rgba(255,255,255,0.08); border-color: var(--border-strong); transform: translateY(-2px); }
.answer-btn:disabled { cursor: default; }
.answer-key {
    flex: none;
    display: grid; place-items: center;
    width: 32px; height: 32px; border-radius: 8px;
    background: rgba(255,255,255,0.08); font-weight: 800; font-size: 0.9rem;
}
.answer-btn.correct { border-color: var(--success); background: rgba(34,197,94,0.15); }
.answer-btn.correct .answer-key { background: var(--success); color: #052e14; }
.answer-btn.wrong { border-color: var(--danger); background: rgba(239,68,68,0.15); animation: shake .35s; }
.answer-btn.wrong .answer-key { background: var(--danger); color: #fff; }
@keyframes shake {
    0%,100%{ transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

.status-line { min-height: 22px; text-align: center; color: var(--text-dim); font-size: 0.95rem; }

/* ========= Damage overlay (for the loser) ========= */
.damage-overlay {
    position: fixed; inset: 0; pointer-events: none; z-index: 100;
    opacity: 0; transition: opacity .25s;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(239,68,68,0.3) 70%, rgba(239,68,68,0.55) 100%);
}
.damage-overlay.active { opacity: 1; animation: dmg-flash .9s ease-out; }
.damage-overlay.active.critical {
    background: radial-gradient(ellipse at center, transparent 20%, rgba(239,68,68,0.5) 60%, rgba(239,68,68,0.8) 100%);
}
@keyframes dmg-flash {
    0%   { opacity: 0; }
    10%  { opacity: 1; }
    100% { opacity: 0; }
}

/* ========= Death screen (theme-specific via each theme CSS) ========= */
.death-screen {
    position: fixed; inset: 0; z-index: 250;
    display: grid; place-items: center;
    overflow: hidden;
    opacity: 0; pointer-events: none;
    transition: opacity .3s;
    background: #000;
}
.death-screen.show { opacity: 1; pointer-events: auto; }
.death-screen.fade-out { opacity: 0; transition: opacity .5s; }

.ds-inner {
    position: relative; z-index: 2;
    text-align: center;
    padding: 2rem;
}
.ds-title {
    font-weight: 900; letter-spacing: 0.08em;
    line-height: 1;
    font-size: clamp(2.5rem, 9vw, 5.5rem);
    margin: 0.5rem 0;
}
.ds-sub {
    font-size: clamp(0.9rem, 2vw, 1.15rem);
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.6);
    margin-top: 0.5rem;
}

/* ========= Reward screen (winner) ========= */
.reward-screen {
    position: fixed; inset: 0; z-index: 240;
    display: grid; place-items: center;
    opacity: 0; pointer-events: none;
    transition: opacity .35s;
    background: rgba(8,8,15,0.9);
    backdrop-filter: blur(14px);
}
.reward-screen.show { opacity: 1; pointer-events: auto; }

.rs-inner {
    position: relative;
    max-width: 440px; width: calc(100% - 2rem);
    padding: 2.5rem 2rem 2rem;
    text-align: center;
    background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.01));
    border: 1px solid var(--border-strong);
    border-radius: 20px;
    box-shadow: 0 30px 80px -20px rgba(0,0,0,0.6);
    animation: rs-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes rs-in {
    from { opacity: 0; transform: translateY(20px) scale(0.92); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.rs-label {
    font-size: 0.75rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--text-dim);
    font-weight: 700;
    margin-bottom: 1.25rem;
}
.rs-item {
    width: 150px; height: 150px;
    margin: 0 auto 1.25rem;
    position: relative;
    display: grid; place-items: center;
    border-radius: 16px;
    background:
        radial-gradient(ellipse at center, rgba(255,255,255,0.08) 0%, transparent 70%),
        linear-gradient(180deg, rgba(0,0,0,0.4), rgba(0,0,0,0.2));
    border: 1px solid rgba(255,255,255,0.1);
    animation: rs-float 3s ease-in-out infinite;
}
.rs-item::before {
    /* Shimmering radial glow behind item */
    content: '';
    position: absolute; inset: -20px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--rs-glow, rgba(127,90,240,0.3)) 0%, transparent 65%);
    animation: rs-glow 2.4s ease-in-out infinite;
    z-index: 0;
}
.rs-item > svg {
    position: relative; z-index: 1;
    width: 80%; height: 80%;
    filter: drop-shadow(0 0 12px var(--rs-glow, rgba(127,90,240,0.5)));
}
@keyframes rs-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}
@keyframes rs-glow {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50%      { opacity: 1; transform: scale(1.15); }
}
.rs-name {
    font-size: 1.25rem; font-weight: 800; letter-spacing: -0.015em;
    margin-bottom: 0.25rem;
}
.rs-value {
    font-size: 0.9rem; color: var(--text-dim);
    margin-bottom: 1.5rem;
}
.rs-actions {
    display: flex; flex-direction: column; gap: 0.6rem;
}
.rs-claim {
    width: 100%;
    font-size: 1.1rem; padding: 1rem;
}
.rs-claim.fail-shake {
    animation: rs-fail-shake 0.5s;
}
@keyframes rs-fail-shake {
    0%, 100% { transform: translateX(0); }
    15% { transform: translateX(-8px) rotate(-1deg); }
    30% { transform: translateX(8px) rotate(1deg); }
    45% { transform: translateX(-6px); }
    60% { transform: translateX(6px); }
    75% { transform: translateX(-3px); }
}
.rs-hint {
    margin-top: 0.6rem;
    font-size: 0.8rem;
    color: var(--text-mute);
    opacity: 0; transition: opacity 0.3s;
}
.rs-hint.show { opacity: 1; }

/* Shimmer edge effect on premium items */
.rs-item.rs-shine::after {
    content: '';
    position: absolute; inset: 0;
    border-radius: 16px;
    background: linear-gradient(
        120deg,
        transparent 30%,
        rgba(255,255,255,0.25) 50%,
        transparent 70%
    );
    background-size: 200% 100%;
    background-position: -100% 0;
    animation: rs-shimmer 2.8s ease-in-out infinite;
    animation-delay: 0.8s;
    pointer-events: none;
}
@keyframes rs-shimmer {
    0%, 30% { background-position: -100% 0; }
    60%, 100% { background-position: 200% 0; }
}

/* ========= Result screen ========= */
.result-screen {
    position: fixed; inset: 0; z-index: 200;
    display: grid; place-items: center;
    background: rgba(8,8,15,0.85); backdrop-filter: blur(12px);
    opacity: 0; pointer-events: none;
    transition: opacity .4s;
}
.result-screen.show { opacity: 1; pointer-events: auto; }
.result-inner {
    max-width: 480px; width: calc(100% - 2rem);
    padding: 2.5rem 2rem; text-align: center;
    background: linear-gradient(180deg, rgba(127,90,240,0.15), rgba(44,182,125,0.05));
    border: 1px solid var(--border-strong); border-radius: 20px;
}
.result-title {
    font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 900;
    letter-spacing: -0.025em; margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #fff, #c9b6ff);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}
.result-scores {
    display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem;
    align-items: center;
    padding: 1.25rem; margin-bottom: 1.5rem;
    background: rgba(0,0,0,0.3); border-radius: 12px;
}
.result-scores > div { display: flex; flex-direction: column; gap: 0.35rem; }
.result-scores strong { font-size: 0.9rem; color: var(--text-dim); }
.result-scores span { font-size: 2rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.result-scores .vs { color: var(--text-mute); font-weight: 700; font-size: 0.875rem; }
.result-actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }

.result-waiting {
    display: flex; flex-direction: column; align-items: center; gap: 1rem;
    padding-top: 0.5rem;
}
.rw-pulse {
    display: inline-flex; gap: 6px;
}
.rw-pulse span {
    display: block; width: 10px; height: 10px; border-radius: 50%;
    background: var(--accent);
    animation: rw-dot 1.2s ease-in-out infinite;
}
.rw-pulse span:nth-child(2) { animation-delay: 0.15s; }
.rw-pulse span:nth-child(3) { animation-delay: 0.30s; }
@keyframes rw-dot {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40%           { opacity: 1;    transform: scale(1.15); }
}
.rw-text {
    font-size: 1rem; font-weight: 600; color: var(--text);
    text-align: center;
}
.rw-text.declined { color: #ef4444; }

/* ========= Error ========= */
.error-state { text-align: center; padding: 5rem 1rem; }
.error-state h1 { font-size: 3rem; margin-bottom: 1rem; }
.error-state p { color: var(--text-dim); margin-bottom: 2rem; }

/* ========= Responsive ========= */
@media (max-width: 640px) {
    .app { padding: 1.25rem 1rem 3rem; }
    .game-header { grid-template-columns: 1fr auto 1fr; gap: 0.5rem; padding: 0.75rem; }
    .player-panel { grid-template-columns: 1fr; gap: 0.25rem; text-align: center; }
    .player-panel--right { direction: ltr; }
    .panel-name { font-size: 0.85rem; }
    .panel-score { font-size: 1rem; min-width: 0; padding: 0.15rem 0.5rem; }
    .answers { grid-template-columns: 1fr; }
    .answer-btn { padding: 0.875rem 1rem; min-height: 56px; }
    .question-stage { padding: 1.5rem 1rem; min-height: 320px; }
}
