/* ============================================================
   CAT STUDY QUIZ — Design System v2.0
   Tema: Dark Mode Clínico + Gaming Accent
   Tipografía: Space Grotesk (display) / Plus Jakarta Sans (body)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ============================================================
   1. TOKENS DE DISEÑO (CSS Custom Properties)
   ============================================================ */
:root {
  /* --- Colores base (dark mode default) --- */
  --bg:          #080B12;
  --bg2:         #0D1117;
  --surface:     #111827;
  --surface2:    #1A2332;
  --surface3:    #243044;
  --border:      #1E2D42;
  --border-soft: #162032;

  /* --- Colores de marca --- */
  --green:       #00D68F;
  --green-dim:   rgba(0, 214, 143, 0.12);
  --green-glow:  rgba(0, 214, 143, 0.25);
  --blue:        #3B82F6;
  --blue-dim:    rgba(59, 130, 246, 0.12);
  --blue-glow:   rgba(59, 130, 246, 0.25);
  --gold:        #F0B929;
  --gold-dim:    rgba(240, 185, 41, 0.12);
  --red:         #F43F5E;
  --red-dim:     rgba(244, 63, 94, 0.12);
  --purple:      #8B5CF6;
  --purple-dim:  rgba(139, 92, 246, 0.12);

  /* --- Texto --- */
  --text:        #F1F5F9;
  --text-soft:   #CBD5E1;
  --muted:       #64748B;
  --muted-soft:  #475569;

  /* --- Tipografía --- */
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body:    'Plus Jakarta Sans', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;

  /* --- Radios --- */
  --r-xs:  4px;
  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  20px;
  --r-2xl: 28px;
  --r-full: 9999px;

  /* --- Sombras --- */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.3);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.35);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.45);
  --shadow-glow-green: 0 0 20px rgba(0, 214, 143, 0.2);
  --shadow-glow-blue:  0 0 20px rgba(59, 130, 246, 0.2);

  /* --- Transiciones --- */
  --t-fast: 120ms ease;
  --t-mid:  200ms ease;
  --t-slow: 350ms ease;

  /* --- Ink alias (compatibilidad legado) --- */
  --ink:    var(--text);
  --paper:  var(--bg);
  --paper2: var(--surface);
  --paper3: var(--surface2);
  --gray:   var(--muted);
}

/* Light mode override */
[data-theme="light"] {
  --bg:          #F0F4F8;
  --bg2:         #E8EEF5;
  --surface:     #FFFFFF;
  --surface2:    #F1F5F9;
  --surface3:    #E2E8F0;
  --border:      #CBD5E1;
  --border-soft: #E2E8F0;
  --text:        #0F172A;
  --text-soft:   #1E293B;
  --muted:       #64748B;
  --muted-soft:  #94A3B8;
  --green:       #059669;
  --green-dim:   rgba(5, 150, 105, 0.1);
  --blue:        #2563EB;
  --blue-dim:    rgba(37, 99, 235, 0.1);
  --gold:        #D97706;
  --gold-dim:    rgba(217, 119, 6, 0.1);
  --red:         #E11D48;
  --red-dim:     rgba(225, 29, 72, 0.1);

  /* Alias legado */
  --ink:    var(--text);
  --paper:  var(--bg);
  --paper2: var(--surface);
  --paper3: var(--surface2);
}

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

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.55;
  overflow-x: hidden;
}

/* Scrollbar personalizado */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--surface3) transparent;
}
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--surface3);
  border-radius: var(--r-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--muted-soft); }

::selection {
  background: var(--green-dim);
  color: var(--green);
}

/* ============================================================
   3. LAYOUT PRINCIPAL
   ============================================================ */
#app-container {
  max-width: 430px;
  margin: 0 auto;
  height: 100vh;
  height: 100dvh;
  background-color: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
  border-left: 1px solid var(--border-soft);
  border-right: 1px solid var(--border-soft);
  overflow: hidden;
}

/* ============================================================
   4. HEADER
   ============================================================ */
header {
  padding: 0 14px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(8, 11, 18, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 10;
  flex-shrink: 0;
  height: 58px;
  position: sticky;
  top: 0;
}

.logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

/* Badge de puntos */
.points-badge {
  font-family: var(--font-mono);
  background: var(--gold-dim);
  color: var(--gold);
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid rgba(240, 185, 41, 0.2);
  letter-spacing: 0.02em;
}

/* Avatar circular */
#user-avatar-home {
  background: linear-gradient(135deg, var(--blue), var(--purple)) !important;
  border: 2px solid var(--border) !important;
  transition: border-color var(--t-mid), box-shadow var(--t-mid);
}
#user-avatar-home:hover {
  border-color: var(--green) !important;
  box-shadow: 0 0 0 3px var(--green-dim);
}

