    :root {
      --accent: #3b82f6;
      --accent2: #10b981;
      --danger: #ef4444;
      --bg: #09111f;
      --surface: #0f1e33;
      --surface2: #162540;
      --border: #1e3a5f;
      --text: #e2e8f0;
      --muted: #64748b;
    }

    * { box-sizing: border-box; }

    body {
      background: var(--bg);
      color: var(--text);
      font-family: 'Syne', sans-serif;
      min-height: 100vh;
    }

    code, pre, .mono { font-family: 'Space Mono', monospace; }

    .glass {
      background: rgba(15, 30, 51, 0.85);
      backdrop-filter: blur(16px);
      border: 1px solid var(--border);
    }

    /* ── Auth overlay ───────────────────────────────────────────── */
    #auth-overlay {
      position: fixed; inset: 0; z-index: 9999;
      background: var(--bg);
      display: flex; align-items: center; justify-content: center;
      padding: 1rem;
    }
    #auth-overlay.hidden { display: none; }

    .auth-card {
      width: 100%; max-width: 420px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 1.5rem;
      padding: 2.5rem 2rem;
      box-shadow: 0 25px 60px rgba(0,0,0,0.5);
    }

    .auth-tab-btn {
      flex: 1; padding: .6rem; border-radius: .6rem;
      font-size: .8rem; font-weight: 700; letter-spacing: .05em;
      text-transform: uppercase; transition: all .2s;
      background: transparent; color: var(--muted); border: none; cursor: pointer;
    }
    .auth-tab-btn.active {
      background: var(--accent); color: #fff;
    }

    .auth-error {
      background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.3);
      color: #fca5a5; border-radius: .75rem;
      padding: .75rem 1rem; font-size: .8rem; display: none;
    }
    .auth-error.show { display: block; }

    .auth-success {
      background: rgba(16,185,129,.1); border: 1px solid rgba(16,185,129,.3);
      color: #6ee7b7; border-radius: .75rem;
      padding: .75rem 1rem; font-size: .8rem; display: none;
    }
    .auth-success.show { display: block; }

    /* ── User chip en el header ─────────────────────────────────── */
    #user-chip {
      display: flex; align-items: center; gap: .6rem;
      background: var(--surface2); border: 1px solid var(--border);
      border-radius: 999px; padding: .35rem .35rem .35rem .85rem;
      font-size: .75rem; cursor: default;
    }
    #user-chip.hidden { display: none; }
    #user-chip .avatar {
      width: 28px; height: 28px; border-radius: 50%;
      background: linear-gradient(135deg, var(--accent), var(--accent2));
      display: flex; align-items: center; justify-content: center;
      font-size: .7rem; font-weight: 800; color: #fff; flex-shrink: 0;
    }
    #btn-logout {
      background: rgba(239,68,68,.15); border: 1px solid rgba(239,68,68,.25);
      color: #fca5a5; border-radius: 999px;
      padding: .25rem .7rem; font-size: .7rem; font-weight: 700;
      cursor: pointer; transition: background .2s;
    }
    #btn-logout:hover { background: rgba(239,68,68,.3); }

    /* Grid de fondo */
    .bg-grid {
      background-image:
        linear-gradient(rgba(59,130,246,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59,130,246,0.04) 1px, transparent 1px);
      background-size: 40px 40px;
    }

    /* Scrollbar */
    ::-webkit-scrollbar { width: 4px; }
    ::-webkit-scrollbar-track { background: var(--bg); }
    ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
    ::-webkit-scrollbar-thumb:hover { background: var(--accent); }

    /* Tabs */
    .tab-btn { transition: all .2s; position: relative; }
    .tab-btn.active { color: var(--accent); }
    .tab-btn.active::after {
      content: '';
      position: absolute;
      bottom: -2px; left: 0; right: 0;
      height: 2px;
      background: var(--accent);
      border-radius: 2px;
    }

    /* Cards de pregunta en editor */
    .q-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 12px;
      transition: border-color .2s;
    }
    .q-card:hover { border-color: rgba(59,130,246,0.4); }

    /* Toggle */
    .toggle-track {
      width: 48px; height: 26px;
      background: var(--surface2);
      border-radius: 13px;
      position: relative;
      transition: background .2s;
      cursor: pointer;
      border: 1px solid var(--border);
    }
    .toggle-track.on { background: var(--accent); }
    .toggle-thumb {
      position: absolute;
      top: 3px; left: 3px;
      width: 18px; height: 18px;
      background: white;
      border-radius: 50%;
      transition: transform .2s;
      pointer-events: none;
    }
    .toggle-track.on .toggle-thumb { transform: translateX(22px); }

    /* Bloque badges */
    .badge-b1 { background: rgba(59,130,246,0.15); color: #60a5fa; border: 1px solid rgba(59,130,246,0.3); }
    .badge-b2 { background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.3); }
    .badge-b3 { background: rgba(245,158,11,0.15); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
    .badge-b4 { background: rgba(168,85,247,0.15); color: #c084fc; border: 1px solid rgba(168,85,247,0.3); }

    /* Input / select estilo base */
    .field {
      background: var(--surface2);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 10px 14px;
      color: var(--text);
      outline: none;
      transition: border-color .2s;
      width: 100%;
      font-family: 'Syne', sans-serif;
    }
    .field:focus { border-color: var(--accent); }
    textarea.field { resize: vertical; }

    /* Respuesta opción */
    .opt-btn {
      width: 100%; text-align: left;
      padding: 14px 18px;
      border-radius: 10px;
      border: 1px solid var(--border);
      background: var(--surface);
      color: var(--text);
      transition: all .15s;
      cursor: pointer;
      font-family: 'Syne', sans-serif;
    }
    .opt-btn:hover:not(:disabled) { border-color: var(--accent); background: rgba(59,130,246,0.08); }
    .opt-btn.correct { border-color: #10b981 !important; background: rgba(16,185,129,0.12) !important; }
    .opt-btn.wrong { border-color: #ef4444 !important; background: rgba(239,68,68,0.10) !important; }
    .opt-btn:disabled { cursor: default; }

    /* Progress bar */
    .progress-bar {
      height: 3px;
      background: var(--surface2);
      border-radius: 2px;
      overflow: hidden;
    }
    .progress-fill {
      height: 100%;
      background: linear-gradient(90deg, var(--accent), var(--accent2));
      transition: width .4s ease;
      border-radius: 2px;
    }

    /* Animaciones */
    @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
    @keyframes scaleIn { from { transform: scale(.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
    .anim-fade { animation: fadeIn .3s ease forwards; }
    .anim-scale { animation: scaleIn .25s ease forwards; }

    /* LED */
    .led { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
    .led-off { background: #334155; }
    .led-ok { background: #10b981; box-shadow: 0 0 6px #10b981; }
    .led-err { background: #ef4444; box-shadow: 0 0 6px #ef4444; }
    .led-wait { background: #f59e0b; animation: pulse 1s infinite; }
    @keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }

    /* Sidebar */
    .sidebar-item {
      padding: 8px 12px;
      border-radius: 8px;
      cursor: pointer;
      transition: all .15s;
      font-size: 12px;
      color: var(--muted);
      border: 1px solid transparent;
    }
    .sidebar-item:hover { background: var(--surface2); color: var(--text); }
    .sidebar-item.active { background: rgba(59,130,246,0.12); color: var(--accent); border-color: rgba(59,130,246,0.3); }

    /* Modal */
    .modal-overlay {
      position: fixed; inset: 0;
      background: rgba(0,0,0,0.7);
      display: flex; align-items: center; justify-content: center;
      z-index: 100;
      padding: 16px;
    }
    .modal-box {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 16px;
      padding: 28px;
      max-width: 560px; width: 100%;
      max-height: 90vh;
      overflow-y: auto;
    }

    /* Spinner */
    .spinner {
      width: 20px; height: 20px;
      border: 2px solid var(--border);
      border-top-color: var(--accent);
      border-radius: 50%;
      animation: spin .6s linear infinite;
      display: inline-block;
    }
    @keyframes spin { to { transform: rotate(360deg); } }

    /* Btn primario */
    .btn-primary {
      background: var(--accent);
      color: white;
      border: none;
      border-radius: 10px;
      padding: 12px 20px;
      font-family: 'Syne', sans-serif;
      font-weight: 700;
      cursor: pointer;
      transition: opacity .15s, transform .1s;
      font-size: 14px;
    }
    .btn-primary:hover { opacity: .88; }
    .btn-primary:active { transform: scale(.97); }

    .btn-secondary {
      background: var(--surface2);
      color: var(--text);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 12px 20px;
      font-family: 'Syne', sans-serif;
      font-weight: 600;
      cursor: pointer;
      transition: all .15s;
      font-size: 14px;
    }
    .btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

    .btn-danger {
      background: rgba(239,68,68,0.1);
      color: #ef4444;
      border: 1px solid rgba(239,68,68,0.3);
      border-radius: 10px;
      padding: 8px 14px;
      font-family: 'Syne', sans-serif;
      font-weight: 600;
      cursor: pointer;
      transition: all .15s;
      font-size: 12px;
    }
    .btn-danger:hover { background: rgba(239,68,68,0.2); }

    /* Select option fix */
    option { background: var(--surface); }
