/* ===== MemoriApp Styles ===== */

/* === VARIABLES === */
:root {
  --primary:       #1565C0;
  --primary-dark:  #0D47A1;
  --primary-light: #1976D2;
  --primary-faint: #E3F2FD;
  --secondary:     #2E7D32;
  --secondary-faint: #E8F5E9;
  --accent:        #00838F;
  --warn:          #E65100;
  --warn-faint:    #FBE9E7;
  --danger:        #C62828;
  --success:       #2E7D32;

  --bg:      #F5F8FF;
  --surface: #FFFFFF;
  --surface2: #F0F4FF;
  --border:  rgba(21,101,192,0.12);

  --text-1: #0D1B3E;
  --text-2: #37517E;
  --text-3: #7891B5;

  --shadow-sm: 0 1px 6px rgba(21,101,192,0.10);
  --shadow-md: 0 4px 16px rgba(21,101,192,0.14);
  --shadow-lg: 0 10px 32px rgba(21,101,192,0.20);

  --r-sm: 10px;
  --r-md: 18px;
  --r-lg: 26px;
  --r-xl: 40px;

  --nav-h: 68px;
  --header-h: 58px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* === RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-1);
  line-height: 1.6;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input  { font-family: inherit; }
img, svg { display: block; }
a { color: var(--primary); text-decoration: none; }

/* === APP SHELL === */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

/* === HEADER === */
.app-header {
  position: fixed;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: var(--header-h);
  background: var(--primary);
  z-index: 100;
  box-shadow: 0 2px 12px rgba(13,71,161,0.35);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 20px;
  padding-top: env(safe-area-inset-top);
}
.header-brand { display: flex; align-items: center; gap: 10px; }
.header-logo {
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.2);
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 20px;
}
.header-text { display: flex; flex-direction: column; }
.header-title { color: #fff; font-weight: 800; font-size: 17px; line-height: 1.1; }
.header-sub   { color: rgba(255,255,255,0.7); font-size: 11px; font-weight: 500; letter-spacing: 0.3px; }

/* === MAIN === */
main {
  margin-top: var(--header-h);
  margin-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding: 20px 16px 12px;
  flex: 1;
  overflow-x: hidden;
}

/* === SECTIONS (SPA) === */
.section { display: none; animation: fadeIn 0.28s var(--ease); }
.section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* === BOTTOM NAV === */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: var(--nav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  box-shadow: 0 -4px 20px rgba(21,101,192,0.10);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-3);
  transition: color 0.2s var(--ease);
  position: relative;
  padding: 0 4px;
}
.nav-item::before {
  content: '';
  position: absolute;
  top: 0; left: 25%; right: 25%;
  height: 3px;
  background: var(--primary);
  border-radius: 0 0 4px 4px;
  transform: scaleX(0);
  transition: transform 0.22s var(--spring);
}
.nav-item.active { color: var(--primary); }
.nav-item.active::before { transform: scaleX(1); }
.nav-icon { width: 26px; height: 26px; }
.nav-icon svg { width: 100%; height: 100%; }
.nav-label { font-size: 10px; font-weight: 600; letter-spacing: 0.2px; }

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 22px;
  border-radius: var(--r-xl);
  font-weight: 600;
  font-size: 15px;
  transition: all 0.18s var(--ease);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.96); }
.btn-primary  { background: var(--primary); color: #fff; box-shadow: 0 4px 14px rgba(21,101,192,0.38); }
.btn-primary:hover  { background: var(--primary-dark); box-shadow: 0 6px 20px rgba(21,101,192,0.45); }
.btn-secondary { background: var(--secondary); color: #fff; box-shadow: 0 4px 14px rgba(46,125,50,0.35); }
.btn-outline  { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover { background: var(--primary-faint); }
.btn-ghost    { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface2); }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-full { width: 100%; }
.btn-icon { padding: 10px; border-radius: 50%; }

/* === CARDS === */
.card {
  background: var(--surface);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}
.card-body { padding: 18px; }
.card-body-lg { padding: 22px; }

/* === SECTION TITLES === */
.section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.section-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-1);
  margin-bottom: 16px;
  letter-spacing: -0.3px;
}
.content-section { margin-bottom: 28px; }