/* Botón PRO */
.pro-button {
  font-family: var(--font-display);
  font-size: 0.62rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.03em;
  background: linear-gradient(135deg, #F0B929, #F97316) !important;
  color: #000 !important;
  border-radius: var(--r-full) !important;
  padding: 3px 10px !important;
  transition: transform var(--t-fast), box-shadow var(--t-mid);
  box-shadow: 0 2px 8px rgba(240, 185, 41, 0.3);
}
.pro-button:hover {
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 4px 14px rgba(240, 185, 41, 0.45);
}

/* Racha (streak badge) */
#streak-badge {
  background: var(--gold-dim) !important;
  color: var(--gold) !important;
  border: 1px solid rgba(240, 185, 41, 0.2) !important;
  font-size: 0.72rem;
  font-weight: 600;
}

/* ============================================================
   5. VISTAS (.view)
   ============================================================ */
.view {
  display: none !important;
  width: 100%;
  flex-direction: column;
  padding: 14px 14px 0;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.view.active {
  display: flex !important;
  visibility: visible !important;
  position: relative !important;
  pointer-events: auto !important;
  overflow-y: auto !important;
}

.view:not(.active) {
  visibility: hidden !important;
  position: absolute !important;
  pointer-events: none !important;
  height: 0 !important;
  overflow: hidden !important;
  padding: 0 !important;
}

/* Vistas específicas con scroll */
#view-home { overflow-y: auto !important; padding-bottom: 88px; }
#view-upload { overflow-y: auto !important; overflow-x: hidden !important; padding-bottom: 100px !important; }
#view-settings { overflow-y: auto !important; overflow-x: hidden; padding-bottom: 100px; }
#view-topic { overflow-y: auto !important; overflow-x: hidden !important; padding-bottom: 100px !important; }
#view-quiz { overflow: hidden !important; }

/* ============================================================
   6. NAVEGACIÓN INFERIOR
   ============================================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  background: rgba(8, 11, 18, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-soft);
  display: flex;
  justify-content: space-around;
  padding: 8px 0 10px;
  z-index: 100;
  flex-shrink: 0;
  height: 68px;
}

.nav-item {
  background: none;
  border: none;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  margin-bottom: 0 !important;
  transition: color var(--t-mid), transform var(--t-fast);
  border-radius: var(--r-md);
  padding: 6px 12px;
  position: relative;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.nav-item svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  transition: transform var(--t-mid);
}

.nav-item:hover { transform: translateY(-2px); }
.nav-item:hover svg { transform: scale(1.08); }

/* Indicador activo — pill bajo el icono */
.nav-item::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 20px;
  height: 2px;
  border-radius: var(--r-full);
  transition: transform var(--t-mid);
}

.nav-item[data-target="home"].active  { color: var(--green); }
.nav-item[data-target="home"].active::after  { background: var(--green); transform: translateX(-50%) scaleX(1); }
.nav-item[data-target="upload"].active { color: var(--blue); }
.nav-item[data-target="upload"].active::after { background: var(--blue); transform: translateX(-50%) scaleX(1); }
.nav-item[data-target="quiz"].active  { color: var(--gold); }
.nav-item[data-target="quiz"].active::after  { background: var(--gold); transform: translateX(-50%) scaleX(1); }
.nav-item[data-target="settings"].active { color: var(--red); }
.nav-item[data-target="settings"].active::after { background: var(--red); transform: translateX(-50%) scaleX(1); }

.nav-item[data-target="home"]:hover   { color: var(--green); }
.nav-item[data-target="upload"]:hover { color: var(--blue); }
.nav-item[data-target="quiz"]:hover   { color: var(--gold); }
.nav-item[data-target="settings"]:hover { color: var(--red); }

/* ============================================================
   7. TIPOGRAFÍA
   ============================================================ */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  color: var(--text);
}

h1 { font-size: 1.5rem; line-height: 1.2; }
h2 { font-size: 1.1rem; line-height: 1.3; }
h3 { font-size: 0.95rem; line-height: 1.35; }

p {
  color: var(--muted);
  margin-bottom: 10px;
  font-size: 0.875rem;
  line-height: 1.6;
}

/* ============================================================
   8. CARDS
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: border-color var(--t-mid), box-shadow var(--t-mid);
}

.card:hover {
  border-color: var(--surface3);
}

/* ============================================================
   9. BOTONES
   ============================================================ */
button {
  font-family: var(--font-body);
  font-weight: 600;
  border: none;
  border-radius: var(--r-md);
  padding: 10px 18px;
  cursor: pointer;
  width: 100%;
  transition: transform var(--t-fast), box-shadow var(--t-mid), background var(--t-fast), opacity var(--t-fast);
  margin-bottom: 6px;
  font-size: 0.875rem;
  letter-spacing: 0.01em;
}

button:active { transform: scale(0.97); }

button:disabled,
.btn-comodin:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none !important;
  pointer-events: none;
}

