/* ============================================================
   FLASHCARDS EN ESPAÑOL — Design System
   Intent: Warm notebook-meets-premium-app. Ameno, no corporativo.
   Palette: Deep night blue canvas, cream card surfaces, board-green accents
   Depth: Subtle shadows + soft borders  
   Typography: Nunito — round, warm, great for learning apps
   Spacing base: 8px
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800;900&family=Nunito+Sans:wght@400;600&display=swap');

/* ── Tokens ── */
:root {
  /* Canvas */
  --bg-0: #0d1117;
  --bg-1: #161b22;
  --bg-2: #1e2631;
  --bg-3: #252d38;

  /* Card surface — warm cream */
  --card-face: #f7f2e8;
  --card-back: #1a2744;
  --card-shadow: 0 20px 60px rgba(0,0,0,0.45), 0 4px 16px rgba(0,0,0,0.3);

  /* Ink & text */
  --ink-primary: #e8e2d5;
  --ink-secondary: #8b96a8;
  --ink-muted: #515d6d;
  --ink-on-card: #1a2744;
  --ink-on-card-secondary: #3d5173;

  /* Accent — pizarrón green */
  --accent: #37b07a;
  --accent-dim: #2d8f62;
  --accent-glow: rgba(55, 176, 122, 0.2);

  /* Semantic */
  --correct: #37b07a;
  --correct-bg: rgba(55, 176, 122, 0.12);
  --incorrect: #e05252;
  --incorrect-bg: rgba(224, 82, 82, 0.12);
  --hint-color: #f5a623;
  --hint-bg: rgba(245, 166, 35, 0.12);

  /* Borders */
  --border-soft: rgba(255,255,255,0.06);
  --border-mid: rgba(255,255,255,0.1);
  --border-accent: rgba(55, 176, 122, 0.35);

  /* Radius */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-card: 18px;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.45, 0, 0.55, 1);
}

/* ── Light Theme Tokens ── */
[data-theme="light"] {
  --bg-0: #f0f2f5;
  --bg-1: #ffffff;
  --bg-2: #e4e7ec;
  --bg-3: #d0d4db;

  --card-face: #ffffff;
  --card-back: #4f6487;
  --card-shadow: 0 10px 40px rgba(0,0,0,0.1), 0 2px 8px rgba(0,0,0,0.06);

  --ink-primary: #111827;
  --ink-secondary: #4b5563;
  --ink-muted: #6b7280;
  --ink-on-card: #223048;
  --ink-on-card-secondary: #5a6b8c;

  --border-soft: rgba(0,0,0,0.06);
  --border-mid: rgba(0,0,0,0.15);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }

*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

body {
  min-height: 100vh;
  background-color: var(--bg-0);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(55, 176, 122, 0.08), transparent),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(26, 39, 68, 0.3), transparent);
  font-family: 'Nunito', sans-serif;
  color: var(--ink-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 48px;
}

/* ── Header ── */
.app-header {
  width: 100%;
  max-width: 720px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  padding: 0 4px;
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-logo .logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), #2d8f62);
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  font-size: 18px;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.app-logo h1 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink-primary);
}

.app-logo span {
  font-weight: 400;
  color: var(--ink-secondary);
}

/* ── Stats Bar ── */
.stats-bar {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 600;
}

.stat-chip .stat-label { color: var(--ink-muted); }
.stat-chip .stat-value { color: var(--ink-primary); }
.stat-chip.streak .stat-value { color: var(--hint-color); }
.stat-chip.correct-chip .stat-value { color: var(--correct); }

/* ── Progress strip ── */
.progress-strip {
  width: 100%;
  max-width: 720px;
  margin-bottom: 28px;
}

.progress-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--ink-muted);
  font-weight: 600;
  margin-bottom: 10px;
  gap: 8px;
}

/* Botón clickeable del número de tarjeta */
.card-num-btn {
  background: var(--bg-3);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 1px 7px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}
.card-num-btn:hover {
  background: var(--accent);
  color: #0d1117;
  border-color: var(--accent);
  transform: scale(1.08);
}

