    /* Lexend is a variable font designed for reading proficiency —
       confirmed dyslexia-friendly by Shaver-Troup (2019). One file
       covers weights 100–900. */
    @font-face {
      font-family: 'Lexend';
      src: url('/fonts/lexend.woff2') format('woff2-variations'),
           url('/fonts/lexend.woff2') format('woff2');
      font-weight: 100 900;
      font-style: normal;
      font-display: swap;
    }
    /* ============================================================
       CSS CUSTOM PROPERTIES — design tokens
    ============================================================ */
    :root {
      --c-primary:    #3A4E9D;   /* brand blue */
      --c-secondary:  #DE826A;   /* terracotta */
      --c-accent:     #76AF77;   /* green — fills, borders, washes */
      --c-accent-ink: #2F6B38;   /* green for text (the light green fails contrast) */
      --c-accent2:    #2B3D85;   /* deep blue highlight */
      --c-bg:         #F9F8FB;   /* off-white page background */
      --c-surface:    #FFFFFF;
      --c-surface2:   #F1F2F7;
      --c-text:       #1F2850;
      --c-text-soft:  #686C86;
      --c-border:     #DCDDE5;

      --radius-sm:  8px;
      --radius-md:  14px;
      --radius-lg:  22px;
      --radius-xl:  32px;

      --shadow-sm:  0 2px 6px rgba(0,0,0,.08);
      --shadow-md:  0 4px 16px rgba(0,0,0,.10);
      --shadow-lg:  0 8px 32px rgba(0,0,0,.13);
      --shadow-btn: 0 4px 0 rgba(0,0,0,.18);

      /* ONE font everywhere: Lexend (designed for reading proficiency;
         dyslexia-friendly). Headings keep their semibold weight. Until
         2026-09-12 headings used Quicksand, which mixed two typefaces. */
      --font-display:        'Lexend', sans-serif;
      --font-display-weight: 600;
      --font-body:           'Lexend', sans-serif;

      --nav-h: 60px;
      --tab-bar-h: 56px;
      --staging-h: 0px;   /* height of the staging ribbon; set by its script when shown */
      --transition: 0.22s cubic-bezier(.4,0,.2,1);
    }

    /* ============================================================
       RESET & BASE
    ============================================================ */
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    html { scroll-behavior: smooth; }

    body {
      font-family: var(--font-body);
      background: var(--c-bg);
      color: var(--c-text);
      min-height: 100vh;
      overflow-x: hidden;
    }

    img { display: block; max-width: 100%; }
    button { cursor: pointer; border: none; background: none; font-family: inherit; }
    input, select, textarea { font-family: inherit; }
    a { color: inherit; text-decoration: none; }
    ul, ol { list-style: none; }

    /* ============================================================
       TYPOGRAPHY UTILITIES
    ============================================================ */
    .font-display { font-family: var(--font-display); font-weight: var(--font-display-weight); }
    .text-primary  { color: var(--c-primary); }
    .text-accent   { color: var(--c-accent-ink); }
    .text-soft     { color: var(--c-text-soft); }

    /* ============================================================
       TOP NAV BAR
    ============================================================ */
    /* Staging ribbon: sits above the nav and pushes it down, never over it. */
    #staging-banner {
      position: fixed;
      top: 0; left: 0; right: 0;
      z-index: 101;
      background: #facc15;
      color: #1F2850;
      font-weight: 800;
      font-size: .85rem;
      line-height: 1.3;
      text-align: center;
      padding: 8px 14px;
    }
    #top-nav {
      position: fixed;
      top: var(--staging-h); left: 0; right: 0;
      height: var(--nav-h);
      background: var(--c-surface);
      border-bottom: 1.5px solid var(--c-border);
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 28px;
      z-index: 100;
      box-shadow: 0 1px 16px rgba(0,0,0,.07);
    }

    .nav-logo {
      display: flex;
      align-items: center;
      gap: 11px;
      cursor: pointer;
      user-select: none;
      text-decoration: none;
      transition: transform .22s cubic-bezier(.34,1.56,.64,1);
    }
    .nav-logo:hover { transform: scale(1.04); }

    /* ── Logo icon tile ── */
    .nav-logo-icon {
      width: 42px;
      height: 42px;
      flex-shrink: 0;
      animation: logoFloat 4s ease-in-out infinite;
      filter: drop-shadow(0 3px 10px rgba(58,78,157,.32));
    }
    .nav-logo:hover .nav-logo-icon {
      animation-play-state: paused;
    }

    @keyframes logoFloat {
      0%, 100% { transform: translateY(0); }
      50%       { transform: translateY(-3px); }
    }

    /* ── Wordmark — matches home page logo ── */
    .nav-logo-text {
      /* The wordmark is 600 everywhere else - the landing page, login,
         privacy, terms, contacto, unirse and the boot splash all
         use it, and --font-display-weight is 600. A hardcoded 800 here
         overrode that and made the logo inside the app visibly heavier
         than the one on the home page (Sandra, 2026-09-19). */
      font-family: var(--font-display); font-weight: var(--font-display-weight);
      font-size: 1.7rem;
      letter-spacing: -0.5px;
      line-height: 1;
      color: #2B3D85;
    }
    .nav-logo-text span {
      color: #DE826A;
    }

    .nav-right {
      display: flex;
      align-items: center;
      gap: 12px;
    }

    /* Language toggle */
    .lang-toggle {
      display: flex;
      align-items: center;
      background: var(--c-surface2);
      border-radius: 99px;
      padding: 3px;
      gap: 2px;
      border: 2px solid var(--c-border);
    }
    .lang-btn {
      padding: 4px 12px;
      border-radius: 99px;
      font-weight: 700;
      font-size: 0.82rem;
      transition: var(--transition);
      color: var(--c-text-soft);
    }
    .lang-btn.active {
      background: var(--c-primary);
      color: #fff;
      box-shadow: var(--shadow-sm);
    }

    /* Login / Guest button */
    .btn-login {
      padding: 7px 16px;
      border-radius: var(--radius-md);
      background: var(--c-accent2);
      color: #fff;
      font-weight: 700;
      font-size: 0.85rem;
      transition: var(--transition);
      box-shadow: 0 3px 0 rgba(43,61,133,.35);
    }
    .btn-login:hover {
      transform: translateY(-1px);
      box-shadow: 0 5px 0 rgba(43,61,133,.35);
    }
    .btn-login:active {
      transform: translateY(2px);
      box-shadow: 0 1px 0 rgba(43,61,133,.35);
    }

    /* Logged-in state — drop the pill chrome and become an avatar +
       first-name combo. The circle uses primary brand color and the
       user's initial, which doubles as a recognizable "account" cue
       (initial-in-circle is the standard Gmail/Twitter/SaaS pattern). */
    .btn-login.is-authed {
      background: transparent;
      box-shadow: none;
      padding: 3px 10px 3px 3px;
      display: inline-flex;
      align-items: center;
      gap: 8px;
      color: var(--c-text);
      font-weight: 700;
      font-size: 0.9rem;
    }
    .btn-login.is-authed:hover {
      transform: none;
      box-shadow: none;
      background: var(--c-surface2, rgba(0,0,0,.04));
    }
    .btn-login.is-authed:active {
      transform: none;
      box-shadow: none;
    }
    #auth-btn-label { display: inline-flex; align-items: center; gap: 8px; }
    .auth-avatar {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 32px;
      height: 32px;
      border-radius: 50%;
      background: var(--c-primary);
      color: #fff;
      font-weight: 800;
      font-size: 0.95rem;
      font-family: var(--font-display, inherit);
      line-height: 1;
      flex: 0 0 32px;
    }
    .auth-name { font-weight: 700; font-size: 0.9rem; }
    @media (max-width: 520px) {
      .auth-name { display: none; }
      .btn-login.is-authed { padding: 3px; }
    }

    /* Guest badge */
    .guest-badge {
      padding: 5px 12px;
      border-radius: var(--radius-md);
      background: var(--c-surface2);
      border: 2px solid var(--c-border);
      font-weight: 700;
      font-size: 0.82rem;
      color: var(--c-text-soft);
    }

    /* ============================================================
       TAB BAR
    ============================================================ */
    #tab-bar {
      position: fixed;
      top: calc(var(--staging-h) + var(--nav-h));
      left: 0; right: 0;
      height: var(--tab-bar-h);
      background: var(--c-surface);
      border-bottom: 2px solid var(--c-border);
      display: flex;
      align-items: stretch;
      gap: 6px;
      z-index: 99;
      overflow-x: auto;
      scrollbar-width: none;
    }
    #tab-bar::-webkit-scrollbar { display: none; }

    .tab-btn {
      flex: 1;
      min-width: 80px;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      font-weight: 700;
      font-size: 0.82rem;
      color: var(--c-text-soft);
      border-bottom: 3px solid transparent;
      transition: var(--transition);
      white-space: nowrap;
      padding: 0 8px;
      letter-spacing: .01em;
    }
    .tab-btn .tab-icon { font-size: 1.1rem; }
    .tab-btn:hover {
      color: var(--c-primary);
      background: rgba(58,78,157,.05);
    }
    .tab-btn.active {
      color: var(--c-primary);
      border-bottom: 3px solid var(--c-primary);
      background: rgba(58,78,157,.06);
      font-weight: 800;
    }

    /* ============================================================
       MAIN CONTENT AREA
    ============================================================ */
    #main-content {
      margin-top: calc(var(--staging-h) + var(--nav-h) + var(--tab-bar-h));
      min-height: calc(100vh - var(--staging-h) - var(--nav-h) - var(--tab-bar-h));
      padding: 24px 16px 48px;
      max-width: 1280px;
      margin-left: auto;
      margin-right: auto;
    }
    /* Override top margin since margin-left/right auto doesn't work with margin-top shorthand */
    #main-content {
      margin-top: calc(var(--staging-h) + var(--nav-h) + var(--tab-bar-h));
    }

    /* Tab panels */
    .tab-panel { display: none; }
    .tab-panel.active { display: block; }

    /* ============================================================
       SHARED COMPONENT: CARD
    ============================================================ */
    .card {
      background: var(--c-surface);
      border-radius: var(--radius-lg);
      box-shadow: var(--shadow-sm);
      border: 1.5px solid var(--c-border);
      padding: 20px;
    }
    .card-lg { padding: 20px; }

    /* ============================================================
       SHARED COMPONENT: BUTTONS
    ============================================================ */
    .btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 7px;
      padding: 11px 22px;
      border-radius: var(--radius-md);
      font-weight: 700;
      font-size: 0.95rem;
      transition: var(--transition);
      box-shadow: var(--shadow-btn);
      position: relative;
      top: 0;
    }
    .btn:hover  { top: -2px; box-shadow: 0 6px 0 rgba(0,0,0,.18); }
    .btn:active { top: 3px;  box-shadow: 0 1px 0 rgba(0,0,0,.18); }

    .btn-primary {
      background: var(--c-primary);
      color: #fff;
      box-shadow: 0 4px 0 #a8472e;
    }
    .btn-primary:hover  { box-shadow: 0 6px 0 #a8472e; }
    .btn-primary:active { box-shadow: 0 1px 0 #a8472e; }

    .btn-secondary {
      background: var(--c-secondary);
      color: var(--c-text);
      box-shadow: 0 4px 0 #a8472e;
    }
    .btn-secondary:hover  { box-shadow: 0 6px 0 #a8472e; }
    .btn-secondary:active { box-shadow: 0 1px 0 #a8472e; }

    .btn-accent {
      background: var(--c-accent);
      color: #fff;
      box-shadow: 0 4px 0 #11907e;
    }
    .btn-accent:hover  { box-shadow: 0 6px 0 #11907e; }
    .btn-accent:active { box-shadow: 0 1px 0 #11907e; }

    .btn-ghost {
      background: var(--c-surface2);
      color: var(--c-text);
      border: 2px solid var(--c-border);
      box-shadow: 0 3px 0 var(--c-border);
    }
    .btn-ghost:hover  { box-shadow: 0 5px 0 var(--c-border); }
    .btn-ghost:active { box-shadow: 0 1px 0 var(--c-border); }

    .btn-sm {
      padding: 7px 14px;
      font-size: 0.82rem;
      border-radius: var(--radius-sm);
    }
    .btn-lg {
      padding: 14px 30px;
      font-size: 1.05rem;
      border-radius: var(--radius-lg);
    }

    /* ============================================================
       SHARED COMPONENT: BADGE / CHIP
    ============================================================ */
    .chip {
      display: inline-flex;
      align-items: center;
      padding: 4px 10px;
      border-radius: 99px;
      font-size: 0.78rem;
      font-weight: 700;
    }
    .chip-primary  { background: rgba(58,78,157,.12);  color: var(--c-primary); }
    .chip-accent   { background: rgba(118,175,119,.12); color: var(--c-accent-ink); }
    .chip-purple   { background: rgba(43,61,133,.12); color: var(--c-accent2); }
    .chip-yellow   { background: rgba(222,130,106,.25); color: #8a6800; }
    .chip-ar       { background: rgba(118,175,119,.14); color: #0e9080; }
    .chip-er       { background: rgba(43,61,133,.14); color: var(--c-accent2); }
    .chip-ir       { background: rgba(222,130,106,.14); color: #c04a00; }
    /* Reflexive verb chip button */
    .refl-chip-btn {
      background: rgba(22,163,74,.1);
      color: #16a34a;
      border: 1.5px solid rgba(22,163,74,.35);
      border-radius: 99px;
      padding: 6px 14px;
      font-size: .82rem;
      font-weight: 700;
      cursor: pointer;
      font-family: inherit;
      display: inline-flex;
      align-items: center;
      gap: 5px;
      transition: background .15s;
      vertical-align: middle;
    }
    .refl-chip-btn:hover { background: rgba(22,163,74,.22); }
    .refl-chip-icon { display: inline-flex; width: 14px; height: 14px; }
    .refl-chip-icon svg { width: 14px; height: 14px; }

    /* ============================================================
       SHARED COMPONENT: SECTION HEADER
    ============================================================ */
    .section-header {
      margin-bottom: 20px;
    }
    .section-title {
      font-family: var(--font-display); font-weight: var(--font-display-weight);
      font-size: 1.4rem;
      color: var(--c-text);
      line-height: 1.15;
    }
    .section-subtitle {
      font-size: 0.88rem;
      color: var(--c-text-soft);
      margin-top: 5px;
      line-height: 1.5;
    }

    /* ── Global footer (copyright + terms link) ── */
    .app-footer {
      margin: 56px auto 0;
      max-width: 1100px;
      padding: 18px 28px 24px;
      border-top: 1px solid var(--c-border);
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: .78rem;
      color: var(--c-text-soft);
      gap: 14px;
      flex-wrap: wrap;
    }
    .app-footer-copy { letter-spacing: .01em; }
    .app-footer-link {
      color: var(--c-accent2);
      text-decoration: none;
      font-weight: 700;
    }
    .app-footer-link:hover { text-decoration: underline; }

    /* ============================================================
       SHARED COMPONENT: MODAL OVERLAY
    ============================================================ */
    .modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(31,40,80,.55);
      backdrop-filter: blur(3px);
      z-index: 200;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 16px;
      opacity: 0;
      pointer-events: none;
      transition: opacity var(--transition);
    }
    .modal-overlay.open {
      opacity: 1;
      pointer-events: all;
    }
    .modal {
      background: var(--c-surface);
      border-radius: var(--radius-xl);
      box-shadow: var(--shadow-lg);
      padding: 28px;
      width: 100%;
      max-width: 500px;
      max-height: 90vh;
      overflow-y: auto;
      transform: translateY(16px) scale(0.97);
      transition: transform var(--transition);
    }
    .modal-overlay.open .modal {
      transform: translateY(0) scale(1);
    }
    .modal-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 18px;
    }
    .modal-title {
      font-family: var(--font-display); font-weight: var(--font-display-weight);
      font-size: 1.4rem;
    }
    .modal-close {
      width: 34px; height: 34px;
      border-radius: 50%;
      background: var(--c-surface2);
      font-size: 1.1rem;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: var(--transition);
    }
    .modal-close:hover { background: var(--c-border); }

    /* ============================================================
       SHARED COMPONENT: TOAST NOTIFICATION
    ============================================================ */
    #toast-container {
      position: fixed;
      bottom: 24px;
      left: 50%;
      transform: translateX(-50%);
      /* Above every overlay in the app (modal-overlay 200, live-student 500,
         admin-overlay 600). A toast that appears behind a blurred modal is
         invisible — this layer needs to win against everything. */
      z-index: 10000;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 8px;
      pointer-events: none;
    }
    .toast {
      padding: 10px 22px;
      border-radius: 99px;
      font-weight: 700;
      font-size: 0.9rem;
      color: #fff;
      box-shadow: var(--shadow-md);
      animation: toastIn .3s ease, toastOut .3s ease 2.2s forwards;
    }
    .toast-success { background: var(--c-accent); }
    .toast-error   { background: var(--c-primary); }
    .toast-info    { background: var(--c-accent2); }

    @keyframes toastIn  { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }
    @keyframes toastOut { from { opacity:1; } to { opacity:0; transform:translateY(-8px); } }

    /* ============================================================
       SHARED COMPONENT: XP BAR (used in Game + Teacher)
    ============================================================ */
    .xp-bar-wrap {
      background: var(--c-surface2);
      border-radius: 99px;
      height: 10px;
      overflow: hidden;
    }
    .xp-bar-fill {
      height: 100%;
      background: linear-gradient(90deg, var(--c-accent), var(--c-accent2));
      border-radius: 99px;
      transition: width .5s cubic-bezier(.4,0,.2,1);
    }

    /* ============================================================
       SHARED COMPONENT: HEART DISPLAY
    ============================================================ */
    .hearts {
      display: flex;
      gap: 4px;
    }
    .heart { font-size: 1.3rem; transition: transform .2s; }
    .heart.lost { filter: grayscale(1) opacity(0.4); transform: scale(0.85); }

    /* ============================================================
       PROGRESS / STREAK PILL
    ============================================================ */
    .streak-pill {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 4px 11px;
      background: linear-gradient(135deg, #DE826A, #A8472E);
      border-radius: 99px;
      font-weight: 800;
      font-size: 0.82rem;
      color: #fff;
      box-shadow: 0 2px 8px rgba(222,130,106,.35);
      cursor: default;
      transition: opacity .2s;
      white-space: nowrap;
      user-select: none;
    }
    .level-pill {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 4px 11px;
      background: linear-gradient(135deg, #7C6CFF, #5A4FE0);
      border-radius: 99px;
      font-weight: 800;
      font-size: 0.82rem;
      color: #fff;
      box-shadow: 0 2px 8px rgba(43,61,133,.35);
      cursor: default;
      white-space: nowrap;
      user-select: none;
      transition: transform .18s ease;
    }
    .level-pill.pop { animation: levelPop .5s ease; }
    @keyframes levelPop {
      0%   { transform: scale(1); }
      35%  { transform: scale(1.2); }
      100% { transform: scale(1); }
    }
    /* Level-up celebration — a bigger, glowing pop */
    .level-pill.levelup { animation: levelUpCelebrate .8s ease; }
    @keyframes levelUpCelebrate {
      0%   { transform: scale(1);              box-shadow: 0 2px 8px rgba(43,61,133,.35); }
      30%  { transform: scale(1.35) rotate(-3deg); box-shadow: 0 0 0 6px rgba(124,108,255,.35), 0 4px 16px rgba(43,61,133,.5); }
      60%  { transform: scale(1.1) rotate(2deg); }
      100% { transform: scale(1);              box-shadow: 0 2px 8px rgba(43,61,133,.35); }
    }
    /* Floating "+N XP" badge that drifts up from the level pill */
    .xp-float {
      position: fixed;
      transform: translateX(-50%);
      font-weight: 800;
      font-size: 0.9rem;
      color: #5A4FE0;
      background: #fff;
      padding: 2px 9px;
      border-radius: 99px;
      box-shadow: 0 2px 8px rgba(43,61,133,.3);
      pointer-events: none;
      z-index: 10000;
      white-space: nowrap;
      animation: xpFloat 1s ease-out forwards;
    }
    @keyframes xpFloat {
      0%   { opacity: 0; transform: translate(-50%, 4px) scale(.9); }
      20%  { opacity: 1; transform: translate(-50%, -2px) scale(1); }
      100% { opacity: 0; transform: translate(-50%, -24px) scale(1); }
    }
    @media (prefers-reduced-motion: reduce) {
      .xp-float { animation-duration: .01ms; }
      .level-pill.levelup, .level-pill.pop { animation: none; }
    }
    /* Streak-save nudge — dismissable bottom bar, never a modal */
    .streak-nudge {
      position: fixed;
      left: 50%;
      bottom: 16px;
      transform: translate(-50%, 160%);
      display: flex;
      align-items: center;
      gap: 12px;
      max-width: calc(100vw - 24px);
      background: var(--c-card, #fff);
      border: 2px solid var(--c-border, #eee);
      box-shadow: 0 8px 30px rgba(0,0,0,.16);
      border-radius: 99px;
      padding: 10px 12px 10px 18px;
      z-index: 9998;
      opacity: 0;
      transition: transform .35s cubic-bezier(.2,.8,.2,1), opacity .35s;
    }
    .streak-nudge.show { transform: translate(-50%, 0); opacity: 1; }
    .streak-nudge-msg { font-weight: 700; font-size: .88rem; color: #1F2850; }
    .streak-nudge-cta {
      flex: 0 0 auto;
      background: linear-gradient(135deg, #DE826A, #A8472E);
      color: #fff; font-weight: 800; font-size: .82rem;
      border: none; border-radius: 99px; padding: 7px 15px; cursor: pointer;
    }
    .streak-nudge-cta:hover { filter: brightness(1.05); }
    .streak-nudge-x {
      flex: 0 0 auto; background: transparent; border: none; cursor: pointer;
      font-size: .9rem; color: var(--c-text-soft, #888); padding: 4px 6px; line-height: 1;
    }
    @media (max-width: 600px) {
      .streak-nudge { flex-wrap: wrap; width: calc(100vw - 20px); border-radius: 18px; bottom: 10px; padding: 12px 14px; gap: 8px 10px; }
      .streak-nudge-msg { font-size: .84rem; flex: 1 1 100%; }
      .streak-nudge-cta { margin-left: auto; }
    }

    /* ============================================================
       CONFETTI CANVAS
    ============================================================ */
    #confetti-canvas {
      position: fixed;
      inset: 0;
      pointer-events: none;
      z-index: 250;
    }

    /* ============================================================
       LOADING SPINNER
    ============================================================ */
    .spinner {
      width: 36px; height: 36px;
      border: 4px solid var(--c-border);
      border-top-color: var(--c-primary);
      border-radius: 50%;
      animation: spin .7s linear infinite;
    }
    @keyframes spin { to { transform: rotate(360deg); } }

    /* ============================================================
       RESPONSIVE HELPERS
    ============================================================ */
    @media (max-width: 600px) {
      #main-content { padding: 16px 10px 60px; }
      .card-lg { padding: 18px; }
      .section-title { font-size: 1.35rem; }
      .tab-btn { font-size: 0.74rem; min-width: 92px; flex: 0 0 auto; padding: 0 10px; }
      .dict-tense-grid { grid-template-columns: 1fr 1fr; }
      .dict-verb-grid  { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
      .quiz-type-cards { grid-template-columns: 1fr 1fr; }
      .game-mode-cards { grid-template-columns: 1fr; }
      .votd-verb { font-size: 2.3rem; }
      /* Compact reward pills so the top bar fits on phones: "⭐ 2" / "🔥 5" */
      .level-pill, .streak-pill { padding: 4px 9px; font-size: 0.78rem; }
      .level-pill .lp-word { display: none; }
      /* Reclaim horizontal room so logo + pills + lang + login all fit.
         #top-nav prefix raises specificity above the later 1.4rem logo rules. */
      #top-nav { padding: 0 12px; }
      #top-nav .nav-right { gap: 7px; }
      #top-nav .nav-logo-text { font-size: 1.25rem; }
      #top-nav .lang-btn { padding: 4px 9px; font-size: 0.78rem; }
      #top-nav .btn-login { padding: 6px 11px; font-size: 0.78rem; }
    }
    @media (max-width: 420px) {
      .tab-btn { font-size: 0.69rem; min-width: 80px; flex: 0 0 auto; }
      .dict-tense-grid { grid-template-columns: 1fr; }
      .quiz-type-cards { grid-template-columns: 1fr 1fr; gap: 10px; }
      .nav-logo-text { font-size: 1.4rem; }
      .dict-verb-grid { grid-template-columns: 1fr 1fr; }
    }

    /* ============================================================
       ANIMATIONS
    ============================================================ */
    @keyframes fadeUp {
      from { opacity:0; transform: translateY(14px); }
      to   { opacity:1; transform: translateY(0); }
    }
    @keyframes popIn {
      0%   { transform: scale(0.7); opacity: 0; }
      70%  { transform: scale(1.08); }
      100% { transform: scale(1); opacity: 1; }
    }
    @keyframes shake {
      0%, 100% { transform: translateX(0); }
      20%       { transform: translateX(-6px); }
      40%       { transform: translateX(6px); }
      60%       { transform: translateX(-4px); }
      80%       { transform: translateX(4px); }
    }
    @keyframes pulse {
      0%, 100% { transform: scale(1); }
      50%       { transform: scale(1.06); }
    }

    .anim-fadeUp   { animation: fadeUp .35s ease both; }
    .anim-popIn    { animation: popIn  .4s cubic-bezier(.4,0,.2,1) both; }
    .anim-shake    { animation: shake  .4s ease; }
    .anim-pulse    { animation: pulse  .6s ease infinite; }


    /* ============================================================
       DICTIONARY TAB
    ============================================================ */
    .dict-search-hero {
      background: var(--c-surface);
      border: 1.5px solid var(--c-border);
      border-radius: var(--radius-xl);
      padding: 24px 24px 20px;
      margin-bottom: 20px;
      box-shadow: var(--shadow-sm);
    }

    .dict-search-input {
      flex: 1;
      min-width: 180px;
      padding: 10px 16px;
      border-radius: var(--radius-md);
      border: 2px solid var(--c-border);
      font-size: 0.95rem;
      background: var(--c-bg);
      color: var(--c-text);
      transition: border-color var(--transition);
      outline: none;
    }
    .dict-search-input:focus { border-color: var(--c-primary); }

    .dict-select {
      padding: 10px 14px;
      border-radius: var(--radius-md);
      border: 2px solid var(--c-border);
      font-size: 0.88rem;
      font-weight: 700;
      background: var(--c-bg);
      color: var(--c-text);
      outline: none;
      cursor: pointer;
      transition: border-color var(--transition);
    }
    .dict-select:focus { border-color: var(--c-primary); }

    .dict-verb-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
      gap: 12px;
      margin-bottom: 24px;
    }
    .dict-grid-ghost { visibility: hidden; pointer-events: none; }
    .dict-group-label {
      grid-column: 1 / -1;
      font-size: .78rem;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: .07em;
      color: var(--c-text-soft);
      padding-top: 6px;
      padding-bottom: 2px;
      border-top: 1.5px solid var(--c-border);
      margin-top: 6px;
    }
    .dict-group-label:first-child { border-top: none; margin-top: 0; padding-top: 0; }

    .dict-verb-card {
      background: var(--c-surface);
      border: 2px solid var(--c-border);
      border-radius: var(--radius-md);
      padding: 14px 12px;
      cursor: pointer;
      transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
      text-align: center;
    }
    .dict-verb-card:hover {
      border-color: var(--c-primary);
      transform: translateY(-3px);
      box-shadow: var(--shadow-md);
    }
    .dict-verb-card .verb-infinitive {
      font-family: var(--font-display); font-weight: var(--font-display-weight);
      font-size: 1.05rem;
      color: var(--c-primary);
      display: block;
      margin-bottom: 4px;
    }
    .dict-verb-card .verb-meaning {
      font-size: 0.78rem;
      color: var(--c-text-soft);
    }
    .dict-verb-card .verb-type-chip {
      margin-top: 6px;
    }

    /* Conjugation detail panel */
    .dict-detail {
      background: var(--c-surface);
      border-radius: var(--radius-lg);
      border: 1.5px solid var(--c-border);
      padding: 24px;
      margin-top: 8px;
      animation: fadeUp .3s ease;
      box-shadow: var(--shadow-sm);
      /* Keep the verb header clear of the fixed nav (60px) + tab bar
         (56px) when we scroll the detail into view via deep-link. */
      scroll-margin-top: 130px;
    }
    .dict-detail-header {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 20px;
      flex-wrap: wrap;
    }
    .dict-detail-verb {
      font-family: var(--font-display); font-weight: var(--font-display-weight);
      font-size: 2rem;
      color: var(--c-primary);
    }
    .dict-detail-meaning {
      font-size: 1rem;
      color: var(--c-text-soft);
      margin-top: 2px;
    }
    .dict-detail-example {
      background: rgba(118,175,119,.08);
      border-left: 4px solid var(--c-accent);
      border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
      padding: 10px 14px;
      font-size: 0.9rem;
      margin-bottom: 20px;
      font-style: italic;
      color: var(--c-text-soft);
    }

    /* Tense tabs inside dictionary */
    .tense-nav {
      display: flex;
      gap: 6px;
      flex-wrap: wrap;
      margin-bottom: 16px;
    }
    .tense-nav-btn {
      padding: 6px 14px;
      border-radius: 99px;
      border: 2px solid var(--c-border);
      font-weight: 700;
      font-size: 0.8rem;
      color: var(--c-text-soft);
      background: var(--c-surface2);
      transition: var(--transition);
    }
    .tense-nav-btn:hover { border-color: var(--c-primary); color: var(--c-primary); }
    .tense-nav-btn.active {
      background: var(--c-primary);
      border-color: var(--c-primary);
      color: #fff;
    }

    /* Conjugation table */
    .conj-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 0.92rem;
    }
    .conj-table th {
      text-align: left;
      padding: 8px 12px;
      background: var(--c-surface2);
      font-weight: 700;
      color: var(--c-text-soft);
      font-size: 0.8rem;
      text-transform: uppercase;
      letter-spacing: .04em;
    }
    .conj-table td {
      padding: 10px 12px;
      border-bottom: 1px solid var(--c-border);
    }
    .conj-table tr:last-child td { border-bottom: none; }
    .conj-table tr:hover td { background: rgba(58,78,157,.04); }
    .conj-pronoun { color: var(--c-text-soft); font-size: 0.85rem; }
    .conj-form {
      font-weight: 700;
      color: var(--c-text);
    }

    /* ============================================================
       DICTIONARY — FULL CONJUGATION VIEW (WordReference style)
    ============================================================ */
    .dict-verb-header {
      margin-bottom: 20px;
    }
    .dict-verb-inf {
      font-family: var(--font-display); font-weight: var(--font-display-weight);
      font-size: 2.2rem;
      color: var(--c-primary);
      line-height: 1.1;
    }
    .dict-verb-meaning {
      font-size: 1rem;
      color: var(--c-text-soft);
      margin-top: 4px;
    }
    .dict-verb-tags {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin-top: 10px;
    }
    .dict-participle-note {
      font-size: 0.85rem;
      color: var(--c-text-soft);
      margin-top: 8px;
      padding: 8px 14px;
      background: var(--c-surface2);
      border-radius: var(--radius-sm);
      display: inline-block;
    }
    .dict-mood-section {
      margin-bottom: 28px;
    }
    .dict-mood-title {
      font-family: var(--font-display); font-weight: var(--font-display-weight);
      font-size: 1rem;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: .08em;
      color: var(--c-primary);
      border-bottom: 2px solid var(--c-primary);
      padding-bottom: 6px;
      margin-bottom: 14px;
    }
    .dict-tense-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
      gap: 12px;
    }
    .dict-tense-card {
      background: var(--c-surface2);
      border-radius: var(--radius-md);
      padding: 14px 16px;
      border: 1.5px solid var(--c-border);
    }
    .dict-tense-label {
      font-size: 0.78rem;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: .06em;
      color: var(--c-accent2);
      margin-bottom: 10px;
    }
    .dict-conj-rows {
      display: grid;
      grid-template-columns: auto 1fr;
      gap: 3px 12px;
      font-size: 0.88rem;
    }
    .dict-conj-rows .dc-pron {
      color: var(--c-text-soft);
      white-space: nowrap;
    }
    .dict-conj-rows .dc-form {
      font-weight: 700;
      color: var(--c-text);
    }
    /* A second, equally correct form (ir: vamos / vayamos) — present,
       but quieter than the one the app answers with. */
    .dict-conj-rows .dc-alt {
      font-weight: 500;
      color: var(--c-text-soft);
    }
    .dict-generated-note {
      font-size: 0.78rem;
      color: var(--c-text-soft);
      text-align: center;
      margin-top: 4px;
      opacity: .7;
    }
    /* "Conjugates like X" banner for unknown verbs */
    .exemplar-banner {
      background: rgba(43,61,133,.08);
      border: 1.5px solid rgba(43,61,133,.22);
      border-radius: var(--radius);
      padding: 14px 18px;
      margin: 4px 0 20px;
      font-size: .9rem;
      color: var(--c-text);
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
      line-height: 1.5;
    }
    .exemplar-banner .exemplar-icon { font-size: 1.3rem; flex-shrink: 0; }
    .exemplar-link-btn {
      background: var(--c-accent2);
      color: #fff;
      border: none;
      border-radius: 99px;
      padding: 4px 14px;
      font-size: .88rem;
      font-weight: 700;
      cursor: pointer;
      font-family: inherit;
      transition: opacity .15s;
      white-space: nowrap;
    }
    .exemplar-link-btn:hover { opacity: .85; }

    /* ============================================================
       GAME TAB — mode picker
    ============================================================ */
    .game-mode-cards {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 18px;
      max-width: 720px;
      margin: 0 auto;
    }

    .game-mode-card {
      background: var(--c-surface);
      border: 2.5px solid var(--c-border);
      border-radius: var(--radius-xl);
      padding: 30px 22px 26px;
      text-align: center;
      cursor: pointer;
      transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
      position: relative;
      overflow: hidden;
    }
    .game-mode-card:hover {
      transform: translateY(-5px);
      box-shadow: var(--shadow-lg);
    }

    .game-mode-icon {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 68px;
      height: 68px;
      border-radius: 50%;
      margin-bottom: 14px;
    }
    .game-mode-icon svg { width: 34px; height: 34px; display: block; }

    .game-mode-card.mode-mission   .game-mode-icon { background: rgba(58,78,157,.12); color: var(--c-primary); }
    .game-mode-card.mode-free      .game-mode-icon { background: rgba(118,175,119,.14); color: var(--c-accent-ink);  }
    .game-mode-card.mode-timed     .game-mode-icon { background: rgba(168,71,46,.14); color: #A8472E; }
    .game-mode-card.mode-mc        .game-mode-icon { background: rgba(58,78,157,.12); color: var(--c-primary); }
    .game-mode-card.mode-fill      .game-mode-icon { background: rgba(118,175,119,.14); color: var(--c-accent-ink); }
    .game-mode-card.mode-match     .game-mode-icon { background: rgba(43,61,133,.14); color: var(--c-accent2); }
    .game-mode-card.mode-wordsearch .game-mode-icon { background: rgba(34,197,94,.14); color: #16a34a; }

    .game-mode-card.mode-mission   { border-color: rgba(58,78,157,.25); }
    .game-mode-card.mode-free      { border-color: rgba(118,175,119,.3); }
    .game-mode-card.mode-mc        { border-color: rgba(58,78,157,.25); }
    .game-mode-card.mode-fill      { border-color: rgba(118,175,119,.3); }
    .game-mode-card.mode-match     { border-color: rgba(43,61,133,.3); }
    .game-mode-card.mode-wordsearch{ border-color: rgba(34,197,94,.3); }
    /* Sopa de letras + — timed/tense sibling; warmer red signals
       "against the clock" so the card reads differently from the
       chill green base Sopa right next to it. */
    .game-mode-card.mode-wordsearch-plus .game-mode-icon { background: rgba(239,68,68,.14); color: #dc2626; }
    .game-mode-card.mode-wordsearch-plus { border-color: rgba(239,68,68,.3); }
    /* Story / Exam — same border + hover treatment as the other mode
       cards so the row reads as one consistent set. */
    .game-mode-card.card-story-mode { border-color: rgba(99,102,241,.3); }
    .game-mode-card.card-exam-mode  { border-color: rgba(16,185,129,.3); }
    .game-mode-card.card-cultural-stories { border-color: rgba(14,165,233,.3); }
    .game-mode-card.card-story-mode .game-mode-icon { background: rgba(99,102,241,.14); color: #6366f1; }
    .game-mode-card.card-exam-mode  .game-mode-icon { background: rgba(16,185,129,.14); color: #10b981; }
    .game-mode-card.card-cultural-stories .game-mode-icon { background: rgba(14,165,233,.14); color: #0ea5e9; }
    .game-mode-card.card-construye { border-color: rgba(219,39,119,.3); }
    .game-mode-card.card-construye .game-mode-icon { background: rgba(219,39,119,.14); color: #db2777; }
    .game-mode-card.card-songs { border-color: rgba(217,119,6,.3); }
    .game-mode-card.card-songs .game-mode-icon { background: rgba(217,119,6,.14); color: #d97706; }
    .game-mode-card.card-videos { border-color: rgba(225,29,72,.3); }
    .game-mode-card.card-videos .game-mode-icon { background: rgba(225,29,72,.14); color: #e11d48; display:flex; align-items:center; justify-content:center; font-size:2.1rem; }
    .game-mode-card:hover.mode-mission         { border-color: var(--c-primary); }
    .game-mode-card:hover.mode-free            { border-color: var(--c-accent); }
    .game-mode-card:hover.mode-mc              { border-color: var(--c-primary); }
    .game-mode-card:hover.mode-fill            { border-color: var(--c-accent); }
    .game-mode-card:hover.mode-match           { border-color: var(--c-accent2); }
    .game-mode-card:hover.mode-wordsearch      { border-color: #16a34a; }
    .game-mode-card:hover.mode-wordsearch-plus { border-color: #dc2626; }
    .game-mode-card:hover.card-story-mode      { border-color: #6366f1; }
    .game-mode-card:hover.card-exam-mode       { border-color: #10b981; }
    .game-mode-card:hover.card-cultural-stories { border-color: #0ea5e9; }
    .game-mode-card:hover.card-construye       { border-color: #db2777; }
    .game-mode-card:hover.card-songs           { border-color: #d97706; }
    .game-mode-card:hover.card-videos          { border-color: #e11d48; }
    /* Videos con preguntas (interactive video + MC) */
    .tvq-wrap { max-width: 720px; margin: 0 auto; }
    .tvq-sample-card, .tvq-soon-card { position: relative; padding: 0; overflow: hidden; margin-bottom: 18px; }
    .tvq-tag { position: absolute; top: 12px; left: 12px; z-index: 3; font-size: .72rem; font-weight: 800; padding: 5px 11px; border-radius: 999px; color: #fff; letter-spacing: .02em; }
    .tvq-tag-free { background: #16a34a; }
    .tvq-tag-soon { background: #5048d4; }
    .tvq-thumb { position: relative; aspect-ratio: 16/9; background-size: cover; background-position: center; }
    .tvq-thumb .tvq-play { position: absolute; inset: 0; margin: auto; width: 64px; height: 64px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; padding-left: 5px; }
    .tvq-sample-body { padding: 16px; }
    .tvq-sample-title { font-weight: 800; font-size: 1.1rem; }
    .tvq-sample-meta { font-size: .82rem; color: var(--c-text-soft); margin: 2px 0 8px; }
    .tvq-sample-desc { font-size: .9rem; color: var(--c-text-soft); line-height: 1.5; margin-bottom: 14px; }
    .tvq-soon-card { border: 2px dashed rgba(124,58,237,.35); background: linear-gradient(180deg, rgba(124,58,237,.06), transparent); }
    .tvq-soon-inner { padding: 26px 20px; text-align: center; }
    .tvq-soon-icon { font-size: 2.2rem; margin-bottom: 8px; }
    .tvq-soon-title { font-weight: 800; font-size: 1.1rem; margin-bottom: 8px; }
    .tvq-soon-desc { font-size: .9rem; color: var(--c-text-soft); line-height: 1.6; max-width: 440px; margin: 0 auto; }
    .tvq-player-progress { font-size: .85rem; color: var(--c-text-soft); margin-bottom: 8px; font-weight: 700; }
    .tvq-video-box { position: relative; aspect-ratio: 16/9; background: #000; border-radius: 14px; overflow: hidden; }
    .tvq-video-box iframe, #tvq-player { width: 100%; height: 100%; display: block; border: 0; }
    .tvq-video-el { object-fit: cover; background: #000; }
    /* Fullscreen goes on the BOX (not the video) so the question overlay
       stays visible; YouTube's own fs button is disabled (fs:0). */
    .tvq-video-box:fullscreen, .tvq-video-box:-webkit-full-screen { aspect-ratio: auto; width: 100%; height: 100%; border-radius: 0; }
    .tvq-expand-btn { position: absolute; top: 10px; right: 10px; z-index: 5; background: rgba(0,0,0,.55); color: #fff; border: 0; border-radius: 10px; padding: 8px 12px; font-size: .95rem; font-weight: 700; cursor: pointer; }
    .tvq-expand-btn:hover { background: rgba(0,0,0,.75); }
    /* Speed sits top-LEFT; the ⛶ button owns the right corner. */
    .tvq-rate {
      position: absolute; top: 10px; left: 10px; z-index: 5;
      display: inline-flex; align-items: center; gap: 6px;
      background: rgba(0,0,0,.55); color: #fff; border-radius: 999px;
      padding: 5px 10px 5px 12px; font-size: .82rem; font-weight: 700;
    }
    .tvq-rate select {
      background: transparent; color: #fff; border: 0; font: inherit;
      font-weight: 700; cursor: pointer; padding: 0 2px;
    }
    .tvq-rate select option { color: #111; }
    .tvq-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: .9rem; background: #000; text-align: center; padding: 20px; }
    .tvq-q-overlay { position: absolute; inset: 0; background: rgba(15,23,42,.95); display: flex; align-items: center; justify-content: center; padding: 18px; overflow: auto; }
    .tvq-q-inner { width: 100%; max-width: 560px; color: #fff; }
    .tvq-q-count { font-size: .78rem; opacity: .8; font-weight: 700; margin-bottom: 8px; }
    .tvq-q-prompt { font-size: 1.08rem; font-weight: 800; margin-bottom: 14px; line-height: 1.4; }
    .tvq-q-opts { display: flex; flex-direction: column; gap: 10px; }
    .tvq-q-opts .tvq-opt { width: 100%; text-align: left; }
    .tvq-hint { font-size: .8rem; color: var(--c-text-soft); text-align: center; margin-top: 10px; }
    .tvq-upsell { background: rgba(124,58,237,.16); border: 1px solid rgba(124,58,237,.4); border-radius: 14px; padding: 16px; margin-top: 6px; }

    /* ── Teatro (recording studio with virtual backgrounds) ── */
    .game-mode-card.card-teatro { border-color: rgba(124,58,237,.3); position: relative; }
    .game-mode-card:hover.card-teatro { border-color: #7c3aed; }
    .teatro-wrap { max-width: 960px; margin: 0 auto; }
    /* The stage is capped by a HEIGHT BUDGET (viewport minus the page chrome
       above it and the controls below it) so the video plus its framing +
       record buttons stay on one screen without scrolling. Width is derived
       from that height keeping a true 16:9, and never exceeds the column.
       On short screens the video simply shrinks; a 240px floor stops it
       vanishing. dvh (with a vh fallback) tracks mobile browser chrome. */
    .teatro-stage-box { position: relative; aspect-ratio: 16/9; background: #000; border-radius: 14px; overflow: hidden; margin: 0 auto;
      width: min(100%, max(240px, calc((100vh - 540px) * 16 / 9)));
      width: min(100%, max(240px, calc((100dvh - 540px) * 16 / 9)));
    }
    /* Trim the header inside Teatro to give the video more height budget. */
    .teatro-wrap .cs-library-header { margin-bottom: 8px; }
    .teatro-wrap .cs-library-sub { font-size: .82rem; }
    /* ── "Modo teatro" (theater / wide mode) ──────────────────────────
       Breaks the studio out of the centered column to use most of the
       window width, and gives the video a taller height budget. Width is
       still clamped to 96vw so it can never cause a horizontal scrollbar. */
    .teatro-wrap.teatro-theater { max-width: none; width: 96vw; margin-left: 50%; transform: translateX(-50%); }
    .teatro-wrap.teatro-theater .teatro-stage-box { width: min(96vw, calc(82vh * 16 / 9)); }

    /* ── Teatro stickers (2026-10-08) ─────────────────────────────
       The tray is a <details> so it is shut by default and never pushes
       the record buttons off a laptop screen. The handles live in a layer
       over the stage; what the camera records is drawn on the canvas, so
       these are only something to grab. */
    .teatro-stickers { margin: 10px auto 0; max-width: 680px; border: 2px solid var(--c-border);
      border-radius: 14px; background: var(--c-surface); overflow: hidden; }
    .teatro-stickers > summary { cursor: pointer; padding: 10px 14px; font-weight: 800;
      font-size: .95rem; list-style: none; display: flex; align-items: center; gap: 8px; }
    .teatro-stickers > summary::-webkit-details-marker { display: none; }
    .teatro-stickers > summary::after { content: '▾'; margin-left: auto; opacity: .6; }
    .teatro-stickers[open] > summary::after { content: '▴'; }
    .teatro-stk-count { background: var(--c-accent); color: #fff; border-radius: 99px;
      padding: 1px 8px; font-size: .78rem; }
    .teatro-stk-hint { padding: 0 14px 8px; font-size: .8rem; color: var(--c-text-soft); line-height: 1.45; }
    .teatro-stk-tray { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 12px; }
    .teatro-stk-btn { font-size: 1.5rem; line-height: 1; padding: 7px 9px; border-radius: 12px;
      border: 2px solid transparent; background: var(--c-surface2); cursor: pointer; }
    .teatro-stk-btn:hover { border-color: var(--c-accent); transform: translateY(-1px); }
    .teatro-stk-word { font-family: Lexend, sans-serif; font-size: .9rem; font-weight: 800;
      color: #fff; padding: 9px 14px; border-radius: 999px;
      box-shadow: 0 0 0 3px #fff, 0 3px 8px rgba(0,0,0,.22); margin: 3px 2px; }
    .teatro-stk-img { padding: 4px; }
    .teatro-stk-img img { width: 42px; height: 42px; object-fit: contain; display: block; }
    .teatro-stk-actions { padding: 0 12px 12px; }

    /* ── Teatro on a phone or an iPad ─────────────────────────────
       Sandra, 2026-10-11: "it does not work very well on my phone".
       Measured on a 390x844 screen: the stage was 362x204 — a stamp —
       and the sticker tray sat at y 819, below the fold, under the
       framing sliders and a 21-tile background grid. Everything was
       technically there and nothing was in reach.

       So on a narrow screen the order changes to what you actually do:
       see yourself, record, decorate, adjust, change scene. The stage
       goes edge to edge for the biggest picture a portrait phone can
       give, and the two long grids become side-swipers instead of
       columns that push the page to four screens. Nothing here touches
       a laptop: it is all inside the max-width query. */
    @media (max-width: 860px) {
      .teatro-wrap { display: flex; flex-direction: column; }
      /* Everything lands late unless it is named below. Without this the
         background picker and the back button keep the default order of 0
         and sit ABOVE the video — which is exactly what happened: measured
         on a 390 px screen the stage was 1235 px down the page. */
      .teatro-wrap > * { order: 7; }
      .teatro-wrap > .cs-library-header { order: 0; }
      .teatro-wrap > .teatro-stage-box { order: 1; }
      .teatro-wrap > .tw-tip          { order: 2; }
      .teatro-wrap > .tw-tools        { order: 3; }
      .teatro-wrap > .tw-stickers     { order: 4; }
      .teatro-wrap > .tw-frame        { order: 5; }
      .teatro-wrap > .tw-note         { order: 6; }
      .teatro-wrap > .teatro-picker,
      .teatro-wrap > div:has(> .teatro-bg-strip) { order: 7; }
      .teatro-wrap > .tw-privacy      { order: 8; }
      .teatro-wrap > .tw-back         { order: 9; }

      /* Edge to edge: a 16:9 stage in a padded column is tiny in portrait. */
      .teatro-stage-box { width: 100vw; margin-left: 50%; transform: translateX(-50%);
                          border-radius: 0; }

      /* Record, pause and stop on one reachable row under the picture. */
      .teatro-toolbar { position: sticky; bottom: 0; z-index: 6; gap: 8px;
        padding: 10px 8px calc(10px + env(safe-area-inset-bottom, 0px));
        background: var(--c-bg); border-top: 1px solid var(--c-border); }
      .teatro-toolbar .btn-lg { padding: 13px 14px; font-size: .95rem; min-width: 0; flex: 1 1 0; }

      /* Both long grids swipe sideways instead of stacking for pages. */
      .teatro-bg-strip { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start;
        scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
        padding-bottom: 12px; }
      .teatro-bg-strip > * { flex: 0 0 auto; scroll-snap-align: start; }
      .teatro-stk-tray { flex-wrap: nowrap; overflow-x: auto;
        -webkit-overflow-scrolling: touch; padding-bottom: 12px; }
      .teatro-stk-tray > * { flex: 0 0 auto; }

      /* The tray is the point of the panel on a phone — open it by default
         and keep the framing sliders out of the way until asked for. */
      .teatro-stickers { max-width: none; margin: 8px 0 0; border-radius: 0;
        border-left: none; border-right: none; }
      .teatro-frame-ctrls { font-size: .92rem; }
      .teatro-frame-grid { gap: 6px; }
    }

    .teatro-tip { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
      max-width: 680px; margin: 10px auto 0; padding: 10px 12px; border-radius: 14px;
      background: rgba(222,130,106,.16); border: 2px solid rgba(222,130,106,.55); }
    .teatro-tip-txt { flex: 1 1 220px; font-size: .88rem; line-height: 1.4; color: var(--c-text); }
    .teatro-tip-go { border: none; border-radius: 999px; padding: 9px 16px; cursor: pointer;
      background: var(--c-accent); color: #fff; font-family: Lexend, sans-serif; font-weight: 800; font-size: .86rem; }
    .teatro-tip-x { border: none; background: transparent; font-size: 1.3rem; line-height: 1;
      cursor: pointer; color: var(--c-text-soft); padding: 4px 8px; min-width: 34px; min-height: 34px; }

    .teatro-trim-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
      margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--c-border); }
    .teatro-trim-btns { display: flex; gap: 6px; }
    .teatro-trim-btn { padding: 7px 14px; border-radius: 999px; border: 2px solid var(--c-border);
      background: var(--c-surface); font-family: Lexend, sans-serif; font-weight: 700;
      font-size: .84rem; cursor: pointer; color: var(--c-text); }
    .teatro-trim-btn.on { background: var(--c-accent-ink); border-color: var(--c-accent-ink); color: #fff; }

    .teatro-stk-layer { position: absolute; inset: 0; z-index: 4; }
    /* Sized in px by the script from the stage's real height — a percentage
       here resolves against the inherited FONT size, which made the handle
       11 px wide while the sticker drew at 70. */
    .teatro-stk-handle { position: absolute; transform: translate(-50%, -50%);
      cursor: grab; touch-action: none; border-radius: 14px; }
    .teatro-stk-handle.dragging { cursor: grabbing; }
    .teatro-stk-handle::before { content: ''; position: absolute; inset: -4px;
      border: 2px dashed rgba(255,255,255,.7); border-radius: 14px; opacity: 0;
      transition: opacity .12s; pointer-events: none; }
    .teatro-stk-handle:hover::before,
    .teatro-stk-handle:focus-within::before,
    .teatro-stk-handle.dragging::before { opacity: 1; }
    .teatro-stk-tools { position: absolute; top: -40px; left: 50%; transform: translateX(-50%);
      display: none; gap: 5px; background: rgba(0,0,0,.76); padding: 5px; border-radius: 12px; }
    .teatro-stk-handle:hover .teatro-stk-tools,
    .teatro-stk-handle:focus-within .teatro-stk-tools { display: flex; }
    .teatro-stk-tools button { width: 32px; height: 32px; border: none; border-radius: 8px;
      background: rgba(255,255,255,.2); color: #fff; font-size: 1.05rem; font-weight: 800;
      cursor: pointer; line-height: 1; }
    .teatro-stk-tools button:hover { background: rgba(255,255,255,.36); }
    /* No hover on a touch screen, so the controls stay out. */
    @media (hover: none) {
      .teatro-stk-tools { display: flex; }
      .teatro-stk-handle::before { opacity: 1; }
    }

    .teatro-wrap.teatro-theater .teatro-frame-ctrls,
    .teatro-wrap.teatro-theater .teatro-toolbar { max-width: 760px; margin-left: auto; margin-right: auto; }
    /* Theater toggle — YouTube-style, bottom-right corner of the video. */
    .teatro-theater-btn { position: absolute; bottom: 10px; right: 10px; z-index: 5; width: 38px; height: 38px; border: none; border-radius: 9px; background: rgba(0,0,0,.55); color: #fff; font-size: 1.1rem; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; transition: background .15s; }
    .teatro-theater-btn:hover { background: rgba(0,0,0,.78); }
    .teatro-theater-btn.on { background: var(--c-accent2, #2B3D85); box-shadow: 0 0 0 2px rgba(255,255,255,.55); }
    .teatro-theater-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
    /* During playback review the native video controls own the corner, so
       get the theater toggle out of the way. */
    .teatro-stage-box:has(video.teatro-playback) .teatro-theater-btn { display: none; }
    .teatro-stage-box canvas, .teatro-stage-box video.teatro-playback { width: 100%; height: 100%; display: block; object-fit: cover; background: #000; }
    .teatro-status { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 12px; align-items: center; justify-content: center; color: #fff; background: #0f172a; text-align: center; padding: 20px; font-size: .95rem; z-index: 2; }
    .teatro-rec-badge { position: absolute; top: 10px; left: 10px; z-index: 3; background: rgba(0,0,0,.6); color: #fff; font-weight: 800; font-size: .82rem; padding: 6px 12px; border-radius: 999px; font-variant-numeric: tabular-nums; }
    .teatro-rec-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #ef4444; margin-right: 7px; animation: teatroBlink 1s infinite; }
    .teatro-countdown { position: absolute; inset: 0; z-index: 4; display: flex; align-items: center; justify-content: center; font-size: 6.5rem; font-weight: 800; color: #fff; background: rgba(15,23,42,.35); text-shadow: 0 4px 24px rgba(0,0,0,.55); }
    @keyframes teatroBlink { 0%,100%{opacity:1} 50%{opacity:.2} }
    /* Record controls sit directly under the video with a tight gap. */
    .teatro-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; margin-top: 10px; }
    /* Framing controls — only rendered while the camera is live. Compact
       so the video + framing + record buttons share one screen. */
    .teatro-frame-ctrls {
      margin-top: 10px; padding: 9px 12px;
      border: 1px solid var(--c-border, rgba(148,163,184,.35));
      border-radius: 12px; background: var(--c-card, rgba(255,255,255,.55));
    }
    .teatro-frame-head {
      display: flex; align-items: center; justify-content: space-between;
      gap: 10px; font-weight: 800; font-size: .9rem; margin-bottom: 4px;
    }
    /* The three sliders sit side by side when there's room and wrap to
       fewer columns (never overflowing) when narrow — auto-fit + minmax
       does this without brittle breakpoints. */
    .teatro-frame-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 6px 16px; }
    .teatro-frame-row {
      display: flex; align-items: center; gap: 8px; margin: 0;
      font-size: .85rem; min-width: 0;
    }
    /* Inside the grid the column owns the width, so the label sizes to its
       text and the slider takes the rest — keeps every column from over-
       flowing its track. */
    .teatro-frame-grid .teatro-frame-lbl { flex: 0 1 auto; font-size: .78rem; }
    .teatro-frame-lbl {
      flex: 0 0 116px; color: var(--c-text-soft); font-weight: 700; white-space: nowrap;
    }
    .teatro-frame-row input[type=range] {
      flex: 1 1 40px; min-width: 40px; accent-color: var(--c-accent2, #2B3D85);
      height: 26px; cursor: pointer;
    }
    .teatro-frame-hint {
      margin-top: 6px; font-size: .76rem; color: var(--c-text-soft); line-height: 1.35;
    }
    @media (max-width: 560px) {
      /* Give the record buttons room to breathe / be easy to tap. */
      .teatro-toolbar .btn { flex: 1 1 auto; }
      /* Reclaim vertical space so the video + Grabar fit on a phone: a
         smaller title and no long subtitle (the UI is self-explanatory). */
      .teatro-wrap .cs-library-title { font-size: 1.25rem; line-height: 1.15; }
      .teatro-wrap .cs-library-sub { display: none; }
      .teatro-wrap .cs-library-header { margin-bottom: 6px; }
      .teatro-frame-ctrls { padding: 8px 10px; }
    }
    /* Short viewports (landscape phones, small laptops): trim Teatro's own
       header hard so the video sits as high as the app chrome allows. */
    @media (max-height: 520px) {
      .teatro-wrap .cs-library-title { font-size: 1.1rem; line-height: 1.1; }
      .teatro-wrap .cs-library-sub { display: none; }
      .teatro-wrap .cs-library-header { margin-bottom: 4px; }
    }
    .teatro-bg-strip { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; padding: 10px 2px 2px; }
    .teatro-bg-thumb { flex: 0 0 auto; width: 106px; border: 2px solid var(--c-border, rgba(148,163,184,.35)); border-radius: 12px; overflow: hidden; cursor: pointer; background: none; padding: 0; position: relative; }
    .teatro-bg-thumb img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; }
    .teatro-bg-thumb .teatro-bg-name { display: block; font-size: .68rem; font-weight: 700; padding: 4px 2px 5px; text-align: center; color: var(--c-text-soft); }
    .teatro-bg-thumb.active { border-color: #7c3aed; box-shadow: 0 0 0 2px rgba(124,58,237,.25); }
    .teatro-bg-thumb.active .teatro-bg-name { color: #7c3aed; }

    /* ── Illustrated icon upgrade ──────────────────────────────────────────
       Each illustrated SVG includes its own full soft background wash, so we
       clear the CSS per-card backgrounds and enlarge the containers. */
    .game-mode-icon {
      width: 120px !important;
      height: 120px !important;
      border-radius: 0 !important;
      background: none !important;
      margin-bottom: 10px !important;
    }
    .game-mode-icon svg { width: 120px !important; height: 120px !important; }

    .quiz-type-icon {
      width: 100px !important;
      height: 100px !important;
      border-radius: 0 !important;
      background: none !important;
    }
    .quiz-type-icon svg { width: 100px !important; height: 100px !important; }
    .quiz-type-card-print .quiz-type-icon {
      background: none !important;
      border-radius: 0 !important;
    }

    /* ══════════════════════════════════════════════════════
       SOPA DE LETRAS — complete layout & component styles
    ══════════════════════════════════════════════════════ */
    #word-search-screen {
      display: flex; flex-direction: column;
    }
    .ws-wrap {
      max-width: 680px; margin: 0 auto; padding: 8px 14px 10px;
      display: flex; flex-direction: column; align-items: center; gap: 8px;
      width: 100%; box-sizing: border-box;
    }

    /* ── Setup screen ── */
    .ws-setup-wrap {
      max-width: 500px; margin: 0 auto; padding: 16px 14px 14px;
      display: flex; flex-direction: column; align-items: center; gap: 16px;
      width: 100%; box-sizing: border-box;
    }
    .ws-setup-title { font-size: 1.5rem; font-weight: 700; text-align: center; }
    .ws-setup-sub   { font-size: .85rem; color: var(--c-text-soft); text-align: center; }
    /* Mode toggle */
    .ws-mode-row {
      display: flex; gap: 10px; width: 100%;
    }
    .ws-mode-btn {
      flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
      padding: 14px 10px; border-radius: 16px; cursor: pointer;
      border: 2px solid var(--c-border); background: var(--c-card);
      transition: border-color .15s, background .15s;
    }
    .ws-mode-btn.active {
      border-color: #16a34a; background: rgba(22,163,74,.1);
    }
    .ws-mode-btn-icon  { font-size: 1.6rem; display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
    .ws-mode-btn-icon svg { width: 1.5em; height: 1.5em; display: block; color: currentColor; }
    .ws-mode-btn-title { font-size: .95rem; font-weight: 700; }
    .ws-mode-btn-sub   { font-size: .75rem; color: var(--c-text-soft); }
    /* Small inline icons inside buttons / section labels — sized in em so
       they scale with the surrounding text. */
    .ws-btn-icon, .print-btn-icon, .lib-section-icon {
      display: inline-flex; align-items: center; justify-content: center;
      vertical-align: -0.18em; margin-right: 6px;
    }
    .ws-btn-icon svg, .print-btn-icon svg { width: 1em; height: 1em; }
    .lib-section-icon svg { width: 1.05em; height: 1.05em; }
    /* Difficulty row */
    .ws-diff-row {
      display: flex; gap: 8px; width: 100%;
    }
    .ws-diff-btn {
      flex: 1; padding: 10px 6px; border-radius: 12px; cursor: pointer;
      border: 2px solid var(--c-border); background: var(--c-card);
      font-size: .85rem; font-weight: 700; text-align: center;
      transition: border-color .15s, background .15s;
    }
    .ws-diff-btn .ws-diff-sub { font-size: .7rem; font-weight: 400; color: var(--c-text-soft); display: block; }
    .ws-diff-btn.active { border-color: #2563eb; background: rgba(37,99,235,.1); }
    .ws-diff-btn.active .ws-diff-sub { color: #2563eb; }
    /* Setup fields */
    .ws-field-label { font-size: .8rem; font-weight: 700; color: var(--c-text-soft); align-self: flex-start; }
    .ws-name-input {
      width: 100%; box-sizing: border-box;
      padding: 9px 14px; border-radius: 12px;
      border: 2px solid var(--c-border); background: var(--c-card);
      color: var(--c-text); font-size: .95rem;
      transition: border-color .15s;
    }
    .ws-name-input:focus { outline: none; border-color: #16a34a; }
    .ws-player-row { display: flex; gap: 8px; align-items: center; width: 100%; }
    .ws-player-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
    .ws-player-count-row {
      display: flex; gap: 6px; margin-bottom: 4px;
    }
    .ws-pcount-btn {
      padding: 5px 14px; border-radius: 20px; border: 2px solid var(--c-border);
      background: var(--c-card); font-size: .85rem; font-weight: 700; cursor: pointer;
    }
    .ws-pcount-btn.active { border-color: #16a34a; background: rgba(22,163,74,.12); color: #16a34a; }
    .ws-tense-sel {
      width: 100%; padding: 9px 14px; border-radius: 12px;
      border: 2px solid var(--c-border); background: var(--c-card);
      color: var(--c-text); font-size: .95rem; cursor: pointer;
    }
    .ws-start-btn {
      width: 100%; padding: 12px; border-radius: 50px; border: none;
      background: #16a34a; color: #fff; font-size: 1.05rem; font-weight: 700;
      cursor: pointer; transition: transform .15s, box-shadow .15s;
    }
    .ws-start-btn:hover { transform: translateY(-2px); box-shadow: 0 5px 18px rgba(22,163,74,.4); }

    /* ── Topbar (in-game) ── */
    .ws-topbar {
      display: flex; align-items: center; justify-content: space-between;
      width: 100%; gap: 8px; flex-shrink: 0;
    }
    .ws-title    { font-size: 1.05rem; font-weight: 700; }
    .ws-subtitle { font-size: .78rem; color: var(--c-text-soft); }
    .ws-progress {
      font-size: .8rem; color: var(--c-text-soft); font-weight: 700;
      white-space: nowrap; background: var(--c-card);
      border: 2px solid var(--c-border); border-radius: 20px; padding: 3px 10px;
    }
    /* Sopa de letras + timer chip — sits next to the progress chip
       and turns red + pulses in the final 10 seconds. */
    .ws-plus-timer {
      font-family: var(--font-display);font-weight: var(--font-display-weight);
      font-size: 1.05rem; line-height: 1; color: #dc2626;
      background: rgba(239,68,68,.1); border: 2px solid rgba(239,68,68,.4);
      border-radius: 20px; padding: 4px 12px; white-space: nowrap;
      transition: background .2s, border-color .2s;
    }
    .ws-plus-timer.ws-plus-timer-danger {
      background: rgba(239,68,68,.18); border-color: #dc2626;
      animation: ws-plus-pulse 0.9s ease-in-out infinite;
    }
    @keyframes ws-plus-pulse {
      0%, 100% { transform: scale(1);     box-shadow: 0 0 0 0 rgba(239,68,68,0); }
      50%      { transform: scale(1.08);  box-shadow: 0 0 0 6px rgba(239,68,68,.18); }
    }
    /* Timeout celebration card — same shape as the win card but warm
       so the player feels the "almost!" sting. */
    .ws-celebrate.ws-celebrate-timeout {
      background: linear-gradient(145deg, #fef3f2, #fff);
      border: 2px solid rgba(239,68,68,.3);
    }

    /* ── Player tokens (Duelo mode) ── */
    .ws-players-bar {
      display: flex; gap: 8px; width: 100%; flex-wrap: wrap;
    }
    .ws-player-token {
      display: flex; align-items: center; gap: 6px;
      padding: 6px 12px; border-radius: 20px; cursor: pointer;
      border: 2px solid transparent; font-size: .88rem; font-weight: 700;
      transition: border-color .15s, transform .1s;
      background: var(--c-card);
    }
    .ws-player-token.ws-active-player {
      border-color: currentColor; transform: translateY(-2px);
      box-shadow: 0 3px 10px rgba(0,0,0,.12);
    }
    .ws-player-token .ws-tok-dot {
      width: 10px; height: 10px; border-radius: 50%;
    }
    .ws-player-token .ws-tok-score {
      font-size: .75rem; opacity: .7; font-weight: 600;
    }

    /* ── Play area ── */
    .ws-body {
      display: flex; flex-direction: row; gap: 12px;
      width: 100%; align-items: flex-start;
    }
    @media (max-width: 519px) { .ws-body { flex-direction: column; } }
    .ws-grid-wrap {
      flex-shrink: 0; user-select: none; -webkit-user-select: none;
      touch-action: none;
      /* --gs set inline by JS; cell size fits viewport */
      --cs: clamp(24px, calc((min(680px, 100vw) - 240px) / var(--gs, 11)), 40px);
    }
    @media (max-width: 519px) {
      .ws-grid-wrap { --cs: clamp(24px, calc((min(680px, 100vw) - 28px) / var(--gs, 11)), 40px); }
    }
    .ws-grid {
      display: grid;
      border: 2px solid var(--c-border); border-radius: 10px; overflow: hidden;
      background: var(--c-card); box-shadow: 0 3px 12px rgba(0,0,0,.07);
    }
    .ws-cell {
      width: var(--cs); height: var(--cs); font-size: calc(var(--cs) * .44);
      display: flex; align-items: center; justify-content: center;
      font-weight: 800; text-transform: uppercase; cursor: default;
      border: 1px solid rgba(0,0,0,.04);
      transition: background .1s, color .1s;
      font-family: var(--font-body);   /* Lexend; cells are fixed-size, so letters stay aligned */
    }
    .ws-cell.selecting { background: rgba(43,61,133,.28); color: var(--c-accent2); }
    /* Solo word colours (rainbow per word) */
    .ws-cell.wf-0  { background: rgba(34,197,94,.32);   color: #14532d; }
    .ws-cell.wf-1  { background: rgba(234,88,12,.28);   color: #7c2d12; }
    .ws-cell.wf-2  { background: rgba(59,130,246,.28);  color: #1e3a8a; }
    .ws-cell.wf-3  { background: rgba(217,70,239,.26);  color: #701a75; }
    .ws-cell.wf-4  { background: rgba(245,158,11,.3);   color: #78350f; }
    .ws-cell.wf-5  { background: rgba(20,184,166,.3);   color: #134e4a; }
    .ws-cell.wf-6  { background: rgba(236,72,153,.26);  color: #831843; }
    .ws-cell.wf-7  { background: rgba(99,102,241,.3);   color: #312e81; }
    .ws-cell.wf-8  { background: rgba(168,85,247,.26);  color: #581c87; }
    .ws-cell.wf-9  { background: rgba(16,185,129,.28);  color: #064e3b; }
    /* Duelo player colours */
    .ws-cell.wp-0  { background: rgba(59,130,246,.32);  color: #1d4ed8; }
    .ws-cell.wp-1  { background: rgba(239,68,68,.30);   color: #b91c1c; }
    .ws-cell.wp-2  { background: rgba(245,158,11,.34);  color: #92400e; }
    .ws-cell.wp-3  { background: rgba(139,92,246,.30);  color: #5b21b6; }
    /* pop animation on find */
    @keyframes ws-pop {
      0%   { transform: scale(1); }
      40%  { transform: scale(1.18); }
      70%  { transform: scale(.94); }
      100% { transform: scale(1); }
    }
    .ws-cell.ws-popping { animation: ws-pop .35s ease both; }

    /* ── Word chips ── */
    .ws-word-panel {
      flex: 0 0 auto; width: 185px; display: flex; flex-direction: column; gap: 5px;
    }
    @media (max-width: 519px) {
      .ws-word-panel { flex-direction: row; flex-wrap: wrap; width: 100%; gap: 6px; }
    }
    .ws-word-panel-label {
      font-size: .7rem; font-weight: 700; text-transform: uppercase;
      letter-spacing: .06em; color: var(--c-text-soft); width: 100%;
    }
    .ws-chip {
      display: inline-flex; align-items: center; gap: 6px;
      background: var(--c-card); border: 2px solid var(--c-border);
      border-radius: 20px; padding: 5px 12px;
      font-size: .9rem; font-weight: 700;
      transition: opacity .25s, border-color .25s; white-space: nowrap;
    }
    @keyframes ws-chip-found {
      0%   { transform: scale(1); }
      50%  { transform: scale(1.08); }
      100% { transform: scale(1); }
    }
    .ws-chip.ws-found { opacity: .38; }
    .ws-chip.ws-found .ws-chip-text { text-decoration: line-through; }
    .ws-chip .ws-dot {
      width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
      background: var(--c-text-soft); transition: background .2s;
    }
    .ws-found-color { background: var(--wc, var(--c-text-soft)) !important; }

    /* ── Footer ── */
    .ws-footer {
      display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; width: 100%;
    }
    .ws-btn {
      padding: 8px 20px; border-radius: 50px; border: 2px solid var(--c-border);
      background: var(--c-card); color: var(--c-text);
      font-size: .88rem; font-weight: 600; cursor: pointer;
      transition: border-color .15s, background .15s;
    }
    .ws-btn:hover { border-color: #16a34a; background: rgba(22,163,74,.08); }
    .ws-btn.ws-btn-primary { background: #16a34a; color: #fff; border-color: #16a34a; }
    .ws-btn.ws-btn-primary:hover { background: #15803d; }

    /* ── Celebration / end screen ── */
    .ws-celebrate {
      width: 100%; text-align: center;
      padding: 12px 0 4px;
    }
    .ws-celebrate-emoji { font-size: 2.8rem; display: block; }
    .ws-celebrate-title { font-size: 1.4rem; font-weight: 700; margin: 6px 0 4px; }
    .ws-celebrate-sub   { font-size: .9rem; color: var(--c-text-soft); margin-bottom: 10px; }
    .ws-leaderboard { width: 100%; max-width: 340px; margin: 0 auto; }
    .ws-lb-row {
      display: flex; align-items: center; gap: 10px;
      padding: 8px 12px; border-radius: 10px; margin-bottom: 6px;
      background: var(--c-card); border: 2px solid var(--c-border);
      font-size: .95rem; font-weight: 700;
    }
    .ws-lb-rank { font-size: 1.1rem; width: 24px; }
    .ws-lb-dot  { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
    .ws-lb-score { margin-left: auto; color: var(--c-text-soft); font-weight: 600; font-size: .85rem; }
    .ws-lb-row.ws-winner { border-color: #f59e0b; background: rgba(245,158,11,.1); }

    /* ── Online mode styles ── */
    .ws-mode-row { flex-wrap: wrap; }
    .ws-online-section {
      width: 100%; border: 1px dashed var(--c-border); border-radius: 12px;
      padding: 12px; margin-top: 8px; box-sizing: border-box;
    }
    .ws-online-section-label {
      font-size: .75rem; font-weight: 700; color: var(--c-text-soft);
      text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px;
    }
    .ws-code-display {
      font-size: 2.6rem; letter-spacing: .4em; font-weight: 900;
      color: var(--c-primary); background: var(--c-card);
      border-radius: 16px; padding: 16px 24px; text-align: center;
      width: 100%; box-sizing: border-box; cursor: pointer; user-select: all;
    }
    .ws-join-url-row {
      display: flex; align-items: center; gap: 8px; width: 100%;
    }
    .ws-join-url-text {
      flex: 1; font-size: .78rem; color: var(--c-text-soft);
      overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
      background: var(--c-surface2); border-radius: 8px; padding: 6px 10px;
    }
    .ws-copy-btn {
      flex-shrink: 0; padding: 6px 12px; border-radius: 8px;
      border: 1.5px solid var(--c-border); background: var(--c-card);
      font-size: .8rem; font-weight: 700; cursor: pointer; color: var(--c-text);
    }
    .ws-copy-btn:hover { border-color: var(--c-primary); }
    .ws-lobby-players {
      display: flex; flex-wrap: wrap; gap: 8px; width: 100%;
      min-height: 32px;
    }
    .ws-lobby-player-chip {
      display: flex; align-items: center; gap: 6px;
      padding: 5px 10px; border-radius: 99px;
      border: 1.5px solid var(--c-border); background: var(--c-surface);
      font-size: .82rem; font-weight: 600;
    }
    .ws-lobby-chip-dot {
      width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
    }
    .ws-waiting-msg {
      font-style: italic; text-align: center;
      color: var(--c-text-soft); font-size: .9rem; padding: 8px 0;
    }
    /* Same job as .live-wait-banner (css/live.css) on the quiz side, on
       a light surface: make the wait the loudest thing on the screen,
       and keep it obviously not-a-button so nobody taps it. The dots and
       the wait-breathe keyframes come from live.css, which always loads
       alongside this file. */
    .ws-wait-banner {
      width: 100%; padding: 16px 16px 14px; border-radius: 16px;
      text-align: center; cursor: default; color: var(--c-text);
      background: linear-gradient(135deg, rgba(118,175,119,.14) 0%, rgba(43,61,133,.16) 100%);
      border: 2px dashed rgba(43,61,133,.38);
      animation: wait-breathe 2.6s ease-in-out infinite;
    }
    .ws-wait-title {
      font-family: var(--font-display); font-weight: var(--font-display-weight);
      font-size: 1.25rem; line-height: 1.15;
      display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
    }
    .ws-wait-title .live-waiting-dots { margin: 0; gap: 6px; }
    .ws-wait-title .live-waiting-dots span { width: 8px; height: 8px; background: var(--c-primary); }
    .ws-wait-sub  { font-size: .95rem; font-weight: 800; margin-top: 6px; }
    .ws-wait-hint { font-size: .8rem; font-weight: 600; color: var(--c-text-soft); margin-top: 8px; }
    @media (prefers-reduced-motion: reduce) { .ws-wait-banner { animation: none; } }
    .ws-online-start-btn {
      width: 100%; padding: 14px; border-radius: 14px;
      background: #16a34a; color: #fff; border: none;
      font-size: 1rem; font-weight: 700; cursor: pointer;
      transition: background .15s, transform .15s;
    }
    .ws-online-start-btn:hover:not(:disabled) { background: #15803d; transform: translateY(-2px); }
    .ws-online-start-btn:disabled { opacity: .5; cursor: not-allowed; }
    .ws-divider-label {
      text-align: center; font-size: .78rem; color: var(--c-text-soft);
      padding: 6px 0; width: 100%;
    }
    /* confetti particles */
    .ws-confetti-wrap {
      position: fixed; top: 0; left: 0; width: 100%; height: 100%;
      pointer-events: none; overflow: hidden; z-index: 999;
    }
    .ws-confetti-piece {
      position: absolute; top: -20px;
      width: 10px; height: 14px; border-radius: 3px;
      animation: ws-fall linear forwards;
    }
    @keyframes ws-fall {
      0%   { transform: translateY(0) rotate(0deg);    opacity: 1; }
      80%  { opacity: 1; }
      100% { transform: translateY(110vh) rotate(900deg); opacity: 0; }
    }

    /* The hero — distinct from the activity tiles below. Bigger, brighter,
       with a "JUEGO EN VIVO" badge so it's clearly THE game in the section. */
    .game-mode-card.mode-live {
      background: linear-gradient(135deg, #1F2850 0%, #223068 55%, #5B49C9 100%);
      border: none;
      box-shadow: 0 12px 36px rgba(43,61,133,.32);
      display: flex; flex-direction: row; align-items: center;
      gap: 22px; text-align: left;
      padding: 26px 30px;
      position: relative;
      overflow: hidden;
      cursor: pointer;
      font: inherit;
      width: 100%;
    }
    .game-mode-card.mode-live::after {
      content: '';
      position: absolute;
      right: -80px;
      top: -80px;
      width: 240px;
      height: 240px;
      background: radial-gradient(circle, rgba(222,130,106,.45), transparent 60%);
      pointer-events: none;
    }
    .game-mode-card.mode-live:hover {
      transform: translateY(-3px);
      box-shadow: 0 18px 48px rgba(43,61,133,.42);
    }
    .game-mode-card.mode-live .game-mode-icon {
      width: 68px; height: 68px;
      background: rgba(255,255,255,.16);
      color: #fff;
      margin: 0;
      flex-shrink: 0;
    }
    .game-mode-card.mode-live .game-mode-icon svg { width: 36px; height: 36px; }
    .game-mode-card.mode-live .mode-live-text { flex: 1; }
    .game-mode-card.mode-live .game-mode-title { color: #fff; font-size: 1.45rem; margin-bottom: 6px; }
    .game-mode-card.mode-live .game-mode-desc  { color: rgba(255,255,255,.78); font-size: .9rem; max-width: 540px; }
    .mode-live-cta {
      align-self: center;
      flex-shrink: 0;
      background: var(--c-secondary, #DE826A);
      color: #1F2850;
      font-weight: 800;
      font-size: .9rem;
      padding: 12px 22px;
      border-radius: 99px;
      box-shadow: 0 6px 18px rgba(222,130,106,.35);
      white-space: nowrap;
      position: relative;
      z-index: 1;
    }
    .game-mode-card.mode-live:hover .mode-live-cta {
      transform: scale(1.04);
      transition: transform .15s ease;
    }

    .game-mode-title {
      font-family: var(--font-display); font-weight: var(--font-display-weight);
      font-size: 1.25rem;
      margin-bottom: 6px;
    }
    .game-mode-desc {
      font-size: 0.86rem;
      color: var(--c-text-soft);
      line-height: 1.5;
    }

    /* ============================================================
       MISSIONS — grid of tiles
    ============================================================ */
    .mission-header {
      display: flex;
      align-items: center;
      gap: 12px;
      margin-bottom: 20px;
    }
    .mission-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
      gap: 16px;
    }
    .mission-tile {
      --mission-color: var(--c-primary);
      --mission-bg:    rgba(58,78,157,.12);
      position: relative;
      background: var(--c-surface);
      border: 2.5px solid var(--c-border);
      border-radius: var(--radius-lg);
      padding: 14px 14px 12px;
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      gap: 4px;
      cursor: pointer;
      text-align: left;
      font: inherit;
      color: inherit;
      transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
      overflow: hidden;
    }
    .mission-tile::before {
      /* subtle accent stripe on the left */
      content: '';
      position: absolute;
      inset: 0 auto 0 0;
      width: 5px;
      background: var(--mission-color);
      opacity: .85;
    }
    .mission-tile:hover {
      transform: translateY(-4px);
      box-shadow: var(--shadow-md);
      border-color: var(--mission-color);
    }
    .mission-tile.locked { opacity: .5; cursor: not-allowed; }
    .mission-tile.locked:hover { transform: none; box-shadow: none; border-color: var(--c-border); }

    .mission-tile-icon {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 56px;
      height: 56px;
      border-radius: 16px;
      background: var(--mission-bg);
      color: var(--mission-color);
      margin-bottom: 10px;
    }
    .mission-tile-icon svg { width: 30px; height: 30px; display: block; }
    .mission-badge-text {
      font-family: var(--font-display); font-weight: var(--font-display-weight);
      font-size: 1.15rem;
      line-height: 1;
      letter-spacing: -.02em;
      white-space: nowrap;
    }
    .mission-tile-title {
      font-family: var(--font-display); font-weight: var(--font-display-weight);
      font-size: 1.05rem;
      line-height: 1.2;
      color: var(--c-text);
    }
    .mission-tile-meta {
      font-size: 0.78rem;
      color: var(--c-text-soft);
      margin-top: 2px;
      line-height: 1.4;
    }
    .mission-tile-xp {
      position: absolute;
      top: 12px;
      right: 12px;
      font-size: 0.68rem;
      font-weight: 800;
      letter-spacing: .04em;
      color: var(--mission-color);
      background: var(--mission-bg);
      padding: 3px 8px;
      border-radius: 99px;
    }
    .mission-tile-lock {
      position: absolute;
      bottom: 14px;
      right: 14px;
      font-size: 1.1rem;
    }

    /* Stars row at the bottom of each tile — best result so far */
    .mission-tile-stars {
      display: inline-flex;
      gap: 3px;
      margin-top: 10px;
      line-height: 1;
    }
    .mission-star {
      font-size: 1rem;
      color: var(--c-border);
      transition: color var(--transition);
    }
    .mission-star.filled { color: #FFC400; }

    /* ── Mission intro card — context + XP / level ─────────────── */
    .mission-intro {
      background: linear-gradient(135deg, #1F2850 0%, #223068 100%);
      color: #fff;
      border-radius: var(--radius-lg);
      padding: 22px 24px 18px;
      margin-bottom: 22px;
      display: grid;
      grid-template-columns: 1fr auto;
      gap: 18px 26px;
      align-items: start;
    }
    .mission-intro-text { grid-column: 1; }
    .mission-intro-title {
      font-family: var(--font-display); font-weight: var(--font-display-weight);
      font-size: 1.25rem;
      margin: 0 0 6px;
    }
    .mission-intro-desc {
      font-size: .88rem;
      line-height: 1.5;
      color: rgba(255,255,255,.78);
      margin: 0;
    }
    .mission-intro-stats {
      grid-column: 2;
      display: flex;
      gap: 18px;
      align-items: stretch;
    }
    .mission-stat {
      background: rgba(255,255,255,.08);
      border-radius: var(--radius-md);
      padding: 10px 16px;
      text-align: center;
      min-width: 72px;
    }
    .mission-stat-label {
      font-size: .68rem;
      font-weight: 800;
      letter-spacing: .08em;
      text-transform: uppercase;
      color: rgba(255,255,255,.6);
    }
    .mission-stat-value {
      font-family: var(--font-display); font-weight: var(--font-display-weight);
      font-size: 1.45rem;
      color: var(--c-secondary);
      line-height: 1.1;
      margin-top: 2px;
    }
    .mission-intro-bar {
      grid-column: 1 / -1;
      height: 6px;
      background: rgba(255,255,255,.12);
      border-radius: 99px;
      overflow: hidden;
    }
    .mission-intro-bar-fill {
      height: 100%;
      background: linear-gradient(90deg, var(--c-secondary), #FF9D5C);
      transition: width .4s ease;
    }

    /* ── Mission setup screen ─────────────────────────────────── */
    .mission-setup-card {
      --mission-color: var(--c-primary);
      --mission-bg:    rgba(58,78,157,.12);
      border-top: 4px solid var(--mission-color);
    }
    .mission-setup-head {
      display: flex;
      align-items: center;
      gap: 14px;
      margin-bottom: 18px;
    }
    .mission-setup-icon {
      width: 56px; height: 56px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border-radius: 16px;
      background: var(--mission-bg);
      color: var(--mission-color);
      flex-shrink: 0;
    }
    .mission-setup-icon svg { width: 30px; height: 30px; display: block; }
    .mission-setup-meta { flex: 1; min-width: 0; }
    .mission-setup-subtitle {
      font-weight: 700;
      color: var(--c-text);
      line-height: 1.3;
    }
    .mission-setup-pool {
      font-size: .8rem;
      color: var(--c-text-soft);
      margin-top: 2px;
    }
    .setup-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
      gap: 14px;
      margin-bottom: 8px;
    }
    .setup-group label {
      display: block;
      font-weight: 700;
      font-size: .82rem;
      color: var(--c-text-soft);
      margin-bottom: 6px;
      text-transform: uppercase;
      letter-spacing: .04em;
    }
    .setup-group select {
      width: 100%;
      padding: 10px 12px;
      border-radius: var(--radius-md);
      border: 2px solid var(--c-border);
      font-size: .9rem;
      font-weight: 600;
      background: var(--c-bg);
      color: var(--c-text);
      outline: none;
    }
    .setup-group select:focus { border-color: var(--mission-color); }
    .setup-locked {
      padding: 10px 12px;
      border-radius: var(--radius-md);
      background: var(--mission-bg);
      color: var(--mission-color);
      font-weight: 700;
      font-size: .9rem;
    }

    /* ── Results: mission stars + earned XP ───────────────────── */
    .results-stars {
      display: flex;
      justify-content: center;
      gap: 10px;
      margin: 8px 0 4px;
      font-size: 2.4rem;
      line-height: 1;
    }
    .results-stars .mission-star { font-size: inherit; }
    .results-mission-xp {
      text-align: center;
      font-family: var(--font-display); font-weight: var(--font-display-weight);
      font-size: 1.4rem;
      color: var(--c-accent2);
      margin-bottom: 12px;
    }

    @media (max-width: 600px) {
      .mission-intro { grid-template-columns: 1fr; }
      .mission-intro-stats { grid-column: 1; }
    }
    @media (max-width: 520px) {
      .game-mode-cards { grid-template-columns: 1fr; }
      .mission-grid    { grid-template-columns: 1fr; }
    }

    /* Free practice setup */
    .free-setup-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
      gap: 14px;
      margin-bottom: 20px;
    }
    .free-setup-group label {
      display: block;
      font-weight: 700;
      font-size: 0.85rem;
      color: var(--c-text-soft);
      margin-bottom: 6px;
      text-transform: uppercase;
      letter-spacing: .04em;
    }
    .free-setup-group select {
      width: 100%;
      padding: 10px 12px;
      border-radius: var(--radius-md);
      border: 2px solid var(--c-border);
      font-size: 0.9rem;
      font-weight: 600;
      background: var(--c-bg);
      color: var(--c-text);
      outline: none;
    }
    .free-setup-group select:focus { border-color: var(--c-accent); }

    /* Active game play screen */
    .game-hud {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 12px;
      flex-wrap: wrap;
      gap: 6px;
    }
    .game-hud-left, .game-hud-right {
      display: flex;
      align-items: center;
      gap: 12px;
    }
    .game-progress-text {
      font-weight: 700;
      font-size: 0.88rem;
      color: var(--c-text-soft);
    }
    .game-timer {
      font-family: var(--font-display); font-weight: var(--font-display-weight);
      font-size: 1.3rem;
      color: var(--c-primary);
      min-width: 40px;
      text-align: center;
    }
    .game-timer.urgent { color: var(--c-primary); animation: pulse .6s ease infinite; }

    /* Contrarreloj clock in the HUD */
    .game-timed-clock {
      display: inline-flex;
      align-items: baseline;
      gap: 6px;
      font-family: var(--font-display); font-weight: var(--font-display-weight);
      color: #A8472E;
    }
    .game-timed-timer { font-size: 1.5rem; line-height: 1; min-width: 2ch; text-align: right; }
    .game-timed-clock-label {
      font-size: .68rem;
      font-weight: 800;
      letter-spacing: .08em;
      text-transform: uppercase;
      color: var(--c-text-soft);
    }

    .game-question-card {
      background: var(--c-surface);
      border-radius: var(--radius-xl);
      border: 2px solid var(--c-border);
      padding: 18px 20px;
      text-align: center;
      margin-bottom: 12px;
      box-shadow: var(--shadow-md);
    }
    .game-q-label {
      font-size: 0.75rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: .07em;
      color: var(--c-text-soft);
      margin-bottom: 6px;
    }
    .game-q-verb {
      font-family: var(--font-display); font-weight: var(--font-display-weight);
      font-size: 1.75rem;
      color: var(--c-primary);
      margin-bottom: 4px;
    }
    .game-q-pronoun {
      font-family: var(--font-display); font-weight: var(--font-display-weight);
      font-size: 1.25rem;
      color: var(--c-accent2);
      margin: 2px 0 1px;
      line-height: 1.1;
    }
    .game-q-context {
      font-size: 1rem;
      font-weight: 700;
      color: var(--c-text-soft);
    }
    .game-sentence-card {
      text-align: left;
    }
    .game-sentence-prompt {
      font-size: 0.78rem;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: .07em;
      color: var(--c-accent2);
      margin-bottom: 12px;
    }
    .game-sentence-text {
      font-size: 1.2rem;
      font-weight: 600;
      color: var(--c-text);
      line-height: 1.5;
      margin-bottom: 8px;
    }
    .game-sentence-blank {
      display: inline-block;
      background: rgba(43,61,133,.12);
      color: var(--c-accent2);
      border-bottom: 2.5px solid var(--c-accent2);
      border-radius: 4px;
      padding: 0 8px;
      font-weight: 800;
      letter-spacing: .05em;
    }
    .game-sentence-translation {
      font-size: 0.95rem;
      color: var(--c-text-soft);
      font-style: italic;
      margin-bottom: 12px;
    }
    /* Meta row under the sentence — verb, person, tense each get their
       own visual weight so the prompt is unambiguous, not buried. */
    .game-sentence-meta {
      display: flex;
      flex-wrap: wrap;
      align-items: baseline;
      gap: 10px;
      margin-top: 8px;
      padding-top: 8px;
      border-top: 1px solid var(--c-border);
    }
    .game-sentence-meta-verb {
      font-family: var(--font-display); font-weight: var(--font-display-weight);
      font-size: 1.3rem;
      color: var(--c-primary);
      line-height: 1;
    }
    .game-sentence-meta-pron {
      font-family: var(--font-display); font-weight: var(--font-display-weight);
      font-size: 1.05rem;
      color: var(--c-accent2);
      line-height: 1;
    }
    .game-sentence-meta-tense {
      font-size: 0.88rem;
      font-weight: 700;
      color: var(--c-text-soft);
      line-height: 1;
    }
    .game-q-english {
      font-size: 0.85rem;
      color: var(--c-accent2);
      margin-top: 6px;
      font-style: italic;
    }

    /* Answer input */
    .game-answer-input {
      width: 100%;
      max-width: 340px;
      padding: 14px 18px;
      border-radius: var(--radius-lg);
      border: 2.5px solid var(--c-border);
      font-size: 1.1rem;
      font-weight: 700;
      text-align: center;
      background: var(--c-surface);
      color: var(--c-text);
      outline: none;
      transition: border-color var(--transition), box-shadow var(--transition);
      display: block;
      margin: 0 auto 12px;
    }
    .game-answer-input:focus { border-color: var(--c-accent); box-shadow: 0 0 0 3px rgba(118,175,119,.15); }
    .game-answer-input.correct { border-color: var(--c-accent); background: rgba(118,175,119,.08); }
    .game-answer-input.wrong   { border-color: #ef4444; background: rgba(239,68,68,.08); }

    /* Multiple choice options */
    .mc-options {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
      max-width: 560px;
      margin: 0 auto;
    }
    .mc-option {
      padding: 10px 8px;
      border-radius: var(--radius-md);
      border: 2.5px solid var(--c-border);
      font-weight: 700;
      font-size: 0.9rem;
      background: var(--c-surface);
      color: var(--c-text);
      transition: border-color var(--transition), background var(--transition), transform var(--transition);
      cursor: pointer;
    }
    .mc-option:hover:not(:disabled) {
      border-color: var(--c-accent2);
      background: rgba(43,61,133,.06);
      transform: scale(1.02);
    }
    .mc-option.correct { border-color: var(--c-accent); background: rgba(118,175,119,.12); color: #2F6B38; }
    .mc-option.wrong   { border-color: #ef4444; background: rgba(239,68,68,.10); }
    .mc-option:disabled { cursor: default; }

    /* Feedback row */
    .game-feedback {
      text-align: center;
      min-height: 32px;
      font-weight: 700;
      font-size: 1rem;
      margin: 8px 0;
      transition: opacity .2s;
    }
    .game-feedback.correct-msg { color: var(--c-accent-ink); }
    .game-feedback.wrong-msg   { color: #dc2626; }

    /* Results screen */
    .results-card {
      text-align: center;
      padding: 20px 20px;
    }
    .results-emoji  { font-size: 2.5rem; margin-bottom: 4px; }
    .results-title  { font-family: var(--font-display); font-weight: var(--font-display-weight); font-size: 1.5rem; margin-bottom: 4px; }
    .results-score  { font-size: 0.95rem; color: var(--c-text-soft); margin-bottom: 14px; }
    .results-stats  {
      display: flex;
      justify-content: center;
      gap: 16px;
      flex-wrap: wrap;
      margin-bottom: 16px;
    }
    .results-stat {
      text-align: center;
    }
    .results-stat-val {
      font-family: var(--font-display); font-weight: var(--font-display-weight);
      font-size: 1.4rem;
      color: var(--c-primary);
    }
    .results-stat-label {
      font-size: 0.78rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: .05em;
      color: var(--c-text-soft);
    }
    .results-actions {
      display: flex;
      gap: 10px;
      justify-content: center;
      flex-wrap: wrap;
    }

    /* ============================================================
       VERB OF THE DAY TAB
    ============================================================ */
    .votd-hero {
      background: linear-gradient(135deg, var(--c-primary) 0%, #DE826A 60%, var(--c-secondary) 100%);
      border-radius: var(--radius-xl);
      padding: 32px 28px;
      color: #fff;
      margin-bottom: 20px;
      position: relative;
      overflow: hidden;
    }
    .votd-hero::before {
      content: '';
      position: absolute;
      right: -20px;
      top: -20px;
      width: 140px;
      height: 140px;
      border-radius: 50%;
      background: rgba(255,255,255,.1);
    }
    .votd-hero::after {
      content: '';
      position: absolute;
      right: 40px;
      bottom: -30px;
      width: 90px;
      height: 90px;
      border-radius: 50%;
      background: rgba(255,255,255,.07);
    }
    .votd-day-label {
      font-size: 0.8rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: .1em;
      opacity: .8;
      margin-bottom: 8px;
    }
    .votd-verb {
      font-family: var(--font-display); font-weight: var(--font-display-weight);
      font-size: 3rem;
      line-height: 1;
      margin-bottom: 6px;
    }
    .votd-meaning {
      font-size: 1.1rem;
      opacity: .9;
      margin-bottom: 16px;
    }
    .votd-example {
      background: rgba(255,255,255,.18);
      border-radius: var(--radius-md);
      padding: 10px 14px;
      font-size: 0.9rem;
      font-style: italic;
    }

    .votd-conj-section {
      background: var(--c-surface);
      border-radius: var(--radius-lg);
      border: 2px solid var(--c-border);
      padding: 20px;
      margin-bottom: 16px;
    }
    .votd-conj-title {
      font-family: var(--font-display); font-weight: var(--font-display-weight);
      font-size: 1.1rem;
      margin-bottom: 14px;
      color: var(--c-primary);
    }

    .votd-practice-btn-wrap {
      text-align: center;
    }

    /* Examples block — three sentences in different verb forms,
       replacing the old single example + cultural note card. */
    .votd-examples {
      background: var(--c-surface);
      border-radius: var(--radius-lg);
      border: 2px solid var(--c-border);
      padding: 18px 20px;
      margin-bottom: 16px;
    }
    .votd-examples-title {
      font-family: var(--font-display); font-weight: var(--font-display-weight);
      font-size: 1.05rem;
      color: var(--c-accent2);
      margin-bottom: 12px;
    }
    .votd-example-item {
      padding: 10px 0;
      border-top: 1px solid var(--c-border);
    }
    .votd-example-item:first-of-type { border-top: none; padding-top: 4px; }
    .votd-example-tense {
      display: inline-block;
      font-size: .68rem;
      font-weight: 800;
      letter-spacing: .06em;
      text-transform: uppercase;
      color: var(--c-text-soft);
      background: var(--c-surface2);
      padding: 3px 9px;
      border-radius: 99px;
      margin-bottom: 6px;
    }
    .votd-example-text {
      font-size: 1.05rem;
      line-height: 1.5;
      color: var(--c-text);
    }
    .votd-example-text strong {
      color: var(--c-primary);
      font-weight: 800;
    }
    .votd-example-trans {
      font-size: .88rem;
      color: var(--c-text-soft);
      font-style: italic;
      margin-top: 3px;
    }

    /* ============================================================
       QUIZZES TAB
    ============================================================ */
    .quiz-type-cards {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
      gap: 18px;
      margin-bottom: 24px;
    }
    .lib-section-label {
      font-size: .78rem;
      font-weight: 800;
      letter-spacing: .08em;
      text-transform: uppercase;
      color: var(--c-text-soft);
      margin: 22px 0 10px;
      padding-bottom: 6px;
      border-bottom: 2px solid var(--c-border);
    }
    .lib-section-label:first-child { margin-top: 0; }
    .quiz-type-card {
      --quiz-color: var(--c-primary);
      background: var(--c-surface);
      border: 2.5px solid var(--c-border);
      border-radius: var(--radius-xl);
      padding: 28px 20px 22px;
      text-align: center;
      cursor: pointer;
      transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
      font: inherit;
      color: inherit;
      width: 100%;
      display: flex;
      flex-direction: column;
      align-items: center;
      position: relative;
      overflow: hidden;
    }
    .quiz-type-card::before {
      content: '';
      position: absolute;
      top: 0; left: 0; right: 0;
      height: 4px;
      background: var(--quiz-color);
      opacity: 0;
      transition: opacity var(--transition);
    }
    .quiz-type-card:hover {
      transform: translateY(-5px);
      box-shadow: 0 8px 28px rgba(0,0,0,.13);
      border-color: var(--quiz-color);
    }
    .quiz-type-card:hover::before { opacity: 1; }
    .quiz-type-icon {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 64px;
      height: 64px;
      border-radius: 18px;
      background: color-mix(in srgb, var(--quiz-color) 14%, transparent);
      color: var(--quiz-color);
      margin-bottom: 14px;
    }
    .quiz-type-icon svg { width: 32px; height: 32px; display: block; }
    .quiz-type-title { font-family: var(--font-display); font-weight: var(--font-display-weight); font-size: 1.08rem; margin-bottom: 6px; }
    .quiz-type-desc  { font-size: 0.82rem; color: var(--c-text-soft); line-height: 1.5; flex: 1; }
    .quiz-type-cta {
      display: inline-block;
      margin-top: 14px;
      font-size: .74rem;
      font-weight: 800;
      letter-spacing: .05em;
      text-transform: uppercase;
      color: var(--quiz-color);
      background: color-mix(in srgb, var(--quiz-color) 12%, transparent);
      padding: 7px 16px;
      border-radius: 99px;
    }

    /* PDF / Print card — visually distinct as the secondary action */
    .quiz-type-card-print {
      background: var(--c-surface2);
      border-style: dashed;
      border-color: var(--c-border);
    }
    .quiz-type-card-print .quiz-type-icon {
      background: rgba(0,0,0,.05);
      border-radius: 50%;
    }

    /* Quiz play */
    .quiz-hud {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 16px;
      flex-wrap: wrap;
      gap: 8px;
    }
    .quiz-q-card {
      background: var(--c-surface);
      border-radius: var(--radius-xl);
      border: 2px solid var(--c-border);
      padding: 26px 22px;
      margin-bottom: 18px;
      box-shadow: var(--shadow-md);
    }
    .quiz-q-number {
      font-size: 0.78rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: .06em;
      color: var(--c-text-soft);
      margin-bottom: 8px;
    }
    .quiz-q-text {
      font-size: 1.1rem;
      font-weight: 700;
      margin-bottom: 6px;
    }
    .quiz-q-sub {
      font-size: 0.85rem;
      color: var(--c-text-soft);
    }

    /* Matching quiz layout */
    .matching-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 12px 18px;
    }
    #match-left, #match-right {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }
    .match-item {
      padding: 14px 14px;
      border-radius: var(--radius-md);
      border: 2.5px solid var(--c-border);
      font-weight: 700;
      cursor: pointer;
      text-align: center;
      transition: border-color var(--transition), background var(--transition);
      font-size: 0.95rem;
      background: var(--c-surface);
    }
    .match-item.selected  { border-color: var(--c-accent2); background: rgba(43,61,133,.1); }
    .match-item.matched   { border-color: var(--c-accent);  background: rgba(118,175,119,.12); pointer-events: none; }
    .match-item.wrong-match { border-color: #ef4444; background: rgba(239,68,68,.1); }

    /* Matching round header — verb being practised this round */
    .match-verb-card {
      text-align: center;
      padding: 18px 20px;
      margin-bottom: 16px;
    }
    .match-verb-inf {
      font-family: var(--font-display); font-weight: var(--font-display-weight);
      font-size: 2rem;
      color: var(--c-primary);
      line-height: 1.1;
    }
    .match-verb-meta {
      font-size: .9rem;
      font-weight: 700;
      color: var(--c-text-soft);
      margin-top: 4px;
    }

    /* Quiz results */
    .quiz-results-card {
      text-align: center;
      padding: 32px 24px;
    }
    .quiz-grade {
      font-family: var(--font-display); font-weight: var(--font-display-weight);
      font-size: 4.5rem;
      color: var(--c-primary);
      line-height: 1;
      margin-bottom: 4px;
    }
    .quiz-grade-label { font-size: 0.9rem; color: var(--c-text-soft); margin-bottom: 20px; }
    .quiz-missed-list { text-align: left; margin-top: 20px; }
    .quiz-missed-item {
      padding: 8px 12px;
      border-radius: var(--radius-sm);
      background: rgba(58,78,157,.06);
      border-left: 4px solid var(--c-primary);
      margin-bottom: 6px;
      font-size: 0.88rem;
    }

    /* ============================================================
       TEACHER TAB
    ============================================================ */
    .teacher-layout {
      display: grid;
      grid-template-columns: 220px 1fr;
      gap: 20px;
      align-items: start;
    }
    @media (max-width: 720px) {
      .teacher-layout { grid-template-columns: 1fr; }
    }

    .teacher-sidebar {
      background: var(--c-surface);
      border-radius: var(--radius-lg);
      border: 2px solid var(--c-border);
      overflow: hidden;
    }
    .teacher-sidebar-title {
      padding: 14px 16px;
      font-weight: 700;
      font-size: 0.8rem;
      text-transform: uppercase;
      letter-spacing: .06em;
      color: var(--c-text-soft);
      background: var(--c-surface2);
      border-bottom: 1px solid var(--c-border);
    }
    .teacher-nav-item {
      width: 100%;
      padding: 12px 16px;
      text-align: left;
      font-weight: 700;
      font-size: 0.9rem;
      color: var(--c-text-soft);
      border-bottom: 1px solid var(--c-border);
      display: flex;
      align-items: center;
      gap: 8px;
      transition: var(--transition);
    }
    .teacher-nav-item:hover  { background: rgba(58,78,157,.05); color: var(--c-primary); }
    .teacher-nav-item.active { background: rgba(58,78,157,.08); color: var(--c-primary); border-left: 3px solid var(--c-primary); }

    .teacher-main { min-width: 0; }
    .teacher-section { display: none; }
    .teacher-section.active { display: block; animation: fadeUp .3s ease; }

    /* Class cards */
    .class-cards {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
      gap: 12px;
      margin-bottom: 20px;
    }
    .class-card {
      background: var(--c-surface);
      border: 2px solid var(--c-border);
      border-radius: var(--radius-lg);
      padding: 18px 14px;
      cursor: pointer;
      transition: var(--transition);
      text-align: center;
    }
    .class-card:hover { border-color: var(--c-accent2); transform: translateY(-3px); box-shadow: var(--shadow-md); }
    .class-card.active-class { border-color: var(--c-accent2); background: rgba(43,61,133,.05); }
    .class-card-name { font-family: var(--font-display); font-weight: var(--font-display-weight); font-size: 1rem; margin-bottom: 4px; }
    .class-card-count { font-size: 0.8rem; color: var(--c-text-soft); }

    /* Student progress table */
    .student-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 0.88rem;
    }
    .student-table th {
      padding: 8px 10px;
      text-align: left;
      background: var(--c-surface2);
      font-size: 0.78rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: .04em;
      color: var(--c-text-soft);
    }
    .student-table td {
      padding: 10px 10px;
      border-bottom: 1px solid var(--c-border);
      vertical-align: middle;
    }
    .student-table tr:last-child td { border-bottom: none; }
    .student-table tr:hover td { background: rgba(43,61,133,.03); }

    /* Google Classroom mockup banner */
    .gc-banner {
      background: linear-gradient(135deg, #4285F4 0%, #34A853 100%);
      border-radius: var(--radius-lg);
      padding: 20px;
      color: #fff;
      display: flex;
      align-items: center;
      gap: 16px;
      margin-bottom: 20px;
    }
    .gc-banner-icon { font-size: 2.2rem; flex-shrink: 0; }
    .gc-banner-text h3 { font-family: var(--font-display); font-weight: var(--font-display-weight); font-size: 1.1rem; margin-bottom: 3px; }
    .gc-banner-text p  { font-size: 0.82rem; opacity: .88; }
    .gc-btn {
      margin-left: auto;
      flex-shrink: 0;
      padding: 8px 16px;
      border-radius: var(--radius-md);
      background: rgba(255,255,255,.2);
      border: 1.5px solid rgba(255,255,255,.5);
      color: #fff;
      font-weight: 700;
      font-size: 0.82rem;
      transition: var(--transition);
    }
    .gc-btn:hover { background: rgba(255,255,255,.35); }

    /* Difficulty heat bar */
    .heat-bar { display:flex; gap:3px; align-items:center; }
    .heat-cell { width:14px; height:14px; border-radius:3px; background:var(--c-surface2); }
    .heat-cell.h1 { background:rgba(118,175,119,.3); }
    .heat-cell.h2 { background:rgba(118,175,119,.6); }
    .heat-cell.h3 { background:rgba(222,130,106,.7); }
    .heat-cell.h4 { background:rgba(58,78,157,.6); }
    .heat-cell.h5 { background:var(--c-primary); }

    /* ── Teacher horizontal tab bar ─────────────────────────── */
    .teacher-tabs {
      display: flex; gap: 4px; background: var(--c-surface2);
      border-radius: var(--radius-lg); padding: 4px;
      margin-bottom: 24px; overflow-x: auto;
    }
    .teacher-tab-btn {
      padding: 9px 18px; border-radius: var(--radius-md); font-weight: 700;
      font-size: .88rem; color: var(--c-text-soft); white-space: nowrap;
      transition: var(--transition); flex-shrink: 0;
    }
    .teacher-tab-btn.active { background: var(--c-surface); color: var(--c-text); box-shadow: 0 1px 6px rgba(0,0,0,.1); }
    .teacher-tab-btn:hover:not(.active) { color: var(--c-text); }

    /* ── Class cards ────────────────────────────────────────
       These used to be an 80px slab of flat colour with the class
       name's first letter in it — a third of the card, and two
       "Sexto/Séptimo" classes both say S, so the letter identified
       nothing the name underneath didn't. Meanwhile the one thing a
       teacher opens this page for, the join code, was not on the card
       at all: it lived in a panel below, for the selected class only,
       so reading five codes meant five clicks.

       Now: a thin colour rail for identity at a glance, the name, the
       roster count, and the code right there with one tap to copy.
       Sandra, 2026-09-20. */
    .tc-class-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(212px,1fr)); gap:14px; margin-bottom:24px; }
    .tc-class-card {
      position: relative; display: flex; flex-direction: column;
      background: var(--c-surface); border: 2px solid var(--c-border);
      border-radius: var(--radius-xl); overflow: hidden; cursor: pointer;
      transition: var(--transition); min-height: 132px;
      padding: 14px 15px 12px;
    }
    .tc-class-card:hover { transform:translateY(-3px); box-shadow:var(--shadow-lg); border-color:transparent; }
    .tc-class-card.tc-selected,
    .tc-class-card.active { border-color: var(--c-accent2); box-shadow: 0 0 0 3px rgba(43,61,133,.15); }
    /* The colour lives here now — enough to tell classes apart in a
       glance down the grid, not enough to be the card. */
    .tc-rail { position:absolute; inset:0 0 auto 0; height:5px; }
    .tc-class-name {
      font-weight: 800; font-size: 1rem; line-height: 1.25; margin-top: 2px;
      display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
      overflow: hidden;
    }
    .tc-class-meta { font-size: .78rem; color: var(--c-text-soft); margin-top: 3px; }
    /* Tap to copy. A button inside a clickable card, so it stops the
       click from also selecting the class. */
    .tc-code {
      margin-top: auto; display:flex; align-items:baseline; gap:7px;
      background: var(--c-card); border: 1px solid var(--c-border);
      border-radius: 9px; padding: 6px 9px; cursor: pointer;
      font: inherit; text-align: left; width: 100%;
      transition: border-color .12s, background .12s;
    }
    .tc-code:hover { border-color: var(--c-accent2); background: var(--c-surface); }
    .tc-code b {
      font-family: var(--font-display); font-weight: var(--font-display-weight);
      font-size: .98rem; letter-spacing: .08em; color: var(--c-primary);
    }
    .tc-code span { font-size: .68rem; font-weight:700; letter-spacing:.04em;
                    text-transform:uppercase; color: var(--c-text-soft); margin-left:auto; }
    .tc-class-add {
      align-items: center; justify-content: center; gap: 6px;
      border-style: dashed; color: var(--c-text-soft);
    }
    .tc-class-add .tc-add-plus { font-size: 1.6rem; line-height: 1; }
    .tc-class-add .tc-add-lab { font-size: .84rem; font-weight: 700; }
    /* The wizard's class picker is a list, not a grid — same card,
       shorter, no code needed there. */
    .tc-class-card.tc-compact { min-height: 0; padding: 11px 13px; }
    .tc-class-card.tc-compact .tc-class-name { font-size: .93rem; -webkit-line-clamp: 1; }
    .tc-class-actions { display:flex; gap:6px; padding:10px 14px; border-top:1px solid var(--c-border); }

    /* ── Assignment wizard stepper ──────────────────────────── */
    .wizard-stepper { display:flex; align-items:center; margin-bottom:28px; }
    .wizard-st { display:flex; align-items:center; gap:8px; }
    .wizard-st-dot {
      width:28px; height:28px; border-radius:50%;
      display:flex; align-items:center; justify-content:center;
      font-size:.75rem; font-weight:700; flex-shrink:0; transition:var(--transition);
    }
    .wizard-st-dot.done    { background:var(--c-accent); color:#fff; }
    .wizard-st-dot.current { background:var(--c-primary); color:#fff; }
    .wizard-st-dot.pending { background:var(--c-surface2); color:var(--c-text-soft); border:2px solid var(--c-border); }
    .wizard-st-label { font-size:.7rem; font-weight:700; text-transform:uppercase; letter-spacing:.05em; color:var(--c-text-soft); }
    .wizard-st-label.current { color:var(--c-primary); }
    @media (max-width:600px) { .wizard-st-label { display:none; } }
    .wizard-conn { flex:1; height:2px; background:var(--c-border); margin:0 6px; }
    .wizard-conn.done { background:var(--c-accent); }
    /* Step 3 asks each activity for its own settings, so each one gets
       its own block rather than a single shared form. */
    .wiz-act-cfg {
      border:1px solid var(--c-border); border-radius:12px;
      padding:14px; margin-bottom:14px; background:var(--c-card);
    }
    .wiz-act-head { display:flex; align-items:center; gap:9px; margin-bottom:12px; }
    .wiz-act-icon {
      width:28px; height:28px; border-radius:8px; flex:0 0 auto;
      display:flex; align-items:center; justify-content:center; font-size:.95rem; color:#fff;
    }
    .wiz-act-name { font-weight:800; font-size:.92rem; }
    .wiz-lab {
      display:block; font-size:.72rem; font-weight:800; letter-spacing:.05em;
      text-transform:uppercase; color:var(--c-text-soft); margin:10px 0 5px;
    }
    .wiz-act-cfg > .wiz-lab:first-of-type { margin-top:0; }
    .wiz-in {
      width:100%; background:var(--c-surface); border:2px solid var(--c-border);
      border-radius:10px; padding:9px 11px; font-family:inherit; font-size:.9rem;
      font-weight:600; color:var(--c-text); outline:none; transition:border-color .15s;
      min-height:42px; box-sizing:border-box;
    }
    .wiz-in:focus { border-color:var(--c-accent2); }
    .wiz-in.wiz-narrow { width:auto; min-width:110px; }
    .wiz-hint { font-size:.76rem; color:var(--c-text-soft); margin-top:5px; line-height:1.45; }
    .wiz-checks { display:flex; flex-wrap:wrap; gap:8px 14px; }
    .wiz-check { display:flex; align-items:center; gap:6px; font-size:.85rem; cursor:pointer; }
    .wiz-check input { accent-color:var(--c-accent2); }
    .wiz-summary {
      background:var(--c-surface); border:1px solid var(--c-border);
      border-radius:10px; padding:12px 14px; font-size:.88rem; line-height:1.5;
    }
    .wiz-summary-note { font-size:.8rem; color:var(--c-text-soft); margin-top:6px; line-height:1.55; }

    /* ── Activity type cards ────────────────────────────────── */
    .activity-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(160px,1fr)); gap:12px; }
    .activity-card {
      background:var(--c-surface); border:2.5px solid var(--c-border);
      border-radius:var(--radius-lg); padding:20px 14px; cursor:pointer;
      transition:var(--transition); text-align:center;
    }
    .activity-card:hover { border-color:var(--c-primary); transform:translateY(-3px); box-shadow:var(--shadow-md); }
    /* Chosen state. Must be unmistakable next to :hover, or a teacher
       can't tell what she actually picked once the mouse moves away. */
    .activity-card.tc-selected {
      border-color:var(--c-primary);
      background:rgba(58,78,157,.07);
      box-shadow:inset 0 0 0 1px var(--c-primary);
    }
    /* "Signed in as … not you?" — so a shared classroom computer never
       silently hands one teacher's dashboard to the next person. */
    .who-bar {
      display:flex; align-items:center; justify-content:space-between;
      gap:12px; flex-wrap:wrap;
      margin:0 0 12px; padding:8px 14px;
      border:1px solid var(--c-border); border-radius:10px;
      background:var(--c-surface,#f9f8fb);
      font-size:.82rem; color:var(--c-text-soft);
    }
    .who-bar strong { color:var(--c-text); }
    .who-switch {
      background:none; border:none; padding:0; cursor:pointer;
      font:inherit; font-weight:800; color:var(--c-primary);
      text-decoration:underline;
    }

    /* Share screen — the link and the QR, away from the marking view. */
    .share-overlay {
      position:fixed; inset:0; z-index:420;
      background:rgba(12,10,30,.62); backdrop-filter:blur(3px);
      display:flex; align-items:center; justify-content:center; padding:20px;
      overflow-y:auto;
    }
    .share-overlay.hidden { display:none; }
    .share-wrap {
      position:relative; width:100%; max-width:460px; text-align:center;
      background:var(--c-card,#fff); border-radius:20px;
      padding:26px 24px 20px; box-shadow:0 26px 70px rgba(0,0,0,.32);
      max-height:92vh; overflow-y:auto;
    }
    .share-close {
      position:absolute; top:12px; right:14px;
      width:36px; height:36px; border-radius:50%;
      border:none; background:var(--c-surface,#eee); color:var(--c-text);
      font-size:1.4rem; line-height:1; cursor:pointer;
    }
    .share-title {
      font-family:var(--font-display); font-weight:var(--font-display-weight);
      font-size:1.3rem; margin-bottom:4px;
    }
    .share-sub { font-size:.86rem; color:var(--c-text-soft); margin-bottom:16px; line-height:1.4; }
    .share-qr { display:flex; flex-direction:column; align-items:center; gap:8px; margin-bottom:18px; }
    /* One block per published activity — the wizard can make several at
       once, and each carries its own QR, code and link. */
    .share-acts { display:flex; flex-direction:column; gap:14px; margin-bottom:16px; }
    .share-act {
      border:1px solid var(--c-border); border-radius:14px;
      padding:14px 14px 12px; background:var(--c-card);
    }
    .share-acts .share-act + .share-act { margin-top:0; }
    .share-act-head { display:flex; align-items:center; gap:9px; margin-bottom:10px; }
    .share-act-icon {
      width:30px; height:30px; border-radius:9px; flex:0 0 auto;
      display:flex; align-items:center; justify-content:center;
      font-size:1rem; color:#fff;
    }
    .share-act-name { font-weight:800; font-size:.95rem; line-height:1.25; }
    .share-act .share-qr { margin-bottom:12px; }
    /* The code is meant to be read out across a classroom, so it is the
       biggest thing in the block and spaced wide enough to dictate. */
    .share-codebox { text-align:center; margin-bottom:12px; }
    .share-code-lab {
      font-size:.66rem; font-weight:800; letter-spacing:.09em;
      text-transform:uppercase; color:var(--c-text-soft); margin-bottom:2px;
    }
    .share-code {
      font-family:var(--font-display); font-weight:var(--font-display-weight);
      font-size:1.8rem; letter-spacing:.16em; color:var(--c-primary);
      cursor:pointer; line-height:1.15; text-transform:lowercase;
    }
    .share-code:hover { opacity:.75; }
    .share-code-url { font-size:.76rem; color:var(--c-text-soft); margin-top:2px; word-break:break-all; }
    .share-code-url b { color:var(--c-text); }
    .share-actions { display:flex; gap:10px; justify-content:flex-end; flex-wrap:wrap; margin-top:16px; }
    .share-actions .btn { min-height:46px; }
    @media (max-width:520px){
      .share-code { font-size:1.5rem; }
      .share-actions .btn { flex:1 1 100%; }
    }
    .share-qr-cap { font-size:.76rem; font-weight:700; color:var(--c-text-soft); }
    .share-linkrow { display:flex; gap:8px; align-items:center; }
    .share-link {
      flex:1 1 auto; min-width:0; font:inherit; font-size:.8rem;
      padding:10px 12px; border-radius:10px;
      border:1px solid var(--c-border); background:var(--c-surface,#f9f8fb);
      color:var(--c-text-soft);
    }
    .share-note {
      margin-top:14px; font-size:.78rem; line-height:1.45;
      color:var(--c-text-soft); text-align:left;
      background:rgba(222,130,106,.14); border:1px solid rgba(222,130,106,.5);
      border-radius:10px; padding:10px 12px;
    }

    /* QR codes — one per activity, and on the class join card. */
    .qr-img {
      display:block; border-radius:8px;
      background:#fff; border:1px solid var(--c-border);
      image-rendering:pixelated;          /* keep module edges crisp */
      max-width:100%; height:auto;
    }
    /* "Sent to your teacher" banner on the results screen. */
    /* The "you are previewing as a student" bar. Pinned, high contrast,
       and never hidden by the preview it announces. */
    .vas-bar {
      position: fixed; left: 0; right: 0; bottom: 0; z-index: 9000;
      display: flex; align-items: center; justify-content: center;
      gap: 14px; flex-wrap: wrap;
      padding: 10px 16px;
      background: #2D2A5A; color: #fff;
      font-size: .85rem; font-weight: 700; line-height: 1.4;
      box-shadow: 0 -4px 16px rgba(0,0,0,.18);
    }
    .vas-bar button {
      background: #DE826A; color: #2D2A5A; border: none;
      border-radius: 999px; padding: 7px 16px;
      font-family: inherit; font-size: .82rem; font-weight: 800;
      cursor: pointer;
    }
    .vas-bar button:hover { filter: brightness(1.05); }
    /* Keep the bar off the last row of content. */
    body:has(.vas-bar) { padding-bottom: 64px; }

    .asgn-sent {
      border-radius:12px; padding:12px 14px; margin-bottom:14px;
      text-align:left; line-height:1.45;
    }
    .asgn-sent.ok  { background:rgba(118,175,119,.12); border:1px solid rgba(118,175,119,.45); }
    .asgn-sent.bad { background:rgba(239,68,68,.10);  border:1px solid rgba(239,68,68,.45); }
    .asgn-sent-top  { font-weight:800; font-size:.95rem; margin-bottom:3px; }
    .asgn-sent-line { font-size:.86rem; font-weight:700; }
    .asgn-sent-note { font-size:.8rem; color:var(--c-text-soft); margin-top:4px; }

    /* Due date + time. Our own calendar, because the native one is
       drawn in the browser's language and can't be translated. */
    .due-wrap { position:relative; display:flex; flex-wrap:wrap; align-items:center; gap:10px; }
    .due-btn {
      display:inline-flex; align-items:center; gap:8px;
      background:var(--c-card); border:2px solid var(--c-border);
      border-radius:12px; padding:10px 14px; cursor:pointer;
      font:inherit; font-weight:700; font-size:.88rem; color:var(--c-text);
      transition:border-color .12s;
    }
    .due-btn:hover, .due-btn:focus-visible { border-color:var(--c-primary); outline:none; }
    .due-time { display:inline-flex; align-items:center; gap:6px; font-size:.85rem; }
    .due-time-lbl { font-weight:700; color:var(--c-text-soft); }
    .due-time select {
      font:inherit; font-weight:700; font-size:.88rem;
      padding:9px 8px; border-radius:10px;
      border:2px solid var(--c-border); background:var(--c-card); color:var(--c-text);
      cursor:pointer;
    }
    .due-time select:focus-visible { border-color:var(--c-primary); outline:none; }
    .due-colon { font-weight:800; color:var(--c-text-soft); }
    .due-cal {
      position:absolute; top:calc(100% + 8px); left:0; z-index:60;
      width:288px; padding:12px;
      background:var(--c-card); border:1px solid var(--c-border);
      border-radius:14px; box-shadow:0 14px 40px rgba(0,0,0,.18);
    }
    .due-cal.hidden { display:none; }
    .due-cal-top { display:flex; align-items:center; justify-content:space-between; margin-bottom:8px; }
    .due-cal-title { font-weight:800; font-size:.92rem; }
    .due-cal-nav {
      background:none; border:none; cursor:pointer; font-size:1.3rem; line-height:1;
      padding:2px 10px; border-radius:8px; color:var(--c-text);
    }
    .due-cal-nav:hover { background:rgba(58,78,157,.10); }
    .due-cal-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:2px; }
    .due-cal-h {
      text-align:center; font-size:.68rem; font-weight:800;
      color:var(--c-text-soft); padding:4px 0;
    }
    .due-cal-d {
      aspect-ratio:1; border:none; background:none; cursor:pointer;
      border-radius:9px; font:inherit; font-size:.82rem; font-weight:700;
      color:var(--c-text);
    }
    .due-cal-d:hover { background:rgba(58,78,157,.12); }
    .due-cal-d.empty { pointer-events:none; }
    .due-cal-d.today { box-shadow:inset 0 0 0 2px var(--c-border); }
    .due-cal-d.sel { background:var(--c-primary); color:#fff; }
    .due-cal-foot { display:flex; justify-content:space-between; margin-top:8px; }
    .due-cal-link {
      background:none; border:none; cursor:pointer; font:inherit;
      font-size:.82rem; font-weight:800; color:var(--c-primary); padding:4px 2px;
    }
    .activity-card { position:relative; }
    .activity-card-check {
      position:absolute; top:8px; right:8px;
      width:22px; height:22px; border-radius:50%;
      background:var(--c-primary); color:#fff;
      font-size:.78rem; font-weight:800;
      display:flex; align-items:center; justify-content:center;
      opacity:0; transform:scale(.6); transition:opacity .12s, transform .12s;
    }
    .activity-card.tc-selected .activity-card-check { opacity:1; transform:scale(1); }
    .activity-card:focus-visible { outline:2px solid var(--c-primary); outline-offset:2px; }
    .activity-card-badge {
      width:48px; height:48px; border-radius:var(--radius-md);
      display:flex; align-items:center; justify-content:center;
      font-family:var(--font-display);font-weight:var(--font-display-weight); font-size:1rem; font-weight:900;
      color:#fff; margin:0 auto 12px;
    }
    .activity-card-name { font-weight:700; font-size:.88rem; margin-bottom:4px; }
    .activity-card-desc { font-size:.74rem; color:var(--c-text-soft); line-height:1.4; }

    /* ── Assignment list (progress view) ────────────────────── */
    .asgn-list { display:flex; flex-direction:column; gap:8px; }
    .asgn-item {
      background:var(--c-surface); border:1.5px solid var(--c-border);
      border-radius:var(--radius-md); padding:14px 16px;
      display:flex; align-items:center; gap:12px;
    }
    .asgn-icon {
      width:38px; height:38px; border-radius:var(--radius-sm);
      display:flex; align-items:center; justify-content:center;
      font-family:var(--font-display);font-weight:var(--font-display-weight); font-size:1rem; font-weight:900;
      color:#fff; flex-shrink:0;
    }
    .asgn-info { flex:1; min-width:0; }
    .asgn-title { font-weight:700; font-size:.9rem; margin-bottom:2px; }
    .asgn-meta { font-size:.75rem; color:var(--c-text-soft); }
    .asgn-prog { flex-shrink:0; text-align:right; }
    .asgn-pct { font-family:var(--font-display);font-weight:var(--font-display-weight); font-size:1.05rem; font-weight:700; color:var(--c-accent-ink); }
    .asgn-bar { width:80px; height:5px; background:var(--c-surface2); border-radius:99px; overflow:hidden; margin-top:4px; }
    .asgn-bar-fill { height:100%; border-radius:99px; }

    /* ── GC connected header ────────────────────────────────── */
    .gc-conn-header {
      background: linear-gradient(135deg,#4285F4,#34A853);
      border-radius: var(--radius-lg); padding: 20px 24px;
      color: #fff; display:flex; align-items:center; gap:16px; margin-bottom:20px;
    }
    .gc-conn-avatar {
      width:44px; height:44px; border-radius:50%;
      background:rgba(255,255,255,.25); display:flex; align-items:center;
      justify-content:center; font-family:var(--font-display);font-weight:var(--font-display-weight); font-size:1.2rem;
      font-weight:700; flex-shrink:0;
    }
    .gc-conn-info { flex:1; }
    .gc-conn-name { font-family:var(--font-display);font-weight:var(--font-display-weight); font-size:1rem; font-weight:700; }
    .gc-conn-email { font-size:.78rem; opacity:.8; margin-top:2px; }
    .gc-feature-row {
      display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:12px; margin-bottom:20px;
    }
    .gc-feature-card {
      background:var(--c-surface); border:1.5px solid var(--c-border);
      border-radius:var(--radius-md); padding:16px;
    }
    .gc-feature-icon { width:40px; height:40px; border-radius:10px; display:flex; align-items:center; justify-content:center; font-weight:800; font-size:1.1rem; color:white; margin-bottom:10px; }
    .gc-feature-title { font-weight:700; font-size:.9rem; margin-bottom:4px; }
    .gc-feature-desc { font-size:.78rem; color:var(--c-text-soft); line-height:1.5; }

    /* Color swatches (Add Class modal) */
    .color-swatch {
      width:28px; height:28px; border-radius:50%; cursor:pointer;
      border:3px solid transparent; transition:border-color .15s, transform .15s;
    }
    .color-swatch.selected { border-color: rgba(0,0,0,.35); transform:scale(1.15); }
    .color-swatch:hover { transform:scale(1.1); }

    /* GC connection steps */
    .gc-step { display:flex; gap:12px; align-items:flex-start; padding:12px 0; border-bottom:1px solid var(--c-border); }
    .gc-step:last-child { border-bottom:none; }
    .gc-step-num { width:26px; height:26px; border-radius:50%; background:var(--c-primary); color:white; font-size:.78rem; font-weight:800; display:flex; align-items:center; justify-content:center; flex-shrink:0; margin-top:1px; }
    .gc-step-text { font-size:.88rem; line-height:1.6; }

    /* Teacher auth gate */
    .teacher-gate { max-width:420px; margin:48px auto; text-align:center; padding:0 20px; }
    .teacher-gate-icon { font-size:3.5rem; margin-bottom:18px; }
    .teacher-gate h2 { font-size:1.35rem; font-weight:800; margin-bottom:10px; }
    .teacher-gate p { color:var(--c-text-soft); font-size:.93rem; line-height:1.65; margin-bottom:28px; }
    .teacher-gate-btns { display:flex; flex-direction:column; gap:11px; max-width:300px; margin:0 auto; }

    /* ── STUDENT LEVEL PROGRESS BAR ────────────────────────── */
    .level-bar-wrap {
      max-width: 680px; margin: 0 auto 20px; padding: 14px 18px;
      background: var(--c-card); border-radius: 16px;
      box-shadow: 0 2px 10px rgba(0,0,0,.07);
      display: flex; align-items: center; gap: 14px;
    }
    .level-bar-icon { font-size: 1.6rem; flex-shrink: 0; }
    .level-bar-info { flex: 1; min-width: 0; }
    .level-bar-name { font-weight: 800; font-size: .92rem; color: var(--c-text); }
    .level-bar-xp   { font-size: .78rem; color: var(--c-text-soft); margin-top: 1px; }
    .level-bar-track {
      height: 8px; border-radius: 99px;
      background: var(--c-border); overflow: hidden; margin-top: 6px;
    }
    .level-bar-fill {
      height: 100%; border-radius: 99px;
      background: linear-gradient(90deg, #6366f1, #a855f7);
      transition: width .5s ease;
    }
    .level-bar-badges-btn {
      flex-shrink: 0; background: none; border: 2px solid var(--c-border);
      border-radius: 10px; padding: 6px 11px; font-size: .82rem;
      font-weight: 700; cursor: pointer; color: var(--c-text-soft);
      transition: border-color .2s, color .2s;
    }
    .level-bar-badges-btn:hover { border-color: #6366f1; color: #6366f1; }

    /* ── BADGES OVERLAY ─────────────────────────────────────── */
    .badges-overlay {
      position: fixed; inset: 0; z-index: 1200;
      background: rgba(0,0,0,.55); display: flex;
      align-items: center; justify-content: center; padding: 20px;
    }
    .badges-modal {
      background: var(--c-card); border-radius: 24px;
      width: 100%; max-width: 560px; max-height: 88vh;
      overflow-y: auto; padding: 28px 24px;
      box-shadow: 0 20px 60px rgba(0,0,0,.25);
    }
    .badges-modal-title {
      font-size: 1.3rem; font-weight: 900; text-align: center;
      margin-bottom: 6px;
    }
    .badges-modal-sub {
      font-size: .85rem; color: var(--c-text-soft); text-align: center;
      margin-bottom: 22px;
    }
    .badges-grid {
      display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
      gap: 14px;
    }
    .badge-chip {
      border-radius: 16px; padding: 18px 12px; text-align: center;
      border: 2px solid transparent; transition: transform .15s;
    }
    .badge-chip.earned { transform: scale(1); }
    .badge-chip.locked { opacity: .35; filter: grayscale(1); }
    .badge-chip:hover  { transform: scale(1.04); }
    .badge-chip-icon   { font-size: 2.2rem; margin-bottom: 8px; }
    .badge-chip-name   { font-weight: 800; font-size: .8rem; line-height: 1.25; }
    .badge-chip-desc   { font-size: .72rem; color: var(--c-text-soft); margin-top: 4px; line-height: 1.4; }
    .badge-earned-label {
      font-size: .68rem; font-weight: 800; text-transform: uppercase;
      letter-spacing: .06em; margin-top: 6px;
    }

    /* badge toast pop */
    .badge-toast {
      position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%) translateY(20px);
      background: #1f2850; color: #fff; border-radius: 18px;
      padding: 14px 22px; display: flex; align-items: center; gap: 12px;
      font-size: .9rem; font-weight: 700; box-shadow: 0 8px 30px rgba(0,0,0,.35);
      z-index: 2000; opacity: 0; transition: opacity .4s, transform .4s;
      pointer-events: none;
    }
    .badge-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
    .badge-toast-icon { font-size: 1.6rem; }

    /* ── STORY MODE ─────────────────────────────────────────── */
    .story-wrap {
      max-width: 700px; margin: 0 auto; padding: 20px 16px 80px;
      /* Completa la historia scrolls the score card into view after Revisar.
         Without this the card's top landed 76 px behind the fixed nav (60) +
         tab bar (56), so the emoji and the grade line were cut on both phone
         and laptop. Same offset .dict-detail already carries, same reason.
         Found while fixing the cultural stories' scrolling, 2026-10-08. */
      scroll-margin-top: 130px;
    }
    .story-pick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
    @media(max-width:520px){ .story-pick-grid { grid-template-columns: 1fr; } }
    .story-pick-card {
      background: var(--c-card); border-radius: 18px; padding: 22px 18px;
      cursor: pointer; border: 2px solid transparent;
      box-shadow: 0 2px 10px rgba(0,0,0,.07); transition: border-color .2s, transform .15s;
    }
    .story-pick-card:hover  { border-color: var(--c-primary); transform: translateY(-2px); }
    .story-pick-icon  { font-size: 2.2rem; margin-bottom: 8px; }
    .story-pick-title { font-weight: 800; font-size: 1rem; margin-bottom: 4px; }
    .story-pick-meta  { font-size: .78rem; color: var(--c-text-soft); }

    .story-header { text-align: center; margin-bottom: 20px; }
    .story-title-main { font-size: 1.4rem; font-weight: 900; margin-bottom: 4px; }
    .story-tense-chip {
      display: inline-block; padding: 3px 12px; border-radius: 99px;
      font-size: .75rem; font-weight: 700; margin-bottom: 14px;
    }
    .story-body {
      background: var(--c-card); border-radius: 20px; padding: 24px 22px;
      font-size: 1.08rem; line-height: 2.1;
      box-shadow: 0 2px 12px rgba(0,0,0,.08);
    }
    .story-blank-wrap {
      display: inline-flex; flex-direction: column; align-items: center;
      vertical-align: bottom; margin: 0 3px 4px;
    }
    .story-blank {
      display: inline-block; border: none; border-bottom: 3px solid #6366f1;
      background: rgba(99,102,241,.07); border-radius: 6px;
      font-size: 1rem; font-family: inherit; font-weight: 700;
      color: #6366f1; padding: 2px 8px; min-width: 90px; width: auto;
      text-align: center; outline: none; transition: background .15s;
    }
    .story-blank:focus { background: rgba(99,102,241,.16); }
    .story-blank.correct { background: rgba(16,185,129,.15); border-bottom-color: #10b981; color: #065f46; }
    .story-blank.wrong   { background: rgba(239,68,68,.12);  border-bottom-color: #ef4444; color: #991b1b; }
    .story-blank.revealed{ background: rgba(245,158,11,.13); border-bottom-color: #f59e0b; color: #92400e; }
    .story-blank-hint {
      font-size: .7rem; font-weight: 700; font-style: italic;
      color: #6366f1; opacity: .75; margin-top: 2px;
      white-space: nowrap; pointer-events: none;
    }
    .story-hint-row { font-size: .82rem; color: var(--c-text-soft); margin-top: 10px; }
    .story-actions  { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; justify-content: center; }
    .story-score-card {
      background: var(--c-card); border-radius: 22px; padding: 32px 24px;
      text-align: center; margin-top: 20px;
      box-shadow: 0 4px 20px rgba(0,0,0,.1);
    }
    .story-score-emoji { font-size: 3.5rem; margin-bottom: 12px; }
    .story-score-title { font-size: 1.4rem; font-weight: 900; margin-bottom: 8px; }
    .story-score-pct   { font-size: 3rem; font-weight: 900; color: #6366f1; }
    .story-answers-list { margin-top: 18px; text-align: left; }
    .story-answer-row   {
      display: flex; align-items: flex-start; gap: 10px;
      padding: 8px 0; border-bottom: 1px solid var(--c-border);
      font-size: .88rem;
    }
    .story-answer-row:last-child { border-bottom: none; }
    .sa-icon  { font-size: 1rem; flex-shrink: 0; margin-top: 2px; }
    .sa-info  { flex: 1; }
    .sa-blank { font-weight: 700; }
    .sa-correct-ans { color: #10b981; font-weight: 700; }

    /* ── HISTORIAS CULTURALES / CULTURAL STORIES ─────────────── */
    .cs-wrap { max-width: 700px; margin: 0 auto; padding: 20px 16px 80px; }
    .cs-library-header { text-align: center; margin-bottom: 28px; }
    .cs-library-title { font-family: var(--font-display); font-weight: var(--font-display-weight); font-size: 1.5rem; margin-bottom: 6px; }
    .cs-library-sub { font-size: .88rem; color: var(--c-text-soft); }
    .cs-level-label {
      display: flex; align-items: center; gap: 12px;
      font-size: 1.25rem; font-weight: 900; text-transform: uppercase; letter-spacing: .05em;
      color: var(--c-text-soft); margin: 30px 0 14px; white-space: nowrap;
    }
    .cs-level-label::after { content: ''; flex: 1; height: 2px; border-radius: 2px; background: currentColor; opacity: .28; }
    .cs-folder-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 8px; }
    .cs-folder {
      position: relative; display: flex; flex-direction: column; text-align: left; font-family: inherit;
      background: var(--c-surface, #fff); color: var(--c-text); cursor: pointer;
      border: 2px solid var(--lvl28); border-radius: 6px 20px 20px 20px;
      padding: 0; margin-top: 16px; box-shadow: 0 6px 20px var(--lvl14);
      transition: transform .18s, box-shadow .18s, border-color .18s;
    }
    .cs-folder:hover:not([disabled]) { transform: translateY(-4px); border-color: var(--lvl); box-shadow: 0 12px 28px var(--lvl24); }
    .cs-folder:focus-visible { outline: 3px solid var(--lvl); outline-offset: 3px; }
    .cs-folder[disabled] { cursor: default; opacity: .6; }
    .cs-folder-tab {
      position: absolute; top: -16px; left: -2px; width: 46%; height: 18px;
      background: var(--lvl); border-radius: 10px 14px 0 0;
    }
    .cs-folder-thumbs {
      position: relative; display: block; height: 128px; border-radius: 4px 18px 0 0; overflow: hidden;
      background: #fff linear-gradient(135deg, var(--lvl), var(--lvl60));
    }
    .cs-folder-thumb {
      position: absolute; top: 16px; width: 58%; height: 104px; object-fit: cover; object-position: center top;
      border-radius: 10px; border: 3px solid #fff; box-shadow: 0 4px 12px rgba(0,0,0,.25);
    }
    .cs-ft-0 { left: 21%; z-index: 3; }
    .cs-ft-1 { left: 4%;  z-index: 2; transform: rotate(-8deg); top: 22px; }
    .cs-ft-2 { right: 4%; z-index: 1; transform: rotate(8deg);  top: 22px; }
    .cs-folder-body { display: flex; flex-direction: column; gap: 3px; padding: 14px 16px 16px; }
    .cs-folder-name { font-family: var(--font-display); font-weight: var(--font-display-weight); font-size: 1.2rem; color: var(--lvl); }
    .cs-folder-count { font-weight: 700; font-size: .9rem; }
    .cs-folder-meta { font-size: .78rem; color: var(--c-text-soft); line-height: 1.35; }
    .cs-folder-cta { margin-top: 8px; font-weight: 700; font-size: .86rem; color: var(--lvl); }
    .cs-crumb { margin: -10px 0 10px; }
    .cs-level-head { display: flex; align-items: center; gap: 12px; margin: 4px 0 16px; padding: 12px 16px;
      border-radius: 16px; background: var(--lvl10); border-left: 5px solid var(--lvl); }
    .cs-level-icon { font-size: 1.8rem; }
    .cs-level-name { font-family: var(--font-display); font-weight: var(--font-display-weight); font-size: 1.3rem; color: var(--lvl); }
    .cs-level-count { font-size: .85rem; color: var(--c-text-soft); }
    @media (max-width: 620px) {
      .cs-folder-grid { grid-template-columns: 1fr; gap: 26px; }
      .cs-folder { flex-direction: row; align-items: stretch; }
      .cs-folder-tab { width: 34%; }
      .cs-folder-thumbs { width: 42%; height: auto; min-height: 132px; border-radius: 4px 0 0 18px; flex-shrink: 0; }
      .cs-folder-thumb { width: 64%; height: 92px; }
      .cs-ft-0 { left: 18%; top: 20px; }
      .cs-folder-body { justify-content: center; }
    }
    .cs-cover-card {
      position: relative; display: block; border-radius: 20px; overflow: hidden;
      height: 190px; cursor: pointer;
      box-shadow: 0 4px 20px rgba(0,0,0,.14);
      transition: transform .2s, box-shadow .2s;
      margin-bottom: 14px;
    }
    .cs-cover-card:hover { transform: translateY(-3px); box-shadow: 0 10px 32px rgba(0,0,0,.22); }
    .cs-cover-card:focus-visible { outline: 3px solid var(--c-primary); outline-offset: 3px; }
    .cs-print-row { position: absolute; top: 10px; right: 10px; display: flex; gap: 6px; z-index: 2; }
    .cs-print-btn {
      font-family: inherit; font-weight: 600; font-size: .78rem; cursor: pointer;
      background: rgba(255,255,255,.94); color: #3d3a55; border: 0; border-radius: 99px;
      padding: 6px 11px; box-shadow: 0 2px 8px rgba(0,0,0,.18);
    }
    .cs-print-btn:hover { background: #fff; color: var(--c-primary); }
    .cs-cover-img {
      position: absolute; inset: 0; width: 100%; height: 100%;
      object-fit: cover; object-position: center top;
    }
    .cs-cover-overlay {
      position: absolute; inset: 0;
      background: linear-gradient(90deg, rgba(8,8,18,.88) 0%, rgba(8,8,18,.68) 38%, rgba(8,8,18,.22) 68%, transparent 100%);
    }
    .cs-cover-body {
      position: absolute; bottom: 0; left: 0;
      padding: 18px 22px 20px; z-index: 1;
      display: flex; flex-direction: column; align-items: flex-start;
    }
    .cs-cover-badge {
      display: inline-block; padding: 3px 10px; border-radius: 99px;
      font-size: .67rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
      color: #fff; margin-bottom: 7px;
    }
    .cs-cover-title {
      font-family: var(--font-display); font-weight: var(--font-display-weight);
      font-size: 1.35rem; line-height: 1.2; color: #fff;
      text-shadow: 0 2px 12px rgba(0,0,0,.55); margin-bottom: 5px;
    }
    .cs-cover-meta { font-size: .78rem; color: rgba(255,255,255,.88); text-shadow: 0 1px 5px rgba(0,0,0,.5); }
    @media (max-width: 520px) {
      .cs-cover-card { height: 160px; }
      .cs-cover-title { font-size: 1.12rem; }
      .cs-cover-body { padding: 14px 16px 16px; }
      .cs-cover-overlay { background: linear-gradient(90deg, rgba(8,8,18,.92) 0%, rgba(8,8,18,.72) 42%, rgba(8,8,18,.3) 70%, transparent 100%); }
    }

    /* ── Scene layout (Sandra, 2026-10-08) ───────────────────────────
       The complaint: you could not see the scene and its question at the
       same time — the page ran 2.5 screens and you scrolled down to answer,
       then back up to look. On a wide screen the picture now sits beside the
       text and the question, so both are in view; the picture sticks while
       the reading column scrolls. On a phone it stays one column, in the
       order it always had, with the question moved directly under the player
       and the picture capped so it no longer fills the screen on its own. */
    .cs-scene-cols { display: block; }
    /* The PX bar is a reward counter; mid-scene it only pushes the question
       below the fold, on a phone most of all. Hidden while a story scene is
       open and restored by itself when it closes. Browsers without :has()
       simply keep it. */
    #tab-game:has(#cultural-stories-screen:not(.hidden)) #level-bar { display: none; }
    @media (min-width: 1000px) {
      .cs-wrap { max-width: 1180px; padding-top: 10px; }
      /* Escuchar belongs to the scene, so it rides under the picture, and its
         three stacked rows become one: seek bar, then the buttons and the
         music control side by side. That is ~60 px the question gets back. */
      .cs-col-media .cs-player {
        display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
        margin: 10px 0 0;
      }
      .cs-col-media .cs-player .cs-seek-track,
      .cs-col-media .cs-player .cs-seek { flex: 1 1 100%; }
      .cs-col-media .cs-player-controls { margin: 0; gap: 10px; justify-content: flex-start; }
      .cs-col-media .cs-player-btn { padding: 9px 14px; min-width: 0; }
      .cs-col-media .cs-music-row { margin: 0 0 0 auto; }
      .cs-col-read .cs-narration { margin-bottom: 0; }
      /* Sized so the whole question lands on the first screen of a 1280x800
         classroom laptop, not just its first line. */
      .cs-col-read .cs-question-card { padding: 15px 16px; }
      .cs-col-read .cs-question-prompt { margin-bottom: 10px; }
      .cs-col-read .cs-options { gap: 6px; }
      .cs-col-read .cs-option-btn { padding: 9px 14px; }
      /* On a short screen the picture gives way before the question does, and
         the whole picture column has to fit the viewport or it stops sticking. */
      .cs-col-media .cs-scene-hero-photo { max-height: min(46vh, 430px); }
      .cs-col-media .cs-scene-hero-portrait { height: min(46vh, 430px); }
      .cs-scene-cols {
        display: grid;
        grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
        gap: 22px; align-items: start;
      }
      /* The picture stays put while the student reads and answers beside it. */
      .cs-col-media { position: sticky; top: 14px; }
      .cs-col-media .cs-scene-hero { margin-bottom: 0; }
      .cs-col-read > :last-child { margin-bottom: 0; }
      .cs-col-read .cs-question-card { margin-top: 10px; }
      .cs-col-read .cs-question-card:first-child { margin-top: 0; }
    }
    /* Phones: the picture took 473 px of an 844 px screen, which is what put
       the question two screens down. */
    @media (max-width: 999px) {
      .cs-scene-hero-photo { max-height: 36vh; }
      .cs-scene-hero-portrait { height: min(36vh, 320px); }
      .cs-col-media .cs-player { margin-top: 10px; }
      .cs-col-read .cs-question-card { margin-top: 14px; }
    }

    .cs-progress-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
    .cs-progress-bar { flex: 1; height: 8px; border-radius: 99px; background: var(--c-border); overflow: hidden; }
    .cs-progress-fill { height: 100%; border-radius: 99px; transition: width .3s ease; }
    .cs-progress-label { font-size: 1.02rem; font-weight: 800; color: var(--c-text); white-space: nowrap; }

    .cs-scene-hero {
      border-radius: 22px; padding: 36px 20px; text-align: center;
      box-shadow: 0 4px 18px rgba(0,0,0,.13); margin-bottom: 14px;
    }
    .cs-scene-icon { font-size: 4rem; line-height: 1; }
    /* Real photo variant — used when a scene has an actual
       illustration (currently just the first story); falls back to
       the icon+gradient hero above for stories that don't have one
       yet. */
    .cs-scene-hero-photo {
      padding: 0; overflow: hidden; background: var(--c-card);
      aspect-ratio: 5 / 3; display: flex; align-items: center; justify-content: center;
    }
    .cs-scene-photo { width: 100%; height: 100%; object-fit: contain; display: block; }
    /* Portrait illustrations (story.portrait): a tall hero so the whole picture
       stays readable, with a blurred copy of the same image filling the sides. */
    .cs-scene-hero-portrait { aspect-ratio: auto; height: min(56vh, 500px); position: relative; background: #1e293b; }
    .cs-scene-backdrop {
      position: absolute; inset: -24px; background-size: cover; background-position: center;
      filter: blur(18px) brightness(.8); transform: scale(1.1);
    }
    .cs-scene-hero-portrait .cs-scene-photo { position: relative; width: auto; max-width: 100%; margin: 0 auto; }
    .cs-narration {
      font-size: 1.05rem; line-height: 1.6; color: var(--c-text);
      background: var(--c-card); border-radius: 16px; padding: 16px 20px;
      margin-bottom: 12px;
    }
    /* Vocabulary terms (cultural nouns) vs. verbs (the grammar focus)
       get distinct colors so a student can visually separate "new
       word to learn" from "verb form being practiced" at a glance. */
    .cs-hl-vocab {
      color: var(--c-primary); font-weight: 800; cursor: pointer;
      text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px;
      border-radius: 4px;
    }
    .cs-hl-vocab:hover, .cs-hl-vocab:focus-visible { background: rgba(0,0,0,.06); outline: none; }
    .cs-hl-verb  {
      color: var(--c-accent-ink); font-weight: 800; cursor: pointer;
      text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px;
      border-radius: 4px;
    }
    .cs-hl-verb:hover, .cs-hl-verb:focus-visible { background: rgba(0,0,0,.06); outline: none; }

    /* Audio player: seek bar + play/pause, styled like a simple
       audiobook transport control. */
    .cs-player { margin-bottom: 18px; }
    .cs-seek-track {
      position: relative; height: 6px; border-radius: 99px;
      background: var(--c-border); margin-bottom: 4px; overflow: hidden;
    }
    .cs-seek-fill { position: absolute; top:0; left:0; height: 100%; border-radius: 99px; transition: width .1s linear; }
    .cs-seek {
      -webkit-appearance: none; appearance: none; width: 100%; height: 22px;
      background: transparent; cursor: pointer; margin: -14px 0 8px; display: block;
    }
    .cs-seek::-webkit-slider-runnable-track { height: 6px; background: transparent; }
    .cs-seek::-webkit-slider-thumb {
      -webkit-appearance: none; appearance: none; margin-top: -7px;
      width: 18px; height: 18px; border-radius: 50%;
      background: var(--c-accent2); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.3); cursor: pointer;
    }
    .cs-seek::-moz-range-track { height: 6px; background: transparent; }
    .cs-seek::-moz-range-thumb {
      width: 18px; height: 18px; border-radius: 50%; border: 3px solid #fff;
      background: var(--c-accent2); box-shadow: 0 1px 4px rgba(0,0,0,.3); cursor: pointer;
    }
    .cs-player-controls { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
    .cs-player-btn {
      display: flex; align-items: center; justify-content: center; gap: 8px;
      min-width: 150px; padding: 14px 22px; border-radius: 14px; border: none;
      font-size: 1rem; font-weight: 800; cursor: pointer; color: #fff;
      box-shadow: 0 3px 10px rgba(0,0,0,.14);
      transition: transform .1s, box-shadow .15s;
    }
    .cs-player-btn:hover:not(:disabled) { transform: translateY(-1px); }
    .cs-player-btn:disabled { opacity: .4; cursor: default; box-shadow: none; transform: none; }
    .cs-player-btn-pause { background: var(--c-surface2); color: var(--c-text); }

    /* Background-music controls (on/off + volume) */
    .cs-music-row { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
    .cs-music-btn {
      display: inline-flex; align-items: center; gap: 6px;
      border: 1px solid rgba(0,0,0,.12); background: var(--c-surface2); color: var(--c-text);
      border-radius: 999px; padding: 8px 14px; font-size: .85rem; font-weight: 700; cursor: pointer;
      transition: opacity .15s, transform .1s;
    }
    .cs-music-btn:hover { transform: translateY(-1px); }
    .cs-music-btn.cs-music-off { opacity: .5; }
    .cs-music-vol { width: 120px; max-width: 45vw; accent-color: var(--c-primary); cursor: pointer; }

    /* Fingers, not mice.

       Found in a sweep across five device sizes (2026-10-11): these three
       are the only controls in the app under about 32 px on a touch
       screen, and two of them are sliders, which are the hardest thing
       there is to grab. Nothing moves on a laptop — `pointer: coarse` only
       matches a touch screen — so the desktop layout is untouched. */
    @media (pointer: coarse) {
      .cs-seek { height: 40px; margin: -24px 0 4px; }
      .cs-seek::-webkit-slider-thumb { width: 26px; height: 26px; margin-top: -10px; }
      .cs-seek::-moz-range-thumb { width: 26px; height: 26px; }
      .cs-music-vol { height: 34px; }
      .teatro-stk-handle { min-width: 44px; min-height: 44px; }
    }

    .cs-nav-row { display: flex; gap: 10px; justify-content: center; margin-top: 18px; }
    .cs-nav-row .btn { min-height: 48px; flex: 1; max-width: 220px; font-weight: 700; white-space: nowrap; }
    .cs-nav-row .btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
    .cs-gate-msg {
      text-align: center; font-size: .85rem; font-weight: 700; color: var(--c-text-soft);
      margin-top: 8px;
    }
    @media (max-width: 420px) {
      .cs-nav-row .btn { font-size: .82rem; padding-left: 10px; padding-right: 10px; }
      .cs-player-btn { min-width: 130px; padding: 13px 14px; font-size: .92rem; }
    }

    /* ── Two ways through a story ─────────────────────────────────
       The chooser a story opens on, and the note that replaces the
       question block while the story is playing itself. Built from the
       same tokens as the rest of the Historias screens — no new colours,
       no padlock: this is a choice, not a gate. */
    .cs-choose { text-align: center; max-width: 560px; margin: 0 auto; padding-top: 6px; }
    .cs-choose-cover {
      width: 100%; max-width: 420px; aspect-ratio: 16 / 10; object-fit: cover;
      border-radius: 18px; display: block; margin: 0 auto 16px;
    }
    .cs-choose-title { font-weight: 800; font-size: 1.3rem; line-height: 1.25; }
    .cs-choose-sub { color: var(--c-text-soft); font-size: .9rem; margin-top: 6px; }
    .cs-choose-opts { display: grid; gap: 12px; margin-top: 20px; }
    .cs-choose-btn {
      display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto auto;
      gap: 2px 14px; align-items: center; text-align: left;
      padding: 16px 18px; border-radius: 16px; cursor: pointer;
      background: var(--c-card); border: 2px solid var(--c-border);
      font: inherit; color: inherit; transition: border-color .15s, transform .15s;
    }
    .cs-choose-btn:hover { border-color: var(--c, var(--c-primary)); transform: translateY(-1px); }
    .cs-choose-ico { grid-row: 1 / 3; font-size: 1.7rem; text-align: center; }
    .cs-choose-name { font-weight: 800; font-size: 1rem; }
    .cs-choose-note { color: var(--c-text-soft); font-size: .84rem; }
    /* ── The listening pass, as a short film ──────────────────────
       A still that never moves reads as a slide, so each scene drifts
       slowly while its clip plays — alternating direction so six scenes
       do not all push the same way. Anyone who asks for less motion gets
       a still picture instead. */
    .cs-film { max-width: 760px; margin: 0 auto; }
    .cs-film-stage {
      position: relative; aspect-ratio: 16 / 10; overflow: hidden;
      border-radius: 18px; background: #0f1020;
      animation: cs-film-in .55s ease both;
    }
    .cs-film-img {
      width: 100%; height: 100%; object-fit: cover; display: block;
      transform-origin: center;
    }
    .cs-film-drift-a { animation: cs-drift-a 26s linear both; }
    .cs-film-drift-b { animation: cs-drift-b 26s linear both; }
    @keyframes cs-film-in { from { opacity: 0 } to { opacity: 1 } }
    @keyframes cs-drift-a { from { transform: scale(1.02) translate3d(0,0,0) } to { transform: scale(1.12) translate3d(-1.5%,-1%,0) } }
    @keyframes cs-drift-b { from { transform: scale(1.12) translate3d(1.5%,1%,0) } to { transform: scale(1.02) translate3d(0,0,0) } }
    @media (prefers-reduced-motion: reduce) {
      .cs-film-drift-a, .cs-film-drift-b, .cs-film-stage { animation: none; }
    }
    /* ── The question run: story left, questions right ───────────
       Built after Sandra pointed at Rockalingua's layout — the media
       holds the left, the list of things to do holds the right. All the
       questions are visible at once so a student can see how many are
       left; only the current one opens, which is also why the grading
       code did not have to change. */
    .cs-quiz { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 24px; align-items: start; }
    .cs-quiz-media { position: sticky; top: 92px; }
    .cs-quiz-replay { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
    .cs-quiz-replay-label { font-size: .82rem; color: var(--c-text-soft); font-weight: 600; }
    .cs-quiz-narration { margin-top: 12px; font-size: .95rem; line-height: 1.6; color: var(--c-text); }
    .cs-quiz-head {
      font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
      color: var(--c-text-soft); margin-bottom: 10px;
    }
    .cs-q-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
    .cs-q-item {
      display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; align-items: start;
      padding: 10px 12px; border-radius: 12px; background: var(--c-surface);
      font-size: .9rem; color: var(--c-text-soft);
    }
    .cs-q-item.is-open { background: transparent; padding: 0; gap: 10px; }
    .cs-q-item.is-done .cs-q-num { background: #2F6B38; color: #fff; }
    .cs-q-num {
      width: 28px; height: 28px; border-radius: 999px; display: grid; place-items: center;
      font-weight: 800; font-size: .8rem; color: #fff; background: var(--c-border);
    }
    .cs-q-item.is-open .cs-q-num { margin-top: 10px; }
    .cs-q-text { padding-top: 5px; }
    .cs-q-open { min-width: 0; }
    .cs-q-open .cs-question-card { margin: 0; }
    .cs-quiz-foot { margin-top: 16px; text-align: center; }
    @media (max-width: 999px) {
      .cs-quiz { grid-template-columns: minmax(0, 1fr); }
      .cs-quiz-media { position: static; }
    }

    .cs-film-portrait { position: absolute; inset: 0; }
    .cs-film-backdrop {
      position: absolute; inset: 0; background-size: cover; background-position: center;
      filter: blur(26px) saturate(1.1) brightness(.6); transform: scale(1.15);
    }
    .cs-film-tall {
      /* 96%, not 100%: the drifting backdrop behind it is scaled, and a
         portrait that exactly fills the stage picks up a hairline crop
         from any rounding. */
      position: relative; height: 96%; top: 2%; margin: 0 auto; display: block;
      width: auto; max-width: 100%; object-fit: contain;
      border-radius: 8px;
    }
    .cs-rate {
      display: inline-flex; align-items: center; gap: 5px;
      background: var(--c-surface); border-radius: 999px;
      padding: 7px 10px 7px 12px; font-size: .84rem; font-weight: 700; color: var(--c-text);
    }
    .cs-rate select {
      background: transparent; border: 0; font: inherit; font-weight: 700;
      color: inherit; cursor: pointer; padding: 0 2px;
    }
    .cs-film-count {
      position: absolute; right: 12px; bottom: 10px;
      background: rgba(0,0,0,.55); color: #fff; font-size: .78rem; font-weight: 700;
      padding: 4px 10px; border-radius: 999px; letter-spacing: .04em;
    }
    .cs-film-bar { position: relative; height: 22px; margin-top: 10px; }
    .cs-film-track {
      position: absolute; left: 0; right: 0; top: 9px; height: 5px;
      border-radius: 3px; background: var(--c-border);
    }
    .cs-film-fill { height: 100%; border-radius: 3px; transition: width .15s linear; }
    .cs-film-seek { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
    .cs-film-caption {
      text-align: center; font-size: 1.04rem; line-height: 1.6;
      padding: 14px 10px 4px; color: var(--c-text);
    }
    .cs-film-controls {
      display: flex; align-items: center; justify-content: center; gap: 10px;
      margin-top: 6px; flex-wrap: wrap;
    }
    .cs-film-btn {
      min-width: 56px; height: 44px; border-radius: 999px; border: none;
      color: #fff; font-size: 1rem; cursor: pointer; font: inherit; font-weight: 800;
    }
    .cs-film-btn-ghost { background: var(--c-surface); color: var(--c-text); }
    .cs-film-btn:disabled { opacity: .45; cursor: default; }
    .cs-film-foot {
      display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 16px;
    }
    @media (max-width: 480px) {
      .cs-film-caption { font-size: .96rem; }
    }

    @media (max-width: 420px) {
      .cs-choose-title { font-size: 1.12rem; }
      .cs-choose-btn { padding: 14px; gap: 2px 10px; }
    }

    .cs-vocab { margin-top: 18px; margin-bottom: 0; }
    .cs-vocab summary {
      cursor: pointer; font-weight: 700; font-size: .9rem; color: var(--c-text-soft);
      padding: 10px 4px;
    }
    .cs-vocab-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; padding: 8px 4px 4px; }
    @media (max-width: 480px) { .cs-vocab-list { grid-template-columns: 1fr; } }
    .cs-vocab-item { font-size: .85rem; color: var(--c-text-soft); }
    .cs-vocab-item strong { color: var(--c-text); }

    .cs-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }

    .cs-question-card {
      background: var(--c-card); border-radius: 20px; padding: 26px 22px;
      box-shadow: 0 4px 18px rgba(0,0,0,.1); margin-top: 18px;
    }
    .cs-question-prompt { font-size: 1.05rem; font-weight: 700; margin-bottom: 16px; }
    .cs-verb-shown {
      display: inline-block; font-size: 1.3rem; font-weight: 900; color: #0ea5e9;
      background: rgba(14,165,233,.12); border-radius: 12px; padding: 8px 16px; margin-bottom: 16px;
    }
    .cs-options { display: flex; flex-direction: column; gap: 10px; }
    .cs-option-btn {
      text-align: left; padding: 13px 16px; border-radius: 12px;
      border: 2px solid var(--c-border); background: var(--c-bg);
      font-size: .95rem; font-weight: 600; font-family: inherit; color: var(--c-text);
      cursor: pointer; transition: all .15s;
    }
    .cs-option-btn:hover:not(:disabled) { border-color: #0ea5e9; }
    .cs-option-btn.selected { border-color: #0ea5e9; background: rgba(14,165,233,.1); }
    .cs-option-btn.correct { border-color: #10b981; background: rgba(16,185,129,.12); color: #10b981; font-weight: 800; }
    .cs-option-btn.wrong   { border-color: #ef4444; background: rgba(239,68,68,.1); color: #ef4444; }
    .cs-option-btn:disabled { cursor: default; }
    /* An option already tried and missed: struck through, so the second
       go is a real choice and not the same shot again. */
    .cs-option-btn.wrong:disabled { text-decoration: line-through; opacity: .8; }
    .cs-text-input {
      width: 100%; padding: 13px 16px; border-radius: 12px; border: 2px solid var(--c-border);
      font-size: 1rem; font-family: inherit; background: var(--c-bg); color: var(--c-text);
      outline: none; box-sizing: border-box; transition: border-color .15s;
    }
    .cs-text-input:focus { border-color: #0ea5e9; }
    .cs-text-input.correct { border-color: #10b981; background: rgba(16,185,129,.08); }
    .cs-text-input.wrong   { border-color: #ef4444; background: rgba(239,68,68,.08); }

    .cs-feedback { margin-top: 16px; padding: 12px 16px; border-radius: 12px; font-weight: 700; font-size: .92rem; }
    .cs-feedback.correct { background: rgba(16,185,129,.12); color: #10b981; }
    .cs-feedback.wrong    { background: rgba(239,68,68,.1); color: #ef4444; }
    /* Missed, but not over: amber, not red — the answer is still theirs
       to find. Also used for the «choose an answer» nudge. */
    .cs-feedback.retry    { background: rgba(245,158,11,.12); color: #b45309; }

    .cs-snapshot {
      text-align: left; background: rgba(14,165,233,.08); border-radius: 14px;
      padding: 16px 18px; margin-top: 20px;
    }
    .cs-snapshot-title { font-weight: 800; font-size: .88rem; color: #0ea5e9; margin-bottom: 6px; }
    .cs-snapshot-fact  { font-size: .9rem; line-height: 1.5; color: var(--c-text); }
    .cs-stats-grid { display: flex; gap: 10px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
    .cs-stat {
      display: flex; flex-direction: column; align-items: center; gap: 2px;
      background: var(--c-bg); border-radius: 12px; padding: 10px 18px; min-width: 80px;
    }
    .cs-stat-val { font-weight: 900; font-size: 1.2rem; color: #0ea5e9; }
    .cs-stat-label { font-size: .72rem; color: var(--c-text-soft); font-weight: 700; }

    /* ── EXAM MODE ──────────────────────────────────────────── */
    .exam-wrap  { max-width: 680px; margin: 0 auto; padding: 20px 16px 80px; }
    .exam-setup-card {
      background: var(--c-card); border-radius: 22px; padding: 28px 24px;
      box-shadow: 0 4px 18px rgba(0,0,0,.09);
    }
    .exam-setup-title { font-size: 1.35rem; font-weight: 900; text-align: center; margin-bottom: 6px; }
    .exam-setup-sub   { font-size: .88rem; color: var(--c-text-soft); text-align: center; margin-bottom: 22px; }
    .exam-field       { margin-bottom: 16px; }
    .exam-label       { font-weight: 700; font-size: .85rem; margin-bottom: 6px; color: var(--c-text); }
    .exam-input, .exam-select {
      width: 100%; padding: 11px 14px; border-radius: 12px;
      border: 2px solid var(--c-border); font-size: .95rem;
      font-family: inherit; background: var(--c-bg);
      color: var(--c-text); outline: none; box-sizing: border-box;
      transition: border-color .2s;
    }
    .exam-input:focus, .exam-select:focus { border-color: #6366f1; }
    .exam-row { display: flex; gap: 12px; }
    .exam-row .exam-field { flex: 1; }
    .exam-num-btns { display: flex; gap: 8px; flex-wrap: wrap; }
    .exam-num-btn {
      padding: 8px 16px; border-radius: 10px; border: 2px solid var(--c-border);
      background: var(--c-bg); font-weight: 700; font-size: .88rem;
      cursor: pointer; transition: all .15s; color: var(--c-text);
    }
    .exam-num-btn.active { background: #6366f1; color: #fff; border-color: #6366f1; }

    /* exam play */
    .exam-play-header {
      display: flex; align-items: center; justify-content: space-between;
      background: var(--c-card); border-radius: 16px; padding: 14px 18px;
      margin-bottom: 18px; box-shadow: 0 2px 8px rgba(0,0,0,.07);
    }
    .exam-timer {
      font-size: 1.4rem; font-weight: 900; font-variant-numeric: tabular-nums;
      color: #6366f1;
    }
    .exam-timer.urgent { color: #ef4444; animation: pulse 1s infinite; }
    @keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.5} }
    .exam-progress-text { font-size: .85rem; font-weight: 700; color: var(--c-text-soft); }
    .exam-q-card {
      background: var(--c-card); border-radius: 20px; padding: 28px 24px;
      box-shadow: 0 4px 18px rgba(0,0,0,.09); margin-bottom: 16px;
    }
    .exam-q-num   { font-size: .78rem; font-weight: 700; color: var(--c-text-soft); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 10px; }
    .exam-q-prompt { font-size: 1.1rem; font-weight: 700; margin-bottom: 18px; line-height: 1.5; }
    .exam-q-pronoun { display: inline-block; background: rgba(99,102,241,.1); color: #6366f1; font-weight: 800; padding: 2px 10px; border-radius: 99px; font-size: .9rem; margin-right: 4px; }
    .exam-q-input {
      width: 100%; padding: 14px 16px; border-radius: 14px;
      border: 2.5px solid var(--c-border); font-size: 1.1rem;
      font-weight: 700; font-family: inherit; background: var(--c-bg);
      color: var(--c-text); outline: none; box-sizing: border-box;
      transition: border-color .2s;
    }
    .exam-q-input:focus { border-color: #6366f1; }
    .exam-q-input.correct { border-color: #10b981; background: rgba(16,185,129,.08); }
    .exam-q-input.wrong   { border-color: #ef4444; background: rgba(239,68,68,.07); }
    .exam-q-feedback { font-size: .85rem; margin-top: 8px; font-weight: 700; min-height: 20px; }
    .exam-nav-row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 12px; }

    /* exam results */
    .exam-results-card {
      background: var(--c-card); border-radius: 22px; padding: 32px 24px;
      box-shadow: 0 6px 24px rgba(0,0,0,.1); text-align: center;
    }
    .exam-results-emoji { font-size: 3.5rem; margin-bottom: 12px; }
    .exam-results-title { font-size: 1.5rem; font-weight: 900; margin-bottom: 6px; }
    .exam-results-name  { font-size: 1rem; color: var(--c-text-soft); margin-bottom: 16px; }
    .exam-results-pct   { font-size: 3.5rem; font-weight: 900; line-height: 1; }
    .exam-results-grade { font-size: 1rem; font-weight: 700; margin-top: 4px; margin-bottom: 20px; }
    .exam-stats-row { display: flex; gap: 12px; justify-content: center; margin-bottom: 24px; flex-wrap: wrap; }
    .exam-stat-box { background: var(--c-bg); border-radius: 14px; padding: 14px 20px; min-width: 90px; }
    .exam-stat-val  { font-size: 1.6rem; font-weight: 900; }
    .exam-stat-lbl  { font-size: .75rem; color: var(--c-text-soft); margin-top: 2px; }
    .exam-answers-list { text-align: left; margin-top: 16px; }
    .exam-ans-row {
      display: flex; align-items: flex-start; gap: 10px;
      padding: 10px 0; border-bottom: 1px solid var(--c-border); font-size: .88rem;
    }
    .exam-ans-row:last-child { border-bottom: none; }
    .ear-icon  { flex-shrink: 0; font-size: 1rem; margin-top: 1px; }
    .ear-verb  { font-weight: 800; }
    .ear-detail { color: var(--c-text-soft); font-size: .8rem; }
    .ear-user  { font-weight: 700; }
    .ear-correct{ color: #10b981; font-weight: 700; }

    /* ============================================================
       FLASHCARDS
    ============================================================ */
    .fc-toolbar {
      display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
      margin-bottom: 18px;
    }
    .fc-toolbar label { font-size: .85rem; font-weight: 700; color: var(--c-text-soft); }
    .fc-toolbar select {
      padding: 8px 12px; border-radius: var(--radius-sm); border: 1.5px solid var(--c-border);
      background: var(--c-surface); font-family: inherit; font-size: .9rem; font-weight: 600;
    }
    .fc-counter { font-size: .85rem; color: var(--c-text-soft); font-weight: 700; margin-left: auto; }

    .fc-stage { display: flex; flex-direction: column; align-items: center; gap: 22px; }

    .fc-card-scene {
      width: 100%; max-width: 480px; min-height: 280px;
      perspective: 1400px;
    }
    .fc-card {
      width: 100%; height: 100%; min-height: 280px;
      position: relative;
      transform-style: preserve-3d;
      transition: transform .5s cubic-bezier(.4,0,.2,1);
      cursor: pointer;
      background: none; border: none; padding: 0; font: inherit; text-align: inherit;
      display: block;
    }
    .fc-card[aria-pressed="true"] { transform: rotateY(180deg); }
    /* role="button" div, not a real <button> — it needs to legally contain
       the front/back audio buttons (a real <button> can't nest <button>s;
       the browser silently breaks the markup if you try). No native focus
       ring on a div, so it needs one explicitly. */
    .fc-card:focus-visible { outline: 3px solid var(--c-accent2); outline-offset: 4px; }
    .fc-card-face {
      position: absolute; inset: 0;
      display: flex; flex-direction: column; align-items: center; justify-content: center;
      gap: 14px; padding: 28px 24px;
      border-radius: var(--radius-xl);
      box-shadow: var(--shadow-lg);
      backface-visibility: hidden;
      -webkit-backface-visibility: hidden;
    }
    .fc-card-front {
      background: linear-gradient(135deg, var(--c-accent2), #8a83ff);
      color: #fff;
    }
    .fc-card-back {
      background: var(--c-surface);
      border: 2.5px solid var(--c-border);
      transform: rotateY(180deg);
      gap: 10px;
    }
    .fc-front-inf { font-size: clamp(1.8rem, 6vw, 2.6rem); font-weight: 900; text-align: center; }
    .fc-front-hint { font-size: .8rem; opacity: .85; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
    .fc-back-en { font-size: clamp(1.2rem, 4vw, 1.5rem); font-weight: 800; color: var(--c-text); text-align: center; }
    .fc-back-example { font-size: .95rem; color: var(--c-text-soft); text-align: center; line-height: 1.5; max-width: 38ch; margin-top: 4px; }
    .fc-audio-btn {
      display: inline-flex; align-items: center; gap: 6px;
      padding: 8px 14px; border-radius: 99px; border: 1.5px solid var(--c-border);
      background: var(--c-surface2); color: var(--c-text); font-size: .8rem; font-weight: 700;
      cursor: pointer;
    }
    .fc-audio-btn:hover { border-color: var(--c-accent2); color: var(--c-accent2); }
    .fc-audio-btn svg { width: 16px; height: 16px; }
    /* Front face sits on a colored gradient — the default light-gray
       pill would clash, so the audio button there gets a translucent
       white treatment that reads on any accent color. */
    .fc-audio-btn-front {
      background: rgba(255,255,255,.18);
      border-color: rgba(255,255,255,.5);
      color: #fff;
    }
    .fc-audio-btn-front:hover { background: rgba(255,255,255,.28); border-color: #fff; color: #fff; }

    .fc-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
    .fc-empty { text-align: center; padding: 40px 20px; color: var(--c-text-soft); }

    @media (prefers-reduced-motion: reduce) {
      .fc-card { transition: none; }
    }
    @media (max-width: 520px) {
      .fc-card-scene { min-height: 240px; }
      .fc-card, .fc-card-face { min-height: 240px; }
      .fc-toolbar { gap: 8px; }
      .fc-counter { margin-left: 0; width: 100%; text-align: center; }
    }

    /* ── Recursos para el aula ─────────────────────────────────── */
    .rl-hero {
      background: linear-gradient(135deg, var(--c-primary) 0%, #7c3aed 100%);
      border-radius: var(--radius-xl);
      padding: 36px 32px;
      margin-bottom: 32px;
      color: #fff;
      position: relative;
      overflow: hidden;
    }
    .rl-hero::before {
      content: '';
      position: absolute;
      right: -40px; top: -40px;
      width: 220px; height: 220px;
      border-radius: 50%;
      background: rgba(255,255,255,.08);
    }
    .rl-hero::after {
      content: '';
      position: absolute;
      right: 60px; bottom: -60px;
      width: 160px; height: 160px;
      border-radius: 50%;
      background: rgba(255,255,255,.05);
    }
    .rl-hero-title {
      font-family: var(--font-display);
      font-weight: var(--font-display-weight);
      font-size: 1.7rem;
      margin-bottom: 6px;
      position: relative; z-index: 1;
    }
    .rl-hero-sub {
      font-size: .93rem;
      opacity: .88;
      line-height: 1.55;
      position: relative; z-index: 1;
    }
    .rl-cat-bar {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      margin-bottom: 32px;
    }
    /* Folder grid — Recursos landing, styled to match the Actividades cards. */
    .rl-folder-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
      gap: 20px;
      margin-top: 8px;
    }
    .rl-folder {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 5px;
      background: var(--c-surface);
      border: 2.5px solid var(--c-border);
      border-radius: var(--radius-xl);
      padding: 28px 20px 24px;
      text-align: center;
      font-family: inherit;
      cursor: pointer;
      transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
    }
    .rl-folder:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
    .rl-folder-icon {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 68px; height: 68px;
      border-radius: 50%;
      margin-bottom: 12px;
    }
    .rl-folder-icon svg { width: 36px; height: 36px; display: block; }
    .rl-folder-name { font-weight: 800; font-size: 1.05rem; line-height: 1.2; }
    .rl-folder-count { font-size: .8rem; color: var(--c-text-soft); }
    .rl-folder-open-head {
      display: flex;
      align-items: center;
      gap: 14px;
      margin-bottom: 22px;
    }
    .rl-folder-open-title { font-size: 1.25rem; font-weight: 800; margin: 0; }
    @media (max-width: 600px) {
      .rl-folder-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
    }
    .rl-cat-pill {
      display: inline-flex;
      align-items: center;
      gap: 7px;
      padding: 9px 20px;
      border-radius: 99px;
      font-size: .875rem;
      font-weight: 700;
      font-family: inherit;
      border: 2px solid var(--rl-pill-color, var(--c-primary));
      background: transparent;
      color: var(--rl-pill-color, var(--c-primary));
      cursor: pointer;
      transition: background .18s ease, color .18s ease, box-shadow .18s ease, transform .15s ease;
      white-space: nowrap;
    }
    .rl-cat-pill:hover:not(.active) {
      background: rgba(0,0,0,.06);
      transform: translateY(-1px);
    }
    .rl-cat-pill.active {
      background: var(--rl-pill-color, var(--c-primary));
      color: #fff;
      box-shadow: 0 4px 18px rgba(0,0,0,.18);
      transform: translateY(-1px);
    }
    .rl-empty-state {
      text-align: center;
      padding: 64px 24px 80px;
    }
    .rl-empty-icon {
      font-size: 3.2rem;
      line-height: 1;
      margin-bottom: 16px;
      opacity: .75;
    }
    .rl-empty-title {
      font-family: var(--font-display);
      font-weight: var(--font-display-weight);
      font-size: 1.35rem;
      color: var(--c-text);
      margin-bottom: 8px;
    }
    .rl-empty-sub {
      font-size: .9rem;
      color: var(--c-text-soft);
      line-height: 1.65;
      max-width: 380px;
      margin: 0 auto;
    }
    .rl-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
      gap: 22px;
    }
    .rl-card {
      background: var(--c-surface);
      border-radius: var(--radius-xl);
      border: 1.5px solid var(--c-border);
      box-shadow: 0 2px 12px rgba(0,0,0,.07);
      overflow: hidden;
      transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
      display: flex;
      flex-direction: column;
      cursor: pointer;
    }
    .rl-card:hover {
      transform: translateY(-5px);
      box-shadow: 0 12px 32px rgba(0,0,0,.13);
      border-color: var(--rl-color, var(--c-primary));
    }
    .rl-thumb-wrap {
      position: relative;
      width: 100%;
      aspect-ratio: 3 / 4;
      overflow: hidden;
      background: var(--c-surface2);
      flex-shrink: 0;
    }
    .rl-thumb {
      width: 100%;
      height: 100%;
      object-fit: cover;
      object-position: top center;
      display: block;
      transition: transform .25s ease;
    }
    .rl-card:hover .rl-thumb { transform: scale(1.03); }
    .rl-thumb-overlay {
      position: absolute;
      inset: 0;
      background: linear-gradient(to bottom, transparent 55%, rgba(0,0,0,.35) 100%);
      pointer-events: none;
    }
    .rl-pages-badge {
      position: absolute;
      bottom: 10px;
      right: 10px;
      background: rgba(0,0,0,.55);
      color: #fff;
      font-size: .72rem;
      font-weight: 700;
      padding: 3px 9px;
      border-radius: 99px;
      backdrop-filter: blur(4px);
    }
    .rl-body {
      padding: 16px 18px 18px;
      display: flex;
      flex-direction: column;
      flex: 1;
      gap: 8px;
    }
    .rl-badge {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      font-size: .72rem;
      font-weight: 800;
      letter-spacing: .04em;
      text-transform: uppercase;
      padding: 4px 10px;
      border-radius: 99px;
      width: fit-content;
      color: #fff;
      background: var(--rl-color, var(--c-primary));
    }
    .rl-title {
      font-family: var(--font-display);
      font-weight: var(--font-display-weight);
      font-size: 1rem;
      line-height: 1.35;
      color: var(--c-text);
    }
    .rl-meta {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin-top: 2px;
    }
    .rl-chip {
      font-size: .73rem;
      color: var(--c-text-soft);
      background: var(--c-surface2);
      padding: 3px 9px;
      border-radius: 99px;
      font-weight: 600;
    }
    .rl-btn {
      margin-top: auto;
      padding-top: 12px;
      display: block;
      width: 100%;
      text-align: center;
      background: var(--rl-color, var(--c-primary));
      color: #fff;
      font-size: .82rem;
      font-weight: 800;
      letter-spacing: .04em;
      border: none;
      border-radius: var(--radius-lg);
      padding: 10px 16px;
      cursor: pointer;
      font-family: inherit;
      transition: filter .15s ease, transform .1s ease;
    }
    .rl-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
    .rl-btn:active { transform: scale(.98); }
    @media (max-width: 700px) {
      .rl-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
      .rl-hero { padding: 26px 20px; }
      .rl-hero-title { font-size: 1.35rem; }
      .rl-cat-pill { font-size: .8rem; padding: 7px 14px; }
    }
    @media (max-width: 480px) {
      .rl-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
      .rl-cat-pill { font-size: .75rem; padding: 6px 12px; gap: 5px; }
    }