.nav-item,
.btn-comodin,
.tc-menu button,
.question-item button { margin-bottom: 0 !important; }
.short-answer-box input { margin-bottom: 0 !important; }

/* Botón primario */
.btn-primary {
  background: var(--green);
  color: #000;
  font-weight: 700;
  box-shadow: 0 2px 8px var(--green-glow);
}
.btn-primary:hover:not(:disabled) {
  background: #00F5A0;
  box-shadow: 0 4px 16px var(--green-glow);
  transform: translateY(-1px);
}

/* Botón secundario */
.btn-secondary {
  background: var(--surface2);
  color: var(--text-soft);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--surface3);
  border-color: var(--muted-soft);
  transform: translateY(-1px);
}

/* ============================================================
   10. INPUTS & FORMULARIOS
   ============================================================ */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.875rem;
  margin-top: 4px;
  margin-bottom: 10px;
  transition: border-color var(--t-mid), box-shadow var(--t-mid);
  outline: none;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
textarea:focus,
select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-dim);
  background: var(--surface);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ============================================================
   11. LISTA DE TEMAS (HOME)
   ============================================================ */
#themes-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 4px;
  overflow-y: auto;
  padding-right: 2px;
  padding-top: 2px;
  padding-bottom: 4px;
  flex: 1 1 0%;
  min-height: 0;
}

.theme-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  transition: border-color var(--t-mid), box-shadow var(--t-mid), transform var(--t-fast);
  min-height: 64px;
}

.theme-card:hover {
  border-color: var(--blue);
  box-shadow: 0 0 0 1px var(--blue-dim), var(--shadow-md);
  transform: translateY(-1px);
}

.theme-card .tc-icon {
  font-size: 1.5rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface2);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  flex-shrink: 0;
  color: var(--blue);
}

.theme-card .tc-info {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.theme-card .tc-info h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.theme-card .tc-info p {
  margin: 3px 0 0 0;
  font-size: 0.72rem;
  color: var(--muted);
}

.theme-card .tc-menu-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  margin: 0;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--t-fast), color var(--t-fast);
}

.theme-card .tc-menu-btn:hover {
  background: var(--surface2);
  color: var(--text);
}

.theme-card .tc-menu {
  position: absolute;
  right: 10px;
  top: calc(100% + 4px);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 200;
  box-shadow: var(--shadow-lg);
  min-width: 150px;
}

.theme-card .tc-menu.show { display: flex; }

.theme-card .tc-menu button {
  width: 100%;
  padding: 8px 12px;
  margin: 0;
  background: none;
  border: none;
  color: var(--text-soft);
  text-align: left;
  font-size: 0.82rem;
  border-radius: var(--r-md);
  transition: background var(--t-fast), color var(--t-fast);
}

.theme-card .tc-menu button:hover { background: var(--surface3); }
.theme-card .tc-menu button.delete { color: var(--red); }
.theme-card .tc-menu button.delete:hover { background: var(--red-dim); }

/* Slots info */
.slots-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 10px 14px;
  margin-bottom: 10px;
}

.slots-info p { margin: 0; font-size: 0.78rem; color: var(--muted); }

.slots-info .slot-dots { display: flex; gap: 6px; }

.slot-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--r-full);
  background: var(--green);
  border: 1.5px solid var(--green);
  transition: background var(--t-mid), box-shadow var(--t-mid);
}

.slot-dot.used {
  background: var(--surface3);
  border-color: var(--border);
}

.slot-dot.ticket {
  background: var(--gold);
  border-color: var(--gold);
  box-shadow: 0 0 6px rgba(240, 185, 41, 0.4);
}

.slot-dot.ticket.used {
  background: var(--muted);
  border-color: var(--border);
  box-shadow: none;
}

/* Unlock card */
.unlock-card {
  background: var(--surface);
  border: 1.5px dashed rgba(240, 185, 41, 0.35);
  border-radius: var(--r-xl);
  padding: 10px 14px;
  text-align: center;
  cursor: pointer;
  transition: background var(--t-mid), border-color var(--t-mid), transform var(--t-fast);
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.unlock-card:hover {
  background: var(--gold-dim);
  border-color: var(--gold);
  transform: translateY(-1px);
}

.unlock-card p {
  margin: 0;
  color: var(--gold);
  font-weight: 600;
  font-size: 0.78rem;
}

.unlock-card span {
  font-size: 1rem;
  display: inline;
  margin-bottom: 0;
}

/* Mensaje motivacional */
#motivational-message {
  font-family: var(--font-display);
  text-align: left;
  margin: 8px 0;
  width: 100%;
  word-break: break-word;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--green);
  line-height: 1.6;
}

/* ============================================================
   12. QUIZ — CANVAS y STATS
   ============================================================ */
