/* =========================================================
   WeWeKa · Sistema visual
   NEUMORFISMO (soft UI): superficies extruidas con doble sombra
   (luz arriba-izquierda, sombra abajo-derecha) y hundidas (inset).
   Monocromático cálido. Iconos SVG, cero emojis.
   Fluido · se adapta a cualquier tamaño · claro/oscuro · movimiento reducido.
   ========================================================= */

/* La familia Nunito se carga de forma no bloqueante desde index.html
   (con respaldo del sistema si no hay conexión). */

/* ---------------- Tokens ---------------- */
:root {
  --font: 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;

  /* Base monocromática: fondo y superficies COMPARTEN color (clave del neumorfismo) */
  --bg: #e7e0d3;
  --surface: #e7e0d3;
  --surface-lo: #e1d9ca;   /* leve hundido para inputs/pistas */

  --ink: #4a3722;
  --muted: #8a7157;
  --faint: #b0997d;

  /* Sombras neumórficas (colores sólidos, no rgba, para nitidez) */
  --sh-d: #c4b59f;   /* sombra proyectada (abajo-derecha) */
  --sh-l: #fdf7ea;   /* luz (arriba-izquierda) */

  --orange: #ec7d2c;
  --orange-deep: #cf5e18;
  --orange-press: #a3480d;
  --orange-soft: rgba(236, 125, 44, .16);

  --green: #6f9a4c;
  --green-deep: #527a34;
  --green-press: #3e5f26;
  --green-soft: rgba(111, 154, 76, .18);

  --blue: #5a7fb5;
  --blue-deep: #3f5f8f;
  --blue-soft: rgba(90, 127, 181, .18);

  --red: #d0553f;
  --red-deep: #b23f2c;
  --red-soft: rgba(208, 85, 63, .16);

  --gold: #d9a93a;

  /* Compat: nombres antiguos remapeados a neumorfismo opaco */
  --glass: var(--surface);
  --glass-2: var(--surface);
  --glass-brd: transparent;
  --glass-inset: 0 0 0 0 transparent;
  --hairline: rgba(120, 86, 48, .14);
  --blur: 0px;

  --r: 22px;
  --r-lg: 28px;
  --r-sm: 16px;
  --r-pill: 999px;

  /* Distancias/difuminados de sombra escalados con el viewport */
  --nm-o: clamp(4px, 1.3vmin, 6px);        /* offset */
  --nm-b: clamp(8px, 2.6vmin, 13px);       /* blur */
  --nm-o2: clamp(6px, 2vmin, 9px);
  --nm-b2: clamp(14px, 4vmin, 22px);

  --nm-1: var(--nm-o) var(--nm-o) var(--nm-b) var(--sh-d), calc(-1 * var(--nm-o)) calc(-1 * var(--nm-o)) var(--nm-b) var(--sh-l);
  --nm-2: var(--nm-o2) var(--nm-o2) var(--nm-b2) var(--sh-d), calc(-1 * var(--nm-o2)) calc(-1 * var(--nm-o2)) var(--nm-b2) var(--sh-l);
  --nm-sm: 3px 3px 6px var(--sh-d), -3px -3px 6px var(--sh-l);
  --nm-in: inset 4px 4px 9px var(--sh-d), inset -4px -4px 9px var(--sh-l);
  --nm-in-sm: inset 2px 2px 5px var(--sh-d), inset -2px -2px 5px var(--sh-l);

  --elev-1: var(--nm-1);
  --elev-2: var(--nm-2);
  --focus: 0 0 0 3px rgba(236, 125, 44, .40);

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #262220;
    --surface: #262220;
    --surface-lo: #221e1c;

    --ink: #f2e7d8;
    --muted: #b6a48c;
    --faint: #7d6e5b;

    --sh-d: #17130f;
    --sh-l: #322c26;

    --orange: #f2894a;
    --orange-deep: #e0742f;
    --orange-press: #b1561b;
    --orange-soft: rgba(242, 137, 74, .20);

    --green: #86ac63;
    --green-deep: #6f9a4c;
    --green-press: #52713a;
    --green-soft: rgba(134, 172, 99, .18);

    --blue: #7ea0d0;
    --blue-deep: #5a7fb5;
    --blue-soft: rgba(126, 160, 208, .18);

    --red: #e0705a;
    --red-deep: #cf5540;
    --red-soft: rgba(224, 112, 90, .20);

    --hairline: rgba(255, 240, 220, .10);
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }

body {
  font-family: var(--font);
  font-size: clamp(14px, 1.6vmin, 16px);
  font-weight: 600;
  color: var(--ink);
  background: var(--bg);
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}
/* Fondo plano monocromático (neumorfismo exige base uniforme) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--bg);
}

button { font-family: inherit; font-size: 14px; font-weight: 700; color: inherit; background: none; border: none; cursor: pointer; }
button:disabled { cursor: default; }
input, select, textarea { font-family: inherit; }

/* ---------------- Icono SVG universal ---------------- */
.ic {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: -0.14em;
  flex: none;
  overflow: visible;
}

/* ---------------- Estructura ---------------- */
.app {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}
.screen { flex: 1; overflow-y: auto; overflow-x: hidden; scroll-behavior: smooth; }
.wrap { padding: clamp(16px, 4vw, 22px) clamp(14px, 4vw, 20px) calc(104px + env(safe-area-inset-bottom)); }

.fadein { animation: fadein .4s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes fadein { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* En neumorfismo no usamos desenfoque de cristal */
.homecard, .langcard, .hero, .modal, .stat, .progrow, .flash, .buildprompt,
.talkhint, .alldone, .msgbubble, .bubble, .storytxt {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

/* ---------------- Navegación (neumórfica) ---------------- */
.bottomnav {
  position: fixed;
  left: 50%;
  bottom: calc(14px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  gap: 4px;
  width: min(440px, calc(100% - 24px));
  padding: 8px;
  background: var(--surface);
  border: none;
  border-radius: var(--r-pill);
  box-shadow: var(--nm-2);
}
.navbtn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 9px 0 7px;
  color: var(--muted);
  border-radius: var(--r-pill);
  position: relative;
  transition: color .25s, box-shadow .25s, transform .1s;
}
.navbtn .ic { font-size: clamp(22px, 3.4vmin, 26px); }
.navbtn span { font-size: 11px; font-weight: 800; letter-spacing: .01em; }
.navbtn:active { transform: scale(.94); }
.navbtn.active { color: var(--orange-deep); box-shadow: var(--nm-in); }
.navbrand { display: none; }

/* ---------------- Cabecera ---------------- */
.apphead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.logo { display: flex; align-items: center; gap: 9px; font-size: clamp(19px, 2.6vmin, 22px); font-weight: 900; }
.logo .brandmark {
  width: 42px; height: 42px; flex: none;
  display: grid; place-items: center;
  border-radius: 14px;
  color: var(--orange-deep);
  background: var(--surface);
  box-shadow: var(--nm-1);
}
.logo .brandmark .ic { font-size: 24px; }
.logo b { letter-spacing: .01em; color: var(--ink); font-weight: 900; }
.logo b span { color: var(--orange-deep); }

.iconbtn {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--surface);
  border: none;
  color: var(--muted);
  box-shadow: var(--nm-sm);
  transition: box-shadow .15s, color .2s, transform .12s;
}
.iconbtn svg, .iconbtn .ic { width: 21px; height: 21px; font-size: 21px; }
.iconbtn:active { transform: scale(.92); box-shadow: var(--nm-in-sm); }

.lead { font-size: clamp(13px, 1.7vmin, 15px); font-weight: 600; color: var(--muted); margin: -4px 2px 18px; line-height: 1.5; }
.sectiontitle { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); margin: 0 4px 10px; }

/* ---------------- Botones (neumórficos) ---------------- */
.btn {
  border-radius: var(--r-sm);
  padding: 14px 20px;
  min-height: 54px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 15px; font-weight: 800; letter-spacing: .02em;
  text-transform: uppercase;
  position: relative;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--nm-1);
  transition: transform .1s, box-shadow .15s, filter .15s;
  touch-action: manipulation;
}
.btn .ic { font-size: 20px; }
.btn:active:not(:disabled) { transform: translateY(1px); box-shadow: var(--nm-in); }
.btn.primary { color: var(--orange-deep); }
.btn.primary:disabled { color: var(--faint); box-shadow: var(--nm-in-sm); opacity: .8; }
.btn.warn { color: var(--ink); }
.btn.ghost { color: var(--muted); box-shadow: var(--nm-sm); margin-top: 14px; width: 100%; }
.btn.danger { color: var(--red); }
.btn.big { width: 100%; }

