:root {
    --purple: #4A1080;
    --purple-dark: #350960;
    --purple-mid: #6B21A8;
    --purple-light: #EDE7F6;
    --purple-glow: rgba(74, 16, 128, 0.25);
    --bg: #f4f0fa;
    --bg-accent: #e8dff5;
    --surface: #ffffff;
    --text: #1a1225;
    --text-muted: #6b6280;
    --border: #e4dce8;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 8px 32px rgba(74, 16, 128, 0.1);
    --shadow-lg: 0 20px 50px rgba(74, 16, 128, 0.15);
    --r: #CC0000;
    --brand-red: #D62828;
    --brand-red-dark: #B91C1C;
    --font-brand: 'Plus Jakarta Sans', system-ui, sans-serif;
    --font-go: 'Kanit', system-ui, sans-serif;
    --font-display: 'Plus Jakarta Sans', system-ui, sans-serif;
    --g: #007700;
    --b: #0055CC;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body.juego-body {
    font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
    background: #ebe4f4;
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    position: relative;
}

/* Fondo decorativo (páginas de inicio / registro) */
.juego-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}
.juego-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 90% 70% at 0% 0%, rgba(107, 33, 168, 0.14) 0%, transparent 55%),
        radial-gradient(ellipse 80% 60% at 100% 5%, rgba(214, 40, 40, 0.09) 0%, transparent 50%),
        radial-gradient(ellipse 70% 55% at 50% 100%, rgba(74, 16, 128, 0.12) 0%, transparent 55%),
        linear-gradient(160deg, #faf8fd 0%, #f3edf9 45%, #e8dff5 100%);
}
.juego-bg-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.55;
    animation: juego-blob-float 20s ease-in-out infinite;
}
.juego-bg-blob--1 {
    width: 340px;
    height: 340px;
    background: rgba(107, 33, 168, 0.28);
    top: -100px;
    left: -80px;
}
.juego-bg-blob--2 {
    width: 280px;
    height: 280px;
    background: rgba(214, 40, 40, 0.15);
    top: 20%;
    right: -70px;
    animation-delay: -7s;
}
.juego-bg-blob--3 {
    width: 360px;
    height: 360px;
    background: rgba(74, 16, 128, 0.2);
    bottom: -120px;
    left: 30%;
    animation-delay: -12s;
}
@keyframes juego-blob-float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(20px, -15px) scale(1.05); }
    66% { transform: translate(-15px, 10px) scale(0.97); }
}

/* Fondo durante los juegos — cálido y amigable */
body.juego-body--play {
    background: #e8dff5;
}