/* Input de salto directo */
.jump-input-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  animation: fadeSlideIn 0.15s ease forwards;
}
.jump-input {
  width: 64px;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: var(--bg-2);
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 700;
  font-family: inherit;
  text-align: center;
  outline: none;
}
.jump-input::-webkit-inner-spin-button { opacity: 0; }
.jump-go, .jump-cancel {
  background: transparent;
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.7rem;
  padding: 2px 5px;
  color: var(--ink-muted);
  transition: all 0.12s ease;
}
.jump-go { border-color: var(--accent); color: var(--accent); }
.jump-go:hover { background: var(--accent); color: #0d1117; }
.jump-cancel:hover { background: var(--bg-3); }

/* Barra de progreso — slider interactivo */
.progress-track {
  width: 100%;
  height: 6px;
  background: var(--bg-3);
  border-radius: 100px;
  position: relative;
  overflow: visible;  /* permitir que el thumb sobresalga */
  cursor: pointer;
  transition: height 0.15s ease;
}
.progress-track:hover,
.progress-track.dragging {
  height: 8px;
}
.progress-track:hover .progress-thumb,
.progress-track.dragging .progress-thumb {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  border-radius: 100px;
  width: 0%;
  transition: width 0.25s var(--ease-out);
  pointer-events: none;
}

/* Thumb (bolita arrastradora) */
.progress-thumb {
  position: absolute;
  top: 50%;
  transform: translateY(-50%) scale(0.6);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(55, 176, 122, 0.25);
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none;
  margin-left: -8px;
}

/* ── Card Scene (3D perspective) ── */
.card-scene {
  width: 100%;
  max-width: 620px;
  height: 240px;
  perspective: 1200px;
  margin-bottom: 28px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.card-3d {
  width: 100%;
  height: 100%;
  position: relative;
  transition: transform 0.2s var(--ease-in-out), opacity 0.2s;
}

.card-3d.flip-out {
  transform: scaleY(0.05) scaleX(0.95);
  opacity: 0;
}

/* Shared card face styles */
.card-face, .card-back-face {
  position: absolute;
  inset: 0;
  border-radius: var(--r-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 40px;
  gap: 12px;
  transition: opacity 0.15s;
}

/* State: flipped — swap which face is shown */
.card-3d.is-flipped .card-face {
  display: none;
}

.card-3d.is-flipped .card-back-face {
  display: flex;
}

/* Front face — cream card */
.card-face {
  background: var(--card-face);
  box-shadow: var(--card-shadow);
  border: 1px solid rgba(255,255,255,0.08);
}

.card-face .card-tag {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-on-card-secondary);
  opacity: 0.7;
}

.card-face .card-word {
  font-size: clamp(1.4rem, 4vw, 2.1rem);
  font-weight: 800;
  color: var(--ink-on-card);
  text-align: center;
  line-height: 1.25;
}

.card-face .flip-hint {
  font-size: 0.72rem;
  color: var(--ink-on-card-secondary);
  opacity: 0.5;
  margin-top: 4px;
}

/* Back face — deep blue */
.card-back-face {
  display: none;
  background: linear-gradient(135deg, #1a2744, #0e1a35);
  box-shadow: var(--card-shadow);
  border: 1px solid rgba(55, 176, 122, 0.15);
}

.card-back-face .back-tag {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.8;
}

.card-back-face .back-word {
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 800;
  color: #ffffff;
  text-align: center;
  line-height: 1.25;
}

/* Speaker Button */
.btn-speak {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--bg-0);
  border: 1px solid var(--border-mid);
  color: var(--ink-primary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: transform 0.15s, background 0.15s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  z-index: 10;
}

.btn-speak:hover {
  background: var(--bg-1);
  transform: scale(1.1);
}

.btn-speak:active {
  transform: scale(0.95);
}

/* Override for back side to make it match dark theme */
.card-back-face .btn-speak {
  background: rgba(0,0,0,0.2);
  border-color: rgba(255,255,255,0.1);
  color: #fff;
}
.card-back-face .btn-speak:hover {
  background: rgba(0,0,0,0.4);
}

/* ── Answer Result Banner ── */
.result-banner {
  width: 100%;
  max-width: 620px;
  padding: 14px 20px;
  border-radius: var(--r-md);
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  min-height: 50px;
  transition: opacity 0.2s, transform 0.3s var(--ease-out);
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
}

.result-banner.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.result-banner.correct {
  background: var(--correct-bg);
  border: 1px solid rgba(55, 176, 122, 0.3);
  color: #6ee7b0;
}

.result-banner.incorrect {
  background: var(--incorrect-bg);
  border: 1px solid rgba(224, 82, 82, 0.3);
  color: #f9a8a8;
}

.result-banner .result-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.result-banner .result-text { line-height: 1.5; }
.result-banner .result-answer { 
  display: block;
  font-weight: 700;
  font-size: 1rem;
  margin-top: 2px;
  color: white;
}

/* ── Hint display ── */
.hint-display {
  width: 100%;
  max-width: 620px;
  min-height: 40px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--hint-bg);
  border: 1px solid rgba(245, 166, 35, 0.2);
  border-radius: var(--r-md);
  font-family: 'Nunito', monospace;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--hint-color);
  letter-spacing: 0.1em;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.25s, transform 0.25s var(--ease-out);
  pointer-events: none;
}

.hint-display.visible {
  opacity: 1;
  transform: translateY(0);
}

.hint-display .hint-icon { font-size: 0.9rem; }

/* ── Input area ── */
.input-group {
  width: 100%;
  max-width: 620px;
  margin-bottom: 20px;
}

.answer-input {
  width: 100%;
  padding: 16px 20px;
  background: var(--bg-2);
  border: 2px solid var(--border-soft);
  border-radius: var(--r-md);
  color: var(--ink-primary);
  font-family: 'Nunito', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  caret-color: var(--accent);
}

.answer-input::placeholder {
  color: var(--ink-muted);
  font-weight: 400;
}

.answer-input:focus {
  border-color: var(--border-accent);
  background: var(--bg-3);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.answer-input.correct-input {
  border-color: rgba(55, 176, 122, 0.5);
  background: rgba(55, 176, 122, 0.05);
}

.answer-input.incorrect-input {
  border-color: rgba(224, 82, 82, 0.4);
  background: rgba(224, 82, 82, 0.04);
}

/* ── Buttons ── */
.btn-row {
  width: 100%;
  max-width: 620px;
  display: flex;
  gap: 10px;
  margin-bottom: 32px;
}

.btn {
  flex: 1;
  padding: 14px 12px;
  border: none;
  border-radius: var(--r-md);
  font-family: 'Nunito', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: transform 0.12s, box-shadow 0.12s, background 0.15s;
  letter-spacing: 0.01em;
  position: relative;
  overflow: hidden;
}

.btn .btn-label { line-height: 1; }
.btn .btn-key {
  font-size: 0.65rem;
  font-weight: 600;
  opacity: 0.5;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.btn:active { transform: scale(0.97); }

/* Primary — check answer */
.btn-primary {
  flex: 2;
  background: var(--bg-1);
  color: var(--accent);
  border: 1px solid var(--border-accent);
}
.btn-primary:hover {
  background: var(--bg-2);
  border-color: var(--accent);
}

/* Secondary — neutral actions */
.btn-secondary {
  background: var(--bg-2);
  color: var(--ink-primary);
  border: 1px solid var(--border-mid);
}
.btn-secondary:hover {
  background: var(--bg-3);
  border-color: var(--border-mid);
}

/* Hint — neutral */
.btn-hint {
  background: transparent;
  color: var(--ink-secondary);
  border: 1px dashed var(--border-mid);
}
.btn-hint:hover {
  background: var(--bg-2);
  color: var(--ink-primary);
  border-style: solid;
}

/* Flip — reveal card back */
.btn-flip {
  background: transparent;
  color: var(--ink-secondary);
  border: 1px solid var(--border-mid);
}
.btn-flip:hover {
  background: var(--bg-2);
  color: var(--ink-primary);
}

/* ── Keyboard shortcuts legend ── */
.shortcuts-row {
  width: 100%;
  max-width: 620px;
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 32px;
}

.shortcut-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--ink-muted);
  font-weight: 600;
}

.key-badge {
  padding: 2px 6px;
  background: var(--bg-3);
  border: 1px solid var(--border-mid);
  border-radius: 4px;
  font-size: 0.65rem;
  font-family: monospace;
  color: var(--ink-secondary);
}

/* ── Card counter dot trail ── */
.card-counter {
  width: 100%;
  max-width: 620px;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-muted);
  letter-spacing: 0.05em;
}