/* === HERO === */
.hero-card {
  background: linear-gradient(135deg, var(--primary) 0%, #0D47A1 60%, #1a237e 100%);
  border-radius: var(--r-lg);
  padding: 28px 22px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  color: #fff;
  box-shadow: var(--shadow-lg);
}
.hero-card::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 200px; height: 200px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
}
.hero-card::after {
  content: '';
  position: absolute;
  bottom: -60px; left: -30px;
  width: 180px; height: 180px;
  background: rgba(255,255,255,0.04);
  border-radius: 50%;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 100px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 12px;
  letter-spacing: 0.3px;
}
.hero-title {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 10px;
  letter-spacing: -0.5px;
}
.hero-accent { color: #90CAF9; }
.hero-desc {
  font-size: 14px;
  color: rgba(255,255,255,0.82);
  margin-bottom: 22px;
  line-height: 1.6;
  max-width: 280px;
}
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-actions .btn-primary { background: rgba(255,255,255,0.22); box-shadow: none; border: 1px solid rgba(255,255,255,0.35); }
.hero-actions .btn-primary:hover { background: rgba(255,255,255,0.32); }
.hero-actions .btn-outline { border-color: rgba(255,255,255,0.5); color: #fff; }
.hero-emoji {
  position: absolute;
  bottom: 18px; right: 22px;
  font-size: 68px;
  opacity: 0.2;
  line-height: 1;
  pointer-events: none;
}

/* === STATS === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}
.stat-item {
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 14px 10px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.stat-icon  { font-size: 22px; margin-bottom: 6px; }
.stat-valor { font-size: 18px; font-weight: 800; color: var(--primary); line-height: 1; margin-bottom: 4px; }
.stat-etiqueta { font-size: 9.5px; font-weight: 500; color: var(--text-3); line-height: 1.3; }

/* === TIPO CARDS (expandable) === */
.tipo-card {
  background: var(--surface);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  margin-bottom: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}
.tipo-card:hover { box-shadow: var(--shadow-md); }
.tipo-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.tipo-emoji { font-size: 22px; flex-shrink: 0; }
.tipo-info  { flex: 1; }
.tipo-titulo { font-size: 15px; font-weight: 700; color: var(--text-1); margin-bottom: 3px; }
.tipo-resumen { font-size: 12.5px; color: var(--text-3); line-height: 1.4; }
.tipo-chevron {
  font-size: 18px; color: var(--text-3);
  transition: transform 0.25s var(--ease);
  flex-shrink: 0;
}
.tipo-card.open .tipo-chevron { transform: rotate(180deg); }
.tipo-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s var(--ease);
}
.tipo-card.open .tipo-body { max-height: 400px; }
.tipo-body-inner { padding: 0 18px 18px; }
.tipo-detalle { font-size: 13.5px; color: var(--text-2); line-height: 1.65; margin-bottom: 12px; }
.tipo-señales { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.tipo-señales li {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 13px; color: var(--text-2);
}
.tipo-señales li::before { content: '✓'; color: var(--secondary); font-weight: 700; margin-top: 1px; flex-shrink: 0; }

/* === CAUSES GRID === */
.causes-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.cause-item {
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.cause-emoji  { font-size: 26px; margin-bottom: 8px; }
.cause-titulo { font-size: 13px; font-weight: 700; color: var(--text-1); margin-bottom: 4px; }
.cause-desc   { font-size: 11.5px; color: var(--text-3); line-height: 1.5; }

/* === DISCLAIMER === */
.disclaimer {
  background: #FFF8E1;
  border: 1px solid #FFE082;
  border-radius: var(--r-sm);
  padding: 12px 14px;
  font-size: 12.5px;
  color: #5D4037;
  line-height: 1.55;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.disclaimer-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }

/* === TEST === */
.test-intro {
  display: flex; flex-direction: column; gap: 20px;
}
.test-intro-hero {
  background: linear-gradient(135deg, #1565C0, #0D47A1);
  border-radius: var(--r-lg);
  padding: 28px 22px;
  color: #fff;
  text-align: center;
}
.test-intro-hero .hero-icon { font-size: 52px; margin-bottom: 12px; }
.test-intro-hero h2 { font-size: 24px; font-weight: 800; margin-bottom: 8px; }
.test-intro-hero p { font-size: 14px; opacity: 0.85; line-height: 1.6; }

.progress-wrap { margin-bottom: 6px; }
.progress-info  { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-3); margin-bottom: 8px; font-weight: 500; }
.progress-bar {
  height: 6px; background: var(--primary-faint);
  border-radius: 100px; overflow: hidden;
}
.progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--primary), #42A5F5);
  border-radius: 100px;
  transition: width 0.4s var(--ease);
}

.question-card { padding: 24px 20px; }
.question-num  { font-size: 11px; font-weight: 700; color: var(--text-3); letter-spacing: 0.8px; text-transform: uppercase; margin-bottom: 10px; }
.question-text { font-size: 18px; font-weight: 700; color: var(--text-1); line-height: 1.45; margin-bottom: 22px; letter-spacing: -0.2px; }
.options-list  { display: flex; flex-direction: column; gap: 10px; }
.option-btn {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-radius: var(--r-sm);
  border: 2px solid var(--border);
  background: var(--surface2);
  text-align: left;
  font-size: 14px; font-weight: 500; color: var(--text-1);
  transition: all 0.18s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.option-btn:hover { border-color: var(--primary-light); background: var(--primary-faint); }
.option-btn.selected { border-color: var(--primary); background: var(--primary-faint); color: var(--primary); }
.option-letter {
  width: 28px; height: 28px; flex-shrink: 0;
  background: var(--surface); border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: var(--text-3);
  border: 1px solid var(--border);
}
.option-btn.selected .option-letter { background: var(--primary); color: #fff; border-color: var(--primary); }

.results-card { padding: 28px 22px; text-align: center; }
.results-emoji  { font-size: 56px; margin-bottom: 16px; }
.results-nivel  { font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 8px; }
.results-titulo { font-size: 26px; font-weight: 800; color: var(--text-1); margin-bottom: 16px; letter-spacing: -0.3px; }
.results-score-ring {
  width: 100px; height: 100px; margin: 0 auto 20px;
  position: relative;
}
.results-score-ring svg { transform: rotate(-90deg); }
.results-score-ring .ring-bg { stroke: var(--primary-faint); }
.results-score-ring .ring-fill { stroke-linecap: round; transition: stroke-dashoffset 1s var(--ease); }
.results-score-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.results-score-num  { font-size: 26px; font-weight: 800; color: var(--text-1); line-height: 1; }
.results-score-max  { font-size: 11px; color: var(--text-3); }
.results-desc { font-size: 14px; color: var(--text-2); line-height: 1.65; margin-bottom: 14px; text-align: left; }
.results-rec-box {
  background: var(--surface2);
  border-radius: var(--r-sm);
  padding: 14px;
  text-align: left;
  margin-bottom: 22px;
  border-left: 3px solid var(--primary);
}
.results-rec-box p { font-size: 13.5px; color: var(--text-2); line-height: 1.6; }
.results-actions { display: flex; flex-direction: column; gap: 10px; }

/* === EXERCISES === */
.exercises-header { margin-bottom: 20px; }
.exercises-header h2 { font-size: 24px; font-weight: 800; color: var(--text-1); margin-bottom: 4px; }
.exercises-header p  { font-size: 14px; color: var(--text-3); }

.exercise-cards { display: flex; flex-direction: column; gap: 12px; }
.exercise-card {
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 18px;
  border: 2px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center; gap: 16px;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.exercise-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.exercise-card:active { transform: scale(0.98); }
.exercise-icon-wrap {
  width: 54px; height: 54px; flex-shrink: 0;
  background: var(--primary-faint);
  border-radius: 16px;
  display: grid; place-items: center;
  font-size: 28px;
}
.exercise-info { flex: 1; }
.exercise-name { font-size: 16px; font-weight: 700; color: var(--text-1); margin-bottom: 3px; }
.exercise-desc { font-size: 12.5px; color: var(--text-3); margin-bottom: 8px; line-height: 1.4; }
.exercise-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.exercise-tag {
  display: inline-flex; align-items: center; gap: 3px;
  background: var(--surface2); border-radius: 100px;
  padding: 3px 9px; font-size: 11px; font-weight: 600; color: var(--text-2);
}
.exercise-chevron { font-size: 20px; color: var(--text-3); flex-shrink: 0; }

/* === GAME AREA === */
.game-area { display: flex; flex-direction: column; gap: 16px; }
.game-header {
  display: flex; align-items: center; gap: 12px;
}
.back-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--surface2);
  display: grid; place-items: center;
  font-size: 18px;
  color: var(--text-2);
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.back-btn:hover { background: var(--primary-faint); color: var(--primary); }
.game-title { font-size: 18px; font-weight: 700; color: var(--text-1); }

.game-card { background: var(--surface); border-radius: var(--r-md); padding: 22px; box-shadow: var(--shadow-md); border: 1px solid var(--border); }
.game-instructions { font-size: 14px; color: var(--text-2); line-height: 1.65; margin-bottom: 16px; }

.timer-display {
  font-size: 38px; font-weight: 800; color: var(--primary);
  text-align: center; margin: 8px 0;
}

/* Visual Memory Grid */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 12px 0;
}
.memory-item {
  aspect-ratio: 1;
  background: var(--surface2);
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  font-size: 36px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.18s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.memory-item:hover { background: var(--primary-faint); border-color: var(--primary-light); }
.memory-item.selected { background: var(--primary-faint); border-color: var(--primary); }
.memory-item.correct  { background: var(--secondary-faint); border-color: var(--secondary); }
.memory-item.wrong    { background: #FFEBEE; border-color: var(--danger); }
.memory-item.missed   { background: #FFF8E1; border-color: #F9A825; }
.memory-item.hidden   { background: #E8EAF6; border-color: transparent; font-size: 0; }

/* Digit Span */
.digits-display {
  text-align: center;
  font-size: 52px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 12px;
  padding: 20px;
  min-height: 100px;
  display: flex; align-items: center; justify-content: center;
}
.digit-input-wrap { display: flex; gap: 8px; margin: 12px 0; }
.digit-input {
  flex: 1;
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  color: var(--text-1);
  background: var(--surface2);
  outline: none;
  transition: border-color 0.2s;
}
.digit-input:focus { border-color: var(--primary); background: var(--primary-faint); }
.span-indicator {
  display: flex; gap: 6px; justify-content: center; margin: 8px 0;
}
.span-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.3s;
}
.span-dot.active  { background: var(--primary); }
.span-dot.success { background: var(--secondary); }
.span-dot.fail    { background: var(--danger); }

/* Word Pairs */
.pairs-grid { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.pair-row {
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; gap: 8px;
}
.pair-word {
  background: var(--primary-faint);
  border-radius: var(--r-sm);
  padding: 12px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
}
.pair-arrow { font-size: 16px; color: var(--text-3); }

.recall-row {
  display: grid; grid-template-columns: 1fr 10px 1fr;
  align-items: center; gap: 8px; margin-bottom: 10px;
}
.recall-cue {
  background: var(--primary-faint);
  border-radius: var(--r-sm);
  padding: 12px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
}
.recall-input {
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  text-transform: uppercase;
  background: var(--surface2);
  color: var(--text-1);
  outline: none;
  transition: border-color 0.2s;
}
.recall-input:focus { border-color: var(--primary); }
.recall-input.correct-input { border-color: var(--secondary); background: var(--secondary-faint); color: var(--secondary); }
.recall-input.wrong-input   { border-color: var(--danger); background: #FFEBEE; color: var(--danger); }

/* ── Memoria Espacial (Corsi 4x4) ── */
.spatial-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-width: 280px;
  margin: 16px auto;
  aspect-ratio: 1;
}
.spatial-cell {
  background: var(--surface2);
  border-radius: var(--r-sm);
  border: 2px solid transparent;
  transition: all 0.18s var(--ease);
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  position: relative;
}
.spatial-cell.tappable:hover { background: var(--primary-faint); }
.spatial-cell.lit {
  background: var(--primary);
  box-shadow: 0 0 22px var(--primary), 0 0 8px var(--primary-light);
  border-color: var(--primary-light);
  transform: scale(0.94);
}
.spatial-cell.tapped {
  background: var(--secondary);
  border-color: var(--secondary);
  animation: tapPulse 0.3s var(--spring);
}
.spatial-cell.wrong {
  background: var(--danger);
  border-color: var(--danger);
}
@keyframes tapPulse { 0% { transform: scale(0.8); } 100% { transform: scale(1); } }

/* ── Fluidez Verbal ── */
.fluidez-categoria {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: var(--r-md);
  padding: 18px;
  text-align: center;
  color: #fff;
  margin-bottom: 14px;
}
.fluidez-cat-label { font-size: 11px; font-weight: 700; opacity: 0.8; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 4px; }
.fluidez-cat-name  { font-size: 24px; font-weight: 800; letter-spacing: -0.3px; }
.fluidez-cat-ej    { font-size: 12px; opacity: 0.75; margin-top: 6px; font-style: italic; }

.fluidez-top {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.fluidez-count {
  background: var(--secondary-faint);
  color: var(--secondary);
  border-radius: 100px;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 800;
}
.fluidez-timer-mini {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
}
.fluidez-input {
  width: 100%;
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 16px;
  background: var(--surface2);
  color: var(--text-1);
  outline: none;
  text-transform: lowercase;
}
.fluidez-input:focus { border-color: var(--primary); }
.fluidez-help { font-size: 11px; color: var(--text-3); text-align: center; margin: 6px 0; }
.fluidez-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  max-height: 180px; overflow-y: auto;
  padding: 8px 0;
}
.fluidez-chip {
  background: var(--surface2);
  color: var(--text-1);
  border-radius: 100px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  animation: chipIn 0.2s var(--spring);
}
@keyframes chipIn { from { opacity: 0; transform: scale(0.7); } to { opacity: 1; transform: scale(1); } }

/* ── Cálculo Mental ── */
.calculo-problema {
  text-align: center;
  padding: 24px 12px;
}
.calculo-num {
  font-size: 48px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 4px;
  line-height: 1.1;
}
.calculo-op { color: var(--text-3); margin: 0 8px; }
.calculo-input {
  width: 100%;
  padding: 18px;
  margin-top: 16px;
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  border: 2px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface2);
  color: var(--text-1);
  outline: none;
}
.calculo-input:focus { border-color: var(--primary); background: var(--primary-faint); }
.calculo-progress {
  display: flex; justify-content: center; gap: 4px; margin-bottom: 12px;
}
.calculo-dot {
  width: 24px; height: 6px;
  border-radius: 3px;
  background: var(--border);
  transition: background 0.2s;
}
.calculo-dot.done    { background: var(--secondary); }
.calculo-dot.fail    { background: var(--danger); }
.calculo-dot.current { background: var(--primary); }

/* ── ¿Qué cambió? grid ronda info ── */
.ronda-info {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; font-weight: 600; color: var(--text-3);
  margin-bottom: 10px;
}
.ronda-info .ronda-num { color: var(--primary); }

/* Score/Result pills */
.score-display {
  text-align: center;
  padding: 20px;
}
.score-big {
  font-size: 54px; font-weight: 800;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 6px;
}
.score-label { font-size: 14px; color: var(--text-3); font-weight: 500; }
.score-stars { font-size: 28px; margin: 8px 0; letter-spacing: 4px; }

/* === GUIDE === */
.guide-section { margin-bottom: 24px; }
.guide-section-title {
  font-size: 18px; font-weight: 800; color: var(--text-1);
  margin-bottom: 14px; letter-spacing: -0.2px;
  display: flex; align-items: center; gap: 8px;
}

.alerts-list { display: flex; flex-direction: column; gap: 8px; }
.alert-item {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--surface);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.alert-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--danger);
  margin-top: 5px; flex-shrink: 0;
}
.alert-text { font-size: 13.5px; color: var(--text-2); line-height: 1.5; }

.habits-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.habit-card {
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.habit-emoji  { font-size: 28px; margin-bottom: 8px; }
.habit-titulo { font-size: 13px; font-weight: 700; color: var(--text-1); margin-bottom: 4px; }
.habit-desc   { font-size: 11.5px; color: var(--text-3); line-height: 1.5; margin-bottom: 8px; }
.habit-freq   {
  display: inline-flex; align-items: center;
  background: var(--secondary-faint);
  border-radius: 100px;
  padding: 3px 9px;
  font-size: 10px; font-weight: 600; color: var(--secondary);
}

.recursos-list { display: flex; flex-direction: column; gap: 10px; }
.recurso-card {
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.recurso-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.recurso-pais   { font-size: 20px; }
.recurso-nombre { font-size: 14px; font-weight: 700; color: var(--text-1); }
.recurso-info   { display: flex; flex-direction: column; gap: 4px; }
.recurso-tel, .recurso-web {
  font-size: 13px; color: var(--text-2);
  display: flex; align-items: center; gap: 6px;
}

/* === INSTALL BANNER === */
.install-banner {
  position: fixed;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 10px);
  left: 50%; transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 448px;
  background: var(--primary-dark);
  color: #fff;
  border-radius: var(--r-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideUp 0.35s var(--spring);
}
.install-banner.hidden { display: none; }
@keyframes slideUp { from { opacity: 0; transform: translateX(-50%) translateY(20px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
.install-icon { font-size: 28px; flex-shrink: 0; }
.install-text { flex: 1; }
.install-text strong { display: block; font-size: 14px; font-weight: 700; }
.install-text small  { font-size: 11.5px; opacity: 0.75; }
.install-actions { display: flex; gap: 6px; flex-shrink: 0; }
.install-actions .btn-primary { background: rgba(255,255,255,0.25); font-size: 13px; padding: 8px 14px; }
.install-actions .btn-ghost   { color: rgba(255,255,255,0.7); font-size: 18px; padding: 6px; }

/* === TOAST === */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 14px);
  left: 50%; transform: translateX(-50%);
  background: #1A237E;
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--r-xl);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 300;
  white-space: nowrap;
  animation: toastIn 0.3s var(--spring);
}
.toast.hidden { display: none; }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) scale(0.9); } to { opacity: 1; transform: translateX(-50%) scale(1); } }

/* === EMPTY / LOADING === */
.phase-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.8px;
  text-transform: uppercase; color: var(--text-3);
  margin-bottom: 8px;
}
.phase-title {
  font-size: 22px; font-weight: 800; color: var(--text-1);
  margin-bottom: 6px; letter-spacing: -0.3px;
}
.phase-desc {
  font-size: 14px; color: var(--text-3); line-height: 1.55;
}

/* === UTILITIES === */
.text-center { text-align: center; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.flex  { display: flex; }
.flex-col { flex-direction: column; }
.hidden { display: none !important; }

/* === PULSE ANIMATION for timer === */
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
.pulse { animation: pulse 1s infinite; }

/* === RESPONSIVE: small screens === */
@media (max-width: 340px) {
  .hero-title { font-size: 26px; }
  .causes-grid { grid-template-columns: 1fr; }
  .habits-grid  { grid-template-columns: 1fr; }
}

/* ===================================================== */
/* === MODO OSCURO AUTOMÁTICO ========================== */
/* ===================================================== */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0F1419;
    --surface:   #1A2332;
    --surface2:  #243042;
    --border:    rgba(144, 202, 249, 0.12);
    --text-1:    #E8F0FF;
    --text-2:    #B0BFD0;
    --text-3:    #7891B5;
    --primary:       #42A5F5;
    --primary-dark:  #1976D2;
    --primary-light: #90CAF9;
    --primary-faint: rgba(66, 165, 245, 0.15);
    --secondary:       #66BB6A;
    --secondary-faint: rgba(102, 187, 106, 0.15);
    --warn-faint:      rgba(230, 81, 0, 0.18);
    --shadow-sm: 0 1px 6px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
    --shadow-lg: 0 10px 32px rgba(0,0,0,0.6);
  }
  .app-header { background: var(--primary-dark); box-shadow: 0 2px 12px rgba(0,0,0,0.5); }
  .disclaimer { background: rgba(255, 224, 130, 0.12); border-color: rgba(255, 224, 130, 0.3); color: #FFE082; }
  .option-btn { background: var(--surface2); }
  .digit-input, .recall-input { background: var(--surface2); color: var(--text-1); }
  .memory-item { background: var(--surface2); }
  .memory-item.hidden { background: var(--surface); }
  .alert-item { background: var(--surface); }
  .recurso-card, .habit-card, .cause-item, .tipo-card, .stat-item { background: var(--surface); }
  .results-rec-box { background: var(--surface2); }
  .pair-word, .recall-cue { background: rgba(66, 165, 245, 0.18); }
  .spatial-cell, .fluidez-input, .calculo-input { background: var(--surface2); }
  .fluidez-chip { background: var(--surface2); }
}

/* ===================================================== */
/* === TAMAÑO DE LETRA AJUSTABLE ======================= */
/* ===================================================== */
body.font-lg .hero-title    { font-size: 36px; }
body.font-lg .hero-desc     { font-size: 16px; }
body.font-lg .section-title { font-size: 22px; }
body.font-lg .question-text { font-size: 20px; }
body.font-lg .option-btn    { font-size: 16px; padding: 16px 18px; }
body.font-lg .tipo-titulo   { font-size: 17px; }
body.font-lg .tipo-resumen  { font-size: 14px; }
body.font-lg .tipo-detalle  { font-size: 15px; }
body.font-lg .tipo-señales li, body.font-lg .alert-text { font-size: 15px; }
body.font-lg .habit-titulo, body.font-lg .cause-titulo { font-size: 15px; }
body.font-lg .habit-desc, body.font-lg .cause-desc     { font-size: 13px; }
body.font-lg .results-desc, body.font-lg .results-rec-box p { font-size: 16px; }
body.font-lg .nav-label { font-size: 11px; }

body.font-xl .hero-title    { font-size: 40px; }
body.font-xl .hero-desc     { font-size: 17px; }
body.font-xl .section-title { font-size: 24px; }
body.font-xl .question-text { font-size: 22px; }
body.font-xl .option-btn    { font-size: 17px; padding: 18px 20px; }
body.font-xl .tipo-titulo   { font-size: 18px; }
body.font-xl .tipo-resumen  { font-size: 15px; }
body.font-xl .tipo-detalle  { font-size: 16px; }
body.font-xl .tipo-señales li, body.font-xl .alert-text { font-size: 16px; }
body.font-xl .habit-titulo, body.font-xl .cause-titulo { font-size: 16px; }
body.font-xl .habit-desc, body.font-xl .cause-desc     { font-size: 14px; }
body.font-xl .results-desc, body.font-xl .results-rec-box p { font-size: 17px; }
body.font-xl .nav-label { font-size: 12px; }

/* Header buttons (A-/A+) */
.header-actions { display: flex; gap: 6px; align-items: center; }
.header-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  display: grid; place-items: center;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.header-btn:active { transform: scale(0.92); }
.header-btn:hover { background: rgba(255,255,255,0.25); }
.header-btn.font-active { background: #fff; color: var(--primary); }

/* ===================================================== */
/* === TARJETA DE PROGRESO PERSONAL ==================== */
/* ===================================================== */
.progress-card {
  background: linear-gradient(135deg, var(--secondary) 0%, #1B5E20 100%);
  border-radius: var(--r-lg);
  padding: 22px 20px;
  color: #fff;
  margin-bottom: 20px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.progress-card::before {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 140px; height: 140px;
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
}
.progress-card-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px;
  position: relative;
}
.progress-card-emoji { font-size: 26px; }
.progress-card-title { font-size: 17px; font-weight: 800; }
.progress-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  position: relative;
}
.progress-stat {
  background: rgba(255,255,255,0.15);
  border-radius: var(--r-sm);
  padding: 10px 6px;
  text-align: center;
  backdrop-filter: blur(4px);
}
.progress-stat-num   { font-size: 22px; font-weight: 800; line-height: 1; margin-bottom: 3px; }
.progress-stat-label { font-size: 10px; opacity: 0.85; font-weight: 500; }
.progress-empty {
  font-size: 13px;
  opacity: 0.9;
  text-align: center;
  padding: 8px 0;
  line-height: 1.5;
}

/* ===================================================== */
/* === BOTÓN COMPARTIR ================================= */
/* ===================================================== */
.share-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 22px;
  border-radius: var(--r-xl);
  background: var(--surface2);
  color: var(--primary);
  font-weight: 600;
  font-size: 14px;
  border: 2px solid var(--primary);
  -webkit-tap-highlight-color: transparent;
  transition: all 0.18s var(--ease);
}
.share-btn:hover  { background: var(--primary); color: #fff; }
.share-btn:active { transform: scale(0.97); }