.canvas-container {
  position: relative;
  width: 100%;
  aspect-ratio: 400 / 190;
  max-height: 170px;
  border-radius: var(--r-xl);
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 8px;
  background: #0D1B2A;
  flex-shrink: 0;
  box-shadow: inset 0 -20px 40px rgba(0,0,0,0.4);
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.canvas-overlay {
  position: absolute;
  top: 8px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: rgba(255,255,255,0.85);
  font-weight: 600;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
  pointer-events: none;
  letter-spacing: 0.06em;
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 8px 4px;
  text-align: center;
  transition: border-color var(--t-mid);
}

.stat-box span {
  display: block;
  font-size: 1.3rem;
  font-weight: 800;
  font-family: var(--font-display);
  letter-spacing: -0.03em;
}

.stat-box.st-green { border-color: rgba(0, 214, 143, 0.2); }
.stat-box.st-green span { color: var(--green); }
.stat-box.st-red { border-color: rgba(244, 63, 94, 0.2); }
.stat-box.st-red span { color: var(--red); }
.stat-box.st-blue { border-color: rgba(59, 130, 246, 0.2); }
.stat-box.st-blue span { color: var(--blue); }

.stat-label {
  font-size: 0.58rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--font-mono);
  margin-top: 2px;
}

/* ============================================================
   13. QUIZ — TARJETA DE PREGUNTA
   ============================================================ */
#quiz-question-card {
  flex: none !important;
  overflow: visible !important;
  max-height: none !important;
}

#q-counter {
  font-size: 0.68rem;
  color: var(--muted);
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  font-weight: 500;
}

#q-text {
  color: var(--text) !important;
  font-size: 1rem;
  line-height: 1.5;
  font-weight: 600;
  font-family: var(--font-display);
  letter-spacing: -0.01em;
  margin-top: 6px;
}

[data-theme="light"] #q-text {
  color: var(--text) !important;
  text-shadow: none;
}

/* Quiz container */
#quiz-game-container {
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding-bottom: 88px !important;
  padding-right: 2px !important;
  gap: 6px;
}

/* Opciones */
.quiz-option {
  background: var(--surface);
  border: 1.5px solid var(--border);
  padding: 12px 16px;
  border-radius: var(--r-lg);
  margin-bottom: 6px;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.875rem;
  text-align: left;
  transition: border-color var(--t-mid), background var(--t-mid), transform var(--t-fast), box-shadow var(--t-mid);
  color: var(--text-soft);
  position: relative;
  overflow: hidden;
  line-height: 1.45;
}

.quiz-option::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--green-dim);
  opacity: 0;
  transition: opacity var(--t-mid);
}

.quiz-option:hover:not(:disabled):not(.disabled) {
  border-color: var(--blue);
  background: var(--surface2);
  transform: translateX(3px);
  box-shadow: -3px 0 0 var(--blue);
}

.quiz-option.correct {
  background: var(--green-dim) !important;
  border-color: var(--green) !important;
  color: var(--green) !important;
  font-weight: 600;
  box-shadow: 0 0 0 1px var(--green-dim), inset 0 0 0 1px rgba(0, 214, 143, 0.1);
}

.quiz-option.wrong {
  background: var(--red-dim) !important;
  border-color: var(--red) !important;
  color: var(--red) !important;
  font-weight: 600;
}

.quiz-option.disabled {
  opacity: 0.35;
  pointer-events: none;
}

[data-theme="light"] .quiz-option { color: var(--text); }
[data-theme="light"] .quiz-option.correct,
[data-theme="light"] .quiz-option.wrong { color: var(--text) !important; }

.quiz-option.hidden-option {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  height: 0;
  padding: 0;
  margin: 0;
  border: none;
  transition: all var(--t-slow);
}

/* Status de respuesta */
#q-status {
  color: var(--red);
  font-weight: 600;
  margin-bottom: 6px;
  display: none;
  font-size: 0.8rem;
  font-family: var(--font-mono);
}

/* Ayuda (hint/summary) */
.ayuda-box {
  display: none;
  font-size: 0.82rem;
  margin-bottom: 10px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  line-height: 1.55;
}

#q-hint {
  color: var(--gold);
  background: var(--gold-dim);
  border-left: 2px solid var(--gold);
}

#q-summary {
  color: var(--blue);
  background: var(--blue-dim);
  border-left: 2px solid var(--blue);
}

/* Botón siguiente */
#btn-next {
  background: var(--green) !important;
  color: #000 !important;
  font-weight: 700;
  margin-top: 8px;
  box-shadow: 0 2px 10px var(--green-glow);
}

#btn-next:hover:not(:disabled) {
  background: #00F5A0 !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--green-glow);
}

/* ============================================================
   14. COMODINES
   ============================================================ */
.comodin-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 0;
}

.btn-comodin {
  font-size: 0.6rem;
  padding: 8px 4px;
  background: var(--surface);
  color: var(--text-soft);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 3px;
  text-align: center;
  line-height: 1.2;
  border-radius: var(--r-lg);
  min-height: 62px;
  transition: all var(--t-mid);
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.btn-comodin:hover:not(:disabled) {
  background: var(--surface2);
  border-color: var(--blue);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--blue-dim);
  color: var(--text);
}

