/* ==========================================================================
   BohrStudy! · styles.css · Estética "Frutiger Eco"
   --------------------------------------------------------------------------
   Índice
   1. Tokens de tema (claro / oscuro)
   2. Base y escenario (cielo, sol/luna, colinas, burbujas)
   3. Superficies de vidrio (header, panel, modal, footer)
   4. Botones gel
   5. Componentes de la app (mascota, materias, pregunta, pizarra)
   6. Formularios y modales
   7. Contenido de las preguntas (tablas, imágenes)
   8. Interruptor de tema
   9. Accesibilidad y movimiento reducido

   Cómo funciona el tema
   - theme.js escribe data-theme="light" | "dark" en <html>.
   - La paleta "slate" y los acentos de Tailwind (emerald, cyan, indigo, purple,
     amber, rose) están enlazados a las variables --slate-* / --emerald-* … de
     este archivo (ver theme.js). Así, cualquier clase de Tailwind que genere
     app.js (opciones, badges, ejes, etc.) cambia sola con el tema.
   - En modo claro la escala slate está invertida: slate-100 = texto oscuro,
     slate-900 = fondo claro. Por eso las clases originales siguen funcionando.
   ========================================================================== */


/* ==========================================================================
   1. TOKENS DE TEMA
   ========================================================================== */