.juego-bg--play::before {
    background:
        radial-gradient(ellipse 85% 65% at 5% 0%, rgba(107, 33, 168, 0.16) 0%, transparent 55%),
        radial-gradient(ellipse 75% 55% at 95% 15%, rgba(255, 138, 138, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse 65% 50% at 40% 100%, rgba(74, 16, 128, 0.14) 0%, transparent 55%),
        linear-gradient(165deg, #f3edf9 0%, #ebe3f5 45%, #e2d8ef 100%);
}
.juego-bg--play .juego-bg-blob {
    opacity: 0.4;
    filter: blur(85px);
    animation-duration: 28s;
}
.juego-bg--play::after {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.45;
    background-image: radial-gradient(circle 1px at center, rgba(74, 16, 128, 0.06) 1px, transparent 1px);
    background-size: 22px 22px;
}

.juego-scene {
    position: relative;
}
.juego-scene .juego-play,
.juego-scene .progress-bar-wrap { position: relative; z-index: 1; }

.juego-play-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.juego-play-head h2 {
    flex: 1;
    margin-bottom: 0;
}

/* ── Layout ── */
.juego-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

.juego-container {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 16px 20px 32px;
    padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
    flex: 1;
}

.juego-container--wide { max-width: 720px; }

/* Logo Conti + go */
.brand-logo {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 2px;
    line-height: 1;
    margin: 0;
}
.brand-conti {
    font-family: var(--font-brand);
    font-size: clamp(2.2rem, 9vw, 3rem);
    font-weight: 800;
    color: var(--purple);
    letter-spacing: -0.04em;
}
.brand-go {
    font-family: var(--font-go);
    font-size: clamp(2.5rem, 10vw, 3.25rem);
    font-weight: 900;
    font-style: italic;
    color: var(--brand-red);
    letter-spacing: -0.02em;
    transform: translateY(1px) skewX(-6deg);
    text-shadow: 0 2px 16px rgba(214, 40, 40, 0.2);
}

/* Avatar / mascota */
.juego-avatar--intro {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}
.juego-avatar-figure {
    flex-shrink: 0;
    width: 88px;
    height: 100px;
}
.mascot-svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
    filter: drop-shadow(0 4px 10px rgba(74, 16, 128, 0.18));
}
.juego-mascot-figure--wave .mascot-arm--wave {
    transform-origin: 84px 78px;
    animation: mascot-wave 1.4s ease-in-out infinite;
}
.juego-mascot-figure--companion {
    animation: mascot-breathe 4s ease-in-out infinite;
}
.juego-mascot-figure--companion .mascot-arm--wave {
    transform-origin: 84px 78px;
    animation: mascot-thumb 2.8s ease-in-out infinite;
}
@keyframes mascot-wave {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-12deg); }
    75% { transform: rotate(8deg); }
}
@keyframes mascot-thumb {
    0%, 70%, 100% { transform: rotate(0deg); }
    35% { transform: rotate(-18deg); }
    50% { transform: rotate(-8deg); }
}
@keyframes mascot-breathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}
.juego-avatar-bubble {
    flex: 1;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 14px;
    padding: 10px 14px;
    box-shadow: 0 4px 20px rgba(74, 16, 128, 0.1);
    position: relative;
}
.juego-avatar-bubble::before {
    content: '';
    position: absolute;
    left: -7px;
    top: 28px;
    width: 12px;
    height: 12px;
    background: rgba(255, 255, 255, 0.95);
    border-left: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    transform: rotate(45deg);
}
.juego-avatar-name {
    display: block;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--purple);
    margin-bottom: 4px;
}
.juego-avatar-bubble p {
    margin: 0;
    font-size: .88rem;
    color: var(--text-muted);
    line-height: 1.45;
}