.btn-comodin .cost {
  font-family: var(--font-mono);
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 600;
}

.btn-comodin.active,
.btn-comodin.comodin-activado {
  background: rgba(59, 130, 246, 0.15) !important;
  border-color: var(--blue) !important;
  color: var(--blue) !important;
  box-shadow: 0 0 14px var(--blue-dim), inset 0 0 10px rgba(59,130,246,0.05);
}

.btn-comodin.active .cost,
.btn-comodin.comodin-activado .cost {
  color: var(--gold) !important;
}

.btn-comodin.comodin-error {
  animation: comodin-shake 0.3s ease-in-out;
  border-color: var(--red) !important;
  color: var(--red) !important;
}

@keyframes comodin-shake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-4px); background-color: var(--red-dim); }
  30% { transform: translateX(4px); }
  45% { transform: translateX(-4px); }
  60% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
}

.comodin-card { position: relative; display: inline-block; }
.comodin-card.comodin-invalido { opacity: 0.35; filter: grayscale(100%); }
.comodin-card.comodin-invalido .btn-comodin { cursor: not-allowed; pointer-events: none; }

/* ============================================================
   15. ÁREA DE SUBIDA (UPLOAD)
   ============================================================ */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--r-xl);
  padding: 28px 20px;
  cursor: pointer;
  transition: all var(--t-mid);
  background: var(--surface);
  text-align: center;
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--blue);
  background: var(--blue-dim);
  box-shadow: 0 0 0 3px var(--blue-dim);
}

#upload-status {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  display: none;
  text-align: center;
}

#progress-container {
  width: 100%;
  height: 6px;
  background: var(--surface2);
  border-radius: var(--r-full);
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  display: none;
}

#progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--green), #00F5A0);
  transition: width 0.25s ease;
  border-radius: var(--r-full);
}

/* Cola de archivos */
.queue-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 0.78rem;
  border-bottom: 1px solid var(--border-soft);
}
.queue-item:last-child { border-bottom: none; }
.queue-active { background: var(--blue-dim); }
.queue-pending { background: var(--surface); }
.queue-icon { font-size: 1rem; flex-shrink: 0; }
.queue-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-soft); }
.queue-badge {
  font-size: 0.62rem;
  padding: 2px 7px;
  border-radius: var(--r-full);
  background: var(--surface2);
  color: var(--muted);
  white-space: nowrap;
  font-family: var(--font-mono);
}
.queue-active .queue-badge { background: var(--blue); color: #fff; }
.queue-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.75rem;
  padding: 2px 5px;
  border-radius: var(--r-sm);
  flex-shrink: 0;
  margin-bottom: 0;
}
.queue-remove:hover { background: var(--red-dim); color: var(--red); }

/* ============================================================
   16. LISTA DE PREGUNTAS (TOPIC)
   ============================================================ */
#topic-questions-list {
  overflow-y: auto !important;
  overflow-x: hidden !important;
  flex: none !important;
  padding-right: 2px;
  margin-bottom: 12px;
}

.question-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: 6px;
  display: flex !important;
  align-items: stretch;
  overflow: hidden;
  flex-direction: column;
  transition: border-color var(--t-mid), transform var(--t-mid), box-shadow var(--t-mid);
  cursor: pointer;
}

.question-item:hover {
  background: var(--surface2);
  border-color: var(--surface3);
  transform: translateX(2px);
}

.q-clickable-area {
  flex: 1;
  padding: 12px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.q-clickable-area:hover { background: var(--surface2); }

.q-text-content {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.84rem;
  color: var(--text-soft);
}

.q-view-mode { display: flex; align-items: center; width: 100%; min-height: 44px; }

.btn-delete-final {
  background: none;
  border: none;
  border-left: 1px solid var(--border-soft);
  color: var(--muted);
  width: 44px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: background var(--t-fast), color var(--t-fast);
  margin-bottom: 0;
}

.btn-delete-final:hover {
  background: var(--red-dim);
  color: var(--red);
}

/* Botones de orden */
.order-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--r-sm);
  color: var(--muted);
  margin-bottom: 0;
  font-size: 0.75rem;
  transition: background var(--t-fast), color var(--t-fast);
}

.order-btn:hover { background: var(--surface3); color: var(--blue); }

/* Animaciones de reordenamiento */
.slide-up {
  transform: translateY(-100%) translateY(-8px);
  background-color: var(--blue-dim) !important;
  border-color: var(--blue) !important;
}
.slide-down {
  transform: translateY(100%) translateY(8px);
  background-color: var(--blue-dim) !important;
  border-color: var(--blue) !important;
}

.just-landed { animation: pulse-border 0.5s ease-out; }