/* ---------------- Selección de lengua ---------------- */
.langgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: clamp(11px, 2.4vw, 16px); }
.langcard {
  background: var(--surface);
  border: none;
  border-radius: var(--r);
  padding: 18px 12px 15px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  text-align: center;
  box-shadow: var(--nm-1);
  transition: transform .16s cubic-bezier(.2, .8, .2, 1), box-shadow .16s;
}
.langcard:active { transform: scale(.97); box-shadow: var(--nm-in); }
.langic { font-size: clamp(38px, 6vmin, 46px); line-height: 1.15; color: var(--orange-deep); }
.langimg { width: 1.15em; height: 1.15em; object-fit: cover; display: inline-block; vertical-align: -0.22em; border-radius: 26%; box-shadow: var(--nm-sm); }
.langname { font-size: clamp(15px, 2vmin, 17px); font-weight: 900; }
.langendo { font-size: 12px; font-weight: 700; color: var(--orange-deep); font-style: italic; }
.langmeta { font-size: 11px; font-weight: 700; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.langmeta .ic { font-size: 14px; }

.langbar { width: 100%; height: 12px; border-radius: var(--r-pill); background: var(--surface); box-shadow: var(--nm-in-sm); overflow: hidden; margin: 8px 0 2px; display: block; padding: 2px; }
.langbar i { display: block; height: 100%; border-radius: var(--r-pill); background: linear-gradient(90deg, var(--orange), var(--gold)); transition: width .6s cubic-bezier(.2, .8, .2, 1); }

/* ---------------- Modal ---------------- */
.overlay { position: fixed; inset: 0; background: rgba(30, 20, 12, .42); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 24px; z-index: 60; animation: fadein .22s ease both; }
.modal {
  background: var(--surface);
  border: none;
  border-radius: var(--r-lg);
  padding: clamp(22px, 5vw, 28px);
  max-width: 380px; width: 100%;
  text-align: center;
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: var(--nm-2);
  animation: popin .3s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes popin { from { transform: scale(.9) translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.modalic { font-size: 46px; color: var(--orange-deep); }
.modal h2 { font-size: clamp(16px, 2.2vmin, 18px); font-weight: 900; }
.modal p { font-size: 13px; font-weight: 600; color: var(--muted); line-height: 1.6; }
.modal .btn { margin-top: 6px; }
.modal .btn.ghost { margin-top: 0; }

/* ---------------- Camino ---------------- */
.hero {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface);
  border: none;
  border-radius: var(--r);
  padding: 14px;
  box-shadow: var(--nm-1);
  position: sticky; top: 8px; z-index: 10;
}
.heroic { font-size: 34px; color: var(--orange-deep); }
.herotxt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.herotxt b { font-size: 15px; font-weight: 900; }
.herotxt > span:not(.langbar) { font-size: 11px; font-weight: 700; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.herostats { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 900; }
.herostats span { display: inline-flex; align-items: center; gap: 5px; }
.herostats .ic { font-size: 17px; }
.herostats .fire { color: var(--orange-deep); }
.herostats .xp { color: var(--gold); }

.levelsec { margin-top: 26px; }
.levelhead {
  display: flex; align-items: center; gap: 11px;
  background: var(--surface);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  box-shadow: var(--nm-sm);
}
.levelhead .lvlic { font-size: 27px; color: var(--orange-deep); flex: none; }
.levelhead > div { flex: 1; min-width: 0; }
.levelhead b { font-size: 15px; font-weight: 900; display: block; }
.levelhead span:not(.lvlic):not(.lock) { font-size: 11px; font-weight: 700; color: var(--orange-deep); }
.levelhead .lock { margin-left: auto; font-size: 18px; color: var(--faint); }
.levelhead.locked { filter: grayscale(.9) opacity(.65); box-shadow: var(--nm-in-sm); }
.leveldesc { font-size: 12px; font-weight: 600; color: var(--muted); margin: 8px 6px 4px 15px; line-height: 1.5; }
.leveldesc.locked { opacity: .55; }

.path { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(14px, 3vw, 20px) 6px; padding: 16px 0 4px; justify-items: center; }
.node { display: flex; flex-direction: column; align-items: center; gap: 7px; width: 100%; }
.node.s0, .node.s1, .node.s2 { align-self: auto; margin: 0; }
.nodeic {
  width: clamp(58px, 15vmin, 72px); height: clamp(58px, 15vmin, 72px);
  display: grid; place-items: center;
  font-size: clamp(26px, 6vmin, 32px);
  border-radius: 50%;
  color: var(--muted);
  background: var(--surface);
  border: none;
  box-shadow: var(--nm-1);
  transition: transform .16s, box-shadow .16s;
}
.node:active:not(:disabled) .nodeic { transform: scale(.96); box-shadow: var(--nm-in); }
.node.done .nodeic { color: var(--orange-deep); box-shadow: var(--nm-in); }
.node.now .nodeic { color: var(--orange-deep); box-shadow: var(--nm-1), 0 0 0 0 rgba(236, 125, 44, .5); animation: nodepulse 1.7s ease infinite; }
@keyframes nodepulse {
  0%, 100% { box-shadow: var(--nm-1), 0 0 0 0 rgba(236, 125, 44, .45); }
  50% { box-shadow: var(--nm-1), 0 0 0 12px rgba(236, 125, 44, 0); }
}
.node.todo { opacity: .55; }
.node.todo .nodeic { color: var(--faint); box-shadow: var(--nm-in-sm); }
.nodelbl { font-size: 11px; font-weight: 700; color: var(--muted); text-align: center; line-height: 1.3; }
.node.now .nodelbl { color: var(--orange-deep); font-weight: 900; }

.alldone {
  text-align: center;
  background: var(--surface); border: none;
  border-radius: var(--r); padding: 22px; margin-top: 22px;
  box-shadow: var(--nm-1);
}
.alldone > .ic, .alldone > span { font-size: 46px; display: block; color: var(--gold); margin: 0 auto 6px; }
.alldone b { font-size: 16px; font-weight: 900; }
.alldone p { font-size: 13px; font-weight: 600; color: var(--muted); margin-top: 6px; line-height: 1.5; }

/* ---------------- Inicio ---------------- */
.homecard {
  background: var(--surface);
  border: none;
  border-radius: var(--r);
  padding: clamp(14px, 3vw, 18px);
  box-shadow: var(--nm-1);
  margin-bottom: 22px;
}

.badgetop { display: flex; align-items: center; gap: 15px; }
.badgeic {
  width: 76px; height: 76px; flex: none;
  display: grid; place-items: center;
  font-size: 42px; color: var(--orange-deep);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--nm-1), var(--nm-in-sm);
}
.badgetxt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.badgetxt b { font-size: 16px; font-weight: 900; }
.badgetxt > span:not(.langbar) { font-size: 12px; font-weight: 600; color: var(--muted); }
.badgetxt .badgemeta { color: var(--orange-deep); font-weight: 800; display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.badgetxt .badgemeta .ic { font-size: 15px; }
.badgegrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(56px, 1fr)); gap: 14px 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--hairline); }
.badge { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.badge i {
  width: 50px; height: 50px;
  display: grid; place-items: center;
  font-style: normal; font-size: 25px; color: var(--orange-deep);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--nm-sm);
}
.badge em { font-style: normal; font-size: 10px; font-weight: 700; color: var(--muted); text-align: center; }
.badge.locked i { color: var(--faint); box-shadow: var(--nm-in-sm); }
.badge.locked em { opacity: .6; }

.ranklist { padding: 6px 8px; }
.rankrow { display: flex; align-items: center; gap: 11px; padding: 10px 6px; border-bottom: 1px solid var(--hairline); }
.rankrow:last-child { border-bottom: none; }
.rankpos { width: 28px; flex: none; text-align: center; font-weight: 900; font-size: 15px; color: var(--muted); display: inline-flex; justify-content: center; }
.rankpos .ic { font-size: 22px; }
.rankname { flex: 1; min-width: 0; font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ranklangs { flex: none; display: inline-flex; gap: 2px; }
.ranklangs .langimg { width: 18px; height: 18px; }
.rankpts { font-size: 13px; font-weight: 800; color: var(--gold); flex: none; display: inline-flex; align-items: center; gap: 4px; }
.rankpts .ic { font-size: 15px; }
.rankrow.me { background: var(--surface); border-radius: var(--r-sm); border-bottom-color: transparent; padding: 12px 10px; box-shadow: var(--nm-in-sm); }
.rankrow.me .rankname { color: var(--orange-deep); font-weight: 900; }

.todayrow { display: flex; align-items: center; gap: 13px; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--hairline); flex-wrap: wrap; }
.todayic { font-size: 34px; flex: none; color: var(--orange-deep); }
.todaytxt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.todaytxt b { font-size: 14px; font-weight: 900; }
.todaytxt span { font-size: 12px; font-weight: 600; color: var(--muted); }
.todayrow .btn { padding: 11px 20px; font-size: 13px; flex: none; min-height: 46px; }

.remindrow { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; }
.remindlbl { flex: 1; min-width: 120px; font-size: 13px; font-weight: 700; color: var(--muted); }
.switch { width: 56px; height: 32px; flex: none; position: relative; border-radius: var(--r-pill); background: var(--surface); box-shadow: var(--nm-in-sm); transition: box-shadow .25s; }
.switch i { position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: var(--surface); box-shadow: var(--nm-sm); transition: left .25s cubic-bezier(.2, .8, .2, 1); }
.switch.on { background: linear-gradient(180deg, var(--orange), var(--orange-deep)); box-shadow: var(--nm-in-sm); }
.switch.on i { left: 28px; }
.timein { font-size: 14px; font-weight: 800; color: var(--ink); background: var(--surface); border: none; border-radius: var(--r-sm); padding: 10px 13px; flex: none; box-shadow: var(--nm-in-sm); }
.timein:disabled { opacity: .5; }
.remindstatus { font-size: 12px; font-weight: 600; color: var(--muted); line-height: 1.55; margin-top: 12px; display: flex; align-items: flex-start; gap: 7px; }
.remindstatus .ic { font-size: 16px; flex: none; margin-top: 1px; }

/* ---------------- Traductor de voz ---------------- */
.talk { height: 100%; display: flex; flex-direction: column; }
.talkhead {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  box-shadow: var(--nm-sm);
  z-index: 5;
}
.talklogo { flex: none; font-size: 28px; line-height: 1; display: flex; color: var(--orange-deep); }
.talklogo .langimg { width: 32px; height: 32px; }
.talkheadr { flex: none; display: flex; align-items: center; gap: 6px; }

.langpick { position: relative; flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; padding: 11px 14px; border-radius: var(--r-pill); background: var(--surface); border: none; box-shadow: var(--nm-in-sm); }
.langsel { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: none; cursor: pointer; font: inherit; }
.langsel-label { font-size: 15px; font-weight: 900; color: var(--ink); }
.langsel-chev { display: flex; color: var(--muted); }
.langsel-chev .ic, .langsel-chev svg { width: 16px; height: 16px; }

.talkmsgs { flex: 1; overflow-y: auto; padding: 16px 14px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 13px; }
.talkhint { background: var(--surface); border: none; border-radius: var(--r); padding: 15px 17px; font-size: 13px; font-weight: 600; line-height: 1.65; box-shadow: var(--nm-1); }
.talkhint b { font-weight: 900; }
.talknote { font-size: 12px; font-weight: 600; color: var(--muted); line-height: 1.6; margin-top: 16px; }
.loadolder { align-self: center; font-size: 12px; font-weight: 800; color: var(--muted); padding: 8px 17px; border-radius: var(--r-pill); background: var(--surface); border: none; box-shadow: var(--nm-sm); display: inline-flex; align-items: center; gap: 6px; }

.msg { display: flex; }
.msg.a { justify-content: flex-end; }
.msgbubble {
  max-width: 86%;
  color: var(--green-deep);
  background: var(--surface);
  border: none;
  border-radius: var(--r) var(--r) var(--r) 6px;
  padding: 12px 14px;
  box-shadow: var(--nm-1);
}
.msg.a .msgbubble { color: var(--blue-deep); border-radius: var(--r) var(--r) 6px var(--r); }

.audiorow { display: flex; align-items: center; gap: 10px; }
.playbtn { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--green-deep); background: var(--surface); box-shadow: var(--nm-sm); transition: transform .12s, box-shadow .12s; }
.msg.a .playbtn { color: var(--blue-deep); }
.playbtn:active { transform: scale(.92); box-shadow: var(--nm-in-sm); }
.playbtn svg, .playbtn .ic { width: 20px; height: 20px; font-size: 20px; }
.wave { position: relative; flex: 1; min-width: 90px; height: 34px; }
.wave-base, .wave-fill { position: absolute; inset: 0; display: flex; align-items: center; gap: 2px; }
.wave-base span, .wave-fill span { flex: 1; min-height: 8%; border-radius: 2px; background: currentColor; }
.wave-base { opacity: .32; }
.wave-fill { opacity: 1; clip-path: inset(0 100% 0 0); }
.wave.on .wave-base span { animation: wavepulse 1s ease-in-out infinite; }
@keyframes wavepulse { 0%, 100% { opacity: .5; } 50% { opacity: .9; } }