/* Mascota junto al título — visible solo al jugar */
.juego-mascot--inline {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    opacity: 0;
    transform: scale(0.92);
    transition: opacity .35s ease, transform .35s ease;
    pointer-events: none;
}
.juego-mascot-name {
    font-size: .65rem;
    font-weight: 700;
    color: var(--purple);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.juego-play:not(.game-pending) .juego-mascot--inline {
    opacity: 1;
    transform: scale(1);
}
.juego-mascot--inline .juego-mascot-figure {
    width: 56px;
    height: 64px;
}
.juego-mascot--inline .mascot-svg {
    width: 100%;
    height: auto;
}
@media (max-width: 480px) {
    .juego-mascot--inline { width: 48px; }
    .juego-mascot--inline .juego-mascot-figure { width: 48px; height: 54px; }
}
@media (prefers-reduced-motion: reduce) {
    .juego-mascot-figure--wave .mascot-arm--wave,
    .juego-mascot-figure--companion,
    .juego-mascot-figure--companion .mascot-arm--wave,
    .juego-bg-blob { animation: none; }
}
.game-modal .juego-avatar-figure { width: 76px; height: 88px; }

/* Acceso profesional — esquina, discreto */
.juego-staff-corner {
    position: fixed;
    top: max(12px, env(safe-area-inset-top, 12px));
    right: max(12px, env(safe-area-inset-right, 12px));
    z-index: 50;
}
.juego-staff-link {
    display: inline-block;
    padding: 6px 10px;
    color: var(--text-muted);
    font-size: .7rem;
    font-weight: 600;
    text-decoration: none;
    opacity: 0.65;
    transition: opacity .2s, color .2s;
}
.juego-staff-link:hover {
    opacity: 1;
    color: var(--purple);
    text-decoration: underline;
}

.juego-footer {
    margin-top: auto;
    padding: 20px 20px calc(16px + env(safe-area-inset-bottom, 0px));
    text-align: center;
}
.juego-footer p {
    margin: 0;
    font-size: .72rem;
    color: var(--text-muted);
    opacity: 0.75;
    line-height: 1.5;
}
.juego-footer strong {
    font-weight: 600;
    color: var(--purple);
    opacity: 1;
}

.juego-top-bar { display: none; }

.juego-header {
    text-align: center;
    margin-bottom: 20px;
    padding-top: 8px;
}
.juego-hero-top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.juego-hero-sabi {
    flex-shrink: 0;
    margin-top: 4px;
}
.juego-hero-sabi-fig {
    width: 68px;
    height: 78px;
}
.juego-header .brand-logo { margin-bottom: 4px; }
.juego-header p {
    margin-top: 6px;
    color: var(--text-muted);
    font-size: .95rem;
}
.juego-header-badge {
    display: inline-block;
    margin-top: 10px;
    padding: 4px 12px;
    background: var(--purple-light);
    color: var(--purple);
    font-size: .75rem;
    font-weight: 700;
    border-radius: 999px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

/* ── Cards ── */
.juego-card {
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius);
    padding: 28px 24px;
    box-shadow: var(--shadow), 0 0 0 1px rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.85);
    position: relative;
    overflow: hidden;
}
.juego-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--purple-dark), var(--purple-mid), var(--purple));
}
.juego-card h2 {
    margin-bottom: 20px;
    color: var(--purple);
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
}

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: .8rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.form-group input,
.form-group select,
.juego-card input,
.juego-card select {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    color: var(--text);
    background: #faf8fc;
    transition: border-color .2s, box-shadow .2s, background .2s;
}
.form-group input:focus,
.form-group select:focus,
.juego-card input:focus,
.juego-card select:focus {
    outline: none;
    border-color: var(--purple-mid);
    background: #fff;
    box-shadow: 0 0 0 3px var(--purple-glow);
}
.form-group input::placeholder { color: #aaa; }

/* Formulario registro compacto */
.juego-card--compact {
    padding: 20px 18px;
}
.juego-card--compact h2 {
    margin-bottom: 12px;
    font-size: 1.1rem;
}
.juego-form--compact .form-group {
    margin-bottom: 0;
}
.juego-form--compact .form-row {
    display: grid;
    gap: 10px;
    margin-bottom: 10px;
}
.juego-form--compact .form-row--2 {
    grid-template-columns: 1fr 1fr;
}
.juego-form--compact .form-row--dni-sexo {
    grid-template-columns: 1fr 88px;
    align-items: start;
}
.juego-form--compact .form-group label {
    margin-bottom: 4px;
    font-size: .72rem;
}
.juego-form--compact .form-group input,
.juego-form--compact .form-group select {
    padding: 9px 11px;
    font-size: .95rem;
}
.juego-form--compact .dni-status {
    margin-top: 4px;
    font-size: .75rem;
}
.juego-form--compact .form-hint-compact {
    display: block;
    margin: -4px 0 10px;
    text-align: left;
    font-size: .72rem;
}
.juego-form--compact .btn-primary {
    margin-top: 4px;
    padding: 11px 16px;
    font-size: .95rem;
}
@media (max-width: 360px) {
    .juego-form--compact .form-row--2,
    .juego-form--compact .form-row--dni-sexo {
        grid-template-columns: 1fr;
    }
    .juego-form--compact .form-row--dni-sexo .form-group--sexo {
        max-width: 120px;
    }
}

.dni-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}
.dni-row input { flex: 1; min-width: 0; }
.dni-row .btn-secondary { margin-top: 0; flex-shrink: 0; white-space: nowrap; }