@keyframes pulse-border {
  0%   { box-shadow: 0 0 0 0 var(--green); }
  100% { box-shadow: 0 0 0 8px transparent; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   17. MODALES
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: modal-fade-in 0.2s ease;
}

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

.modal-box {
  background: var(--surface);
  padding: 28px 24px;
  border-radius: var(--r-2xl);
  text-align: center;
  max-width: 88%;
  width: 320px;
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--border);
  border: 1px solid var(--surface3);
  animation: modal-slide-up 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modal-slide-up {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-box h2 {
  margin-bottom: 4px;
  color: var(--blue);
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.modal-box p {
  font-size: 0.875rem;
  margin-bottom: 18px;
  color: var(--text-soft);
  line-height: 1.5;
  font-weight: 500;
}

/* ============================================================
   18. TOAST
   ============================================================ */
#toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 99999;
  pointer-events: none;
  width: 90%;
  max-width: 360px;
}

.toast-msg {
  background: var(--surface2);
  color: var(--text);
  border-left: 3px solid var(--blue);
  padding: 12px 18px;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md), 0 0 0 1px var(--border);
  font-size: 0.84rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transform: translateY(-12px) scale(0.96);
  transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.toast-msg.show { opacity: 1; transform: translateY(0) scale(1); }
.toast-msg.success { border-left-color: var(--green); }
.toast-msg.error   { border-left-color: var(--red); }
.toast-msg.info    { border-left-color: var(--blue); }

/* ============================================================
   19. PANTALLA DE CARGA
   ============================================================ */
#loading-overlay {
  transition: opacity var(--t-slow);
}

#loading-canvas {
  display: block;
  margin: 0 auto;
  image-rendering: pixelated;
}

/* ============================================================
   20. SETTINGS / PERFIL
   ============================================================ */
.panel-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  width: 100%;
}

.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
}

.toggle-row:last-child { border-bottom: none; }

.toggle-row span {
  font-size: 0.875rem;
  color: var(--text-soft);
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--surface3);
  transition: var(--t-mid);
  border-radius: var(--r-full);
  border: 1px solid var(--border);
}

.toggle-slider::before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: var(--muted);
  transition: var(--t-mid);
  border-radius: var(--r-full);
}

input:checked + .toggle-slider { background-color: var(--green); border-color: var(--green); }
input:checked + .toggle-slider::before {
  transform: translateX(18px);
  background-color: #000;
}

/* Pestañas de perfil */
.tab-btn {
  flex: 1;
  background: none;
  border: none;
  padding: 13px 0;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
  transition: color var(--t-mid);
  font-family: var(--font-body);
  font-size: 0.8rem;
  border-bottom: 2px solid transparent;
  letter-spacing: 0.01em;
}

.tab-btn.active {
  color: var(--green);
  border-bottom-color: var(--green);
}

.tab-btn:hover:not(.active) {
  color: var(--text-soft);
}

/* Menú desplegable ajustes */
.menu-desplegable {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height var(--t-slow), opacity 0.2s ease, margin 0.2s ease;
  margin-bottom: 0;
  padding: 0 16px;
  background: var(--surface2);
  border-radius: var(--r-lg);
  border: 1px solid transparent;
}

.menu-desplegable.mostrar {
  max-height: 300px;
  opacity: 1;
  margin-bottom: 16px;
  padding: 16px;
  border-color: var(--border);
}

/* Botón círculo */
.btn-circle {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  width: 42px;
  height: 42px;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
  transition: all var(--t-mid);
  line-height: 1;
  text-align: center;
  padding: 0;
  transform: none;
}

.btn-circle:hover {
  border-color: var(--green);
  color: var(--green);
  box-shadow: 0 0 0 3px var(--green-dim);
  transform: none;
}

.btn-circle.activo {
  transform: rotate(180deg);
  box-shadow: 0 0 12px var(--green-glow), 0 0 0 2px var(--green-dim);
  background: var(--green-dim);
  border-color: var(--green);
  color: var(--text);
}

/* Scale buttons */
.scale-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 1.1rem;
  font-weight: bold;
  background: var(--surface2);
  color: var(--text-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-fast);
  margin-bottom: 0;
}

.scale-btn:hover {
  background: var(--surface3);
  border-color: var(--blue);
  color: var(--blue);
}

/* Panel invitación */
.panel-invitacion {
  display: none;
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background: var(--surface);
  z-index: 10;
  overflow-y: auto;
  padding: 20px;
  box-sizing: border-box;
  border-radius: var(--r-2xl);
}

.panel-invitacion.mostrar {
  display: block;
  animation: zoomIn var(--t-slow) ease;
}

