/* ============================================================
   BARNETEGI — Hoja de estilos
   Móvil primero. Tema claro/oscuro automático + manual.
   Paleta inspirada en la ikurriña suavizada: verde bosque,
   rojo teja y crudo.
   ============================================================ */

/* Identidad Barnetegi: bosque · teja · crema · cantábrico · dorado · pizarra.
   El alma: el camino (bidea) — cálido, artesanal, sereno. */
:root {
  --bg: #f3ede1;           /* crema */
  --bg-card: #fbf8f1;
  --bg-sunken: #eae2d1;
  --ink: #2b3530;          /* verde-tinta cálido */
  --ink-soft: #6f6b5e;
  --line: #e0d7c4;
  --brand: #2e4a3b;        /* bosque */
  --brand-ink: #f3ede1;
  --brand-soft: #dfe7dd;
  --accent: #c24b3a;       /* teja */
  --accent-soft: #f3ded7;
  --gold: #a97e2f;         /* dorado legible sobre crema */
  --gold-bright: #e1b55c;
  --gold-soft: #f2e6c9;
  --ok: #3d6e51;
  --ok-soft: #dfe9de;
  --bad: #c24b3a;
  --bad-soft: #f3ded7;
  --info: #2e6fa7;         /* cantábrico */
  --info-soft: #dde8f1;
  --slate: #4a535a;        /* pizarra */
  --radius: 18px;
  --shadow: 0 1px 2px rgba(46, 58, 47, .07), 0 6px 18px rgba(46, 58, 47, .07);
  --nav-h: 62px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, ui-serif, serif;
}

:root {
  /* ---- tokens semánticos (Instrucción Maestra §9/§17) sobre la paleta base ---- */
  --color-forest: #2e4a3b;
  --color-terracotta: #c24b3a;
  --color-cream: #f3ede1;
  --color-cantabrian: #2e6fa7;
  --color-gold: #e1b55c;
  --color-slate: #4a535a;
  --color-brand-primary: var(--brand);
  --color-brand-secondary: var(--accent);
  --color-bg-page: var(--bg);
  --color-bg-surface: var(--bg-card);
  --color-text-primary: var(--ink);
  --color-text-secondary: var(--ink-soft);
  --color-success: var(--ok);
  --color-warning: var(--gold);
  --color-danger: var(--bad);
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px;
  --radius-card: 18px; --radius-pill: 999px; --radius-field: 12px;
  --motion-quick: .18s; --motion-standard: .28s;
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease-out: cubic-bezier(.22, .8, .36, 1);
}

:root {
  --c-nor: #2f6fd0;
  --c-nori: #1d8a4e;
  --c-nork: #c2453f;
}
[data-theme="dark"] {
  --c-nor: #7aa7ec;
  --c-nori: #63c98f;
  --c-nork: #ef8b85;
  /* gaua: noche del bosque, contraste cálido y descansado */
  --bg: #141b17;
  --bg-card: #232e27;
  --bg-sunken: #0e130f;
  --ink: #ece5d5;
  --ink-soft: #9aa295;
  --line: #3a4740;
  --brand: #8db99a;
  --brand-ink: #141b17;
  --brand-soft: #24352b;
  --accent: #e07b62;
  --accent-soft: #3a251f;
  --gold: #e1b55c;
  --gold-bright: #e1b55c;
  --gold-soft: #372e1a;
  --ok: #8db99a;
  --ok-soft: #24352b;
  --bad: #e07b62;
  --bad-soft: #3a251f;
  --info: #85b1d8;
  --info-soft: #1d2a37;
  --slate: #9aa5ad;
  --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; }

/* ---------- estructura ---------- */

#screen {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--nav-h) + var(--safe-bottom) + 24px);
  animation: fadein .28s cubic-bezier(.22, .8, .36, 1);
}

@keyframes fadein {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- barra de navegación inferior ---------- */

nav.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--bg-card);
  border-top: 1px solid var(--line);
  display: flex;
  z-index: 50;
}

nav.tabbar button {
  flex: 1;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: .68rem;
  color: var(--ink-soft);
  cursor: pointer;
  padding-top: 6px;
}

nav.tabbar button .ico { font-size: 1.35rem; line-height: 1.1; }
nav.tabbar button.active { color: var(--brand); font-weight: 600; }

/* ---------- componentes ---------- */