.dni-status {
    margin-top: 8px;
    font-size: .82rem;
    font-weight: 600;
}
.dni-status--ok { color: var(--g); }
.dni-status--err { color: var(--brand-red); }

.input-codigo {
    text-transform: uppercase;
    text-align: center;
    font-size: clamp(1.25rem, 5vw, 1.5rem) !important;
    font-weight: 700;
    letter-spacing: 0.15em;
    padding: 16px !important;
}

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}

/* ── Buttons ── */
.btn-primary, .btn-secondary, .btn-whatsapp {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: transform .15s, box-shadow .2s, background .2s;
}
.btn-primary {
    background: linear-gradient(135deg, var(--purple-mid), var(--purple));
    color: #fff;
    width: 100%;
    margin-top: 8px;
    box-shadow: 0 4px 16px var(--purple-glow);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--purple-glow);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.btn-secondary {
    background: var(--purple-light);
    color: var(--purple);
    font-size: .85rem;
    padding: 10px 16px;
    margin-top: 16px;
}
.btn-secondary:hover { background: #ddd0f0; }
.btn-large { width: 100%; font-size: 1.05rem; padding: 16px; }
.btn-whatsapp {
    background: linear-gradient(135deg, #20bd5a, #25D366);
    color: #fff;
    width: 100%;
    margin-top: 16px;
    box-shadow: 0 4px 16px rgba(37, 211, 102, 0.35);
}
.btn-whatsapp:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(37, 211, 102, 0.4);
}
.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text-muted);
    width: 100%;
    margin-top: 12px;
}

/* ── Alerts & hints ── */
.alert-error {
    background: #fef2f2;
    color: #991b1b;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    border-left: 4px solid #ef4444;
    font-size: .9rem;
}
.hint {
    font-size: .85rem;
    color: var(--text-muted);
    margin-top: 16px;
    text-align: center;
}
.hint a {
    color: var(--purple);
    font-weight: 600;
    text-decoration: none;
}
.hint a:hover { text-decoration: underline; }

/* ── Game play area ── */
.juego-play {
    max-width: 720px;
    margin: 0 auto;
    padding: 12px 16px 24px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}
.juego-play h2 {
    font-family: var(--font-display);
    color: var(--purple);
    font-size: clamp(1.25rem, 4vw, 1.5rem);
    margin-bottom: 8px;
}
.instruccion {
    margin-bottom: 12px;
    color: var(--text-muted);
    line-height: 1.55;
    font-size: .92rem;
}
.instrucciones-box {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 16px;
    border: 1px solid rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 20px rgba(74, 16, 128, 0.08);
}
body.juego-body--play .instrucciones-box {
    background: rgba(255, 255, 255, 0.78);
    border-color: rgba(212, 196, 232, 0.6);
}

/* Progress */
.progress-bar-wrap {
    max-width: 720px;
    margin: 0 auto;
    padding: 14px 16px 0;
    position: relative;
    z-index: 1;
}
.progress-label {
    font-size: .72rem;
    font-weight: 600;
    color: #8a8494;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.progress-bar {
    height: 5px;
    background: rgba(74, 16, 128, 0.12);
    border-radius: 999px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--purple-mid), var(--purple));
    border-radius: 999px;
    transition: width .4s cubic-bezier(.4,0,.2,1);
}
body.juego-body--play .progress-label {
    color: var(--purple);
    opacity: 0.75;
}

/* Timer fijo arriba derecha */
.game-timer-fixed {
    position: fixed;
    top: max(12px, env(safe-area-inset-top, 12px));
    right: max(14px, env(safe-area-inset-right, 14px));
    z-index: 220;
}
.game-timer-fixed #timer {
    display: block;
    font-family: 'DM Sans', monospace;
    font-size: clamp(1.1rem, 3.5vw, 1.35rem);
    font-weight: 700;
    color: var(--purple);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 8px 14px;
    border-radius: 999px;
    min-width: 76px;
    text-align: center;
    border: 1px solid rgba(212, 196, 232, 0.65);
    box-shadow: 0 4px 16px rgba(74, 16, 128, 0.12);
}
body.juego-body--play:has(.game-pending) .game-timer-fixed {
    opacity: 0.5;
}