/* ---- Claro: "cielo de mañana" ---- */
:root {
    color-scheme: light;

    /* Escala slate (canales RGB; modo claro = invertida) */
    --slate-50: 4 28 40;
    --slate-100: 10 38 52;
    --slate-200: 20 50 66;
    --slate-300: 36 74 92;
    --slate-400: 58 100 120;
    --slate-500: 66 106 126;
    --slate-600: 140 186 205;
    --slate-700: 170 208 226;
    --slate-800: 255 255 255;
    --slate-900: 226 243 252;
    --slate-950: 240 249 255;

    /* Acentos: tonos 300/400 oscurecidos para leerse sobre vidrio claro */
    --emerald-300: 6 80 60;
    --emerald-400: 3 95 70;
    --emerald-500: 4 115 84;
    --emerald-600: 4 120 87;
    --cyan-300: 21 94 117;
    --cyan-400: 8 92 118;
    --cyan-500: 8 145 178;
    --cyan-600: 14 116 144;
    --indigo-300: 55 48 163;
    --indigo-400: 67 56 202;
    --indigo-500: 79 70 229;
    --indigo-600: 67 56 202;
    --purple-300: 107 33 168;
    --purple-400: 112 26 190;
    --purple-500: 147 51 234;
    --purple-600: 126 34 206;
    --amber-300: 146 64 14;
    --amber-400: 150 66 4;
    --amber-500: 217 119 6;
    --amber-600: 180 83 9;
    --rose-300: 159 18 57;
    --rose-400: 176 16 54;
    --rose-500: 225 29 72;
    --rose-600: 190 18 60;

    /* Cajas de explicación/pista y opción correcta/incorrecta (app.js) */
    --emerald-200: 6 78 59;
    --emerald-950: 209 250 229;
    --rose-200: 136 19 55;
    --rose-950: 255 228 230;
    --amber-200: 120 53 15;

    /* Escenario */
    --sky:
        radial-gradient(60rem 28rem at 12% -8%, rgba(255, 255, 255, .95), rgba(255, 255, 255, 0) 60%),
        radial-gradient(48rem 24rem at 92% 4%, rgba(190, 240, 255, .85), rgba(190, 240, 255, 0) 62%),
        radial-gradient(40rem 18rem at 50% 105%, rgba(190, 255, 150, .55), rgba(190, 255, 150, 0) 70%),
        linear-gradient(180deg, #4fb8f5 0%, #8fd6ff 32%, #cdeeff 62%, #e6fbe0 100%);
    --sky-fallback: #8fd6ff;
    --sun: radial-gradient(circle, rgba(255, 255, 235, .95) 0%, rgba(255, 243, 180, .45) 32%, rgba(255, 243, 180, 0) 66%);
    --hills: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 320' preserveAspectRatio='none'%3E%3Cpath fill='%23a5e36b' fill-opacity='.75' d='M0 200C240 120 420 120 640 190S1100 260 1440 150V320H0Z'/%3E%3Cpath fill='%2352b84a' fill-opacity='.85' d='M0 250C300 190 520 200 760 250S1200 300 1440 230V320H0Z'/%3E%3Cpath fill='%232f9a45' d='M0 290C360 250 640 270 900 295S1280 310 1440 280V320H0Z'/%3E%3C/svg%3E");
    --bubble-fill: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, .95) 0 7%, rgba(255, 255, 255, .35) 18%, rgba(190, 240, 255, .14) 55%, rgba(255, 255, 255, .38) 100%);
    --bubble-edge: rgba(255, 255, 255, .6);
    --bubble-shadow: 0 4px 18px rgba(0, 120, 200, .18);

    /* Vidrio */
    --glass-bg: linear-gradient(180deg, rgba(255, 255, 255, .74), rgba(255, 255, 255, .46));
    --glass-bg-strong: linear-gradient(180deg, rgba(255, 255, 255, .95), rgba(232, 247, 255, .92));
    --card-bg: rgba(255, 255, 255, .58);
    --field-bg: rgba(255, 255, 255, .85);
    --glass-border: rgba(255, 255, 255, .85);
    --glass-highlight: rgba(255, 255, 255, .95);
    --gloss: linear-gradient(180deg, rgba(255, 255, 255, .7), rgba(255, 255, 255, 0));
    --panel-shadow: 0 12px 32px rgba(20, 110, 180, .22), 0 2px 6px rgba(20, 110, 180, .12);
    --overlay: rgba(10, 60, 100, .45);
    --focus-ring: rgba(15, 155, 224, .95);
    --scroll-a: #7fd3ff;
    --scroll-b: #3aa6e8;

    /* Header y footer */
    --header-bg: linear-gradient(180deg, rgba(255, 255, 255, .88) 0%, rgba(214, 241, 255, .72) 49%, rgba(168, 222, 250, .62) 50%, rgba(200, 240, 255, .74) 100%);
    --header-border: rgba(255, 255, 255, .95);
    --header-shadow: 0 4px 22px rgba(20, 120, 190, .28);
    --footer-bg: linear-gradient(180deg, rgba(255, 255, 255, .5), rgba(200, 244, 190, .72));

    /* Globo de diálogo de la mascota (el rabo usa el color inferior) */
    --bubble-top: #ffffff;
    --bubble-bottom: #e3f6ff;
    --bubble-border: rgba(60, 160, 220, .35);

    /* Interruptor de tema */
    --toggle-track:
        radial-gradient(ellipse 30% 22% at 72% 62%, rgba(255, 255, 255, .95), transparent 70%),
        radial-gradient(ellipse 22% 16% at 84% 38%, rgba(255, 255, 255, .8), transparent 70%),
        linear-gradient(180deg, #62c5ff, #bfeaff);
    --knob: radial-gradient(circle at 35% 28%, #fffbe0 0%, #ffd75e 55%, #f5a623 100%);
    --knob-glow: 0 0 10px rgba(255, 200, 60, .85), inset 0 -2px 4px rgba(190, 110, 0, .35);

    /* Pizarra (siempre oscura: el trazo del canvas es claro) */
    --board-bg: radial-gradient(120% 90% at 30% 10%, #2a6a4f 0%, #17463a 55%, #0f3229 100%);
}

/* ---- Oscuro: "noche eco" ---- */
:root[data-theme="dark"] {
    color-scheme: dark;

    --slate-50: 244 250 251;
    --slate-100: 228 242 245;
    --slate-200: 203 228 233;
    --slate-300: 168 205 214;
    --slate-400: 128 173 184;
    --slate-500: 118 168 180;
    --slate-600: 42 94 108;
    --slate-700: 30 78 92;
    --slate-800: 12 44 54;
    --slate-900: 6 28 36;
    --slate-950: 3 18 24;

    --emerald-300: 110 231 183;
    --emerald-400: 52 211 153;
    --emerald-500: 16 185 129;
    --emerald-600: 5 150 105;
    --cyan-300: 103 232 249;
    --cyan-400: 34 211 238;
    --cyan-500: 6 182 212;
    --cyan-600: 8 145 178;
    --indigo-300: 165 180 252;
    --indigo-400: 147 157 250;
    --indigo-500: 99 102 241;
    --indigo-600: 79 70 229;
    --purple-300: 216 180 254;
    --purple-400: 205 160 255;
    --purple-500: 168 85 247;
    --purple-600: 147 51 234;
    --amber-300: 252 211 77;
    --amber-400: 251 191 36;
    --amber-500: 245 158 11;
    --amber-600: 217 119 6;
    --rose-300: 253 164 175;
    --rose-400: 251 113 133;
    --rose-500: 244 63 94;
    --rose-600: 225 29 72;

    --emerald-200: 167 243 208;
    --emerald-950: 2 44 34;
    --rose-200: 254 205 211;
    --rose-950: 76 5 25;
    --amber-200: 253 230 138;

    --sky:
        radial-gradient(50rem 26rem at 15% -5%, rgba(40, 200, 190, .28), transparent 62%),
        radial-gradient(44rem 22rem at 90% 8%, rgba(70, 130, 255, .2), transparent 62%),
        radial-gradient(46rem 18rem at 50% 108%, rgba(120, 255, 160, .22), transparent 70%),
        linear-gradient(180deg, #021019 0%, #04293a 42%, #05413f 80%, #08553f 100%);
    --sky-fallback: #04293a;
    --sun: radial-gradient(circle, rgba(170, 255, 240, .22) 0%, rgba(120, 230, 230, .1) 35%, rgba(0, 0, 0, 0) 66%);
    --hills: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 320' preserveAspectRatio='none'%3E%3Cpath fill='%23127a55' fill-opacity='.55' d='M0 200C240 120 420 120 640 190S1100 260 1440 150V320H0Z'/%3E%3Cpath fill='%230c5f47' fill-opacity='.8' d='M0 250C300 190 520 200 760 250S1200 300 1440 230V320H0Z'/%3E%3Cpath fill='%23063f31' d='M0 290C360 250 640 270 900 295S1280 310 1440 280V320H0Z'/%3E%3C/svg%3E");
    --bubble-fill: radial-gradient(circle at 30% 25%, rgba(200, 255, 250, .8) 0 6%, rgba(120, 240, 230, .22) 20%, rgba(60, 200, 200, .08) 58%, rgba(120, 255, 235, .22) 100%);
    --bubble-edge: rgba(130, 255, 240, .4);
    --bubble-shadow: 0 0 20px rgba(60, 230, 210, .22);

    --glass-bg: linear-gradient(180deg, rgba(14, 62, 76, .66), rgba(6, 36, 48, .58));
    --glass-bg-strong: linear-gradient(180deg, rgba(10, 52, 66, .97), rgba(5, 32, 43, .97));
    --card-bg: rgba(10, 50, 62, .55);
    --field-bg: rgba(3, 22, 30, .7);
    --glass-border: rgba(110, 230, 225, .22);
    --glass-highlight: rgba(170, 255, 245, .2);
    --gloss: linear-gradient(180deg, rgba(150, 255, 240, .16), rgba(150, 255, 240, 0));
    --panel-shadow: 0 14px 38px rgba(0, 0, 0, .5), 0 0 0 1px rgba(60, 220, 200, .05);
    --overlay: rgba(1, 10, 16, .72);
    --focus-ring: rgba(80, 230, 220, .95);
    --scroll-a: #2fb5b0;
    --scroll-b: #167a7a;

    --header-bg: linear-gradient(180deg, rgba(22, 76, 92, .9) 0%, rgba(8, 46, 59, .9) 49%, rgba(4, 32, 44, .94) 50%, rgba(6, 44, 56, .94) 100%);
    --header-border: rgba(100, 230, 230, .25);
    --header-shadow: 0 4px 24px rgba(0, 0, 0, .5), 0 1px 0 rgba(80, 230, 220, .12);
    --footer-bg: linear-gradient(180deg, rgba(3, 24, 28, .6), rgba(3, 30, 26, .85));

    --bubble-top: #10475a;
    --bubble-bottom: #0b3646;
    --bubble-border: rgba(110, 230, 225, .3);

    --toggle-track:
        radial-gradient(circle at 22% 34%, #fff 0 1px, transparent 1.6px),
        radial-gradient(circle at 36% 70%, rgba(255, 255, 255, .8) 0 1px, transparent 1.6px),
        radial-gradient(circle at 52% 28%, rgba(255, 255, 255, .7) 0 1px, transparent 1.6px),
        linear-gradient(180deg, #021824, #0a3d4d);
    --knob: radial-gradient(circle at 35% 28%, #ffffff 0%, #d7ecff 55%, #8fb7e8 100%);
    --knob-glow: 0 0 10px rgba(170, 215, 255, .6), inset -5px -3px 0 rgba(110, 140, 200, .5);
}


/* ==========================================================================
   2. BASE Y ESCENARIO
   ========================================================================== */

html {
    scroll-behavior: smooth;
}

body {
    font-family: "Nunito Sans", "Segoe UI", Frutiger, system-ui, sans-serif;
    background-color: var(--sky-fallback);
    background-image: var(--sky);
    background-attachment: fixed;
    background-repeat: no-repeat;
}

::selection {
    background: rgb(var(--cyan-500) / .35);
}

/* Escenario fijo detrás de todo: sol/luna, colinas y burbujas */
.eco-scene {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.eco-scene::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 30vh;
    min-height: 180px;
    background: var(--hills) center bottom / 100% 100% no-repeat;
}

.eco-scene::after {
    content: "";
    position: absolute;
    top: -14rem;
    left: -10rem;
    width: 38rem;
    height: 38rem;
    border-radius: 50%;
    background: var(--sun);
}

.bubble {
    position: absolute;
    bottom: -140px;
    left: var(--l);
    width: var(--s);
    height: var(--s);
    border-radius: 50%;
    background: var(--bubble-fill);
    border: 1px solid var(--bubble-edge);
    box-shadow: inset 0 0 12px var(--bubble-edge), var(--bubble-shadow);
    opacity: 0;
    animation: bubble-rise var(--d) linear infinite;
    animation-delay: var(--delay);
}

.bubble:nth-child(1) {
    --s: 46px;
    --l: 6%;
    --d: 22s;
    --delay: -2s;
}

.bubble:nth-child(2) {
    --s: 22px;
    --l: 14%;
    --d: 17s;
    --delay: -8s;
}

.bubble:nth-child(3) {
    --s: 70px;
    --l: 27%;
    --d: 28s;
    --delay: -12s;
}

.bubble:nth-child(4) {
    --s: 30px;
    --l: 41%;
    --d: 19s;
    --delay: -4s;
}

.bubble:nth-child(5) {
    --s: 54px;
    --l: 58%;
    --d: 25s;
    --delay: -16s;
}

.bubble:nth-child(6) {
    --s: 20px;
    --l: 66%;
    --d: 16s;
    --delay: -6s;
}

.bubble:nth-child(7) {
    --s: 84px;
    --l: 78%;
    --d: 32s;
    --delay: -20s;
}

.bubble:nth-child(8) {
    --s: 34px;
    --l: 88%;
    --d: 21s;
    --delay: -10s;
}

.bubble:nth-child(9) {
    --s: 26px;
    --l: 95%;
    --d: 18s;
    --delay: -1s;
}

@keyframes bubble-rise {
    0% {
        transform: translate3d(0, 0, 0) scale(.9);
        opacity: 0;
    }

    10% {
        opacity: .85;
    }

    50% {
        transform: translate3d(22px, -55vh, 0) scale(1);
    }

    90% {
        opacity: .6;
    }

    100% {
        transform: translate3d(-12px, -118vh, 0) scale(1.06);
        opacity: 0;
    }
}

/* Transición suave al cambiar de tema (la activa theme.js por ~450 ms) */
html.theme-transition *,
html.theme-transition *::before,
html.theme-transition *::after {
    transition: background-color .35s ease, border-color .35s ease, color .35s ease, box-shadow .35s ease !important;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: rgb(var(--slate-900) / .45);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--scroll-a), var(--scroll-b));
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    filter: brightness(1.12);
}

* {
    scrollbar-color: var(--scroll-b) transparent;
}


/* ==========================================================================
   3. SUPERFICIES DE VIDRIO
   ========================================================================== */

/* Header: barra Aero con el clásico corte de brillo a mitad de altura */
.app-header {
    background: var(--header-bg);
    border-bottom: 1px solid var(--header-border);
    box-shadow: var(--header-shadow);
    backdrop-filter: blur(14px) saturate(1.5);
    -webkit-backdrop-filter: blur(14px) saturate(1.5);
}

.brand-logo {
    filter: drop-shadow(0 2px 4px rgba(0, 80, 140, .28));
}

/* Panel de vidrio con reflejo superior */
.panel {
    position: relative;
    isolation: isolate;
    border-radius: 1.5rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--panel-shadow), inset 0 1px 0 var(--glass-highlight);
    backdrop-filter: blur(18px) saturate(1.4);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
}

.panel::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0 0 auto 0;
    height: 40%;
    border-radius: inherit;
    background: var(--gloss);
    pointer-events: none;
}

.panel--sm {
    border-radius: 1.25rem;
}

.stats-pill {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    box-shadow: inset 0 1px 0 var(--glass-highlight), 0 2px 8px rgba(10, 80, 130, .12);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.section-label {
    color: rgb(var(--slate-300));
}

/* Modales */
.modal-overlay {
    background: var(--overlay);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fade-in .2s ease both;
}

.modal-card {
    position: relative;
    isolation: isolate;
    border-radius: 1.5rem;
    background: var(--glass-bg-strong);
    border: 1px solid var(--glass-border);
    box-shadow: 0 24px 60px rgba(0, 40, 80, .4), inset 0 1px 0 var(--glass-highlight);
    animation: pop-in .25s cubic-bezier(.2, .9, .3, 1.2) both;
}

.modal-header {
    background:
        var(--gloss),
        linear-gradient(90deg, rgb(var(--cyan-500) / .2), rgb(var(--emerald-500) / .16));
    border-bottom: 1px solid rgb(var(--slate-700) / .7);
}

.modal-footer {
    background: rgb(var(--slate-800) / .4);
    border-top: 1px solid rgb(var(--slate-700) / .7);
}

.modal-icon {
    background: radial-gradient(circle at 32% 24%, #fff 0%, rgb(var(--cyan-500) / .35) 60%, rgb(var(--cyan-500) / .55) 100%);
    border: 1px solid rgba(255, 255, 255, .8);
    box-shadow: inset 0 -4px 8px rgb(var(--cyan-500) / .3), 0 3px 8px rgb(var(--cyan-500) / .25);
}

@keyframes pop-in {
    from {
        opacity: 0;
        transform: translateY(12px) scale(.96);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.notice {
    background: rgb(var(--amber-500) / .14);
    border: 1px solid rgb(var(--amber-500) / .4);
    color: rgb(var(--amber-300));
    border-radius: 1rem;
}

/* Footer */
.site-footer {
    background: var(--footer-bg);
    border-top: 1px solid var(--glass-border);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}


/* ==========================================================================
   4. BOTONES GEL
   Las propiedades de color se controlan con variables (--g1…--g4) para crear
   variantes. No se define "display": usa las utilidades de Tailwind (flex, etc.).
   #btn-accion usa el mismo estilo por ID para sobrevivir a cambios de clases.
   ========================================================================== */

.btn-gel,
#btn-accion {
    --g1: #9af27a;
    --g2: #4fcf3d;
    --g3: #2eb12c;
    --g4: #66dc52;
    --g-border: #238a2a;
    --g-glow: rgba(46, 177, 44, .45);
    --g-text-shadow: rgba(0, 70, 20, .5);

    position: relative;
    isolation: isolate;
    overflow: hidden;
    cursor: pointer;
    color: #fff;
    font-weight: 800;
    letter-spacing: .01em;
    text-shadow: 0 1px 1px var(--g-text-shadow);
    border: 1px solid var(--g-border);
    border-radius: 999px;
    background: linear-gradient(180deg, var(--g1) 0%, var(--g2) 48%, var(--g3) 52%, var(--g4) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .75),
        inset 0 -3px 8px rgba(0, 0, 0, .14),
        0 6px 16px var(--g-glow);
    transition: transform .15s ease, filter .15s ease, box-shadow .15s ease;
}

.btn-gel::after,
#btn-accion::after {
    content: "";
    position: absolute;
    z-index: -1;
    left: 5%;
    right: 5%;
    top: 2px;
    height: 46%;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .8), rgba(255, 255, 255, .18));
    pointer-events: none;
}

.btn-gel:hover,
#btn-accion:hover {
    transform: translateY(-1px);
    filter: brightness(1.07) saturate(1.1);
}

.btn-gel:active,
#btn-accion:active {
    transform: translateY(1px);
    filter: brightness(.97);
    box-shadow: inset 0 3px 8px rgba(0, 0, 0, .28), 0 2px 6px var(--g-glow);
}