.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
}

.card.tappable { cursor: pointer; transition: transform .08s ease; }
.card.tappable:active { transform: scale(.985); }

h1 { font-size: 1.55rem; margin: 10px 0 4px; letter-spacing: -.01em; font-family: var(--serif); font-weight: 700; }
h2 { font-size: 1.18rem; margin: 20px 0 8px; font-family: var(--serif); }
h3 { font-size: 1.02rem; margin: 14px 0 6px; }

.sub { color: var(--ink-soft); font-size: .9rem; }
.small { font-size: .8rem; }
.center { text-align: center; }

.eu { color: var(--brand); font-weight: 650; }

.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 650;
  background: var(--bg-sunken);
  color: var(--ink-soft);
  vertical-align: middle;
}
.pill.brand { background: var(--brand-soft); color: var(--brand); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.pill.gold { background: var(--gold-soft); color: var(--gold); }
.pill.info { background: var(--info-soft); color: var(--info); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 12px;
  padding: 13px 20px;
  font-size: 1rem;
  font-weight: 650;
  cursor: pointer;
  background: var(--bg-sunken);
  color: var(--ink);
  min-height: 48px;
  transition: transform .08s ease, opacity .15s;
  touch-action: manipulation;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--brand); color: var(--brand-ink); }
.btn.danger  { background: var(--accent); color: #fff; }
.btn.ghost   { background: transparent; border: 1.5px solid var(--line); }
.btn.block   { display: flex; width: 100%; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.sm { padding: 8px 14px; min-height: 38px; font-size: .88rem; border-radius: 10px; }

.btnrow { display: flex; gap: 10px; margin-top: 12px; }
.btnrow .btn { flex: 1; }

/* ---------- barras de progreso ---------- */

.bar {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-sunken);
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--brand);
  transition: width .3s ease;
}
.bar.gold > i { background: var(--gold); }

/* ---------- cabecera de pantalla ---------- */

.screen-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.screen-head .back {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  width: 40px; height: 40px;
  font-size: 1.1rem;
  cursor: pointer;
  flex: none;
}
.screen-head h1 { margin: 0; font-size: 1.25rem; }

/* ---------- ejercicios ---------- */

.ex-prompt { font-size: 1.25rem; margin: 14px 0 4px; font-weight: 600; }
.ex-hint { color: var(--ink-soft); font-size: .85rem; margin-bottom: 12px; }

.choices { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.choices .btn { justify-content: flex-start; text-align: left; font-weight: 500; }
.choices .btn.correct { background: var(--ok-soft); color: var(--ok); border: 1.5px solid var(--ok); }
.choices .btn.wrong   { background: var(--bad-soft); color: var(--bad); border: 1.5px solid var(--bad); }

input.answer {
  width: 100%;
  font: inherit;
  font-size: 1.15rem;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--bg-card);
  color: var(--ink);
  margin-top: 12px;
}
input.answer:focus { outline: none; border-color: var(--brand); }
input.answer.correct { border-color: var(--ok); background: var(--ok-soft); }
input.answer.wrong   { border-color: var(--bad); background: var(--bad-soft); }

/* fichas de ordenar palabras */
.chips, .chips-target {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  min-height: 52px;
}
.chips-target {
  border: 1.5px dashed var(--line);
  border-radius: 12px;
  padding: 8px;
  background: var(--bg-sunken);
}
.chip {
  border: 1px solid var(--line);
  background: var(--bg-card);
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 1.05rem;
  cursor: pointer;
  box-shadow: var(--shadow);
  touch-action: manipulation;
}
.chip:active { transform: scale(.96); }
.chip.ghosted { opacity: .25; pointer-events: none; }

/* feedback */
.feedback {
  margin-top: 14px;
  border-radius: 12px;
  padding: 13px 15px;
  font-size: .95rem;
}
.feedback.ok  { background: var(--ok-soft); color: var(--ok); }
.feedback.bad { background: var(--bad-soft); color: var(--bad); }
.feedback .right-answer { font-size: 1.1rem; font-weight: 700; display: block; margin-top: 4px; }