/* Game footer */
.game-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    padding: 16px 0;
    flex-wrap: wrap;
}
#timer {
    font-family: 'DM Sans', monospace;
    font-size: clamp(1.25rem, 4vw, 1.5rem);
    font-weight: 700;
    color: var(--purple);
    background: rgba(237, 231, 246, 0.9);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    min-width: 80px;
    text-align: center;
    border: 1px solid rgba(212, 196, 232, 0.5);
}
.game-footer .btn-primary,
.game-footer .btn-large {
    flex: 1;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-top: 0;
}

/* ASRS */
#preguntas { margin-bottom: 16px; }
.pregunta {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 16px 18px;
    margin-bottom: 10px;
    border-radius: 14px;
    box-shadow: 0 4px 18px rgba(74, 16, 128, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.92);
}
body.juego-body--play .pregunta {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(212, 196, 232, 0.55);
}
.pregunta p { margin-bottom: 12px; font-size: .93rem; line-height: 1.45; }
.escala { display: flex; gap: 6px; flex-wrap: wrap; }
.escala label {
    flex: 1;
    min-width: 52px;
    text-align: center;
    padding: 10px 4px;
    border: 2px solid rgba(107, 33, 168, 0.14);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: .85rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.55);
    transition: border-color .15s, background .15s, transform .12s;
}
body.juego-body--play .escala label:hover {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(107, 33, 168, 0.28);
}
.escala input { display: none; }
.escala label:has(input:checked) {
    border-color: var(--purple);
    background: var(--purple-light);
    color: var(--purple);
}