.btn-gel:disabled,
#btn-accion:disabled {
    opacity: .55;
    filter: grayscale(.45);
    cursor: not-allowed;
    transform: none;
}

/* Variantes (van después de la base para ganar por orden) */
.btn-aqua {
    --g1: #a8ecff;
    --g2: #45bff5;
    --g3: #1d93e2;
    --g4: #52c6f5;
    --g-border: #1673b8;
    --g-glow: rgba(29, 147, 226, .45);
    --g-text-shadow: rgba(0, 50, 100, .5);
}

.btn-amber {
    --g1: #ffe48a;
    --g2: #ffb92e;
    --g3: #f08c0a;
    --g4: #ffc54d;
    --g-border: #c26c06;
    --g-glow: rgba(240, 140, 10, .45);
    --g-text-shadow: rgba(110, 50, 0, .5);
}

/* Botón secundario de vidrio (#btn-pista conserva el estilo por ID) */
.btn-ghost,
#btn-pista {
    padding: .5rem 1rem;
    border-radius: 999px;
    background: var(--card-bg);
    border: 1px solid rgb(var(--slate-700));
    color: rgb(var(--slate-300));
    box-shadow: inset 0 1px 0 var(--glass-highlight);
    transition: border-color .15s ease, color .15s ease, transform .15s ease;
}