/* ── Toast notifications ── */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
  pointer-events: none;
}

.toast {
  padding: 10px 18px;
  background: var(--bg-3);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-md);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-primary);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  animation: toastIn 0.35s var(--ease-out) forwards, toastOut 0.3s var(--ease-in-out) 2.2s forwards;
}

.toast.streak-toast {
  background: rgba(245, 166, 35, 0.15);
  border-color: rgba(245, 166, 35, 0.3);
  color: var(--hint-color);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}

/* ── Micro-animations ── */
@keyframes cardEntrance {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.card-scene.entering .card-3d {
  animation: cardEntrance 0.4s var(--ease-out) forwards;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-8px); }
  40%       { transform: translateX(8px); }
  60%       { transform: translateX(-5px); }
  80%       { transform: translateX(5px); }
}

.answer-input.shake {
  animation: shake 0.45s var(--ease-out);
}

@keyframes popIn {
  0%   { transform: scale(0.85) translateY(-2px); opacity: 0; }
  60%  { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1); }
}

/* ── Language Toggle & Filters ── */
.lang-toggle-bar {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
}
.btn-toggle-lang, .btn-filter, .btn-theme {
  background: var(--bg-1);
  border: 1px solid var(--border-mid);
  color: var(--ink-secondary);
  border-radius: 20px;
  padding: 6px 14px;
  font-family: inherit;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.btn-toggle-lang strong, .btn-filter strong {
  color: var(--accent);
}
.btn-toggle-lang:hover, .btn-filter:hover, .btn-theme:hover {
  background: var(--bg-2);
  border-color: var(--border-accent);
  transform: translateY(-1px);
}
.btn-filter.active-filter {
  background: #2a1414;
  color: #ffcccc;
  border-color: #ff5555;
}

/* ── Evaluation Buttons (Anki Style) ── */
.evaluation-row {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 600px;
  margin: 12px auto 0;
}
.btn-dont-know, .btn-know {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  text-align: left;
  border-radius: 8px;
  font-family: inherit;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-dont-know {
  background: var(--incorrect-bg);
  color: var(--incorrect);
}
.btn-dont-know:hover { background: rgba(224, 82, 82, 0.25); transform: scale(0.98); }
.btn-know {
  background: var(--correct-bg);
  color: var(--correct);
}
.btn-know:hover { background: rgba(55, 176, 122, 0.25); transform: scale(0.98); }

.eval-icon {
  font-size: 1.1rem;
}
.eval-texts {
  display: flex;
  flex-direction: column;
}
.eval-title {
  font-weight: 700;
  font-size: 0.85rem;
}
.eval-sub {
  font-size: 0.65rem;
  opacity: 0.8;
  margin-top: 0px;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  body { padding: 16px 12px 40px; }
  
  .app-header { margin-bottom: 20px; }
  
  .stats-bar { gap: 4px; }
  .stat-chip { padding: 4px 9px; font-size: 0.72rem; gap: 4px; }
  .stat-chip .stat-label { display: none; }

  .card-scene { height: 200px; }
  .card-face, .card-back-face { padding: 24px 24px; }

  .btn-row { flex-wrap: wrap; }
  .btn-primary { flex: 1 0 100%; order: -1; }
  
  .shortcuts-row { display: none; }
}

/* ── Admin Button ── */
.btn-admin {
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  color: var(--ink-muted);
  border-radius: var(--r-sm);
  padding: 4px 8px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  margin-left: 8px;
}
.btn-admin:hover {
  background: var(--bg-3);
  color: var(--ink-primary);
  border-color: var(--border-mid);
}

/* ── Modal Overlay ── */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease-out);
}
.modal-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