/* Go/No-Go & CPT stages */
.gonogo-stage, .cpt-stage {
    background: linear-gradient(160deg, #1a1030 0%, #0f0a1a 100%);
    border-radius: var(--radius);
    height: clamp(180px, 40vw, 240px);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    border: 1px solid rgba(107, 33, 168, 0.3);
    box-shadow: inset 0 0 60px rgba(107, 33, 168, 0.15), var(--shadow);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
.gonogo-stage--active {
    cursor: pointer;
    border-color: rgba(107, 33, 168, 0.55);
    box-shadow: inset 0 0 60px rgba(107, 33, 168, 0.2), 0 0 0 3px var(--purple-glow);
}
.gonogo-stage--active .stimulus { transform: scale(1.02); }
.cpt-stage--active {
    cursor: pointer;
    border-color: rgba(107, 33, 168, 0.55);
    box-shadow: inset 0 0 60px rgba(107, 33, 168, 0.2), 0 0 0 3px var(--purple-glow);
}
.cpt-stage--active .cpt-stimulus { transform: scale(1.05); }
.stimulus { font-size: clamp(3.5rem, 15vw, 5rem); transition: transform .15s; }
.stimulus.go { color: #4ade80; }
.stimulus.nogo { color: #f87171; }
.cpt-stimulus { font-size: clamp(3rem, 12vw, 4rem); color: #fff; transition: transform .15s; }

.game-stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: .85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    justify-content: center;
}
.game-stats span {
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(212, 196, 232, 0.5);
    box-shadow: 0 2px 10px rgba(74, 16, 128, 0.06);
}
.game-stats b { color: var(--purple); }

/* Stroop */
.stroop-phase {
    background: linear-gradient(135deg, var(--purple-mid), var(--purple));
    color: #fff;
    padding: 10px 18px;
    border-radius: 999px;
    display: inline-block;
    margin-bottom: 12px;
    font-size: .82rem;
    font-weight: 700;
    box-shadow: 0 4px 12px var(--purple-glow);
}
.stroop-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 12px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(212, 196, 232, 0.55);
    box-shadow: 0 4px 18px rgba(74, 16, 128, 0.08);
    max-height: 55vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.stroop-cell {
    padding: 10px 2px;
    text-align: center;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    font-size: .8rem;
    border: 1px solid rgba(107, 33, 168, 0.1);
    border-radius: 6px;
    cursor: pointer;
    user-select: none;
    background: rgba(255, 255, 255, 0.6);
    transition: background .15s;
}
.stroop-cell.done { opacity: .35; pointer-events: none; }
.stroop-cell.active {
    outline: 3px solid var(--purple);
    background: var(--purple-light);
    transform: scale(1.02);
}
.col-r { color: var(--r); } .col-b { color: var(--b); } .col-g { color: var(--g); } .col-k { color: #111; }

.stroop-color-bar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 200;
    display: flex;
    gap: 10px;
    justify-content: center;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.1);
}
.stroop-color-bar[hidden] { display: none !important; }
.stroop-color-bar .btn-stroop-color {
    flex: 1;
    max-width: 120px;
    padding: 14px 8px;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 800;
    font-size: .9rem;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
    transition: transform .15s;
}
.stroop-color-bar .btn-stroop-color:active { transform: scale(.96); }
.stroop-color-bar .btn-stroop-rojo { background: var(--r); }
.stroop-color-bar .btn-stroop-azul { background: var(--b); }
.stroop-color-bar .btn-stroop-verde { background: var(--g); }
#game-stroop.has-color-bar { padding-bottom: 88px; }

/* Gracias */
.gracias .juego-card { text-align: center; padding: 36px 24px; }
.gracias-icon {
    width: 80px; height: 80px;
    background: linear-gradient(135deg, #34d399, #10b981);
    color: #fff;
    border-radius: 50%;
    font-size: 2.2rem;
    line-height: 80px;
    margin: 0 auto 20px;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.35);
}
.gracias h2 {
    font-family: var(--font-display);
    color: var(--purple);
    font-size: 1.35rem;
    margin-bottom: 8px;
}
.gracias p { color: var(--text-muted); margin-bottom: 8px; }
.text-center { text-align: center; }

/* Modal */
.game-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}
.game-modal.open { display: flex; }
.game-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(26, 18, 37, 0.6);
    backdrop-filter: blur(6px);
}
.game-modal-content {
    position: relative;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 28px 24px;
    max-width: 480px;
    width: 100%;
    max-height: 90vh;
    max-height: 90dvh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn .3s cubic-bezier(.34,1.2,.64,1);
}
@keyframes modalIn {
    from { opacity: 0; transform: translateY(20px) scale(.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.game-modal-title {
    font-family: var(--font-display);
    color: var(--purple);
    font-size: 1.35rem;
    margin-bottom: 4px;
    text-align: center;
}
.game-modal-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: .9rem;
    margin-bottom: 16px;
}
.game-modal-instrucciones {
    background: var(--purple-light);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 20px;
    border: 1px solid rgba(74, 16, 128, 0.1);
}
.game-modal-instrucciones .instruccion { margin-bottom: 8px; font-size: .93rem; }
.game-modal-instrucciones .instruccion:last-child { margin-bottom: 0; }
.game-modal-btn { margin-top: 0; font-size: 1.05rem; padding: 14px; }
.juego-play.game-pending {
    pointer-events: none;
    opacity: .45;
    filter: grayscale(.1);
    user-select: none;
}

/* ── Responsive ── */
@media (max-width: 480px) {
    .juego-container { padding: 12px 16px 24px; padding-top: 40px; }
    .juego-card { padding: 22px 18px; }
    .juego-staff-link { font-size: .65rem; }
    .dni-row { flex-direction: column; }
    .dni-row .btn-secondary { width: 100%; }
    .stroop-cell { font-size: .65rem; padding: 8px 1px; }
    .game-footer {
        position: sticky;
        bottom: 0;
        background: linear-gradient(transparent, rgba(235, 228, 245, 0.95) 25%);
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        z-index: 10;
    }
    .escala label { min-width: 44px; padding: 8px 2px; font-size: .78rem; }
}

@media (min-width: 768px) {
    .juego-container { padding-top: 32px; }
    .juego-card { padding: 32px 28px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