.btn-ghost:hover,
#btn-pista:hover {
    border-color: rgb(var(--cyan-500));
    color: rgb(var(--slate-100));
    transform: translateY(-1px);
}


/* ==========================================================================
   5. COMPONENTES DE LA APP
   ========================================================================== */

/* ---- Mascota ---- */
.speech-bubble {
    background: linear-gradient(180deg, var(--bubble-top), var(--bubble-bottom));
    border: 1px solid var(--bubble-border);
    border-radius: 1.1rem;
    color: rgb(var(--slate-200));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), 0 6px 16px rgba(20, 120, 190, .18);
}

.speech-bubble__tail {
    background: var(--bubble-bottom);
    border-right: 1px solid var(--bubble-border);
    border-bottom: 1px solid var(--bubble-border);
}

.mascot-orb {
    position: relative;
    isolation: isolate;
    border-radius: 50%;
    background: radial-gradient(circle at 32% 24%, rgba(255, 255, 255, .9) 0%, rgba(255, 255, 255, .35) 22%, rgba(150, 225, 255, .28) 60%, rgba(60, 190, 150, .3) 100%);
    border: 2px solid rgba(255, 255, 255, .75);
    box-shadow:
        inset 0 -10px 22px rgba(30, 140, 200, .25),
        inset 0 8px 14px rgba(255, 255, 255, .5),
        0 10px 26px rgba(20, 120, 190, .28);
}