/* ── Modal Content ── */
.modal-content {
  background: var(--bg-1);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  border-radius: var(--r-md);
  border: 1px solid var(--border-mid);
  box-shadow: 0 24px 48px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  transform: translateY(20px) scale(0.98);
  transition: transform 0.3s var(--ease-out);
  overflow: hidden;
}
.modal-overlay.visible .modal-content {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-2);
}
.modal-header h2 {
  font-size: 1.1rem;
  color: var(--ink-primary);
}
.btn-close {
  background: none; border: none;
  color: var(--ink-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
}
.btn-close:hover { color: var(--error-red); }

/* ── Admin Sections ── */
.admin-add-section, .admin-list-section {
  padding: 20px;
  border-bottom: 1px solid var(--border-soft);
}
.admin-add-section h3, .list-header h3 {
  font-size: 0.9rem;
  color: var(--ink-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}
.add-card-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.add-card-form input, .search-input, .edit-input {
  flex: 1;
  min-width: 140px;
  background: var(--bg-0);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  color: var(--ink-primary);
  font-family: inherit;
  font-size: 0.9rem;
}
.add-card-form input:focus, .search-input:focus, .edit-input:focus {
  border-color: var(--accent);
  outline: none;
}
.btn-sm {
  padding: 8px 16px;
  font-size: 0.85rem;
  border-radius: var(--r-sm);
}

.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.search-input { width: 100%; max-width: 240px; padding: 8px 12px; }

/* ── Cards List ── */
.cards-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  max-height: calc(90vh - 280px);
  padding-right: 4px;
}
.cards-list::-webkit-scrollbar { width: 6px; }
.cards-list::-webkit-scrollbar-track { background: var(--bg-0); }
.cards-list::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 10px; }