/* tarjeta SRS */
.srs-card { text-align: center; padding: 30px 18px; }
.srs-word { font-size: 1.9rem; font-weight: 700; letter-spacing: -.01em; }
.srs-sub { color: var(--ink-soft); margin-top: 6px; }
.srs-answer { margin-top: 18px; padding-top: 18px; border-top: 1px dashed var(--line); }
.grade-row { display: flex; gap: 8px; margin-top: 16px; }
.grade-row .btn { flex: 1; padding: 12px 4px; font-size: .85rem; flex-direction: column; gap: 0; }
.grade-row .btn small { font-weight: 400; opacity: .75; font-size: .68rem; }
.g-again { background: var(--bad-soft); color: var(--bad); }
.g-hard  { background: var(--gold-soft); color: var(--gold); }
.g-good  { background: var(--ok-soft); color: var(--ok); }
.g-easy  { background: var(--info-soft); color: var(--info); }

/* ---------- lecciones ---------- */

.lesson-body p { margin: 10px 0; }
.lesson-body h3 { color: var(--brand); margin-top: 22px; }
/* Listas de las lecciones generadas por IA (las curadas usan .ej, no <ul>). */
.lesson-body ul, .lesson-body ol { margin: 10px 0 14px; padding-left: 20px; }
.lesson-body li { margin: 6px 0; line-height: 1.55; padding-left: 3px; }
.lesson-body ul { list-style: disc; }
.lesson-body ol { list-style: decimal; }
.lesson-body li::marker { color: var(--brand); }
.lesson-body li > ul, .lesson-body li > ol { margin: 6px 0; }
.lesson-body table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: .92rem; }
.lesson-body th, .lesson-body td {
  border: 1px solid var(--line);
  padding: 7px 9px;
  text-align: left;
}
.lesson-body th { background: var(--bg-sunken); font-weight: 650; }
.lesson-body .ej {
  background: var(--brand-soft);
  border-left: 3px solid var(--brand);
  border-radius: 0 10px 10px 0;
  padding: 10px 14px;
  margin: 10px 0;
}
.lesson-body .ej .es { color: var(--ink-soft); font-size: .88rem; display: block; }
.lesson-body .ojo {
  background: var(--gold-soft);
  border-left: 3px solid var(--gold);
  border-radius: 0 10px 10px 0;
  padding: 10px 14px;
  margin: 10px 0;
  font-size: .92rem;
}
.lesson-body .morf { letter-spacing: .02em; }
.lesson-body .nor  { color: var(--c-nor);  font-weight: 700; }
.lesson-body .nori { color: var(--c-nori); font-weight: 700; }
.lesson-body .nork { color: var(--c-nork); font-weight: 700; }
.lesson-body .freq { color: var(--gold); font-size: .85rem; white-space: nowrap; }
.lesson-body .ancla {
  background: var(--bg-sunken);
  border-radius: 10px;
  padding: 10px 14px;
  margin: 10px 0;
  font-size: 1.02rem;
}
.lesson-body .morf b { color: var(--accent); }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- lectura graduada ---------- */

.reading-text { font-size: 1.12rem; line-height: 1.9; }
.reading-text .w { cursor: pointer; border-bottom: 1px dotted var(--line); }
.reading-text .w:active { background: var(--brand-soft); }
.gloss-pop {
  position: fixed;
  left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 12px);
  background: var(--ink);
  color: var(--bg);
  border-radius: 12px;
  padding: 10px 18px;
  font-size: .95rem;
  box-shadow: var(--shadow);
  z-index: 60;
  max-width: 90vw;
}

/* ---------- estadísticas ---------- */

.statgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}
.stat .n { font-size: 1.6rem; font-weight: 750; color: var(--brand); }
.stat .l { font-size: .75rem; color: var(--ink-soft); }

.heat { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 8px; }
.heat i {
  width: 11px; height: 11px;
  border-radius: 3px;
  background: var(--bg-sunken);
}
.heat i.h1 { background: color-mix(in srgb, var(--brand) 35%, var(--bg-sunken)); }
.heat i.h2 { background: color-mix(in srgb, var(--brand) 65%, var(--bg-sunken)); }
.heat i.h3 { background: var(--brand); }

/* ---------- nivel / itinerario ---------- */

.level-row { display: flex; align-items: center; gap: 12px; }
.level-badge {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 1.05rem;
  flex: none;
  background: var(--brand-soft);
  color: var(--brand);
}
.level-badge.locked { background: var(--bg-sunken); color: var(--ink-soft); }
.unit-num {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem;
  flex: none;
  background: var(--bg-sunken);
  color: var(--ink-soft);
}
.unit-num.done { background: var(--brand); color: var(--brand-ink); }
.unit-num.next { background: var(--gold-soft); color: var(--gold); border: 2px solid var(--gold); }