.mascot-orb::after {
    content: "";
    position: absolute;
    z-index: -1;
    top: 5%;
    left: 16%;
    width: 46%;
    height: 26%;
    border-radius: 50%;
    background: linear-gradient(180deg, rgba(255, 255, 255, .85), rgba(255, 255, 255, 0));
    transform: rotate(-18deg);
    pointer-events: none;
}

:root[data-theme="dark"] .mascot-orb {
    background: radial-gradient(circle at 32% 24%, rgba(190, 255, 250, .45) 0%, rgba(80, 210, 210, .16) 28%, rgba(20, 110, 120, .3) 70%, rgba(40, 190, 150, .28) 100%);
    border-color: rgba(120, 240, 230, .4);
    box-shadow:
        inset 0 -10px 22px rgba(0, 0, 0, .35),
        inset 0 6px 12px rgba(160, 255, 245, .18),
        0 0 28px rgba(60, 230, 210, .25);
}

/* ---- Tarjetas de materia (cada una define su propio acento) ---- */
.subject-card {
    --accent: 70 130 235;
    position: relative;
    border-radius: 1.1rem;
    background: var(--card-bg);
    border: 1px solid rgb(var(--accent) / .38);
    box-shadow: inset 0 1px 0 var(--glass-highlight), 0 4px 14px rgb(var(--accent) / .14);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.subject-card[data-subject="biologia"] {
    --accent: 52 190 90;
}

.subject-card[data-subject="fisica"] {
    --accent: 28 166 230;
}

.subject-card[data-subject="quimica"] {
    --accent: 150 100 235;
}

.subject-card:hover {
    transform: translateY(-2px);
    border-color: rgb(var(--accent) / .85);
    box-shadow: inset 0 1px 0 var(--glass-highlight), 0 10px 22px rgb(var(--accent) / .28), 0 0 0 3px rgb(var(--accent) / .14);
}

.subject-icon {
    border-radius: 50%;
    background: radial-gradient(circle at 32% 24%, #fff 0%, rgb(var(--accent) / .35) 58%, rgb(var(--accent) / .62) 100%);
    border: 1px solid rgba(255, 255, 255, .8);
    box-shadow: inset 0 -4px 8px rgb(var(--accent) / .35), 0 3px 8px rgb(var(--accent) / .3);
}

:root[data-theme="dark"] .subject-icon {
    background: radial-gradient(circle at 32% 24%, rgba(255, 255, 255, .55) 0%, rgb(var(--accent) / .4) 58%, rgb(var(--accent) / .7) 100%);
    border-color: rgb(var(--accent) / .6);
}

.count-pill {
    background: rgb(var(--accent) / .2);
    border: 1px solid rgb(var(--accent) / .4);
    color: rgb(var(--slate-200));
}

/* ---- Pregunta ---- */
.chip {
    background: rgb(var(--slate-700) / .55);
    border: 1px solid rgb(var(--slate-600) / .6);
    color: rgb(var(--slate-200));
}

.progress-track {
    background: rgb(var(--slate-700) / .7);
    border: 1px solid rgb(var(--slate-600) / .5);
    box-shadow: inset 0 2px 4px rgba(10, 70, 120, .25), 0 1px 0 var(--glass-highlight);
}

.progress-fill {
    position: relative;
    overflow: hidden;
    border-radius: 999px;
    background: linear-gradient(180deg, #a6f58a 0%, #46c93a 52%, #2aa636 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 0 10px rgba(60, 200, 60, .5);
}

.progress-fill::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .55) 50%, transparent 70%);
    transform: translateX(-100%);
    animation: shimmer 2.8s ease-in-out infinite;
}