.admin-card-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-2);
  padding: 12px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-soft);
  gap: 10px;
}
.admin-card-texts {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.admin-card-es { font-weight: 700; color: var(--ink-primary); font-size: 0.95rem; }
.admin-card-en { font-size: 0.85rem; color: var(--accent); }

.admin-card-actions {
  display: flex;
  gap: 6px;
}
.btn-icon {
  background: var(--bg-3);
  border: none;
  color: var(--ink-muted);
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  cursor: pointer;
  display: grid; place-items: center;
  transition: all 0.2s;
}
.btn-icon:hover { color: var(--ink-primary); background: var(--border-mid); }
.btn-icon.delete:hover { color: #f9a8a8; background: var(--incorrect-bg); }

/* Edit mode */
.admin-card-item.editing {
  flex-direction: column;
  align-items: stretch;
  background: var(--bg-3);
  border-color: var(--border-accent);
}
.edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}
/* ── Voice Assistant Module ── */
.voice-fab {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #248b5d);
  border: none;
  box-shadow: 0 10px 25px rgba(55, 176, 122, 0.4);
  cursor: pointer;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s;
}

.voice-fab:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 15px 35px rgba(55, 176, 122, 0.6);
}

.voice-ripple {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: 50%;
  border: 2px solid var(--accent);
  animation: ripple 2s infinite;
  opacity: 0;
  pointer-events: none;
}

@keyframes ripple {
  0% { transform: scale(1); opacity: 0.5; }
  100% { transform: scale(1.8); opacity: 0; }
}

.voice-board {
  position: fixed;
  bottom: 100px;
  right: 30px;
  width: 320px;
  background: var(--bg-1);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-lg);
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  z-index: 99;
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s var(--ease-out);
  overflow: hidden;
}

.voice-board.visible {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.voice-board-content {
  padding: 20px;
}

.voice-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.voice-header h3 {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--ink-primary);
}

.btn-close-voice {
  background: transparent;
  border: none;
  color: var(--ink-secondary);
  cursor: pointer;
  font-size: 1.1rem;
}

.voice-status-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  margin-bottom: 24px;
  min-height: 100px;
  justify-content: center;
}

.voice-visualizer {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 40px;
}

.voice-visualizer .bar {
  width: 4px;
  height: 10px;
  background: var(--accent);
  border-radius: 2px;
  transition: height 0.1s ease;
}

.voice-visualizer.active .bar {
  animation: voiceBar 0.8s infinite ease-in-out;
}

.voice-visualizer.active .bar:nth-child(2) { animation-delay: 0.1s; }
.voice-visualizer.active .bar:nth-child(3) { animation-delay: 0.2s; }
.voice-visualizer.active .bar:nth-child(4) { animation-delay: 0.15s; }
.voice-visualizer.active .bar:nth-child(5) { animation-delay: 0.05s; }

@keyframes voiceBar {
  0%, 100% { height: 10px; }
  50% { height: 35px; }
}

#voice-status-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-secondary);
  text-align: center;
}

/* ── Voice Mode Selector ── */
.voice-mode-selector {
  display: flex;
  gap: 6px;
  background: var(--bg-0);
  border-radius: 100px;
  padding: 4px;
  border: 1px solid var(--border-soft);
  margin-bottom: 12px;
}

.btn-mode {
  flex: 1;
  padding: 7px 10px;
  border-radius: 100px;
  border: none;
  font-family: 'Nunito', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--ink-muted);
  background: transparent;
  white-space: nowrap;
}

.btn-mode.active {
  background: var(--accent);
  color: #0d1117;
  box-shadow: 0 2px 8px rgba(55, 176, 122, 0.4);
}

.btn-mode-practice.active {
  background: #f5a623;
  color: #0d1117;
  box-shadow: 0 2px 8px rgba(245, 166, 35, 0.4);
}