.list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 4px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.list-row:last-child { border-bottom: none; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .title { font-weight: 600; }
.list-row .chev { color: var(--ink-soft); }

/* ---------- referencia / diccionario ---------- */

input.search {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--bg-card);
  color: var(--ink);
  margin-bottom: 12px;
}
input.search:focus { outline: none; border-color: var(--brand); }

.dict-entry { padding: 10px 2px; border-bottom: 1px solid var(--line); }
.dict-entry:last-child { border: none; }
.dict-entry .eu-word { font-weight: 700; color: var(--brand); font-size: 1.05rem; }
.dict-entry .es-word { color: var(--ink-soft); }
.dict-entry .ex { font-size: .85rem; color: var(--ink-soft); font-style: italic; margin-top: 2px; }

/* ---------- utilidades ---------- */

.mt0 { margin-top: 0; } .mt1 { margin-top: 8px; } .mt2 { margin-top: 16px; } .mt3 { margin-top: 24px; }
.mb1 { margin-bottom: 8px; } .mb2 { margin-bottom: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row .grow { flex: 1; }
.hidden { display: none !important; }

.audio-btn {
  background: var(--brand-soft);
  color: var(--brand);
  border: none;
  border-radius: 50%;
  width: 42px; height: 42px;
  font-size: 1.15rem;
  cursor: pointer;
  flex: none;
}

.toast {
  position: fixed;
  left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 14px);
  background: var(--ink);
  color: var(--bg);
  padding: 11px 20px;
  border-radius: 12px;
  font-size: .92rem;
  z-index: 100;
  box-shadow: var(--shadow);
  animation: fadein .2s ease;
  max-width: 88vw;
  text-align: center;
}

/* pantallas grandes */
@media (min-width: 720px) {
  #screen { padding-top: 28px; }
  h1 { font-size: 1.7rem; }
}

/* globo flotante «pregunta al tutor» (solo con IA activa) */
#askfab {
  position: fixed;
  right: 16px;
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  font-size: 1.45rem;
  background: var(--brand);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .28);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
#askfab[hidden] { display: none; }

/* junta evaluadora: legibilidad y modo mayor */
nav.tabbar button { font-size: .8125rem; }
.big-text { font-size: 118%; }
.big-text nav.tabbar button { font-size: .875rem; }
.card { overflow-wrap: break-word; }

/* Bidelaguna: conexiones entre la unidad y la teoría. */
.bridge .lotu { margin-top: 6px; }
.bridge .list-row { cursor: pointer; }