@keyframes shimmer {
    to {
        transform: translateX(100%);
    }
}

/* Opciones A–E generadas por app.js: solo forma y movimiento.
   Los colores vienen de las clases de Tailwind (ya enlazadas al tema).
   :where() deja la especificidad en cero para no pisar los estados. */
:where(#contenedor-opciones)>* {
    border-radius: 1rem;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: inset 0 1px 0 var(--glass-highlight), 0 3px 10px rgba(20, 110, 180, .1);
    transition: transform .15s ease, box-shadow .2s ease, border-color .2s ease, background-color .2s ease;
}

:where(#contenedor-opciones)>*:not(:disabled):hover {
    transform: translateY(-1px);
}

/* ---- Pizarra ---- */
#pizarra-canvas-wrapper {
    background: var(--board-bg);
    border: 3px solid rgb(var(--slate-700));
    box-shadow: inset 0 0 28px rgba(0, 0, 0, .5), inset 0 2px 0 rgba(255, 255, 255, .08);
}

.board-hint {
    color: rgba(214, 240, 228, .75);
}

.board-hint small {
    color: rgba(214, 240, 228, .5);
}

/* ---- Footer: tarjeta de donaciones ---- */
.donate-card {
    background: var(--card-bg);
}


/* ==========================================================================
   6. FORMULARIOS Y MODALES
   ========================================================================== */