@keyframes zoomIn {
  from { transform: scale(0.92); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.tab-invitacion {
  background: none;
  border: none;
  padding: 8px 0;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--t-mid);
  font-family: var(--font-body);
  font-size: 0.84rem;
  margin-bottom: 0;
}

.tab-invitacion.active { color: var(--green); border-bottom: 2px solid var(--green); }
.tab-invitacion:not(.active) { color: var(--muted); }

/* ============================================================
   21. DONACIONES
   ============================================================ */
.donate-btn {
  display: block;
  text-align: center;
  padding: 13px;
  border-radius: var(--r-lg);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text);
  background-color: var(--surface2);
  border: 1px solid var(--border);
  transition: all var(--t-mid);
}

.donate-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  background: var(--surface3);
}

.donate-btn.kofi    { border-left: 3px solid #FF5E5B; }
.donate-btn.binance { border-left: 3px solid #F3BA2F; }
.donate-btn.paypal  { border-left: 3px solid #003087; }
.donate-btn.zinli   { border-left: 3px solid #16bb40; }

/* ============================================================
   22. INFO ICON (tooltips)
   ============================================================ */
.info-icon {
  cursor: help;
  font-size: 0.8rem;
  color: var(--blue);
  position: absolute;
  top: -8px;
  right: -8px;
  z-index: 10;
  background-color: var(--surface);
  border-radius: var(--r-full);
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.info-icon::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 8px 12px;
  font-family: var(--font-body);
  font-weight: 500;
  box-shadow: var(--shadow-md);
  width: max-content;
  max-width: 180px;
  white-space: normal;
  text-align: center;
  line-height: 1.4;
  font-size: 0.72rem;
  opacity: 0;
  visibility: hidden;
  transition: all var(--t-mid);
  z-index: 100;
  color: var(--text-soft);
}

.info-icon::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  border-width: 5px 5px 0;
  border-style: solid;
  border-color: var(--border) transparent transparent;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) translateY(8px);
  transition: all var(--t-mid);
  z-index: 101;
}

.info-icon:hover::after,
.info-icon:active::after,
.info-icon:focus::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.info-icon:hover::before,
.info-icon:active::before,
.info-icon:focus::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.info-icon.right-side::after {
  left: auto;
  right: -5px;
  transform: translateY(8px);
}

.info-icon.right-side:hover::after,
.info-icon.right-side:active::after {
  transform: translateY(0);
}

/* ============================================================
   23. QUIZ SELECTOR (selección de tema)
   ============================================================ */
.quiz-theme-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all var(--t-mid);
  text-align: left;
  margin-bottom: 6px;
}

.quiz-theme-card:hover {
  border-color: var(--green);
  background: var(--surface2);
  transform: translateX(3px);
  box-shadow: -3px 0 0 var(--green);
}

.quiz-theme-card .qt-icon {
  font-size: 1.5rem;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface2);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  flex-shrink: 0;
  color: var(--green);
}

.quiz-theme-card .qt-info { flex: 1; }
.quiz-theme-card .qt-info h4 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-display);
  color: var(--text);
}
.quiz-theme-card .qt-info p {
  margin: 3px 0 0 0;
  font-size: 0.7rem;
  color: var(--muted);
}

.quiz-theme-card .qt-stats {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted);
  flex-shrink: 0;
}
.quiz-theme-card .qt-stats span {
  display: block;
  color: var(--gold);
  font-size: 1rem;
  font-weight: bold;
}

.quiz-theme-card.disabled { opacity: 0.4; cursor: not-allowed; }

#quiz-select-topic {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 20px;
}

#quiz-themes-list {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
  padding-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ============================================================
   24. RESPUESTA CORTA
   ============================================================ */
.short-answer-box {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.short-answer-box input {
  flex: 1;
  padding: 10px 14px;
  border-radius: var(--r-lg);
  border: 1.5px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  margin: 0;
}

.short-answer-box input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-dim);
}

.short-answer-box input.correct {
  border-color: var(--green);
  background: var(--green-dim);
  color: var(--green);
}

.short-answer-box input.wrong {
  border-color: var(--red);
  background: var(--red-dim);
  color: var(--red);
}

.short-answer-box button {
  width: auto;
  padding: 10px 16px;
  margin-bottom: 0;
  white-space: nowrap;
  background: var(--blue);
  color: #fff;
  border-radius: var(--r-lg);
  font-weight: 700;
}

.short-answer-box button:hover {
  background: #2563EB;
  transform: translateY(-1px);
}

/* ============================================================
   25. ADMIN PANEL
   ============================================================ */
#contenido-admin .card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 16px;
  transition: transform var(--t-mid), box-shadow var(--t-mid);
}

#contenido-admin .card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

#contenido-admin .stat-label {
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  font-family: var(--font-mono);
  color: var(--muted);
  text-transform: uppercase;
  margin-top: 4px;
}

#contenido-admin table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.75rem;
}

#contenido-admin th {
  background: var(--surface2);
  padding: 10px 8px;
  text-align: center;
  font-weight: 600;
  color: var(--green);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  position: sticky;
  top: 0;
  font-family: var(--font-mono);
}