.msgmain { display: block; font-size: 15px; font-weight: 700; line-height: 1.45; color: var(--ink); margin-top: 8px; overflow-wrap: break-word; }
.msgsub { display: flex; align-items: baseline; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); margin-top: 4px; overflow-wrap: break-word; }
.msgsub .ic { font-size: 14px; flex: none; align-self: center; }
.msgnote { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; color: var(--red); margin-top: 4px; }
.msgnote .ic { font-size: 14px; }
.unk { font-style: italic; opacity: .6; font-weight: 500; }
.msgmeta { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 5px; }
.msgmeta span { font-size: 10px; font-weight: 700; color: var(--faint); }
.msgmeta .ic { font-size: 13px; color: var(--blue); }

.talkbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 18px calc(100px + env(safe-area-inset-bottom)); background: var(--surface); box-shadow: 0 -2px 10px rgba(0,0,0,.04); border-top: 1px solid var(--hairline); }
.miccell { flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.micbtn { position: relative; width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; isolation: isolate; transition: transform .12s; --smoke: rgba(111, 154, 76, .5); }
.micbtn.a { --smoke: rgba(90, 127, 181, .45); }
.micbtn:active { transform: scale(.94); }
.micbtn .micic { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; color: var(--green-deep); background: var(--surface); box-shadow: var(--nm-1); transition: box-shadow .12s; }
.micbtn.a .micic { color: var(--blue-deep); }
.micbtn:active .micic { box-shadow: var(--nm-in); }
.micbtn .micic svg, .micbtn .micic .ic { width: 28px; height: 28px; font-size: 28px; }
.smoke { position: absolute; left: 50%; bottom: 44%; width: 26px; height: 26px; margin-left: -13px; border-radius: 50%; background: radial-gradient(circle, var(--smoke) 0%, transparent 68%); filter: blur(7px); opacity: 0; z-index: -1; animation: smokeRise 3.4s ease-in-out infinite; }
.smoke.s2 { animation-delay: 1.1s; animation-duration: 3.9s; --sx: -20px; }
.smoke.s3 { animation-delay: 2.2s; animation-duration: 3.2s; --sx: 22px; }
@keyframes smokeRise {
  0% { opacity: 0; transform: translate(0, 8px) scale(.5); }
  25% { opacity: .55; }
  60% { opacity: .4; }
  100% { opacity: 0; transform: translate(var(--sx, 14px), -34px) scale(1.7); }
}
.miclbl { font-size: 12px; font-weight: 800; color: var(--ink); text-align: center; line-height: 1.2; }
.miclbl i { display: block; font-style: normal; font-weight: 600; font-size: 10px; color: var(--muted); }
.midcol { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.langtoggle { flex: none; display: flex; align-items: baseline; gap: 3px; padding: 8px 14px; border-radius: var(--r-pill); background: var(--surface); color: var(--blue-deep); box-shadow: var(--nm-sm); }
.langtoggle b { font-size: 13px; font-weight: 900; letter-spacing: .04em; }
.langtoggle span { font-size: 10px; opacity: .55; }
.langtoggle.en { color: var(--green-deep); }
.kbbtn { flex: none; width: 42px; height: 42px; border-radius: 50%; background: var(--surface); border: none; color: var(--muted); display: grid; place-items: center; box-shadow: var(--nm-sm); }
.kbbtn:active { box-shadow: var(--nm-in-sm); }
.kbbtn .ic { font-size: 19px; }
.msgsub.bridge { opacity: .85; }
.webtag { display: inline-flex; }
.webwait .msgmain::after { content: '  ·  ·  ·'; font-weight: 900; opacity: .5; animation: webpulse 1.2s ease infinite; }
@keyframes webpulse { 0%, 100% { opacity: .25; } 50% { opacity: .8; } }

.recdot { width: 14px; height: 14px; border-radius: 50%; background: var(--red); flex: none; animation: recpulse 1.1s ease infinite; }
@keyframes recpulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(208, 85, 63, .5); } 50% { box-shadow: 0 0 0 10px rgba(208, 85, 63, 0); } }
.rectxt { flex: 1; min-height: 44px; max-height: 62px; overflow-y: auto; display: flex; align-items: center; font-size: 13px; font-weight: 600; font-style: italic; color: var(--muted); }
.recstop { flex: none; padding: 13px 17px; border-radius: var(--r-sm); background: var(--surface); color: var(--red); font-weight: 800; display: inline-flex; align-items: center; gap: 6px; box-shadow: var(--nm-sm); }
.recstop:active { box-shadow: var(--nm-in-sm); }
.reccancel { flex: none; width: 42px; height: 42px; border-radius: 50%; background: var(--surface); border: none; color: var(--muted); display: grid; place-items: center; box-shadow: var(--nm-sm); }
.reccancel .ic { font-size: 18px; }