input[type="checkbox"],
input[type="radio"] {
    accent-color: rgb(var(--emerald-500));
}

.field {
    background: var(--field-bg);
    border: 1px solid rgb(var(--slate-700));
    color: rgb(var(--slate-100));
    border-radius: .9rem;
    box-shadow: inset 0 2px 5px rgba(20, 90, 140, .12);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.field:focus {
    outline: none;
    border-color: rgb(var(--cyan-500));
    box-shadow: 0 0 0 3px rgb(var(--cyan-500) / .25), inset 0 2px 5px rgba(20, 90, 140, .12);
}

.field option {
    background: rgb(var(--slate-900));
    color: rgb(var(--slate-100));
}

.option-tile {
    background: var(--card-bg);
    border: 1px solid rgb(var(--slate-700));
    border-radius: .9rem;
    box-shadow: inset 0 1px 0 var(--glass-highlight);
    transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}

.option-tile:hover {
    border-color: rgb(var(--cyan-500) / .6);
}

.option-tile:has(input:checked) {
    border-color: rgb(var(--emerald-500) / .75);
    background: rgb(var(--emerald-500) / .12);
}

.eje-box {
    background: rgb(var(--slate-950) / .6);
    border: 1px solid rgb(var(--slate-700));
    border-radius: .9rem;
    box-shadow: inset 0 2px 6px rgba(20, 90, 140, .1);
}

/* Botones de cantidad rápida: solo transición, colores los maneja app.js */
.btn-cant-modal {
    transition: border-color .15s ease, background-color .15s ease, transform .15s ease;
}

.btn-cant-modal:hover {
    transform: translateY(-1px);
}


/* ==========================================================================
   7. CONTENIDO DE LAS PREGUNTAS
   ========================================================================== */

#texto-pregunta p {
    margin-bottom: .75rem;
    line-height: 1.6;
}