#contenido-admin td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
  color: var(--text-soft);
  text-align: center;
  font-size: 0.78rem;
}

#contenido-admin tr:last-child td { border-bottom: none; }
#contenido-admin tbody tr:hover { background: var(--surface2); }

#contenido-admin select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 5px 8px;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text);
  cursor: pointer;
  margin: 0;
  transition: border-color var(--t-fast);
}

#contenido-admin select:hover { border-color: var(--blue); }
#contenido-admin select:disabled { opacity: 0.4; cursor: not-allowed; }

/* Admin switches */
.switch-lock {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 60px;
  height: 28px;
  background: var(--green-dim);
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--t-mid);
}

.switch-lock .lock-icon-left,
.switch-lock .lock-icon-right {
  position: absolute;
  width: 14px;
  height: 14px;
  z-index: 1;
  transition: all var(--t-mid);
  color: var(--muted);
  top: 6px;
}

.switch-lock .lock-icon-left { left: 6px; }
.switch-lock .lock-icon-right { right: 6px; }

.switch-lock .knob {
  position: absolute;
  width: 22px;
  height: 22px;
  background: var(--text);
  border-radius: var(--r-full);
  top: 2px;
  left: 3px;
  transition: left var(--t-mid);
  z-index: 2;
  box-shadow: var(--shadow-sm);
}

.switch-lock.active { background: var(--red-dim); border-color: var(--red-dim); }
.switch-lock.active .knob { left: calc(100% - 25px); }
.switch-lock.active .lock-icon-right { color: var(--red); }
.switch-lock:not(.active) .lock-icon-left { color: var(--green); }

/* Botón lápiz */
.edit-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  margin: 0;
  border-radius: var(--r-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--t-fast);
  vertical-align: middle;
}
.edit-icon-btn:hover { background: var(--surface3); }
.edit-icon-btn svg { width: 14px; height: 14px; stroke: var(--blue); stroke-width: 2; fill: none; display: block; }

/* ============================================================
   26. ANIMACIONES GLOBALES
   ============================================================ */
@keyframes flicker {
  0%   { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.15); opacity: 1; filter: drop-shadow(0 0 3px #F0B929); }
}

.animated-flame {
  width: 16px;
  height: 16px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 4px;
  animation: flicker 0.8s infinite alternate;
}

.heart-svg {
  width: 14px;
  height: 14px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 4px;
  fill: #F43F5E;
}

/* ============================================================
   27. GLOBAL UPLOAD BAR
   ============================================================ */
#global-upload-bar {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: 90vw;
}

/* ============================================================
   28. RESPONSIVE
   ============================================================ */
@media (max-width: 360px) {
  .comodin-grid { gap: 4px; }
  .btn-comodin  { padding: 6px 2px; font-size: 0.58rem; min-height: 56px; }
  .stats-grid   { gap: 4px; }
  .stat-box span { font-size: 1.1rem; }
  .canvas-container { max-height: 150px; }
}

/* ============================================================
   29. PREFERS-REDUCED-MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   30. COMPATIBILIDAD (aliases legado)
   ============================================================ */
/* Para elementos que aún usan variables del CSS antiguo */
:root {
  --font-display: var(--font-display);
}

/* Auth modal */
.auth-separator {
  text-align: center;
  margin: 14px 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  position: relative;
}
.auth-separator::before,
.auth-separator::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 42%;
  height: 1px;
  background-color: var(--border);
}
.auth-separator::before { left: 0; }
.auth-separator::after  { right: 0; }

/* Switch IA admin */
.switch-ia {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  margin-right: 8px;
  vertical-align: middle;
}
.switch-ia input { opacity: 0; width: 0; height: 0; }
.slider-ia {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--surface3);
  transition: var(--t-mid);
  border-radius: var(--r-full);
}
.slider-ia::before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text);
  transition: var(--t-mid);
  border-radius: var(--r-full);
}
input:checked + .slider-ia { background-color: var(--red); }
input:checked + .slider-ia::before { transform: translateX(20px); }

/* Selector de cantidad de preguntas */
.qty-wrapper {
  margin: 14px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 1;
}
.qty-container {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface);
  padding: 8px 14px;
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
}
.qty-btn {
  padding: 6px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-soft);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t-fast);
  margin-bottom: 0;
}
.qty-btn:hover { border-color: var(--green); color: var(--green); }
.qty-btn.selected {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-dim);
}
.qty-divider { width: 1px; height: 24px; background: var(--border); margin: 0 4px; }
.custom-math-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-soft);
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-fast);
  margin-bottom: 0;
}
.custom-math-btn:hover { border-color: var(--green); color: var(--green); }
.custom-qty-input {
  width: 40px;
  text-align: center;
  background: transparent;
  border: none;
  color: var(--text);
  font-weight: bold;
  font-size: 0.95rem;
  outline: none;
  margin: 0;
}
.custom-qty-input::-webkit-outer-spin-button,
.custom-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