.rolebtn { flex: none; font-size: 12px; font-weight: 800; padding: 11px 13px; border-radius: var(--r-pill); background: var(--surface); color: var(--green-deep); border: none; box-shadow: var(--nm-sm); display: inline-flex; align-items: center; gap: 5px; }
.rolebtn .ic { font-size: 16px; }
.rolebtn.a { color: var(--blue-deep); }
.txtin { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; color: var(--ink); background: var(--surface); border: none; border-radius: var(--r-pill); padding: 12px 16px; box-shadow: var(--nm-in-sm); }
.txtin:focus { outline: none; box-shadow: var(--nm-in-sm), var(--focus); }
.sendbtn { flex: none; width: 46px; height: 46px; border-radius: 50%; background: var(--surface); color: var(--orange-deep); display: grid; place-items: center; box-shadow: var(--nm-sm); }
.sendbtn:active { box-shadow: var(--nm-in-sm); }
.sendbtn .ic { font-size: 19px; }

.headspace { width: 42px; flex: none; }
.histprev { display: block; font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.histmeta { flex: none; font-size: 11px; font-weight: 700; color: var(--muted); text-align: right; line-height: 1.5; display: inline-flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.histmeta .ic { font-size: 13px; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 112px; z-index: 70; background: var(--surface); color: var(--ink); padding: 12px 20px; border-radius: var(--r-pill); font-size: 13px; font-weight: 700; max-width: 86%; text-align: center; box-shadow: var(--nm-2); animation: toastin .3s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes toastin { from { transform: translate(-50%, 10px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* ---------------- Perfil ---------------- */
.statrow { display: flex; gap: clamp(9px, 2vw, 13px); margin-bottom: 22px; flex-wrap: wrap; }
.stat { flex: 1; min-width: 90px; background: var(--surface); border: none; border-radius: var(--r); padding: 14px 8px; display: flex; flex-direction: column; align-items: center; gap: 3px; box-shadow: var(--nm-1); }
.stat span, .stat .ic { font-size: 25px; color: var(--orange-deep); }
.stat b { font-size: 16px; font-weight: 900; }
.stat i { font-size: 12px; font-weight: 700; font-style: normal; color: var(--muted); }

.proglist { display: flex; flex-direction: column; gap: 9px; }
.progrow { display: flex; align-items: center; gap: 13px; background: var(--surface); border: none; border-radius: var(--r); padding: 14px; text-align: left; box-shadow: var(--nm-1); transition: transform .12s, box-shadow .12s; }
.progrow:active { transform: scale(.98); box-shadow: var(--nm-in); }
.progic { font-size: 28px; flex: none; color: var(--orange-deep); }
.progic .langimg { width: 30px; height: 30px; }
.progtxt { flex: 1; min-width: 0; }
.progtxt b { font-size: 14px; font-weight: 900; }
.progbadges { font-size: 13px; color: var(--muted); }

.idtop { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.idleft { display: flex; flex-direction: column; align-items: center; gap: 10px; flex: none; }
.avatar { width: 94px; height: 94px; border-radius: 50%; overflow: hidden; position: relative; flex: none; border: none; box-shadow: var(--nm-1); background: var(--surface); display: grid; place-items: center; padding: 0; color: var(--orange-deep); transition: transform .12s, box-shadow .12s; }
.avatar:active { transform: scale(.97); box-shadow: var(--nm-in); }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.empty .ic { font-size: 42px; }
.avatarcam { position: absolute; right: 2px; bottom: 2px; font-style: normal; background: var(--surface); border: none; border-radius: 50%; width: 28px; height: 28px; display: grid; place-items: center; color: var(--muted); box-shadow: var(--nm-sm); }
.avatarcam .ic { font-size: 14px; }

.unamebox { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 6px; }
.unamelbl { font-size: 12px; font-weight: 800; color: var(--muted); }
.unamerow { display: flex; align-items: center; gap: 6px; background: var(--surface); border: none; border-radius: var(--r-sm); padding: 4px 4px 4px 12px; box-shadow: var(--nm-in-sm); }
.unamein { flex: 1; min-width: 0; border: none; background: none; font-size: 14px; font-weight: 700; color: var(--ink); padding: 9px 0; outline: none; }
.unamesave { flex: none; width: auto; min-height: 42px; padding: 9px 16px; font-size: 12px; border-radius: 12px; margin: 0; }
.unamemsg { font-size: 12px; font-weight: 700; color: var(--muted); min-height: 16px; line-height: 1.4; }
.unamemsg.ok { color: var(--green-deep); }
.unamemsg.bad { color: var(--red); }

.emptynote { font-size: 13px; font-weight: 600; color: var(--muted); line-height: 1.5; text-align: center; padding: 6px 4px; }
.wonhead { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 14px; }
.wonhead b { font-size: 18px; font-weight: 900; color: var(--orange-deep); }
.wongrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); gap: 16px 8px; }
.wonbadge { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.wonbadge i { width: 56px; height: 56px; display: grid; place-items: center; font-style: normal; font-size: 27px; border-radius: 50%; background: var(--surface); box-shadow: var(--nm-1); color: var(--orange-deep); }
.wonbadge em { font-style: normal; font-size: 10px; font-weight: 700; color: var(--muted); text-align: center; line-height: 1.2; }
.wonbadge i .langimg { width: 34px; height: 34px; }
.wonbadge.locked i { box-shadow: var(--nm-in-sm); }
.wonbadge.locked i .langimg { filter: grayscale(1); opacity: .45; }

.streakcard { text-align: center; }
.streakbig { display: flex; align-items: baseline; justify-content: center; gap: 8px; }
.streakbig span, .streakbig .ic { font-size: 30px; color: var(--orange-deep); align-self: center; }
.streakbig b { font-size: clamp(36px, 8vmin, 44px); font-weight: 900; color: var(--orange-deep); line-height: 1; }
.streakbig i { font-style: normal; font-size: 13px; font-weight: 700; color: var(--muted); }
.streaksub { font-size: 12px; font-weight: 600; color: var(--muted); line-height: 1.55; margin-top: 8px; }
.streaksub b { color: var(--ink); font-weight: 900; }

.posbig { display: flex; align-items: center; gap: 15px; }
.posmedal { width: 66px; height: 66px; flex: none; display: grid; place-items: center; font-size: 26px; font-weight: 900; color: var(--orange-deep); border-radius: 50%; background: var(--surface); box-shadow: var(--nm-1); }
.posmedal .ic { font-size: 34px; }
.postxt { display: flex; flex-direction: column; gap: 3px; }
.postxt b { font-size: 16px; font-weight: 900; }
.postxt span { font-size: 12px; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.postxt span .ic { font-size: 15px; color: var(--gold); }
.poscard .btn.ghost { margin-top: 14px; }

.photoeditor { gap: 12px; }
.pe-stage { width: 260px; height: 260px; max-width: 72vw; max-height: 72vw; position: relative; overflow: hidden; border-radius: var(--r-sm); background: #000; touch-action: none; cursor: grab; align-self: center; box-shadow: var(--nm-in); }
.pe-stage:active { cursor: grabbing; }
.pe-img { position: absolute; top: 0; left: 0; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.pe-mask { position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 999px rgba(0, 0, 0, .5); pointer-events: none; }
.pe-zoom { display: flex; align-items: center; gap: 10px; width: 100%; }
.pe-zi { font-size: 18px; color: var(--muted); display: inline-flex; }
.pe-zoom input[type="range"] { flex: 1; accent-color: var(--orange); }

/* ---------------- Lección ---------------- */
.lesson { height: 100%; display: flex; flex-direction: column; padding: 12px clamp(14px, 4vw, 20px) calc(16px + env(safe-area-inset-bottom)); }
.lessonhead { display: flex; align-items: center; gap: 13px; }
.lessonic { font-size: 23px; color: var(--orange-deep); }
.pbar { flex: 1; height: 16px; background: var(--surface); border-radius: var(--r-pill); overflow: hidden; box-shadow: var(--nm-in-sm); padding: 2px; }
.pbar i { display: block; height: 100%; width: 0; border-radius: var(--r-pill); background: linear-gradient(90deg, var(--orange), var(--gold)); transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.lessonbody { flex: 1; overflow-y: auto; padding: 20px 2px 10px; display: flex; flex-direction: column; }
.lessonfoot { display: flex; flex-direction: column; gap: 10px; padding-top: 10px; }

.flash { margin: auto 0; background: var(--surface); border: none; border-radius: var(--r-lg); box-shadow: var(--nm-2); padding: clamp(26px, 6vw, 38px) 22px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.tag { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--orange-deep); background: var(--surface); border-radius: var(--r-pill); padding: 6px 15px; display: inline-flex; align-items: center; gap: 6px; box-shadow: var(--nm-in-sm); }
.tag .ic { font-size: 15px; }
.flic { font-size: clamp(60px, 14vmin, 78px); line-height: 1.1; color: var(--orange-deep); }
.flash b { font-size: clamp(16px, 2.4vmin, 18px); font-weight: 900; letter-spacing: .02em; }
.flash p { font-size: 14px; font-weight: 600; color: var(--muted); line-height: 1.6; max-width: 32ch; }

.exercise { display: flex; flex-direction: column; gap: 12px; margin: auto 0; }
.extitle { font-size: clamp(16px, 2.4vmin, 18px); font-weight: 900; text-align: center; }
.exsub { font-size: 13px; font-weight: 600; color: var(--muted); text-align: center; line-height: 1.5; }
.bigic { font-size: clamp(50px, 12vmin, 64px); text-align: center; color: var(--orange-deep); }

.npc { display: flex; align-items: flex-end; gap: 9px; margin-bottom: 6px; }
.npcface { font-size: 36px; flex: none; color: var(--orange-deep); }
.bubble { background: var(--surface); border: none; border-radius: var(--r) var(--r) var(--r) 4px; padding: 13px 16px; font-size: 14px; font-weight: 600; box-shadow: var(--nm-1); }

.opts { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 8px; }
.opts.iconic { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.opt { background: var(--surface); border: none; border-radius: var(--r-sm); padding: 15px 16px; display: flex; align-items: center; gap: 12px; font-size: 15px; font-weight: 800; box-shadow: var(--nm-1); transition: transform .12s, box-shadow .15s, color .15s; justify-content: flex-start; }
.opts.iconic .opt { justify-content: center; padding: 20px 10px; }
.opt .optic { font-size: 42px; line-height: 1; color: var(--orange-deep); }
.opt .optic.sm { font-size: 24px; }
.opt:active:not(:disabled) { transform: translateY(1px); box-shadow: var(--nm-in); }
.opt.sel { color: var(--orange-deep); box-shadow: var(--nm-in); }
.opt.right { color: var(--green-deep); box-shadow: var(--nm-in); }
.opt.right .optic { color: var(--green-deep); }
.opt.wrong { color: var(--red); box-shadow: var(--nm-in); }
.opt .optlbl { width: 100%; text-align: center; }

.matchgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 130px), 1fr)); gap: 10px; margin-top: 8px; }
.tile { min-height: 74px; background: var(--surface); border: none; border-radius: var(--r-sm); display: grid; place-items: center; font-size: 15px; font-weight: 800; padding: 8px; box-shadow: var(--nm-1); transition: opacity .25s, transform .12s, box-shadow .15s, color .15s; }
.tile .optic { font-size: 38px; color: var(--orange-deep); }
.tile.sel { color: var(--orange-deep); box-shadow: var(--nm-in); }
.tile.gone { opacity: .3; pointer-events: none; color: var(--green-deep); box-shadow: var(--nm-in-sm); }

.shake { animation: shake .35s ease; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

.seqrow { display: flex; justify-content: center; gap: 10px; margin: 6px 0; flex-wrap: wrap; }
.seqslot { min-width: 64px; min-height: 64px; border-radius: var(--r-sm); background: var(--surface); border: none; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 26px; color: var(--orange-deep); padding: 4px; box-shadow: var(--nm-in-sm); transition: all .25s; }
.seqslot i { font-size: 11px; font-style: normal; font-weight: 700; color: var(--muted); }
.seqslot .ic { font-size: 30px; }
.seqslot.on { color: var(--orange-deep); box-shadow: var(--nm-in); transform: scale(1.05); }
.seqslot.ok { color: var(--green-deep); box-shadow: var(--nm-in); }
.seqpool { margin-top: 14px; }

.story .storytxt { background: var(--surface); border: none; border-radius: var(--r); padding: 18px 16px; box-shadow: var(--nm-1); }
.storytxt p { font-size: 15px; font-weight: 600; line-height: 2; margin-bottom: 12px; }
.storytxt p:last-child { margin-bottom: 0; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--surface); color: var(--orange-deep); font-weight: 800; font-size: 14px; border-radius: var(--r-pill); padding: 4px 12px; margin: 0 2px; box-shadow: var(--nm-sm); transition: box-shadow .2s, color .2s; }
.chip .ic { font-size: 16px; }
.chip.open { color: var(--green-deep); box-shadow: var(--nm-in-sm); }

.habits { display: flex; flex-direction: column; gap: 9px; margin-top: 6px; }
.habit { display: flex; align-items: center; gap: 13px; text-align: left; background: var(--surface); border: none; border-radius: var(--r-sm); padding: 14px; box-shadow: var(--nm-1); transition: box-shadow .15s, color .15s; }
.habit > span, .habit > .ic { font-size: 26px; flex: none; color: var(--orange-deep); }
.habit p { flex: 1; font-size: 13px; font-weight: 600; line-height: 1.45; }
.habit .tick { width: 30px; height: 30px; border-radius: 50%; background: var(--surface); box-shadow: var(--nm-in-sm); display: grid; place-items: center; color: transparent; flex: none; }
.habit .tick .ic { font-size: 15px; }
.habit.on { color: var(--green-deep); box-shadow: var(--nm-in); }
.habit.on .tick { color: var(--green-deep); box-shadow: none; }

.speakbtn { width: 42px; height: 42px; flex: none; display: inline-grid; place-items: center; font-size: 18px; border-radius: 50%; background: var(--surface); border: none; color: var(--orange-deep); box-shadow: var(--nm-sm); transition: transform .12s, box-shadow .12s; }
.speakbtn:active { transform: scale(.92); box-shadow: var(--nm-in-sm); }
.flashword { display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.extitlerow { display: flex; align-items: center; justify-content: center; gap: 10px; }
.listenbtn { width: clamp(80px, 22vmin, 100px); height: clamp(80px, 22vmin, 100px); margin: 8px auto 0; display: grid; place-items: center; font-size: clamp(34px, 9vmin, 44px); border-radius: 50%; background: var(--surface); border: none; color: var(--orange-deep); box-shadow: var(--nm-2); transition: transform .12s, box-shadow .12s; }
.listenbtn:active { transform: translateY(1px); box-shadow: var(--nm-in); }

.speaktag { text-align: center; }
.bigmic { width: clamp(80px, 22vmin, 100px); height: clamp(80px, 22vmin, 100px); margin: 8px auto 0; display: grid; place-items: center; border-radius: 50%; background: var(--surface); border: none; box-shadow: var(--nm-2); color: var(--orange-deep); transition: transform .12s, box-shadow .15s, color .15s; }
.bigmic svg, .bigmic .ic { width: 42px; height: 42px; font-size: 42px; }
.bigmic:active:not(:disabled) { transform: translateY(1px); box-shadow: var(--nm-in); }
.bigmic:disabled { opacity: .5; box-shadow: var(--nm-in-sm); }
.bigmic.rec { color: var(--red); box-shadow: var(--nm-in); animation: recpulse 1.1s ease infinite; }
.speakstatus { min-height: 20px; text-align: center; font-size: 13px; font-weight: 600; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 6px; }
.speakstatus .ic { font-size: 16px; }

.buildprompt { display: flex; align-items: center; justify-content: center; gap: 10px; background: var(--surface); border: none; border-radius: var(--r-sm); padding: 14px 16px; box-shadow: var(--nm-1); font-size: 15px; font-weight: 600; }
.buildprompt > span, .buildprompt > .ic { font-size: 26px; color: var(--orange-deep); }
.buildprompt i { font-style: normal; font-weight: 800; }
.buildrow { min-height: 56px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; padding: 12px; border: none; border-radius: var(--r-sm); background: var(--surface); box-shadow: var(--nm-in-sm); }
.buildrow.right { color: var(--green-deep); box-shadow: var(--nm-in); }
.buildrow.wrong { color: var(--red); box-shadow: var(--nm-in); }
.buildhint { font-size: 13px; font-style: normal; font-weight: 600; color: var(--faint); }
.buildpool { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 4px; }
.buildchip { background: var(--surface); border: none; border-radius: var(--r-pill); padding: 11px 17px; font-size: 15px; font-weight: 800; box-shadow: var(--nm-1); transition: transform .12s, box-shadow .12s, color .15s; }
.buildchip:active:not(:disabled) { transform: translateY(1px); box-shadow: var(--nm-in); }
.buildchip.in { color: var(--orange-deep); box-shadow: var(--nm-in); }

.feedback { display: flex; align-items: center; gap: 12px; border-radius: var(--r-sm); padding: 14px 16px; background: var(--surface); box-shadow: var(--nm-in-sm); animation: fadein .25s ease both; }
.feedback.ok { color: var(--green-deep); }
.feedback.bad { color: var(--red); }
.feedback > span, .feedback > .ic { font-size: 28px; flex: none; }
.feedback.ok .ic { color: var(--green-deep); }
.feedback.bad .ic { color: var(--red); }
.feedback b { font-size: 14px; font-weight: 900; display: block; }
.feedback i { font-size: 13px; font-weight: 600; font-style: normal; color: var(--muted); }

.result { margin: auto 0; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.resic { font-size: clamp(60px, 16vmin, 78px); color: var(--gold); animation: pop .5s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes pop { 0% { transform: scale(.3); opacity: 0; } 70% { transform: scale(1.15); } 100% { transform: scale(1); opacity: 1; } }
.result b { font-size: 18px; font-weight: 900; }
.result p { font-size: 13px; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; justify-content: center; }
.result p .ic { font-size: 16px; color: var(--orange-deep); }
.resstats { display: flex; gap: 10px; width: 100%; flex-wrap: wrap; }
.resstats > div { flex: 1; min-width: 90px; background: var(--surface); border: none; border-radius: var(--r-sm); padding: 13px 8px; display: flex; flex-direction: column; align-items: center; gap: 3px; box-shadow: var(--nm-1); }
.resstats span, .resstats .ic { font-size: 24px; color: var(--orange-deep); }
.resstats b { font-size: 17px; font-weight: 900; }
.resstats i { font-size: 11px; font-weight: 700; font-style: normal; color: var(--muted); }

/* ---------------- Ripple (sutil) ---------------- */
.ripple { position: absolute; border-radius: 50%; background: currentColor; opacity: .12; transform: scale(0); pointer-events: none; animation: ripple .6s ease-out forwards; z-index: 0; }
@keyframes ripple { to { transform: scale(1); opacity: 0; } }
.opt, .node, .btn, .navbtn, .iconbtn, .buildchip, .chip, .tile, .habit, .progrow, .langcard, .playbtn, .micbtn, .listenbtn, .bigmic, .speakbtn, .sendbtn, .kbbtn, .rolebtn, .langtoggle, .loadolder, .photoacts .chip { overflow: hidden; }
.opt > *, .node > *, .btn > *, .navbtn > *, .langcard > *, .habit > *, .progrow > *, .buildchip, .chip > * { position: relative; z-index: 1; }

/* ---------------- Celebración ---------------- */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 65; overflow: hidden; }
.confetti { position: absolute; top: -14px; border-radius: 2px; animation: confetti-fall linear forwards; }
@keyframes confetti-fall { 0% { transform: translate(0, 0) rotate(0); opacity: 1; } 100% { transform: translate(var(--dx), 105vh) rotate(var(--rot)); opacity: .9; } }

/* =========================================================
   RESPONSIVO · fluido de móvil pequeño a pantalla gigante
   ========================================================= */
@media (max-width: 360px) {
  .langic { font-size: 38px; }
  .nodeic { width: 56px; height: 56px; font-size: 26px; }
}

/* Teléfono apaisado */
@media (max-width: 899px) and (max-height: 480px) {
  .bottomnav { padding: 5px; }
  .navbtn { padding: 7px 0; }
  .navbtn span { display: none; }
  .navbtn .ic { font-size: 23px; }
}

/* Tablet / ventana media */
@media (min-width: 600px) {
  .app { max-width: none; }
  .wrap { max-width: 720px; margin-inline: auto; padding: clamp(22px, 3vw, 30px) clamp(20px, 3vw, 28px) calc(104px + env(safe-area-inset-bottom)); }
  .bottomnav { width: min(480px, calc(100% - 32px)); }
  .talkhead { padding-inline: max(14px, calc(50% - 360px)); }
  .talkmsgs { padding-inline: max(14px, calc(50% - 360px)); }
  .talkbar { padding-inline: max(18px, calc(50% - 360px)); }
  .lesson { padding-inline: max(16px, calc(50% - 340px)); }
}

/* Escritorio: riel lateral */
@media (min-width: 900px) {
  .app { flex-direction: row; }
  .bottomnav {
    position: static; transform: none;
    order: -1; flex: none;
    width: clamp(220px, 20vw, 260px); flex-direction: column; justify-content: flex-start; align-items: stretch;
    gap: 6px; border-radius: 0;
    border: none;
    padding: 20px 14px calc(16px + env(safe-area-inset-bottom));
    box-shadow: 8px 0 18px var(--sh-d), -1px 0 0 var(--sh-l);
    background: var(--surface);
    height: 100dvh;
  }
  .navbrand { display: flex; align-items: center; gap: 10px; font-size: 21px; font-weight: 900; padding: 6px 12px 18px; border-bottom: 1px solid var(--hairline); margin-bottom: 14px; }
  .navbrand .brandmark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; color: var(--orange-deep); background: var(--surface); box-shadow: var(--nm-1); }
  .navbrand .brandmark .ic { font-size: 26px; }
  .navbrand b { color: var(--ink); letter-spacing: .01em; }
  .navbrand b span { color: var(--orange-deep); }
  .navbtn { flex: none; flex-direction: row; justify-content: flex-start; gap: 13px; padding: 14px 16px; border-radius: var(--r-sm); }
  .navbtn .ic { font-size: 24px; }
  .navbtn span { font-size: 15px; font-weight: 800; }
  .navbtn.active { box-shadow: var(--nm-in-sm); }
  .wrap { max-width: 780px; padding: clamp(28px, 3vw, 40px) clamp(24px, 3vw, 32px) 48px; }
  .wrap.pathwrap { max-width: 700px; }
  .hero { top: 12px; }
  .toast { bottom: 40px; }
  /* Riel lateral: la barra del traductor ya no compite con el nav */
  .talkbar { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
}

/* Pantalla ancha: inicio a dos columnas */
@media (min-width: 1200px) {
  .wrap { max-width: 860px; }
  .wrap.home {
    max-width: 1120px;
    display: grid; grid-template-columns: 1fr 1fr; column-gap: 30px; align-items: start;
  }
  .wrap.home > * { min-width: 0; }
  .wrap.home > .apphead { grid-column: 1 / -1; grid-row: 1; }
  .wrap.home > :nth-child(2) { grid-column: 1; grid-row: 2; }
  .wrap.home > :nth-child(3) { grid-column: 1; grid-row: 3; }
  .wrap.home > :nth-child(4) { grid-column: 2; grid-row: 2; }
  .wrap.home > :nth-child(5) { grid-column: 2; grid-row: 3 / span 3; }
  .wrap.home > :nth-child(6) { grid-column: 1; grid-row: 4; }
  .wrap.home > :nth-child(7) { grid-column: 1; grid-row: 5; }
}

/* Pantalla muy ancha: más aire y contenido más amplio */
@media (min-width: 1600px) {
  .wrap { max-width: 960px; }
  .wrap.home { max-width: 1280px; column-gap: 40px; }
}

/* Puntero fino: hover */
@media (hover: hover) and (pointer: fine) {
  .navbtn:hover:not(.active) { color: var(--ink); box-shadow: var(--nm-sm); }
  .iconbtn:hover { color: var(--orange-deep); }
  .btn:hover:not(:disabled) { filter: brightness(1.02); }
  .langcard:hover { transform: translateY(-3px); box-shadow: var(--nm-2); }
  .opt:hover:not(:disabled), .tile:hover:not(.gone), .habit:hover, .buildchip:hover:not(:disabled), .progrow:hover { color: var(--orange-deep); }
  .node:hover:not(:disabled) .nodeic { transform: scale(1.05); }
  .playbtn:hover, .speakbtn:hover, .listenbtn:hover, .micbtn:hover, .sendbtn:hover, .kbbtn:hover { color: var(--orange-deep); }
  .loadolder:hover, .photoacts .chip:hover { color: var(--orange-deep); }
  .avatar:hover { filter: brightness(1.02); }
}

/* Movimiento reducido */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .screen { scroll-behavior: auto; }
  .confetti { display: none; }
}

/* =========================================================
   LOGIN 360 · gate de sesión (neumórfico)
   ========================================================= */
.authwrap {
  min-height: 100dvh;
  display: grid; place-items: center;
  padding: clamp(18px, 5vw, 40px) 16px calc(28px + env(safe-area-inset-bottom));
}
.authcard {
  width: 100%; max-width: 400px;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--nm-2);
  padding: clamp(22px, 6vw, 34px);
  display: flex; flex-direction: column; gap: 14px;
  animation: popin .3s cubic-bezier(.2, .8, .2, 1) both;
}
.authbrand { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: clamp(24px, 6vmin, 30px); font-weight: 900; }
.authbrand .brandmark { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 16px; color: var(--orange-deep); background: var(--surface); box-shadow: var(--nm-1); }
.authbrand .brandmark .ic { font-size: 28px; }
.authbrand b span { color: var(--orange-deep); }
.authlead { text-align: center; font-size: 14px; font-weight: 600; color: var(--muted); line-height: 1.55; margin-bottom: 2px; }

.gsiwrap { display: flex; justify-content: center; min-height: 4px; }
.gsiwrap > div { border-radius: var(--r-pill); overflow: hidden; box-shadow: var(--nm-sm); }

.authsep { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 12px; font-weight: 700; }
.authsep::before, .authsep::after { content: ''; flex: 1; height: 1px; background: var(--hairline); }

.authlbl { font-size: 12px; font-weight: 800; color: var(--muted); margin: 4px 2px 0; }
.authinrow { margin: 6px 0 12px; }
.authin { width: 100%; font-size: 15px; font-weight: 700; color: var(--ink); background: var(--surface); border: none; border-radius: var(--r-sm); padding: 14px 16px; box-shadow: var(--nm-in-sm); }
.authin:focus { outline: none; box-shadow: var(--nm-in-sm), var(--focus); }

.codeboxes { display: flex; justify-content: center; gap: clamp(6px, 2.5vw, 12px); margin: 14px 0; }
.codebox {
  width: clamp(44px, 15vw, 58px); height: clamp(54px, 18vw, 68px);
  text-align: center; font-size: clamp(22px, 7vw, 30px); font-weight: 900; text-transform: uppercase;
  color: var(--orange-deep); background: var(--surface); border: none; border-radius: var(--r-sm);
  box-shadow: var(--nm-in-sm); caret-color: var(--orange);
}
.codebox:focus { outline: none; box-shadow: var(--nm-in-sm), var(--focus); }
.authcodehint { font-size: 13px; font-weight: 600; color: var(--muted); text-align: center; line-height: 1.5; }
.authcodehint b { color: var(--ink); word-break: break-all; }

.authfoot { display: flex; justify-content: space-between; gap: 10px; margin-top: 12px; }
.linkbtn { background: none; border: none; color: var(--orange-deep); font-size: 13px; font-weight: 800; padding: 6px 4px; cursor: pointer; }
.linkbtn:disabled { color: var(--faint); cursor: default; }
.authmsg { min-height: 18px; text-align: center; font-size: 13px; font-weight: 700; color: var(--muted); }
.authmsg.ok { color: var(--green-deep); }
.authmsg.bad { color: var(--red); }
.authtos { text-align: center; font-size: 11px; font-weight: 600; color: var(--faint); line-height: 1.5; margin-top: 4px; }

/* ---- Cuenta en Perfil ---- */
.acctop { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; }
.accic { width: 56px; height: 56px; flex: none; display: grid; place-items: center; font-size: 26px; color: var(--orange-deep); border-radius: 50%; background: var(--surface); box-shadow: var(--nm-1); }
.acctxt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.acctxt b { font-size: 15px; font-weight: 900; }
.acctxt > span { font-size: 12px; font-weight: 600; color: var(--muted); word-break: break-word; }
.accrole { color: var(--orange-deep) !important; font-weight: 800 !important; display: inline-flex; align-items: center; gap: 5px; }
.accrole .ic { font-size: 15px; }
.homecard .btn { margin-top: 12px; }

/* ---- Admin ---- */
.adminrow { align-items: center; }
.adminactions { flex: none; display: flex; align-items: center; gap: 8px; }
.adminrole { font-size: 13px; font-weight: 800; color: var(--ink); background: var(--surface); border: none; border-radius: var(--r-sm); padding: 9px 10px; box-shadow: var(--nm-in-sm); }
.adminrole:focus { outline: none; box-shadow: var(--nm-in-sm), var(--focus); }
.iconbtn.adminlbl { width: 40px; height: 40px; color: var(--red); }
.iconbtn.adminlbl .ic { font-size: 18px; }

/* =========================================================
   ONBOARDING / NOVEDADES
   ========================================================= */
.onbwrap {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center;
  padding: 20px;
  background: rgba(30, 20, 12, .4);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  animation: fadein .25s ease both;
}
.onbwrap.onb-out { animation: fadeout .22s ease both; }
@keyframes fadeout { to { opacity: 0; } }
.onbcard {
  position: relative;
  width: 100%; max-width: 380px;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--nm-2);
  padding: clamp(26px, 7vw, 38px) clamp(22px, 6vw, 30px) clamp(20px, 5vw, 26px);
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  animation: popin .3s cubic-bezier(.2, .8, .2, 1) both;
}
.onbskip { position: absolute; top: 14px; right: 14px; color: var(--muted); }
.onbstage { width: 100%; min-height: 220px; display: grid; place-items: center; }
.onbslide { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.onbic { width: clamp(84px, 24vw, 104px); height: clamp(84px, 24vw, 104px); display: grid; place-items: center; border-radius: 50%; color: var(--orange-deep); background: var(--surface); box-shadow: var(--nm-1); }
.onbic .ic { font-size: clamp(40px, 12vw, 52px); }
.onbtag { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--orange-deep); background: var(--surface); border-radius: var(--r-pill); padding: 5px 14px; box-shadow: var(--nm-in-sm); }
.onbtitle { font-size: clamp(18px, 3vmin, 21px); font-weight: 900; }
.onbtext { font-size: 14px; font-weight: 600; color: var(--muted); line-height: 1.6; max-width: 30ch; }
.onbdots { display: flex; gap: 8px; }
.onbdot { width: 9px; height: 9px; border-radius: 50%; background: var(--surface); box-shadow: var(--nm-in-sm); transition: background .2s, width .2s; }
.onbdot.on { width: 22px; border-radius: var(--r-pill); background: linear-gradient(90deg, var(--orange), var(--orange-deep)); box-shadow: none; }
.onbnext { width: 100%; }

/* ---- Contraseña: campo con ojo y requisitos ---- */
.pwrow { position: relative; }
.pwrow .authin { padding-right: 48px; }
.eyebtn { position: absolute; top: 50%; right: 8px; transform: translateY(-50%); width: 36px; height: 36px; display: grid; place-items: center; border: none; background: none; color: var(--muted); cursor: pointer; }
.eyebtn .ic { font-size: 20px; }
.pwreqs { list-style: none; margin: 6px 2px 12px; padding: 0; display: grid; gap: 4px; }
.pwreqs li { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; color: var(--faint); }
.pwreqs li .ic { font-size: 14px; }
.pwreqs li.met { color: var(--green-deep); }
.authchange .authchangebody { text-align: left; margin-top: 6px; }
.authchange .authlbl { display: block; }