#texto-pregunta table {
    width: 100%;
    margin: 1.25rem 0;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--card-bg);
    border: 1px solid rgb(var(--slate-700));
    border-radius: .9rem;
    overflow: hidden;
    box-shadow: inset 0 1px 0 var(--glass-highlight);
}

#texto-pregunta th {
    padding: .625rem .875rem;
    font-size: .85rem;
    font-weight: 800;
    text-align: center;
    color: rgb(var(--cyan-300));
    background: linear-gradient(180deg, rgb(var(--cyan-500) / .28), rgb(var(--cyan-500) / .12));
    border-bottom: 1px solid rgb(var(--slate-700));
}

#texto-pregunta td {
    padding: .5rem .875rem;
    font-size: .85rem;
    text-align: center;
    color: rgb(var(--slate-200));
    border-bottom: 1px solid rgb(var(--slate-700) / .5);
}

#texto-pregunta tr:last-child td {
    border-bottom: none;
}

/* Los gráficos DEMRE suelen tener trazo negro y fondo transparente:
   sobre fondo blanco se leen igual en modo claro y oscuro. */
#texto-pregunta img,
#contenedor-opciones img {
    max-width: 100%;
    background: #fff;
    border-radius: .6rem;
    padding: .35rem;
}

#texto-pregunta img {
    border: 1px solid rgb(var(--slate-700));
    box-shadow: 0 4px 14px rgba(20, 110, 180, .15);
}


/* ==========================================================================
   8. INTERRUPTOR DE TEMA
   ========================================================================== */

button.theme-toggle {
    position: relative;
    flex-shrink: 0;
    width: 4.25rem;
    height: 2.15rem;
    padding: 0;
    cursor: pointer;
    border-radius: 999px;
    border: 1px solid var(--glass-border);
    background: var(--toggle-track);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, .25), 0 2px 8px rgba(10, 80, 130, .18);
    transition: box-shadow .2s ease;
}

button.theme-toggle:hover {
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, .25), 0 0 0 3px rgb(var(--cyan-500) / .25);
}

.theme-toggle__knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: calc(2.15rem - 6px);
    height: calc(2.15rem - 6px);
    border-radius: 50%;
    background: var(--knob);
    box-shadow: var(--knob-glow);
    transition: transform .35s cubic-bezier(.34, 1.56, .64, 1);
}

:root[data-theme="dark"] .theme-toggle__knob {
    transform: translateX(2.1rem);
}


/* ==========================================================================
   9. ACCESIBILIDAD Y MOVIMIENTO REDUCIDO
   ========================================================================== */

:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

.field:focus-visible {
    outline: none;
}

@media (prefers-reduced-motion: reduce) {
    .bubble {
        display: none;
    }

    .progress-fill::after {
        animation: none;
        display: none;
    }

    .modal-overlay,
    .modal-card {
        animation: none;
    }

    .btn-gel,
    #btn-accion,
    .subject-card,
    .theme-toggle__knob {
        transition: none;
    }

    html {
        scroll-behavior: auto;
    }
}


/* ==========================================================================
   10. CORRECCIONES DE AUDITORÍA
   ========================================================================== */

/* El enunciado nunca ensancha el layout */
#texto-pregunta {
    min-width: 0;
    overflow-wrap: anywhere;
}

/* Tablas (envueltas por app.js en .table-scroll): scroll interno, no de la página */
.table-scroll {
    max-width: 100%;
    overflow-x: auto;
    margin: 1.25rem 0;
    -webkit-overflow-scrolling: touch;
}

#texto-pregunta .table-scroll table {
    margin: 0;
    min-width: max-content;
}

/* Fórmulas LaTeX anchas: scroll dentro de su propia línea */
#texto-pregunta mjx-container[display="true"],
#contenedor-opciones mjx-container[display="true"],
#caja-pista-explicacion mjx-container[display="true"] {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

/* Botón principal: "Siguiente pregunta" en aqua (app.js define data-estado) */
#btn-accion[data-estado="siguiente"] {
    --g1: #a8ecff;
    --g2: #45bff5;
    --g3: #1d93e2;
    --g4: #52c6f5;
    --g-border: #1673b8;
    --g-glow: rgba(29, 147, 226, .45);
    --g-text-shadow: rgba(0, 50, 100, .5);
}