/* Badge que muestra el modo activo durante la sesión */
.voice-mode-badge {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 100px;
  background: rgba(55, 176, 122, 0.12);
  border: 1px solid rgba(55, 176, 122, 0.25);
  color: var(--accent);
  margin-bottom: 10px;
  letter-spacing: 0.03em;
}

.voice-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Grupo de controles activos (Pausar / Reanudar / Fin) */
.voice-active-controls {
  display: flex;
  gap: 8px;
}

.btn-voice-pause {
  flex: 1;
  background: rgba(245, 166, 35, 0.12);
  color: #f5a623;
  border: 1px solid rgba(245, 166, 35, 0.35);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.18s ease;
}
.btn-voice-pause:hover {
  background: rgba(245, 166, 35, 0.22);
  transform: translateY(-1px);
}

.btn-voice-resume {
  flex: 1;
  background: rgba(55, 176, 122, 0.12);
  color: var(--accent);
  border: 1px solid rgba(55, 176, 122, 0.35);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.18s ease;
}
.btn-voice-resume:hover {
  background: rgba(55, 176, 122, 0.22);
  transform: translateY(-1px);
}

.btn-voice-disconnect {
  padding: 10px 12px;
  font-size: 0.8rem;
  border-radius: var(--r-sm);
}

.hidden { display: none !important; }

.voice-transcript {
  margin-top: 20px;
  max-height: 160px;
  overflow-y: auto;
  font-size: 0.8rem;
  color: var(--ink-muted);
  line-height: 1.5;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 4px;
}


/* Mobile assistant adjustments */
@media (max-width: 600px) {
  .voice-fab { bottom: 20px; right: 20px; width: 50px; height: 50px; }
  .voice-board { width: calc(100vw - 40px); bottom: 85px; right: 20px; }
}

/* ── User Controls ── */
.user-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-2);
  padding: 4px 6px 4px 14px;
  border-radius: 100px;
  border: 1px solid var(--border-soft);
}

.username-display {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-secondary);
}

.btn-logout {
  background: var(--bg-3);
  border: none;
  font-size: 0.9rem;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.2s;
  color: var(--ink-muted);
}

.btn-logout:hover {
  background: var(--incorrect-bg);
  color: #f9a8a8;
  transform: translateY(-1px);
}

/* ── Auth Modal Specifics ── */
.auth-content {
  max-width: 400px;
  padding: 0;
  border: 1px solid var(--border-mid);
}

.auth-header {
  padding: 32px 32px 20px;
  text-align: center;
}

.auth-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--ink-primary), var(--ink-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-header p {
  font-size: 0.9rem;
  color: var(--ink-muted);
}

.auth-tabs {
  display: flex;
  padding: 0 32px;
  gap: 16px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-soft);
}

.auth-tab {
  padding: 10px 0;
  background: none;
  border: none;
  color: var(--ink-muted);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
}

.auth-tab.active {
  color: var(--accent);
}

.auth-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

.auth-form {
  padding: 0 32px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-group input {
  background: var(--bg-0);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-sm);
  padding: 12px 16px;
  color: var(--ink-primary);
  font-family: inherit;
  font-size: 1rem;
  transition: all 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.auth-error-msg {
  font-size: 0.8rem;
  color: #f9a8a8;
  background: rgba(224, 82, 82, 0.1);
  padding: 8px 12px;
  border-radius: var(--r-sm);
  display: none;
  border-left: 3px solid var(--incorrect);
}

.btn-block {
  width: 100%;
  margin-top: 8px;
}

.auth-footer {
  padding: 16px;
  background: var(--bg-2);
  text-align: center;
  border-top: 1px solid var(--border-soft);
}

.auth-footer p {
  font-size: 0.75rem;
  color: var(--ink-muted);
  font-weight: 600;
}

/* ── Voice Transcript Bubbles ── */
.transcript-line {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 0.78rem;
  line-height: 1.4;
  animation: fadeSlideIn 0.25s var(--ease-out) forwards;
}

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

.transcript-user {
  background: rgba(55, 176, 122, 0.08);
  border: 1px solid rgba(55, 176, 122, 0.2);
  align-self: flex-end;
}

.transcript-assistant {
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  align-self: flex-start;
}

.transcript-role {
  font-weight: 800;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.7;
  margin-bottom: 2px;
  display: block;
}

/* Scrollbar en el transcript */
.voice-transcript::-webkit-scrollbar { width: 4px; }
.voice-transcript::-webkit-scrollbar-track { background: transparent; }
.voice-transcript::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 10px; }