/* Barra de progreso superior + desplegable «¿dónde estoy? · continuar» */
#topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--bg-card);
  border-bottom: 1px solid var(--line);
  padding-top: var(--safe-top);
}
#topbar[hidden] { display: none; }
#topbar-btn {
  display: block; width: 100%; max-width: 640px; margin: 0 auto;
  background: none; border: none; cursor: pointer;
  padding: 7px 16px 9px; text-align: left;
}
.tb-row { display: flex; align-items: center; justify-content: space-between; }
#tb-label { font-size: .82rem; color: var(--muted); }
.tb-chev { font-size: .75rem; color: var(--muted); transition: transform .2s; }
#topbar-btn[aria-expanded="true"] .tb-chev { transform: rotate(180deg); }
.tb-fill-wrap { height: 4px; background: var(--line); border-radius: 2px; margin-top: 6px; overflow: hidden; }
#tb-fill { display: block; height: 100%; background: var(--brand); width: 0; transition: width .35s ease; }
#topmenu {
  max-width: 640px; margin: 0 auto; padding: 2px 12px 12px;
}
#topmenu[hidden] { display: none; }
.tm-continue {
  display: block; width: 100%; text-align: left;
  background: var(--brand); color: var(--brand-ink);
  border: none; border-radius: 10px; padding: 11px 12px;
  font-weight: 600; margin: 4px 0 10px; cursor: pointer;
}
.tm-level {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: none; padding: 8px 4px; cursor: pointer; color: inherit;
}
.tm-lv { font-weight: 650; min-width: 26px; }
.tm-bar { flex: 1; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.tm-bar i { display: block; height: 100%; background: var(--brand); }
.tm-num { font-size: .8rem; color: var(--muted); min-width: 44px; text-align: right; }
.tm-done { padding: 10px 4px; color: var(--muted); }

/* Breadcrumb a Referencia + resalte de la última ficha vista */
.crumb {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; cursor: pointer;
  color: var(--brand); font-size: .85rem; font-weight: 600;
  padding: 0 0 10px;
}
.crumb:active { opacity: .6; }
.list-row.last-visited {
  background: var(--brand-soft);
  border-radius: 10px;
  margin: 2px -6px; padding-left: 6px; padding-right: 6px;
}

/* ============================================================
   Identidad Barnetegi — héroe, Ari, racha, celebración
   ============================================================ */

/* Cabecera narrativa del inicio: panorama + saludo + Ari */
.hero {
  position: relative;
  margin: -16px -16px 14px;
  overflow: hidden;
  border-radius: 0 0 26px 26px;
}
.hero svg { display: block; width: 100%; height: auto; }
.hero .hero-text {
  position: absolute; left: 14px; top: 12px; right: 118px;
  background: rgba(243, 237, 225, .78);
  border-radius: 14px;
  padding: 8px 12px 9px;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
[data-theme="dark"] .hero .hero-text { background: rgba(20, 27, 23, .62); }
.hero .hero-text h1 { margin: 0; font-size: 1.5rem; color: #2e4a3b; }
[data-theme="dark"] .hero .hero-text h1 { color: #ece5d5; }
.hero .hero-text p { margin: 2px 0 0; font-size: .85rem; color: #4a535a; }
[data-theme="dark"] .hero .hero-text p { color: #b5bdb2; }
.hero .ari {
  position: absolute; right: 12px; bottom: 10px;
  width: 92px; height: 92px; object-fit: cover; object-position: center 30%;
  border-radius: 50%;
  border: 3px solid rgba(243, 237, 225, .92);
  background: #f3ede1;
  box-shadow: 0 4px 12px rgba(20, 30, 20, .28);
}

/* Ari (mascota): estampas redondeadas sobre crema */
.ari-img {
  display: block; border-radius: 16px;
  background: #f3ede1;
}
.ari-pop { animation: aripop .55s cubic-bezier(.34, 1.56, .64, 1) both; }
@keyframes aripop {
  from { opacity: 0; transform: scale(.6) translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* Racha: llama con número */
.flame { display: inline-flex; align-items: center; gap: 8px; }
.flame svg { width: 34px; height: 40px; }
.flame.big svg { width: 46px; height: 54px; animation: flamepulse 2.6s ease-in-out infinite; }
@keyframes flamepulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06) rotate(-2deg); }
}

/* Objetivo del día */
.goal-card .bar { height: 10px; }
.goal-card .goal-num { font-family: var(--serif); font-size: 1.5rem; font-weight: 700; }

/* Rejilla rápida de entrenos como fichas con icono */
.quickgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quickgrid .btn { justify-content: flex-start; font-weight: 600; }

/* Confeti de celebración (CSS puro, respeta reduced-motion) */
.confetti { position: relative; height: 0; overflow: visible; pointer-events: none; }
.confetti i {
  position: absolute; top: -6px; width: 8px; height: 12px; border-radius: 2px;
  opacity: 0;
  animation: confetti 1.6s cubic-bezier(.2, .6, .4, 1) both;
}
@keyframes confetti {
  0%   { opacity: 0; transform: translateY(-10px) rotate(0); }
  12%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(150px) rotate(320deg); }
}

/* tabbar: estilos en studio.css (fuente única) */

/* Cabecera de pantalla: título serif */
.screen-head h1 { font-family: var(--serif); }

/* Divisor decorativo (olas / ramita del pack ART) */
.deco { display: flex; justify-content: center; margin: 6px 0 2px; opacity: .8; }
.deco svg { height: 14px; width: auto; }

/* Estados vacíos con Ari */
.empty-ari { text-align: center; padding: 10px 0 4px; }
.empty-ari img { width: 110px; border-radius: 18px; }
.empty-ari p { margin-top: 8px; }

/* ============================================================
   Sistema UX Ari — XP, semana, tabbar de línea, profila, dominak
   ============================================================ */

/* chip de XP en el feedback de acierto */
.xp-chip {
  display: inline-block; margin-left: 6px; padding: 1px 9px;
  border-radius: 999px; background: var(--gold-soft); color: var(--gold);
  font-size: .78rem; font-weight: 700;
  animation: aripop .4s cubic-bezier(.34, 1.56, .64, 1) both;
}

/* tira semanal al·ar·az·og·or·lr·ig (abreviatura dentro de la burbuja; ✓ = día con actividad) */
.aste { display: flex; gap: 8px; margin-top: 6px; }
.aste-d { flex: 1; text-align: center; }
.aste-d b {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; margin: 0 auto;
  border-radius: 50%; border: 1.5px solid var(--line);
  font-size: .68rem; font-weight: 700; letter-spacing: .02em;
  color: var(--ink-soft); background: var(--bg-card);
}
.aste-d.on b { background: var(--brand); border-color: var(--brand); color: #fff; font-size: .82rem; }
.aste-d.today b { box-shadow: 0 0 0 2px var(--gold-bright); color: var(--ink); }
.aste-d.on.today b { color: #fff; }
.aste-gaur { margin-top: 8px; font-size: .74rem; color: var(--ink-soft); }
.aste-gaur b { color: var(--ink); }

/* tabbar con iconos SVG de línea */
nav.tabbar button .ico svg { width: 22px; height: 22px; display: block; }
nav.tabbar button .ico { display: flex; align-items: center; justify-content: center; height: 24px; }

/* profila */
.profila-ari {
  width: 64px; height: 64px; border-radius: 50%;
  border: 3px solid var(--brand-soft); background: #f3ede1;
  object-fit: cover; object-position: center 25%;
}
.dominak { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; text-align: center; }
.domina svg { width: 46px; height: 50px; }
.domina.off { opacity: .32; filter: grayscale(.7); }
.domina .small { line-height: 1.25; }

/* botones de calificación del repaso (guía: Berria/Zaila/Ona/Erraza) */
.grade-row .btn { flex-direction: column; gap: 0; }
.grade-row .btn small { font-weight: 400; opacity: .8; }
.grade-row .g-again { background: var(--info); color: #fff; }
.grade-row .g-hard  { background: var(--accent); color: #fff; }
.grade-row .g-good  { background: var(--brand); color: var(--brand-ink); }
.grade-row .g-easy  { background: var(--gold-bright); color: #3a2f14; }

/* opciones de ejercicio: contorno suave estilo guía */
.choices .btn {
  background: var(--bg-card);
  border: 1.5px solid var(--line);
}

/* ============================================================
   Fase 1-2 · Instrucción Maestra: componentes del póster
   ============================================================ */

/* iconos de línea inline en cualquier texto/botón (helper ic()) */
.ic { display: inline-flex; vertical-align: -0.18em; }
.ic svg { width: 1.1em; height: 1.1em; }
.btn .ic svg { width: 1.15em; height: 1.15em; }
.list-row .ic { margin-right: 2px; }
h2 .ic svg, h3 .ic svg { width: 1.05em; height: 1.05em; }

/* CTA primario del póster: píldora con flecha */
.btn.primary { border-radius: var(--radius-pill); }
.btn.primary.block { border-radius: var(--radius-pill); }

/* chips de tema con icono (póster 1) */
.chip-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius-pill);
  background: var(--color-bg-surface); border: 1.5px solid var(--line);
  font-size: .88rem; font-weight: 600; cursor: pointer;
}
.chip-tag .ic svg { width: 1em; height: 1em; }
.chip-tag.brand { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.chip-tag.info { background: var(--info-soft); border-color: var(--info); color: var(--info); }
.chip-tag.gold { background: var(--gold-soft); border-color: var(--gold); color: var(--gold); }

/* cabecera de sección con motivo decorativo */
.head-deco { display: flex; align-items: center; gap: 8px; opacity: .75; margin: -6px 0 10px; }
.head-deco svg { height: 12px; width: auto; }

/* Fase 5: pre-sesión Berrikusi, cabecera olas, Aurrerapena */
.zbar { display: inline-flex; gap: 3px; margin-left: 6px; vertical-align: middle; }
.zbar i { width: 6px; border-radius: 2px; background: var(--bg-sunken); display: inline-block; }
.zbar i:nth-child(1) { height: 8px; } .zbar i:nth-child(2) { height: 12px; } .zbar i:nth-child(3) { height: 16px; }
.zbar i.on { background: var(--gold-bright); }
.speak-hero { position: relative; margin: -4px 0 12px; border-radius: var(--radius-card); overflow: hidden; }
.speak-hero svg { display: block; width: 100%; height: 92px; object-fit: cover; }
.speak-hero-text {
  position: absolute; left: 14px; bottom: 10px;
  color: #f3ede1; font-family: var(--serif); font-size: 1.05rem; font-weight: 700;
  text-shadow: 0 1px 6px rgba(10, 30, 50, .45);
}
.xp-star svg { width: 40px; height: 40px; }

/* marca (símbolo recreado del póster) */
.brand-mark { text-align: center; padding: 8px 0 16px; }
.brand-mark svg { width: 84px; height: 84px; }
.brand-word { font-family: var(--serif); font-size: 1.6rem; font-weight: 700; margin-top: 4px; }

/* TOP-10 del crítico: controles nativos en paleta + FAB de línea */
input[type="checkbox"], input[type="radio"], input[type="range"], progress { accent-color: var(--brand); }
select {
  font: inherit; color: var(--ink);
  background: var(--bg-card); border: 1.5px solid var(--line);
  border-radius: 10px; padding: 8px 10px;
}
#askfab { color: #fff; }
#askfab svg { width: 26px; height: 26px; }
[data-theme="dark"] #askfab { color: var(--brand-ink); }
/* el contenido nunca queda oculto bajo el FAB */
#screen { padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 88px); }

/* Marca real (derivada del logo maestro del director) */
.brand-symbol { width: 96px; height: auto; display: inline-block; }
.brand-lockup { width: min(320px, 78%); height: auto; display: inline-block; }
.more-brand { text-align: center; padding: 6px 0 14px; }


}

/* ---------- aviso de actualización disponible ---------- */
#updatebar {
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 74px);
  z-index: 1200;
  display: flex; align-items: center; gap: 10px;
  background: var(--brand); color: var(--brand-ink);
  padding: 10px 12px; border-radius: 14px;
  box-shadow: 0 12px 32px rgba(20, 27, 23, .30);
  transform: translateY(180%); opacity: 0;
  transition: transform .3s ease, opacity .3s ease;
  max-width: 620px; margin: 0 auto;
}
#updatebar.in { transform: translateY(0); opacity: 1; }
#updatebar .ub-txt { flex: 1; font-size: 14px; font-weight: 600; line-height: 1.25; }
#updatebar .ub-txt svg { width: 18px; height: 18px; vertical-align: -3px; }
#updatebar .ub-go { background: var(--gold-bright); color: #3a251f; border: 0; border-radius: 10px; padding: 8px 14px; font-weight: 700; cursor: pointer; }
#updatebar .ub-x { background: transparent; border: 0; color: var(--brand-ink); opacity: .8; font-size: 15px; cursor: pointer; padding: 4px 6px; }
.card.flash { animation: cardflash 1.3s ease 2; }
@keyframes cardflash {
  0%, 100% { box-shadow: 0 0 0 0 rgba(225, 181, 92, 0); }
  50% { box-shadow: 0 0 0 4px rgba(225, 181, 92, .75); }
}

/* ---------- guía de IA in-app ---------- */
.aiguide-overlay { transition: opacity .2s ease; }
.aiguide-overlay.out { opacity: 0; }
.aiguide-list { margin: 6px 0 4px; padding-left: 18px; }
.aiguide-list li { margin: 8px 0; line-height: 1.4; font-size: 14.5px; }

/* ---------- aviso de mudanza (solo en la URL antigua) ---------- */
#movedbar {
  position: fixed; left: 0; right: 0; top: 0; z-index: 1300;
  display: flex; align-items: center; gap: 10px;
  background: var(--accent); color: #fff;
  padding: 8px 12px; font-size: 13.5px; line-height: 1.3;
  box-shadow: 0 4px 16px rgba(20, 27, 23, .25);
}
#movedbar .mb-txt { flex: 1; }
#movedbar .mb-go { background: #fff; color: var(--accent); border-radius: 8px; padding: 6px 12px; font-weight: 700; text-decoration: none; white-space: nowrap; }
#movedbar .mb-x { background: transparent; border: 0; color: #fff; opacity: .85; font-size: 14px; cursor: pointer; padding: 4px 6px; }
