/* Hanzi Quest — app de aprendizaje, tema claro. Se adapta a celular, tablet (600px+) y PC (1024px+). */
:root {
  --bg: #e8eee8;
  --app: #fffaf2;
  --surface: #ffffff;
  --surface-2: #f5f2e9;
  --ink: #18342b;
  --ink-soft: #315247;
  --muted: #73867d;
  --dim: #9dada5;
  --line: #e7e3d8;
  --line-strong: #d8d3c7;
  --jade: #12a878;
  --jade-deep: #0a7756;
  --mint: #e2f6ed;
  --mint-strong: #c9f0df;
  --gold: #eeb646;
  --gold-soft: #fdf3d9;
  --coral: #ef7e6a;
  --violet: #8b7bd8;
  --red: #df5d66;
  --red-soft: #fdecec;
  --radius: 24px;
  --shadow: 0 22px 50px rgba(24, 52, 43, 0.10);
  --hanzi: "Kaiti SC", "KaiTi", "STKaiti", "Noto Serif SC", "Songti SC", serif;
  --sans: "Segoe UI", "Inter", "Noto Sans", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  font-family: var(--sans);
  background:
    radial-gradient(800px 600px at 10% -10%, rgba(18, 168, 120, 0.14), transparent 65%),
    radial-gradient(700px 500px at 105% 10%, rgba(238, 182, 70, 0.12), transparent 60%),
    linear-gradient(160deg, #e6ece5, #f1efe7 50%, #e4ebe4);
  overflow: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(24, 52, 43, 0.08) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: 0.35;
  mask-image: linear-gradient(180deg, transparent, #000 15%, #000 85%, transparent);
}
button { font: inherit; color: inherit; }
button:focus-visible { outline: 3px solid rgba(18, 168, 120, 0.35); outline-offset: 2px; }
[hidden] { display: none !important; }
.noscript { position: fixed; inset: 0; display: grid; place-items: center; background: var(--app); }

.stage { position: relative; z-index: 1; width: 100%; }

/* La app ocupa toda la ventana en cualquier pantalla (en CV Chat va dentro de un marco). */
.app {
  width: 100%;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  background: var(--app);
}
.app.focus { grid-template-rows: 1fr; }
.app.focus #topbar, .app.focus #bottomnav { display: none; }

#topbar { padding: 18px 18px 0; }
#screen { overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: #d8d3c7 transparent; }
#screen::-webkit-scrollbar { width: 6px; }
#screen::-webkit-scrollbar-thumb { background: #d8d3c7; border-radius: 99px; }
#bottomnav {
  display: flex;
  align-items: center;
  justify-content: space-around;
  margin: 0 12px max(10px, env(safe-area-inset-bottom));
  padding: 6px;
  border: 1px solid #f0e9dc;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 10px 30px rgba(60, 40, 20, 0.14);
}
.nav-btn {
  flex: 1;
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 7px 4px;
  border: 0;
  border-radius: 14px;
  background: none;
  color: var(--dim);
  cursor: pointer;
  transition: 0.18s;
}
.nav-btn .nav-icon { width: 22px; height: 22px; display: grid; place-items: center; }
.nav-btn .nav-icon svg { width: 22px; height: 22px; }
.nav-btn span { font-size: 0.68rem; font-weight: 800; letter-spacing: 0.02em; }
.nav-btn.active { color: var(--jade-deep); background: var(--mint); box-shadow: inset 0 -3px 0 #bfe9d6; }
.nav-btn.active span { color: var(--jade-deep); }

/* ---------- Topbar ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.seal {
  width: 42px; height: 42px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 13px;
  color: #fff;
  font-family: var(--hanzi);
  font-size: 25px;
  background: linear-gradient(145deg, #67e2b4, var(--jade) 48%, var(--jade-deep));
  box-shadow: 0 8px 18px rgba(18, 168, 120, 0.25), inset 0 2px 0 rgba(255, 255, 255, 0.4);
  transform: rotate(-3deg);
  user-select: none;
}
.brand-txt { min-width: 0; }
.brand-txt b { display: block; font-size: 1rem; letter-spacing: -0.02em; white-space: nowrap; }
.brand-txt span { display: block; margin-top: 1px; font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.topstats { display: flex; align-items: center; gap: 6px; }
.pill {
  height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 9px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}
.pill.streak { color: #b97a06; border-color: #f2dfae; background: var(--gold-soft); }
.pill.xp { color: var(--jade-deep); border-color: #c8eadc; background: var(--mint); }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s, filter 0.15s;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0) scale(0.99); }
.btn:disabled { opacity: 0.38; cursor: not-allowed; box-shadow: none; }
.btn.primary {
  color: #fff;
  background: linear-gradient(180deg, #26c393, var(--jade) 55%, var(--jade-deep));
  box-shadow: 0 10px 22px rgba(18, 168, 120, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.btn.primary:hover:not(:disabled) { filter: brightness(1.03); box-shadow: 0 13px 26px rgba(18, 168, 120, 0.3); }
.btn.gold { color: #4a3203; background: linear-gradient(180deg, #ffd77a, var(--gold)); box-shadow: 0 10px 22px rgba(238, 182, 70, 0.22); }
.btn.ghost { color: var(--ink); background: var(--surface); border-color: var(--line); }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn.soft { color: var(--jade-deep); background: var(--mint); border-color: #c8eadc; }
.btn.soft:hover:not(:disabled) { background: #d2f2e4; }
.btn.danger { color: #fff; background: linear-gradient(180deg, #f18a92, var(--red)); }
.btn.wide { width: 100%; }
.btn.sm { min-height: 38px; padding: 8px 13px; border-radius: 11px; font-size: 0.8rem; }
.btn .arrow { font-size: 1rem; }
.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 1rem;
}
.icon-btn:hover { background: var(--surface-2); }
.link-btn { border: 0; background: none; padding: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 0.78rem; }

/* ---------- Home ---------- */
.home { padding: 16px 18px 26px; display: grid; gap: 14px; }
.home-side, .home-main, .units { display: grid; gap: 14px; align-content: start; }
.nav-brand, .nav-summary, .nav-seal { display: none; }
.nav-items { display: contents; }
.words-card { display: none; padding: 16px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
.words-head b { display: block; font-size: 0.86rem; }
.words-head span { display: block; margin-top: 1px; font-size: 0.68rem; color: var(--muted); }
.words-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 12px; }
.word-chip { display: grid; justify-items: center; gap: 1px; padding: 9px 4px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); cursor: pointer; transition: 0.14s; }
.word-chip:hover { border-color: #bfe7d8; background: #f6fdf9; transform: translateY(-1px); }
.word-chip .h { font-family: var(--hanzi); font-size: 1.45rem; line-height: 1.15; }
.word-chip small { font-size: 0.62rem; color: var(--jade-deep); }
.word-chip em { font-style: normal; font-size: 0.6rem; color: var(--muted); text-align: center; line-height: 1.2; }
.hero-card {
  position: relative;
  overflow: hidden;
  padding: 21px;
  border-radius: 26px;
  border: 1px solid color-mix(in srgb, var(--unit, var(--jade)) 24%, var(--line));
  background:
    radial-gradient(400px 260px at 100% 0%, color-mix(in srgb, var(--unit, var(--jade)) 16%, transparent), transparent 65%),
    linear-gradient(145deg, #fff, color-mix(in srgb, var(--unit, var(--jade)) 7%, #fff));
  box-shadow: var(--shadow);
}
.hero-card::after {
  content: attr(data-mark);
  position: absolute;
  right: -6px;
  bottom: -34px;
  font-family: var(--hanzi);
  font-size: 150px;
  line-height: 1;
  color: color-mix(in srgb, var(--unit, var(--jade)) 13%, transparent);
  pointer-events: none;
}
.hero-card .eyebrow { color: color-mix(in srgb, var(--unit, var(--jade)) 80%, var(--ink)); }
.hero-card h1 { margin: 7px 0 5px; font-size: 1.65rem; line-height: 1.1; letter-spacing: -0.035em; max-width: 12ch; }
.hero-card p { margin: 0; color: var(--muted); font-size: 0.8rem; line-height: 1.45; max-width: 32ch; }
.hero-progress { margin-top: 15px; max-width: 250px; }
.hero-actions { display: flex; gap: 8px; margin-top: 16px; position: relative; z-index: 1; }
.hero-actions .btn { min-height: 43px; }
.hero-foot { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 0.7rem; color: var(--muted); position: relative; z-index: 1; }
.hero-foot b { color: var(--ink); }
.hero-card.compact { padding: 18px 19px; }
.hero-card.compact h1 { margin-top: 5px; }
.hero-goal { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px; margin-top: 14px; font-size: 0.7rem; color: var(--muted); position: relative; z-index: 1; }
.hero-goal .progress-track { height: 6px; }
.hero-goal b { color: var(--jade-deep); font-size: 0.72rem; white-space: nowrap; }
.hero-goal.done span { color: var(--jade-deep); font-weight: 700; }

.prize-card { padding: 15px; border: 1px solid #efdcad; border-radius: 20px; background: linear-gradient(180deg, #fffdf6, #fff7e3); }
.prize-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.prize-head b { display: block; font-size: 0.86rem; }
.prize-head span { display: block; margin-top: 1px; font-size: 0.68rem; color: var(--muted); }
.prize-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 12px; }
.prize { display: grid; justify-items: center; gap: 1px; padding: 8px 4px; border: 1px solid #f2e3bd; border-radius: 13px; background: #fff; text-align: center; }
.prize .medal { font-size: 1.1rem; line-height: 1.2; }
.prize b { font-size: 1rem; color: #8a5a00; line-height: 1.15; }
.prize b::after { content: " 🪙"; font-size: 0.72em; }
.prize small { font-size: 0.56rem; line-height: 1.2; color: var(--muted); }
.prize.big { border-color: #e7c66f; background: #fff8e2; }
.prize-strip { display: flex; align-items: center; gap: 9px; width: 100%; padding: 10px 13px; border: 1px solid #efdcad; border-radius: 15px; background: linear-gradient(180deg, #fffdf6, #fff7e3); color: var(--ink-soft); font: inherit; font-size: 0.74rem; text-align: left; cursor: pointer; }
.prize-strip b { color: #8a5a00; }
.prize-strip .arrow { margin-left: auto; color: #8a5a00; }
.prize-note { margin: 10px 2px 0; font-size: 0.66rem; line-height: 1.45; color: var(--muted); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.65rem;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--jade-deep);
}
.eyebrow::before { content: ""; width: 17px; height: 2px; border-radius: 2px; background: currentColor; opacity: 0.7; }

.progress-track { height: 8px; border-radius: 99px; background: #e9e5db; overflow: hidden; }
.progress-track i {
  display: block; height: 100%; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, var(--jade-deep), var(--jade) 60%, #77e4b9);
  transition: width 0.35s cubic-bezier(0.22, 0.9, 0.3, 1);
}

.daily-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 14px;
  align-items: center;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(24, 52, 43, 0.04);
}
.daily-copy { min-width: 0; }
.daily-copy b { display: block; font-size: 0.86rem; }
.daily-copy span { display: block; margin-top: 2px; font-size: 0.7rem; color: var(--muted); }
.daily-target { text-align: right; }
.daily-target b { display: block; color: var(--jade-deep); font-size: 0.92rem; }
.daily-target span { display: block; font-size: 0.62rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.daily-bar { grid-column: 1 / -1; }
.daily-bar .progress-track { height: 7px; }
.daily-card.done .daily-target b { color: var(--jade-deep); }
.daily-card.done .daily-bar .progress-track i { background: linear-gradient(90deg, #0a7756, #22c08e); }

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 10px; margin: 6px 2px 0; }
.section-head h2 { margin: 0; font-size: 1.02rem; letter-spacing: -0.02em; }
.section-head p { margin: 2px 0 0; font-size: 0.7rem; color: var(--muted); }
.section-head .tiny { font-size: 0.66rem; color: var(--dim); font-weight: 650; }

/* Unidad: encabezado de color y camino de burbujas */
.unit-card { position: relative; display: grid; justify-items: center; gap: 6px; }
.unit-card.locked .road { filter: saturate(0.25); opacity: 0.75; }
.unit-banner {
  position: relative;
  overflow: hidden;
  width: 100%;
  padding: 16px 18px 15px;
  border-radius: 22px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--unit) 22%, #fff), color-mix(in srgb, var(--unit) 10%, #fff));
  border: 2px solid color-mix(in srgb, var(--unit) 30%, #fff);
  box-shadow: 0 5px 0 color-mix(in srgb, var(--unit) 22%, #fff);
}
.unit-banner::after {
  content: attr(data-deco);
  position: absolute;
  right: 10px;
  top: -14px;
  font-family: var(--hanzi);
  font-size: 92px;
  line-height: 1;
  color: color-mix(in srgb, var(--unit) 22%, transparent);
  pointer-events: none;
}
.unit-tab {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  background: #fff;
  color: color-mix(in srgb, var(--unit) 70%, #222);
  font-size: 0.64rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.unit-banner h3 { position: relative; margin: 8px 0 2px; font-size: 1.12rem; letter-spacing: -0.02em; color: color-mix(in srgb, var(--unit) 62%, #1b1b1b); }
.unit-banner p { position: relative; margin: 0; font-size: 0.74rem; color: color-mix(in srgb, var(--unit) 35%, #5a5a5a); }
.unit-card.locked .unit-banner { filter: saturate(0.3); }
.locked-note { margin-top: 8px !important; font-weight: 700; }

.trail { position: relative; margin: 6px auto 0; max-width: 100%; }
.trail .unit-banner { position: absolute; z-index: 1; }
.unit-banner.locked { filter: saturate(0.3); }
.road-base.dim { opacity: 0.45; }
.road { position: relative; margin: 4px auto 0; }
.road-svg { position: absolute; inset: 0; overflow: visible; }
.road-base, .road-done { fill: none; stroke-linecap: round; stroke-width: 22; }
.road-base { stroke: color-mix(in srgb, var(--unit) 22%, #fff); }
.road-done { stroke: color-mix(in srgb, var(--unit) 55%, #fff); }
@media (min-width: 600px) { .road-base, .road-done { stroke-width: 26; } }
.node {
  position: absolute;
  z-index: 1;
  width: 140px;
  transform: translate(-50%, -40px);
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: center;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
.orb {
  position: relative;
  width: 80px; height: 80px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: #fff;
  background: radial-gradient(circle at 34% 28%, color-mix(in srgb, var(--unit) 55%, #fff) 0 16%, var(--unit) 52%, color-mix(in srgb, var(--unit) 82%, #000) 100%);
  box-shadow: 0 7px 0 color-mix(in srgb, var(--unit) 62%, #000), 0 14px 20px rgba(40, 30, 20, 0.16);
  transition: transform 0.12s, box-shadow 0.12s;
  user-select: none;
}
.orb::after {
  content: "";
  position: absolute;
  top: 10px; right: 14px;
  width: 22px; height: 14px;
  border-radius: 50%;
  border-top: 4px solid rgba(255, 255, 255, 0.75);
  transform: rotate(32deg);
}
.orb-char { font-family: var(--hanzi); font-size: 2.3rem; line-height: 1; text-shadow: 0 2px 0 color-mix(in srgb, var(--unit) 60%, #000); }
.orb-badge { position: absolute; right: -4px; bottom: -2px; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; border: 3px solid #fff; font-size: 0.8rem; }
.orb-badge.ok { color: #fff; background: #f5b324; font-weight: 900; }
.orb-badge.lock { background: #fff; font-size: 0.75rem; }
.node:hover:not(:disabled) .orb { transform: translateY(-2px); }
.node:active:not(:disabled) .orb { transform: translateY(5px); box-shadow: 0 2px 0 color-mix(in srgb, var(--unit) 62%, #000), 0 6px 10px rgba(40, 30, 20, 0.14); }
.node.current .orb { animation: node-bounce 1.8s ease-in-out infinite; }
.node.current .orb::before { content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 4px solid color-mix(in srgb, var(--unit) 35%, #fff); }
.node.locked { cursor: not-allowed; }
.node.locked .orb { background: radial-gradient(circle at 34% 28%, #fbfaf6 0 16%, #e8e4da 55%, #d6d0c3 100%); box-shadow: 0 7px 0 #c9c2b3, 0 12px 16px rgba(40, 30, 20, 0.08); }
.node.locked .orb-char { color: #bdb5a5; text-shadow: none; }
.node.locked .orb::after { border-top-color: rgba(255, 255, 255, 0.9); }
.node-label { margin-top: 9px; font-size: 0.74rem; font-weight: 800; line-height: 1.2; }
.node.locked .node-label { color: var(--dim); }
.node-tip {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 12px;
  border-radius: 12px;
  background: #fff;
  color: color-mix(in srgb, var(--unit) 70%, #222);
  border: 2px solid color-mix(in srgb, var(--unit) 35%, #fff);
  box-shadow: 0 4px 0 color-mix(in srgb, var(--unit) 25%, #fff);
  font-size: 0.72rem;
  font-weight: 900;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.node-tip::after { content: ""; position: absolute; top: 100%; left: 50%; width: 10px; height: 10px; background: #fff; border-right: 2px solid color-mix(in srgb, var(--unit) 35%, #fff); border-bottom: 2px solid color-mix(in srgb, var(--unit) 35%, #fff); transform: translate(-50%, -4px) rotate(45deg); }
.node-stars { display: flex; gap: 1px; height: 12px; font-size: 0.72rem; line-height: 1; }
.node-stars span { color: #e5e0d3; }
.node-stars .on { color: var(--gold); }

.review-promo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid #eadfbe;
  border-radius: 18px;
  background: linear-gradient(180deg, #fffdf5, #fdf8e8);
}
.review-promo .ico { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: var(--gold-soft); font-size: 1.15rem; }
.review-promo b { display: block; font-size: 0.82rem; }
.review-promo span { display: block; margin-top: 1px; font-size: 0.68rem; color: var(--muted); }
.review-promo .btn { margin-left: auto; flex: 0 0 auto; }
.foot { margin: 4px 0 0; text-align: center; font-size: 0.62rem; color: var(--dim); line-height: 1.5; }

/* ---------- Páginas Repaso / Perfil ---------- */
.page { padding: 16px 18px 26px; display: grid; gap: 13px; }
.page-title { margin: 2px 0 0; font-size: 1.5rem; letter-spacing: -0.04em; }
.page-sub { margin: 2px 0 0; color: var(--muted); font-size: 0.78rem; line-height: 1.45; }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.stat-card { padding: 13px 14px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); }
.stat-card b { display: block; font-size: 1.3rem; line-height: 1.15; color: var(--ink); }
.stat-card span { display: block; margin-top: 2px; font-size: 0.6rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.stat-card.highlight { background: var(--mint); border-color: #c8eadc; }
.stat-card.highlight b { color: var(--jade-deep); }
.due-card { padding: 18px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); text-align: center; }
.due-card .big { font-family: var(--hanzi); font-size: 2.4rem; line-height: 1.1; color: var(--jade-deep); }
.due-card h2 { margin: 5px 0 3px; font-size: 1.15rem; }
.due-card p { margin: 0 auto; max-width: 28ch; color: var(--muted); font-size: 0.76rem; line-height: 1.45; }
.due-card .btn { margin-top: 14px; }
.due-list { display: grid; gap: 6px; }
.due-row { display: flex; align-items: baseline; gap: 8px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.due-row .h { font-family: var(--hanzi); font-size: 1.25rem; }
.due-row .p { font-size: 0.68rem; color: var(--jade-deep); }
.due-row .e { margin-left: auto; font-size: 0.68rem; color: var(--muted); text-align: right; }
.settings-card { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); overflow: hidden; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 15px; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-copy strong { display: block; font-size: 0.8rem; }
.setting-copy span { display: block; margin-top: 1px; font-size: 0.68rem; color: var(--muted); }
.about-card { padding: 14px 15px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); font-size: 0.7rem; color: var(--muted); line-height: 1.55; }
.about-card b { color: var(--ink); }
.app-version { text-align: center; font-size: 0.62rem; color: var(--dim); margin: 4px 0 0; }
.pill.account { max-width: 96px; overflow: hidden; text-overflow: ellipsis; color: var(--ink-soft); background: var(--surface-2); border-color: var(--line); }
.review-promo.rank-promo { border-color: #e4dcf7; background: linear-gradient(180deg, #fdfbff, #f7f3ff); }
.review-promo.rank-promo .ico { background: #eee8ff; }
.rank-sheet { width: min(520px, 100%); }
.rank-tabs { display: flex; gap: 4px; margin: 4px 0 14px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.rank-tab { flex: 1; min-height: 34px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 0.76rem; font-weight: 800; cursor: pointer; }
.rank-tab.on { color: #fff; background: linear-gradient(180deg, #a99aef, var(--violet)); box-shadow: 0 6px 14px rgba(139, 123, 216, 0.25); }
.rank-content { min-height: 160px; }
.rank-meta { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 5px; font-size: 0.7rem; color: var(--muted); }
.rank-prizes { margin-bottom: 12px; font-size: 0.7rem; line-height: 1.4; color: var(--violet); }
.rank-list { display: grid; gap: 6px; }
.rank-row { display: grid; grid-template-columns: 28px 1fr auto; gap: 2px 8px; align-items: center; padding: 9px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.rank-row.me { border-color: #cfc4f4; background: #f7f3ff; }
.rank-pos { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--ink-soft); font-size: 0.66rem; font-weight: 850; }
.rank-row:nth-child(1) .rank-pos { color: #4a3203; background: linear-gradient(180deg, #ffe28c, #e4b33e); }
.rank-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.82rem; font-weight: 650; }
.rank-name em { font-size: 0.66rem; font-style: normal; color: var(--violet); }
.rank-val { font-size: 0.78rem; font-weight: 800; color: var(--jade-deep); white-space: nowrap; }
.rank-sub { grid-column: 2 / -1; font-size: 0.65rem; color: var(--muted); }
.rank-mine { margin-top: 12px; padding: 10px 12px; border: 1px solid #ddd4f6; border-radius: 12px; background: #f7f3ff; font-size: 0.74rem; color: var(--muted); }
.rank-mine b { color: var(--violet); }
.rank-note { margin: 12px 0 0; font-size: 0.72rem; line-height: 1.5; color: var(--muted); }
.rank-empty { padding: 22px 10px; text-align: center; font-size: 0.8rem; line-height: 1.5; color: var(--muted); }

/* ---------- Lección ---------- */
.lesson { min-height: 100%; padding: 16px 18px 24px; display: flex; flex-direction: column; }
.lesson-top { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; }
.lesson-top .progress-track { flex: 1; height: 9px; }
.hearts { display: flex; gap: 1px; color: var(--red); font-size: 0.92rem; letter-spacing: 0.3px; }
.hearts .off { color: #e4ded2; }
.lesson-xp { font-size: 0.68rem; font-weight: 800; color: var(--jade-deep); white-space: nowrap; }
.combo-pill { font-size: 0.66rem; font-weight: 850; color: #a66a05; background: var(--gold-soft); border: 1px solid #efdcad; border-radius: 99px; padding: 3px 7px; white-space: nowrap; }
.lesson-body { flex: 1; display: grid; align-content: start; padding-top: 2px; }
.intro-card, .q-card, .write-card {
  position: relative;
  padding: 22px 20px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: rise 0.25s ease both;
  overflow: hidden;
}
.intro-card::before, .q-card::before, .write-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--jade), var(--gold), transparent);
  opacity: 0.65;
}
.intro-count { font-size: 0.64rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--jade-deep); }
.intro-hanzi { font-family: var(--hanzi); font-size: clamp(76px, 22vw, 116px); line-height: 1.08; text-align: center; padding: 8px 0 2px; letter-spacing: 0.04em; color: var(--ink); }
.intro-pinyin { text-align: center; font-size: 1.12rem; color: var(--jade-deep); font-weight: 650; }
.intro-meaning { text-align: center; margin-top: 2px; font-size: 0.94rem; color: var(--ink-soft); font-weight: 650; }
.intro-note { margin: 13px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); color: var(--muted); font-size: 0.73rem; line-height: 1.45; text-align: center; }
.intro-actions { display: grid; gap: 7px; margin-top: 16px; }
.intro-audio { display: flex; justify-content: center; margin-top: 8px; }

.q-label { font-size: 0.62rem; font-weight: 850; letter-spacing: 0.12em; text-transform: uppercase; color: var(--jade-deep); margin-bottom: 12px; }
.hanzi { font-family: var(--hanzi); font-size: clamp(62px, 19vw, 96px); line-height: 1.08; text-align: center; padding: 2px 0 9px; letter-spacing: 0.05em; color: var(--ink); user-select: none; }
.audio-wrap { display: grid; justify-items: center; gap: 8px; padding: 4px 0 12px; }
.translate-prompt {
  padding: 22px 8px 2px;
  text-align: center;
  font-size: clamp(2rem, 8vw, 2.8rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.audio-mini.slow { color: var(--muted); background: transparent; }
.audio-mini.slow:hover { color: var(--jade-deep); background: var(--mint); }
.intro-audio { flex-wrap: wrap; gap: 6px; }
.audio-orb {
  width: 92px; height: 92px;
  display: grid; place-items: center;
  border: 1px solid #bfeadb;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #ffffff, var(--mint));
  color: var(--jade-deep);
  font-size: 2rem;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(18, 168, 120, 0.16), 0 0 0 9px rgba(18, 168, 120, 0.05);
  transition: transform 0.18s, box-shadow 0.18s;
}
.audio-orb:hover { transform: scale(1.04); box-shadow: 0 14px 34px rgba(18, 168, 120, 0.22), 0 0 0 12px rgba(18, 168, 120, 0.06); }
.audio-sub { margin: 0; color: var(--muted); font-size: 0.76rem; text-align: center; }
.audio-mini { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 6px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--ink-soft); font-size: 0.73rem; cursor: pointer; }
.audio-mini:hover { background: var(--mint); border-color: #c8eadc; }
.hint-slot { min-height: 27px; display: flex; justify-content: center; align-items: center; }
.hint-pinyin { display: inline-block; padding: 4px 10px; border-radius: 99px; color: #9c6b09; background: var(--gold-soft); border: 1px solid #eed9a6; font-size: 0.85rem; }
.tone-sub { margin: 0; text-align: center; color: var(--muted); font-size: 0.76rem; }

.options { display: grid; gap: 8px; margin-top: 14px; }
.opt {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  font-size: 0.9rem;
  cursor: pointer;
  transition: 0.16s;
}
.opt:hover:not(:disabled) { border-color: #bfe7d8; background: #f6fdf9; transform: translateY(-1px); }
.opt:disabled { cursor: default; }
.opt .key { flex: 0 0 24px; height: 24px; display: grid; place-items: center; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); font-size: 0.64rem; font-weight: 800; }
.opt-text { flex: 1; min-width: 0; }
.opt-hanzi { font-family: var(--hanzi); font-size: 1.45rem; line-height: 1.1; }
.opt-pinyin { display: block; margin-top: 1px; font-size: 0.63rem; color: var(--muted); }
.opt.correct { border-color: #8fdcc3; background: var(--mint); box-shadow: 0 0 0 1px #8fdcc3 inset; }
.opt.correct .key { color: #fff; background: var(--jade); border-color: transparent; }
.opt.wrong { border-color: #efb0b4; background: var(--red-soft); animation: shake 0.26s ease; }
.opt.wrong .key { color: #fff; background: var(--red); border-color: transparent; }

.build-prompt { margin: 0 0 13px; font-size: 1.08rem; line-height: 1.35; font-weight: 750; }
.answer-zone { min-height: 74px; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 6px; padding: 10px; border: 1.5px dashed var(--line-strong); border-radius: 14px; background: var(--surface-2); }
.answer-zone.ok { border-style: solid; border-color: #8fdcc3; background: var(--mint); }
.answer-zone.bad { border-style: solid; border-color: #efb0b4; background: var(--red-soft); }
.placeholder { align-self: center; padding: 6px 3px; color: var(--dim); font-size: 0.76rem; }
.bank { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; min-height: 50px; }
.check-bar { margin-top: 18px; }
.check-bar[hidden] { display: none; }
.chip { display: inline-flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 11px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink); cursor: pointer; line-height: 1.1; transition: 0.14s; }
.chip:hover:not(:disabled) { transform: translateY(-1px); border-color: #bfe7d8; background: #f6fdf9; }
.chip:disabled { cursor: default; opacity: 0.85; }
.chip span { font-family: var(--hanzi); font-size: 1.25rem; }
.chip small { font-size: 0.54rem; color: var(--muted); }
.chip[data-place="placed"] { border-color: #a6e4d0; background: var(--mint); }

.fill-sentence { font-family: var(--hanzi); font-size: clamp(28px, 8vw, 38px); line-height: 1.45; text-align: center; padding: 8px 0 4px; letter-spacing: 0.02em; }
.fill-sentence .blank { display: inline-block; min-width: 46px; margin: 0 3px; border-bottom: 3px dashed var(--gold); color: var(--gold); }
.fill-es { margin: 2px 0 0; text-align: center; color: var(--muted); font-size: 0.76rem; }
.fill-options { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 13px; }
.fill-opt { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 8px; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; transition: 0.15s; }
.fill-opt span { font-family: var(--hanzi); font-size: 1.5rem; }
.fill-opt small { font-size: 0.58rem; color: var(--muted); }
.fill-opt:hover:not(:disabled) { border-color: #bfe7d8; background: #f6fdf9; }
.fill-opt.correct { border-color: #8fdcc3; background: var(--mint); }
.fill-opt.wrong { border-color: #efb0b4; background: var(--red-soft); }

.write-word { text-align: center; }
.write-word .h { font-family: var(--hanzi); font-size: 2.1rem; line-height: 1.1; }
.write-word .p { color: var(--jade-deep); font-size: 0.82rem; }
.write-word .e { color: var(--muted); font-size: 0.72rem; }
.write-word .h .pick { color: var(--jade-deep); text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 6px; }
.writer-box { width: min(230px, 62vw); aspect-ratio: 1; margin: 12px auto 4px; border-radius: 20px; border: 1px solid var(--line); background: repeating-linear-gradient(0deg, transparent 0 31px, #f2eee4 31px 32px), repeating-linear-gradient(90deg, transparent 0 31px, #f2eee4 31px 32px), #fff; display: grid; place-items: center; touch-action: none; }
.writer-box svg { display: block; width: 100%; height: 100%; }
.write-tip { text-align: center; color: var(--muted); font-size: 0.68rem; margin: 0 0 8px; }
.write-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }

.feedback { margin-top: 13px; padding: 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface-2); animation: rise 0.2s ease both; }
.feedback.ok { border-color: #b9e8d8; background: #f0fbf6; }
.feedback.bad { border-color: #f0c3c6; background: #fdf3f3; }
.fb-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.fb-head strong { font-size: 0.9rem; }
.feedback.ok .fb-head strong { color: var(--jade-deep); }
.feedback.bad .fb-head strong { color: #b73c46; }
.gain { font-size: 0.7rem; font-weight: 800; color: #a66a05; }
.combo-tag { display: inline-block; margin-left: 4px; padding: 2px 6px; border-radius: 99px; font-size: 0.6rem; color: #a66a05; background: var(--gold-soft); border: 1px solid #eed9a6; vertical-align: middle; }
.fb-answer { display: flex; align-items: baseline; flex-wrap: wrap; gap: 7px; margin-bottom: 4px; }
.fb-hanzi { font-family: var(--hanzi); font-size: 1.65rem; }
.fb-py { color: var(--jade-deep); font-size: 0.82rem; }
.fb-es { color: var(--muted); font-size: 0.76rem; }
.fb-label { margin: 0 0 2px; font-size: 0.68rem; color: var(--muted); }
.fb-note { margin: 0 0 9px; color: var(--muted); font-size: 0.7rem; line-height: 1.45; }
.fb-sentence { font-family: var(--hanzi); font-size: 1.4rem; line-height: 2; margin-bottom: 4px; }
.fb-sentence ruby { ruby-position: over; margin-right: 0.1em; }
.fb-sentence rt { font-family: var(--sans); font-size: 0.42em; font-weight: 400; color: var(--jade-deep); }
.fb-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 9px; }
.fb-actions .btn { margin-left: auto; }

/* ---------- Resultados ---------- */
.results { min-height: 100%; padding: 26px 18px; display: grid; align-content: center; }
.result-card { padding: 24px 20px; border: 1px solid var(--line); border-radius: 27px; background: var(--surface); box-shadow: var(--shadow); text-align: center; animation: rise 0.28s ease both; }
.stars { display: flex; justify-content: center; gap: 7px; margin-bottom: 4px; }
.stars span { font-size: clamp(38px, 10vw, 52px); line-height: 1; color: #e8e2d5; transform: scale(0.88); }
.stars .on { color: var(--gold); text-shadow: 0 5px 18px rgba(238, 182, 70, 0.4); animation: pop 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.3) var(--d, 0s) both; }
.result-card h2 { margin: 6px 0 5px; font-size: 1.55rem; letter-spacing: -0.035em; }
.result-card .sub { margin: 0 auto; max-width: 30ch; color: var(--muted); font-size: 0.78rem; line-height: 1.45; }
.goal-banner { display: inline-flex; align-items: center; gap: 6px; margin: 11px 3px 0; padding: 6px 11px; border-radius: 99px; background: var(--mint); border: 1px solid #c8eadc; color: var(--jade-deep); font-size: 0.68rem; font-weight: 800; }
.goal-banner.cap { color: #8b5c05; background: var(--gold-soft); border-color: #efdcad; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 18px 0 4px; }
.result-stat { padding: 11px 6px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); }
.result-stat b { display: block; font-size: 1.1rem; color: var(--ink); }
.result-stat span { display: block; margin-top: 2px; font-size: 0.55rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.result-note { margin: 11px 0 0; font-size: 0.7rem; color: var(--muted); line-height: 1.45; }
.result-actions { display: grid; gap: 7px; margin-top: 16px; }

/* ---------- Modal ---------- */
.scrim { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(17, 38, 31, 0.35); backdrop-filter: blur(5px); animation: fade 0.18s ease both; }
.sheet { width: min(430px, 100%); max-height: min(85dvh, 760px); overflow-y: auto; padding: 21px; border-radius: 25px; background: var(--surface); box-shadow: 0 30px 80px rgba(24, 52, 43, 0.25); animation: sheet-up 0.26s cubic-bezier(0.22, 0.9, 0.3, 1) both; position: relative; }
.sheet-close { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); color: var(--muted); cursor: pointer; font-size: 1.1rem; }
.sheet-close:hover { background: #ece8dd; }
.sheet .eyebrow { margin-bottom: 5px; }
.sheet h2 { margin: 0 0 4px; font-size: 1.35rem; letter-spacing: -0.03em; }
.sheet-sub { margin: 0 0 14px; color: var(--muted); font-size: 0.76rem; line-height: 1.45; }
.word-list { display: grid; gap: 6px; margin: 12px 0 16px; }
.word-row { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: baseline; padding: 8px 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.word-row .h { font-family: var(--hanzi); font-size: 1.25rem; }
.word-row .p { font-size: 0.68rem; color: var(--jade-deep); }
.word-row .e { font-size: 0.68rem; color: var(--muted); text-align: right; }
.sheet-stars { display: flex; justify-content: center; gap: 4px; margin: 0 0 12px; font-size: 1rem; color: #e3ddd0; }
.sheet-stars .on { color: var(--gold); }
.sheet-actions { display: grid; gap: 7px; }

/* ---------- Toast / confetti ---------- */
#toast { position: fixed; left: 50%; bottom: 22px; z-index: 70; max-width: min(90vw, 380px); padding: 9px 15px; border: 1px solid var(--line-strong); border-radius: 99px; background: #1f3a31; color: #fff; font-size: 0.75rem; text-align: center; opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(14px); transition: 0.2s; box-shadow: 0 16px 40px rgba(24, 52, 43, 0.25); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.bad { background: #7f2f36; }
#toast.good { background: #0c6e50; }
#confetti { position: fixed; inset: 0; z-index: 60; overflow: hidden; pointer-events: none; }
.confetti-piece { position: absolute; top: -16px; width: 7px; height: 12px; border-radius: 2px; animation: confetti-fall var(--dur, 2.5s) linear var(--delay, 0s) forwards; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheet-up { from { opacity: 0; transform: translateY(14px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { opacity: 0; transform: scale(0.3); } 65% { opacity: 1; transform: scale(1.16); } 100% { opacity: 1; transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@keyframes node-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes node-pulse { 0%, 100% { box-shadow: 0 0 0 2px color-mix(in srgb, var(--unit) 35%, transparent), 0 0 0 0 color-mix(in srgb, var(--unit) 22%, transparent), 0 8px 18px rgba(24, 52, 43, 0.12); } 50% { box-shadow: 0 0 0 2px color-mix(in srgb, var(--unit) 55%, transparent), 0 0 0 10px color-mix(in srgb, var(--unit) 0%, transparent), 0 8px 18px rgba(24, 52, 43, 0.12); } }
@keyframes confetti-fall { 0% { transform: translate3d(0, 0, 0) rotate(0); opacity: 0.95; } 100% { transform: translate3d(var(--drift, 0px), 108vh, 0) rotate(720deg); opacity: 0.85; } }

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  #topbar { padding: 14px 16px 0; }
  .home, .page { padding: 13px 16px 22px; }
  .lesson { padding: 13px 16px 22px; }
  .hero-card h1 { font-size: 1.5rem; }
  .result-stats { gap: 5px; }
}
@media (max-width: 420px) {
  .brand-txt span { display: none; }
  .topstats { gap: 4px; }
  .pill { height: 28px; padding: 0 7px; font-size: 0.65rem; }
  .pill.account { max-width: 72px; }
}
@media (max-width: 380px) {
  .brand-txt span { display: none; }
  .pill { padding: 0 7px; font-size: 0.66rem; }
  .hero-actions { flex-wrap: wrap; }
  .hero-actions .btn { flex: 1 1 120px; }
  .fill-options { gap: 5px; }
  .fill-opt span { font-size: 1.3rem; }
  .prize-row { grid-template-columns: repeat(2, 1fr); }
}
/* ---------- Bienvenida (introducción al chino) ---------- */
.welcome { min-height: 100%; display: flex; flex-direction: column; padding: 16px 18px max(18px, env(safe-area-inset-bottom)); width: 100%; max-width: 640px; margin: 0 auto; }
.welcome-body { flex: 1; display: grid; align-content: center; justify-items: center; gap: 12px; padding: 10px 2px 18px; text-align: center; animation: rise 0.3s ease both; }
.welcome-art { width: 100%; min-height: 250px; display: grid; place-items: center; align-content: center; gap: 14px; }
.welcome-title { margin: 6px 0 0; font-size: 1.45rem; line-height: 1.2; letter-spacing: -0.02em; }
.welcome-text { margin: 0; max-width: 34ch; color: var(--ink-soft); font-size: 0.95rem; line-height: 1.55; }
.welcome-text b { color: var(--jade-deep); }
.welcome-actions { display: flex; gap: 10px; }
.welcome-actions .btn { min-height: 54px; font-size: 1rem; }
.welcome-actions .btn.ghost { flex: 0 0 60px; font-size: 1.2rem; }

.wl-scroll { display: flex; align-items: center; animation: pop 0.45s ease both; }
.wl-rod { width: 16px; height: 150px; border-radius: 8px; background: linear-gradient(90deg, #e0a112, #ffd35a, #e0a112); box-shadow: 0 4px 0 #b47d08; }
.wl-scroll-paper { display: flex; gap: 10px; padding: 22px 30px; margin: 0 -4px; border: 0; border-top: 6px solid #fbe48a; border-bottom: 6px solid #fbe48a; background: #fffdf3; font-family: var(--hanzi); font-size: 4.2rem; line-height: 1; color: #1d1712; cursor: pointer; }
.wl-parts { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--muted); }
.wl-parts > span:not(.plus) { padding: 6px 10px; border-radius: 12px; background: var(--mint); color: var(--jade-deep); }
.wl-parts b { font-family: var(--hanzi); font-size: 1.15rem; font-weight: 400; color: var(--ink); margin-right: 3px; }
.wl-parts .plus { font-weight: 900; color: var(--dim); }

.wl-pinyin { position: relative; display: grid; justify-items: center; padding-top: 78px; }
.wl-tag { position: absolute; top: 0; right: -64px; padding: 8px 16px; border-radius: 14px; background: var(--mint-strong); color: var(--ink); font-size: 1.3rem; font-weight: 700; animation: pop 0.4s 0.2s ease both; }
.wl-arrow { position: absolute; top: 34px; right: -26px; width: 70px; height: 54px; fill: none; stroke: var(--jade); stroke-width: 4; stroke-linecap: round; }
.wl-py { padding: 4px 26px; border: 4px solid var(--jade); border-radius: 50%; background: none; font-size: 2.6rem; color: var(--ink); cursor: pointer; transform: rotate(-3deg); }
.wl-big { margin-top: 4px; font-family: var(--hanzi); font-size: 5.2rem; line-height: 1.05; }

.wl-tones { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: 100%; max-width: 380px; }
.wl-tone, .wl-card { position: relative; display: grid; justify-items: center; gap: 2px; padding: 12px 8px 10px; border: 2px solid color-mix(in srgb, var(--c) 35%, #fff); border-radius: 18px; background: color-mix(in srgb, var(--c) 9%, #fff); box-shadow: 0 5px 0 color-mix(in srgb, var(--c) 28%, #fff); cursor: pointer; }
.wl-tone:active, .wl-card:active { transform: translateY(4px); box-shadow: 0 1px 0 color-mix(in srgb, var(--c) 28%, #fff); }
.wl-tone svg { width: 60px; height: 40px; }
.wl-tone path { fill: none; stroke: var(--c); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.wl-tone b, .wl-card b { font-size: 1.9rem; line-height: 1.1; color: var(--c); }
.wl-tone small, .wl-card small { font-size: 0.7rem; color: var(--muted); }
.wl-play { position: absolute; top: 7px; right: 9px; font-size: 0.8rem; opacity: 0.7; }
.wl-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; width: 100%; max-width: 400px; }
.wl-card { padding: 16px 8px 14px; }
.wl-emoji { font-size: 3.6rem; line-height: 1.1; }
.wl-han { font-family: var(--hanzi); font-size: 1.6rem; color: var(--ink); }

.wl-order { display: flex; align-items: flex-end; justify-content: center; gap: 12px; }
.wl-say { align-self: center; width: 44px; height: 44px; border: 2px solid var(--line); border-radius: 50%; background: #fff; box-shadow: 0 3px 0 var(--line); cursor: pointer; }
.wl-word { display: grid; justify-items: center; gap: 6px; animation: rise 0.35s ease both; animation-delay: var(--d); }
.wl-word small { font-size: 0.95rem; color: var(--ink-soft); }
.wl-word span { font-family: var(--hanzi); font-size: 3.4rem; line-height: 1; }
.wl-word em { font-style: normal; padding: 5px 10px; border-radius: 10px; background: var(--mint); color: var(--jade-deep); font-size: 0.9rem; }
.wl-word i { font-style: normal; padding: 4px 10px; border-radius: 99px; border: 2px dashed var(--line-strong); color: var(--muted); font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; }

.wl-writer { width: min(240px, 64vw); aspect-ratio: 1; border-radius: 22px; border: 2px solid #f0e9dc; background: repeating-linear-gradient(0deg, transparent 0 39px, #f2eee4 39px 40px), repeating-linear-gradient(90deg, transparent 0 39px, #f2eee4 39px 40px), #fff; box-shadow: 0 6px 0 #efe6d6; display: grid; place-items: center; }
.wl-writer svg { display: block; width: 100%; height: 100%; }

.wl-final { display: flex; align-items: center; justify-content: center; gap: 16px; }
.wl-lantern { width: 64px; height: 76px; display: grid; place-items: center; border-radius: 46%; background: radial-gradient(circle at 35% 30%, #f5646c, #c8202a 70%); box-shadow: 0 5px 0 #8f141b; color: #f7cc5c; font-family: var(--hanzi); font-size: 1.9rem; animation: node-bounce 2s ease-in-out infinite; }
.wl-lantern:last-child { animation-delay: 0.5s; }
.wl-cheer { display: grid; justify-items: center; padding: 14px 20px; border: 0; border-radius: 24px; background: linear-gradient(180deg, #2bd09c, var(--jade)); box-shadow: 0 6px 0 var(--jade-deep); color: #fff; cursor: pointer; animation: pop 0.45s ease both; }
.wl-cheer small { font-size: 1rem; opacity: 0.9; }
.wl-cheer span { font-family: var(--hanzi); font-size: 3.6rem; line-height: 1.1; }
@media (max-width: 380px) {
  .wl-tag { right: -30px; font-size: 1.05rem; }
  .wl-arrow { right: -4px; }
  .wl-py { font-size: 2.1rem; }
  .wl-big, .wl-scroll-paper { font-size: 3.6rem; }
  .wl-word span { font-size: 2.8rem; }
}

/* ---------- Estilo de juego: botones y tarjetas con relieve ---------- */
.btn { border-radius: 16px; letter-spacing: 0.01em; }
.btn.primary {
  background: linear-gradient(180deg, #2bd09c, var(--jade));
  box-shadow: 0 5px 0 var(--jade-deep), 0 10px 18px rgba(18, 168, 120, 0.22);
}
.btn.primary:hover:not(:disabled) { box-shadow: 0 5px 0 var(--jade-deep), 0 12px 22px rgba(18, 168, 120, 0.28); }
.btn.primary:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--jade-deep); }
.btn.gold { box-shadow: 0 5px 0 #c88a12; }
.btn.gold:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 #c88a12; }
.btn.ghost, .btn.soft { border-width: 2px; box-shadow: 0 4px 0 var(--line); }
.btn.soft { box-shadow: 0 4px 0 #bfe6d4; }
.btn.danger { box-shadow: 0 5px 0 #b13d46; }
.btn.ghost:active:not(:disabled), .btn.soft:active:not(:disabled), .btn.danger:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.opt, .fill-opt, .chip { border-width: 2px; box-shadow: 0 4px 0 var(--line); }
.opt { border-radius: 16px; }
.opt:hover:not(:disabled) { transform: translateY(-1px); }
.opt:active:not(:disabled), .fill-opt:active:not(:disabled), .chip:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.opt.correct, .fill-opt.correct { box-shadow: 0 4px 0 #8fdcc3; }
.opt.wrong, .fill-opt.wrong { box-shadow: 0 4px 0 #efb0b4; }
.chip[data-place="placed"] { box-shadow: 0 4px 0 #a6e4d0; }
.intro-card, .q-card, .write-card, .result-card { border-width: 2px; border-color: #f0e9dc; box-shadow: 0 6px 0 #efe6d6, 0 18px 40px rgba(60, 40, 20, 0.08); }
.pill { height: 32px; padding: 0 11px; border-width: 2px; box-shadow: 0 3px 0 var(--line); font-size: 0.78rem; }
.pill.streak { box-shadow: 0 3px 0 #f2dfae; }
.pill.xp { box-shadow: 0 3px 0 #c8eadc; }
.app:has(.home) { background: linear-gradient(180deg, color-mix(in srgb, var(--cur, #f2a51f) 26%, #fffaf2) 0, #fffaf2 420px) no-repeat, #fffaf2; }
.hero-card {
  border-width: 2px;
  background:
    radial-gradient(380px 240px at 100% 0%, color-mix(in srgb, var(--unit, var(--jade)) 24%, transparent), transparent 65%),
    linear-gradient(150deg, #fff, color-mix(in srgb, var(--unit, var(--jade)) 10%, #fff));
  box-shadow: 0 6px 0 color-mix(in srgb, var(--unit, var(--jade)) 22%, #fff), 0 18px 40px rgba(60, 40, 20, 0.08);
}
.prize-strip { border-width: 2px; box-shadow: 0 4px 0 #f2e0b0; }
.review-promo, .words-card, .prize-card { border-width: 2px; }
.feedback { border-width: 2px; }

/* ---------- Fluidez: transiciones y respuesta al toque ---------- */
* { -webkit-tap-highlight-color: transparent; }
button { touch-action: manipulation; }
#screen { overscroll-behavior: contain; scroll-behavior: smooth; }
@keyframes screen-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes slide-in { from { opacity: 0; transform: translateX(36px); } to { opacity: 1; transform: none; } }
@keyframes sheet-rise { from { transform: translateY(105%); } to { transform: none; } }
@keyframes pop-ok { 0% { transform: scale(1); } 45% { transform: scale(1.045); } 100% { transform: scale(1); } }
/* (sin "forwards": si la animación queda aplicada, lo fijo de adentro deja de fijarse a la ventana) */
#screen > .home, #screen > .page, #screen > .results, .reader > .rd-title, .reader > .rd-lines { animation: screen-in 0.34s cubic-bezier(0.2, 0.8, 0.2, 1) backwards; }
.lesson-body > article { animation: slide-in 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.home .unit-card { animation: screen-in 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.home .unit-card:nth-child(2) { animation-delay: 0.05s; }
.home .unit-card:nth-child(3) { animation-delay: 0.1s; }
.home .unit-card:nth-child(n+4) { animation-delay: 0.15s; }
.opt.correct, .fill-opt.correct { animation: pop-ok 0.34s ease; }
.nav-btn { transition: transform 0.12s, background 0.2s, color 0.2s; }
.nav-btn:active { transform: scale(0.93); }
.nav-btn.active .nav-icon { animation: pop 0.3s ease both; }
.progress-track i { transition: width 0.45s cubic-bezier(0.2, 0.8, 0.2, 1); }
.icon-btn:active, .audio-mini:active, .audio-orb:active { transform: scale(0.92); }
.audio-orb, .audio-mini, .icon-btn { transition: transform 0.12s; }

/* El panel de corrección sube desde abajo y queda fijo, con el botón siempre a mano */
.lesson #feedback:not(:empty) { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; justify-items: center; pointer-events: none; }
.lesson .feedback { pointer-events: auto; width: 100%; max-width: 760px; margin: 0; padding: 16px 18px max(16px, env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; border-width: 2px 2px 0; box-shadow: 0 -14px 40px rgba(40, 30, 20, 0.16); animation: sheet-rise 0.3s cubic-bezier(0.2, 0.85, 0.25, 1) both; }
.lesson .feedback.ok { background: #e9faf2; }
.lesson .feedback.bad { background: #fdeeee; }
.lesson .fb-head strong { font-size: 1.1rem; }
.lesson .fb-actions .btn.primary { min-height: 50px; padding-inline: 26px; }
.lesson:has(.feedback) { padding-bottom: 250px; }
.feedback.bad .btn.primary { background: linear-gradient(180deg, #f18a92, var(--red)); box-shadow: 0 5px 0 #b13d46; }

/* ---------- Camino: parada y botón para volver a la lección actual ---------- */
.node.parada .orb { border-radius: 24px; background: radial-gradient(circle at 34% 28%, #ffe9a6 0 16%, #f5b324 55%, #d98f0a 100%); box-shadow: 0 7px 0 #b97a06, 0 14px 20px rgba(40, 30, 20, 0.16); }
.node.parada .orb::after { display: none; }
.node.parada .orb-char { font-family: inherit; font-size: 2rem; text-shadow: none; }
.node.parada.locked .orb { background: radial-gradient(circle at 34% 28%, #fbfaf6 0 16%, #e8e4da 55%, #d6d0c3 100%); box-shadow: 0 7px 0 #c9c2b3; }
.node.parada.locked .orb-char { filter: grayscale(1); opacity: 0.5; }
.node-sub { font-size: 0.62rem; color: var(--muted); }
.jump-wrap { position: sticky; bottom: 14px; height: 0; display: flex; justify-content: flex-end; padding-right: 16px; pointer-events: none; z-index: 4; }
.jump-btn { pointer-events: auto; transform: translateY(-100%); width: 46px; height: 46px; border: 2px solid #d6f1e5; border-radius: 16px; background: #fff; color: var(--jade); font-size: 1.3rem; font-weight: 900; box-shadow: 0 4px 0 #d6f1e5, 0 10px 22px rgba(40, 30, 20, 0.12); cursor: pointer; }
.jump-btn:active { transform: translateY(calc(-100% + 3px)); box-shadow: 0 1px 0 #d6f1e5; }

/* ---------- Practicar ---------- */
.sec-title { margin: 10px 2px 0; font-size: 1rem; letter-spacing: -0.01em; }
.due-card { border-width: 2px; box-shadow: 0 6px 0 #efe6d6; }
.due-card.hot { border-color: #bfe9d6; background: linear-gradient(180deg, #f3fcf8, #fff); box-shadow: 0 6px 0 #cfeee0; }
.course-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.course-tile { position: relative; overflow: hidden; display: grid; gap: 3px; align-content: start; min-height: 96px; padding: 14px; border: 0; border-radius: 18px; background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 78%, #fff)); box-shadow: 0 5px 0 color-mix(in srgb, var(--c) 70%, #000); color: #fff; text-align: left; cursor: pointer; transition: transform 0.12s, box-shadow 0.12s; }
.course-tile::after { content: attr(data-deco); position: absolute; right: 8px; bottom: -12px; font-family: var(--hanzi); font-size: 4.4rem; line-height: 1; color: rgba(255, 255, 255, 0.28); }
.course-tile b { font-size: 0.98rem; }
.course-tile small { font-size: 0.72rem; opacity: 0.92; max-width: 16ch; }
.course-tile:active { transform: translateY(4px); box-shadow: 0 1px 0 color-mix(in srgb, var(--c) 70%, #000); }
.course-tile.locked, .list-row.locked { filter: saturate(0.35); opacity: 0.75; }
.list-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 14px; border: 2px solid var(--line); border-radius: 16px; background: #fff; box-shadow: 0 4px 0 var(--line); text-align: left; cursor: pointer; transition: transform 0.12s, box-shadow 0.12s; }
.list-row:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.list-row .ico { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: var(--surface-2); font-size: 1.15rem; }
.list-row .txt { display: grid; gap: 1px; min-width: 0; }
.list-row .txt b { font-size: 0.9rem; }
.list-row .txt small { font-size: 0.7rem; color: var(--muted); }
.list-row .end { margin-left: auto; font-weight: 800; color: var(--muted); }

/* ---------- Colección de palabras ---------- */
.back-link { justify-self: start; padding: 0; border: 0; background: none; color: var(--jade-deep); font-weight: 800; font-size: 0.85rem; cursor: pointer; }
.seg { display: flex; gap: 4px; padding: 4px; border: 2px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.seg button { flex: 1; min-height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 800; font-size: 0.78rem; cursor: pointer; transition: 0.15s; }
.seg button.on { color: #fff; background: var(--jade); box-shadow: 0 3px 0 var(--jade-deep); }
.word-items { display: grid; gap: 7px; }
.word-item { display: flex; align-items: stretch; gap: 6px; }
.word-main { flex: 1; display: flex; align-items: baseline; gap: 10px; padding: 11px 13px; border: 2px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 3px 0 var(--line); text-align: left; cursor: pointer; }
.word-main:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.word-main .h { font-family: var(--hanzi); font-size: 1.4rem; }
.word-main .p { font-size: 0.78rem; color: var(--jade-deep); }
.word-main .e { margin-left: auto; font-size: 0.76rem; color: var(--muted); text-align: right; }
.fav-btn { flex: 0 0 44px; border: 2px solid var(--line); border-radius: 14px; background: #fff; color: #c9c2b3; font-size: 1.15rem; cursor: pointer; transition: transform 0.12s; }
.fav-btn.on { color: #f5b324; border-color: #f2dfae; background: var(--gold-soft); }
.fav-btn:active { transform: scale(0.9); }

/* ---------- Historias ---------- */
.story-grid { display: grid; gap: 12px; }
.story-card { display: flex; gap: 13px; align-items: stretch; padding: 10px; border: 2px solid color-mix(in srgb, var(--c) 25%, #fff); border-radius: 20px; background: #fff; box-shadow: 0 5px 0 color-mix(in srgb, var(--c) 20%, #fff); text-align: left; cursor: pointer; transition: transform 0.12s, box-shadow 0.12s; }
.story-card:active { transform: translateY(4px); box-shadow: 0 1px 0 color-mix(in srgb, var(--c) 20%, #fff); }
.story-card.locked { filter: saturate(0.25); opacity: 0.8; }
.story-cover, .story-hero { position: relative; overflow: hidden; display: grid; place-items: center; border-radius: 14px; background: linear-gradient(150deg, var(--c), color-mix(in srgb, var(--c) 60%, #1b1b1b)); color: #fff; }
.story-cover { flex: 0 0 92px; min-height: 118px; }
.story-cover .zh, .story-hero .zh { font-family: var(--hanzi); font-size: 2.3rem; line-height: 1.05; writing-mode: vertical-rl; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.18); }
.story-cover .em, .story-hero .em { position: absolute; right: 5px; bottom: 3px; font-size: 1.3rem; }
.story-cover .done { position: absolute; left: 6px; top: 6px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: #fff; color: var(--jade); font-size: 0.75rem; font-weight: 900; }
.story-info { display: grid; align-content: center; gap: 4px; min-width: 0; }
.story-info b { font-size: 1rem; }
.story-info small { font-size: 0.76rem; color: var(--muted); line-height: 1.4; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 3px; }
.tags i, .rd-pop-es i { font-style: normal; padding: 2px 8px; border-radius: 99px; background: var(--mint); color: var(--jade-deep); font-size: 0.62rem; font-weight: 800; }
.tags i.ok { background: var(--gold-soft); color: #8a5a00; }
.story-hero { height: 150px; margin: -4px 0 14px; border-radius: 18px; }
.story-hero .zh { font-size: 3.4rem; }
.story-hero .em { font-size: 2rem; right: 12px; bottom: 8px; }

/* Lector */
.reader { position: relative; min-height: 100%; width: 100%; max-width: 760px; margin: 0 auto; padding: 12px 16px 150px; }
.rd-top { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 8px; margin: -12px -16px 6px; padding: 12px 16px 10px; background: color-mix(in srgb, var(--app) 92%, transparent); backdrop-filter: blur(8px); }
.rd-top b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.95rem; }
.rd-title { margin: 8px 0 14px; font-family: var(--hanzi); font-weight: 400; font-size: 2rem; }
.rd-title small { font-family: var(--sans); font-size: 0.8rem; color: var(--muted); margin-left: 6px; }
.rd-lines { display: grid; gap: 6px; }
.rd-line { display: flex; gap: 8px; align-items: flex-start; padding: 8px 8px 8px 4px; border-radius: 16px; transition: background 0.25s; }
.rd-line.on { background: color-mix(in srgb, var(--c, var(--jade)) 12%, #fff); }
.rd-play { flex: 0 0 34px; height: 34px; margin-top: 4px; border: 0; border-radius: 50%; background: none; font-size: 0.95rem; opacity: 0.7; cursor: pointer; }
.rd-line.on .rd-play { opacity: 1; }
.rd-body { min-width: 0; }
.rd-zh { margin: 0; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 2px 3px; }
.rd-w { display: inline-grid; justify-items: center; padding: 1px 2px 2px; border: 0; border-bottom: 2px solid color-mix(in srgb, var(--c, var(--jade)) 30%, transparent); border-radius: 6px 6px 0 0; background: none; color: var(--ink); cursor: pointer; transition: background 0.15s; }
.rd-w small { font-size: 0.72rem; color: var(--jade-deep); line-height: 1.3; }
.rd-w span, .rd-punct { font-family: var(--hanzi); font-size: 1.65rem; line-height: 1.35; }
.rd-w.on, .rd-w:active { background: color-mix(in srgb, var(--c, var(--jade)) 22%, #fff); }
.reader.mode-han .rd-w small { display: none; }
.reader.mode-pin .rd-w span, .reader.mode-pin .rd-punct { display: none; }
.reader.mode-pin .rd-w small { font-size: 1.15rem; color: var(--ink); padding: 3px 2px; }
.reader.mode-pin .rd-zh { gap: 4px 8px; }
.reader.size-0 .rd-w span, .reader.size-0 .rd-punct { font-size: 1.35rem; }
.reader.size-2 .rd-w span, .reader.size-2 .rd-punct { font-size: 2.1rem; }
.reader.size-2 .rd-w small { font-size: 0.85rem; }
.rd-es { display: none; margin: 4px 0 0; font-size: 0.82rem; color: var(--muted); line-height: 1.4; }
.reader.show-es .rd-es { display: block; }
.rd-end { display: grid; gap: 8px; margin-top: 22px; }
.rd-pop { position: fixed; left: 50%; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 10; width: min(520px, calc(100% - 24px)); margin-left: calc(min(520px, 100% - 24px) / -2); padding: 14px 16px; border-radius: 20px; background: #1d2b26; color: #fff; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28); animation: screen-in 0.22s ease both; }
.rd-pop-head { display: flex; align-items: baseline; gap: 10px; }
.rd-pop-head .h { font-family: var(--hanzi); font-size: 1.9rem; }
.rd-pop-head .p { color: #8fe3c4; font-size: 0.95rem; }
.rd-pop-head .fav-btn { margin-left: auto; flex: 0 0 38px; height: 38px; align-self: center; background: rgba(255, 255, 255, 0.08); border-color: transparent; }
.rd-pop-head .fav-btn.on { background: rgba(245, 179, 36, 0.18); }
.rd-pop-x { align-self: center; width: 34px; height: 34px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, 0.08); color: #fff; font-size: 1.1rem; cursor: pointer; }
.rd-pop-es { margin-top: 4px; font-size: 0.95rem; }
.rd-pop-note { margin: 5px 0 9px; font-size: 0.74rem; line-height: 1.45; color: #b9c9c2; }
.rd-pop-actions { display: flex; gap: 7px; }
.set-label { margin: 14px 0 6px; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.opt-row { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 12px 4px; border: 0; border-bottom: 1px solid var(--line); background: none; font-size: 0.9rem; text-align: left; cursor: pointer; }
.opt-row span { color: var(--jade); font-weight: 900; }
.opt-row.on { color: var(--jade-deep); font-weight: 700; }
.choice-prompt { margin: 10px 0 4px; font-size: 1.2rem; font-weight: 750; line-height: 1.35; text-align: center; }
.options.one-col { grid-template-columns: 1fr !important; }

/* ---------- Lección: botones de arriba, pinyin y opciones ---------- */
.lesson-top.hud { flex-wrap: wrap; row-gap: 10px; }
.lesson-top.hud .progress-track { order: 9; flex: 0 0 100%; }
.hud-gap { flex: 1; }
.lesson-top.hud .hearts { order: -1; margin-left: 4px; }
.lesson-top.hud .combo-pill, .lesson-top.hud .lesson-xp { order: -1; }
.lesson-top.hud .icon-btn:first-child { order: -2; }
.hud-btn { font-size: 1rem; font-weight: 800; color: var(--jade-deep); border-width: 2px; box-shadow: 0 3px 0 var(--line); }
.hud-btn.py { font-family: var(--hanzi); font-size: 1.1rem; background: var(--mint); border-color: #bfe9d6; box-shadow: 0 3px 0 #bfe9d6; }
.hud-btn.py.off { background: #fff; color: var(--dim); border-color: var(--line); box-shadow: 0 3px 0 var(--line); text-decoration: line-through; }
.hud-btn.tip { background: var(--gold-soft); border-color: #f2dfae; box-shadow: 0 3px 0 #f2dfae; }
.hud-btn.pulse { animation: node-bounce 1.2s ease-in-out 3; }
.hanzi-py { text-align: center; font-size: 1.15rem; color: var(--jade-deep); margin-bottom: -2px; }
.opt-hanzi { display: flex; align-items: baseline; gap: 10px; }
.opt-hanzi .opt-pinyin { display: inline; margin: 0; font-family: var(--sans); font-size: 0.8rem; color: var(--jade-deep); }
.tk { display: inline-grid; justify-items: center; margin: 0 2px; vertical-align: bottom; }
.tk small { font-family: var(--sans); font-size: 0.7rem; color: var(--jade-deep); line-height: 1.2; }
.tk b { font-weight: 400; }
.app.show-han .hanzi-py, .app.show-han .chip small, .app.show-han .fill-opt small, .app.show-han .opt-pinyin, .app.show-han .tk small { display: none; }
.app.show-pin .hanzi-py + .hanzi, .app.show-pin .chip span, .app.show-pin .fill-opt span, .app.show-pin .oh, .app.show-pin .tk b { display: none; }
.app.show-pin .hanzi-py { font-size: 3rem; color: var(--ink); padding: 20px 0 14px; }
.app.show-pin .chip small, .app.show-pin .fill-opt small, .app.show-pin .opt-hanzi .opt-pinyin, .app.show-pin .tk small { font-size: 1.15rem; color: var(--ink); padding: 4px 2px; }
.app.fs-0 .lesson-body { zoom: 0.9; }
.app.fs-2 .lesson-body { zoom: 1.14; }
.tip-pattern { display: grid; gap: 4px; padding: 14px 16px; border-radius: 16px; background: #f3edff; }
.tip-pattern b { font-size: 1.15rem; color: #5b3fc4; }
.tip-pattern span { font-size: 0.82rem; color: #6d6488; font-weight: 700; }
.tip-text { margin: 12px 2px 4px; font-size: 0.9rem; line-height: 1.55; color: var(--ink-soft); }
.tip-ex { position: relative; display: grid; gap: 2px; width: 100%; margin-bottom: 7px; padding: 10px 40px 10px 14px; border: 2px solid var(--line); border-radius: 14px; background: #fff; text-align: left; cursor: pointer; }
.tip-ex:active { transform: translateY(2px); }
.tip-zh { font-family: var(--hanzi); font-size: 1.4rem; line-height: 2; }
.tip-zh rt { font-family: var(--sans); font-size: 0.42em; color: #5b3fc4; }
.tip-es { font-size: 0.8rem; color: var(--muted); }
.tip-play { position: absolute; right: 12px; top: 12px; opacity: 0.7; }
.tip-sheet .sheet-actions { margin-top: 12px; }
.set-label b { float: right; color: var(--ink); font-size: 0.85rem; letter-spacing: 0; }
.rate-row { display: flex; align-items: center; gap: 10px; padding: 4px 2px 10px; }
.rate-row input { flex: 1; accent-color: var(--jade); height: 28px; }
.switch { position: relative; width: 42px; height: 24px; border-radius: 99px; background: #d9d4c8; transition: background 0.2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform 0.2s; }
.switch.on { background: var(--jade); }
.switch.on::after { transform: translateX(18px); }

/* ---------- Inicio con vida ---------- */
.home-side { grid-template-columns: minmax(0, 1fr); }
.mascot-row { position: relative; z-index: 1; display: flex; align-items: flex-end; gap: 6px; margin: -4px 0 12px -6px; }
.panda { flex: 0 0 84px; width: 84px; height: 84px; animation: panda-bob 3.2s ease-in-out infinite; }
.panda-eyes { animation: panda-blink 4.5s infinite; transform-origin: 60px 52px; }
.panda-arm { animation: panda-wave 2.4s ease-in-out infinite; transform-origin: 86px 84px; }
@keyframes panda-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes panda-blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(0.1); } }
@keyframes panda-wave { 0%, 60%, 100% { transform: rotate(0); } 70% { transform: rotate(-22deg); } 80% { transform: rotate(8deg); } 90% { transform: rotate(-16deg); } }
.bubble { position: relative; flex: 1; min-width: 0; display: grid; gap: 1px; margin-bottom: 14px; padding: 10px 14px; border: 2px solid color-mix(in srgb, var(--unit, var(--jade)) 28%, #fff); border-radius: 18px 18px 18px 4px; background: #fff; box-shadow: 0 4px 0 color-mix(in srgb, var(--unit, var(--jade)) 20%, #fff); text-align: left; cursor: pointer; animation: pop 0.45s 0.15s ease both; }
.bubble:active { transform: translateY(3px); box-shadow: 0 1px 0 color-mix(in srgb, var(--unit, var(--jade)) 20%, #fff); }
.bubble b { font-family: var(--hanzi); font-size: 1.5rem; font-weight: 400; line-height: 1.15; color: var(--ink); }
.bubble small { font-size: 0.72rem; color: var(--jade-deep); }
.bubble span { margin-top: 3px; font-size: 0.78rem; line-height: 1.35; color: var(--ink-soft); }
.hero-card h1 { max-width: none; }

.home-cards { display: flex; gap: 12px; min-width: 0; margin: 0 -16px; padding: 2px 16px 10px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; scroll-behavior: smooth; }
.home-cards::-webkit-scrollbar { display: none; }
.hc { flex: 0 0 86%; scroll-snap-align: center; display: grid; align-content: start; gap: 8px; padding: 14px 15px; border: 2px solid #f0e9dc; border-radius: 22px; background: #fff; box-shadow: 0 5px 0 #efe6d6; text-align: left; font: inherit; color: inherit; }
.hc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hc-head b { font-size: 0.92rem; }
.hc-head .count { padding: 2px 9px; border-radius: 99px; background: var(--surface-2); font-size: 0.72rem; font-weight: 800; color: var(--muted); }
.hc-head .count.all { background: var(--mint); color: var(--jade-deep); }
.coin-tag { font-style: normal; margin-left: 6px; padding: 2px 8px; border-radius: 99px; background: var(--gold-soft); color: #8a5a00; font-size: 0.68rem; }
.goal-banner.coin { background: var(--gold-soft); color: #8a5a00; border-color: #f2dfae; }
.hc-link { border: 0; background: none; padding: 0; color: var(--jade-deep); font-size: 0.74rem; font-weight: 800; cursor: pointer; }
.mission { display: flex; align-items: center; gap: 10px; }
.mission .mi { width: 32px; height: 32px; flex: 0 0 32px; display: grid; place-items: center; border-radius: 10px; background: var(--surface-2); font-size: 0.95rem; }
.mission .mt { flex: 1; min-width: 0; display: grid; gap: 4px; font-size: 0.78rem; }
.mission .progress-track { height: 6px; }
.mission b { flex: 0 0 auto; min-width: 34px; text-align: right; font-size: 0.72rem; color: var(--muted); }
.mission.done .mt span { color: var(--muted); text-decoration: line-through; }
.mission.done b { color: var(--jade); font-size: 1rem; }
.mission.done .mi { background: var(--mint); }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 4px; padding-top: 10px; border-top: 1px dashed var(--line); }
.wd { display: grid; justify-items: center; gap: 2px; }
.wd i { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); font-style: normal; font-size: 0.85rem; }
.wd.on i { background: #ffe9c2; box-shadow: 0 2px 0 #f5cf8a; }
.wd.today i { outline: 2px solid var(--jade); outline-offset: 1px; }
.wd small { font-size: 0.6rem; font-weight: 800; color: var(--muted); }
.hc.wod { position: relative; overflow: hidden; justify-items: center; gap: 0; cursor: pointer; border-color: color-mix(in srgb, var(--c) 30%, #fff); background: linear-gradient(160deg, #fff, color-mix(in srgb, var(--c) 14%, #fff)); box-shadow: 0 5px 0 color-mix(in srgb, var(--c) 24%, #fff); transition: transform 0.12s, box-shadow 0.12s; }
.hc.wod:active { transform: translateY(4px); box-shadow: 0 1px 0 color-mix(in srgb, var(--c) 24%, #fff); }
.hc-tag { justify-self: start; padding: 3px 10px; border-radius: 99px; background: color-mix(in srgb, var(--c) 16%, #fff); color: color-mix(in srgb, var(--c) 70%, #222); font-size: 0.64rem; font-weight: 850; letter-spacing: 0.04em; text-transform: uppercase; }
.wod-h { font-family: var(--hanzi); font-size: 3.6rem; line-height: 1.2; }
.wod-p { font-size: 1rem; color: color-mix(in srgb, var(--c) 70%, #222); font-weight: 700; }
.wod-e { font-size: 0.86rem; color: var(--ink-soft); }
.wod-play { margin-top: 8px; font-size: 0.68rem; color: var(--muted); }
.hr-body { display: grid; gap: 6px; }
.hr-row { display: grid; grid-template-columns: 30px 1fr auto auto; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); font-size: 0.82rem; }
.hr-row.me { background: #f3edff; }
.hr-row b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hr-row em { font-style: normal; font-weight: 800; color: var(--jade-deep); font-size: 0.76rem; }
.hr-row i { font-style: normal; font-size: 0.7rem; color: #8a5a00; min-width: 44px; text-align: right; }
.hr-empty, .hr-note { margin: 0; font-size: 0.72rem; color: var(--muted); line-height: 1.4; }
.wod-sheet h2 { font-family: var(--hanzi); font-weight: 400; font-size: 2.4rem; }
.wod-sheet h2 small { font-family: var(--sans); font-size: 1rem; color: var(--jade-deep); margin-left: 8px; }
.wod-writers { display: flex; justify-content: center; gap: 10px; margin: 4px 0 12px; }
.wod-writer { width: 120px; height: 120px; border: 2px solid #f0e9dc; border-radius: 16px; background: repeating-linear-gradient(0deg, transparent 0 29px, #f2eee4 29px 30px), repeating-linear-gradient(90deg, transparent 0 29px, #f2eee4 29px 30px), #fff; }
.wod-actions { display: flex; justify-content: center; align-items: stretch; gap: 7px; margin-bottom: 14px; }
.wod-actions .fav-btn { min-height: 36px; }
.deco { position: absolute; transform: translate(-50%, -50%); font-size: 1.7rem; opacity: 0.5; pointer-events: none; user-select: none; animation: deco-float 5s ease-in-out infinite; animation-delay: var(--d, 0s); }
@keyframes deco-float { 0%, 100% { transform: translate(-50%, -50%); } 50% { transform: translate(-50%, calc(-50% - 9px)) rotate(4deg); } }

/* ---------- Unir parejas ---------- */
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.match-col { display: grid; gap: 9px; align-content: start; }
.match-btn { display: grid; justify-items: center; align-content: center; gap: 1px; min-height: 64px; padding: 8px 6px; border: 2px solid var(--line); border-radius: 16px; background: #fff; box-shadow: 0 4px 0 var(--line); font-size: 0.86rem; line-height: 1.2; text-align: center; cursor: pointer; transition: transform 0.12s, box-shadow 0.12s, background 0.15s, opacity 0.2s; }
.match-btn .mh { font-family: var(--hanzi); font-size: 1.5rem; }
.match-btn small { font-size: 0.68rem; color: var(--jade-deep); }
.match-btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.match-btn.sel { border-color: #6aa9f5; background: #eef5ff; box-shadow: 0 4px 0 #b9d6fb; }
.match-btn.ok { border-color: #8fdcc3; background: var(--mint); box-shadow: none; opacity: 0.55; animation: pop-ok 0.3s ease; }
.match-btn.no { border-color: #efb0b4; background: var(--red-soft); animation: shake 0.26s ease; }
.app.show-han .match-btn small { display: none; }
.app.show-pin .match-btn .mh { display: none; }
.app.show-pin .match-btn small { font-size: 1.1rem; color: var(--ink); }

/* ---------- Opciones con imagen, traducción de frases y festejo de combo ---------- */
.options.tiles { grid-template-columns: 1fr 1fr !important; gap: 10px; }
.opt.tile { flex-direction: column; justify-content: center; gap: 4px; padding: 12px 8px; text-align: center; }
.tile-img { font-size: 2.9rem; line-height: 1.15; }
.opt.tile .opt-text { flex: none; font-size: 0.86rem; }
.opt.tile .opt-hanzi { flex-direction: column; align-items: center; gap: 0; }
.sc-prompt { display: flex; align-items: center; gap: 12px; margin: 6px 0 4px; }
.sc-prompt .fill-sentence { text-align: left; margin: 0; }
.sc-play { flex: 0 0 46px; height: 46px; border: 0; border-radius: 14px; background: linear-gradient(180deg, #2bd09c, var(--jade)); box-shadow: 0 4px 0 var(--jade-deep); color: #fff; font-size: 1.1rem; cursor: pointer; }
.sc-play:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--jade-deep); }
.sc-zh { font-family: var(--hanzi); font-size: 1.25rem; }
.combo-screen { flex: 1; display: grid; place-content: center; justify-items: center; gap: 6px; width: 100%; min-height: 70vh; border: 0; background: none; cursor: pointer; animation: pop 0.4s ease both; }
.combo-screen .panda { width: 150px; height: 150px; flex: none; }
.combo-screen b { font-size: 1.9rem; color: var(--jade-deep); }
.combo-screen span { padding: 6px 18px; border-radius: 99px; background: var(--gold-soft); border: 2px solid #f2dfae; color: #a66a05; font-size: 1.2rem; font-weight: 900; }

/* ---------- Ingreso (en su propio dominio) ---------- */
.ingreso { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; overflow-y: auto; padding: 18px 14px; background: radial-gradient(700px 500px at 20% 0%, rgba(18, 168, 120, 0.22), transparent 60%), radial-gradient(600px 500px at 100% 100%, rgba(238, 182, 70, 0.22), transparent 60%), #fffaf2; }
.ingreso[hidden] { display: none; }
body.con-ingreso .stage { visibility: hidden; }
.in-card { width: min(420px, 100%); display: grid; gap: 12px; padding: 22px 20px; border: 2px solid #f0e9dc; border-radius: 26px; background: #fff; box-shadow: 0 8px 0 #efe6d6, 0 24px 60px rgba(60, 40, 20, 0.12); animation: screen-in 0.35s ease both; }
.in-head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.in-head h1 { margin: 0; font-size: 1.45rem; letter-spacing: -0.02em; }
.in-head p { margin: 1px 0 0; color: var(--muted); font-size: 0.85rem; }
.in-o { display: flex; align-items: center; gap: 10px; margin: 2px 0; color: var(--dim); font-size: 0.74rem; }
.in-o::before, .in-o::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
#in-form { display: grid; gap: 10px; }
.in-f { display: grid; gap: 4px; font-size: 0.78rem; font-weight: 700; color: var(--ink-soft); }
.in-f[hidden], .in-check[hidden] { display: none; }
.in-f input { min-height: 46px; padding: 10px 12px; border: 2px solid var(--line); border-radius: 13px; background: #fff; font: inherit; font-size: 1rem; font-weight: 400; color: var(--ink); }
.in-f input:focus { outline: none; border-color: #8fdcc3; box-shadow: 0 0 0 3px rgba(18, 168, 120, 0.15); }
.in-check { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--ink-soft); }
.in-check input { width: 18px; height: 18px; accent-color: var(--jade); }
.in-check a { color: var(--jade-deep); }
.in-error { margin: 0; min-height: 1em; color: #b73c46; font-size: 0.82rem; font-weight: 700; }
.in-error:empty { display: none; }
.in-nota, .in-chico { margin: 0; text-align: center; font-size: 0.76rem; line-height: 1.45; color: var(--muted); }
.in-chico { font-size: 0.7rem; }
.in-terminos { display: grid; gap: 10px; }
.in-terminos-texto { max-height: 260px; overflow-y: auto; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); font-size: 0.74rem; line-height: 1.5; white-space: pre-wrap; }
.in-terminos-texto .sep { text-align: center; color: var(--muted); }

/* ---------- Tablet ---------- */
@media (min-width: 600px) {
  html { font-size: 16.5px; }
  #topbar { padding: 18px max(24px, calc((100% - 860px) / 2)) 0; }
  .home, .page { width: 100%; max-width: 860px; margin: 0 auto; padding: 22px 28px 32px; }
  .units { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .lesson { width: 100%; max-width: 720px; margin: 0 auto; padding: 22px 28px 30px; }
  .options { grid-template-columns: 1fr 1fr; }
  .fill-options { grid-template-columns: repeat(4, 1fr); }
  .results { width: 100%; max-width: 560px; margin: 0 auto; }
  .story-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .word-items { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .writer-box { width: 280px; }
  #bottomnav { justify-content: center; gap: 10px; }
  .home-cards { margin: 0 -28px; padding: 2px 28px 10px; }
  .hc { flex: 0 0 46%; }
  .deco { font-size: 2.4rem; }
  #bottomnav .nav-btn { flex: 0 1 160px; }
}

/* ---------- PC ---------- */
@media (min-width: 1024px) {
  html { font-size: 17px; }
  .app {
    grid-template-columns: 250px minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: "nav top" "nav screen";
  }
  .app.focus { grid-template-columns: 1fr; grid-template-rows: 1fr; grid-template-areas: "screen"; }
  #topbar { grid-area: top; padding: 18px 40px 0; }
  #screen { grid-area: screen; }
  #bottomnav {
    grid-area: nav;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 18px;
    padding: 22px 16px;
    border-top: 0;
    border-right: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.7);
    overflow-y: auto;
  }
  .topbar { justify-content: flex-end; }
  .topbar .brand { display: none; }
  .nav-brand { display: flex; align-items: center; gap: 11px; padding: 2px 6px 6px; }
  .nav-brand .brand-txt span { display: block; }
  .nav-items { display: grid; gap: 4px; }
  #bottomnav .nav-btn { flex: none; display: flex; align-items: center; justify-content: flex-start; gap: 12px; padding: 11px 14px; text-align: left; }
  #bottomnav .nav-btn span:last-child { font-size: 0.88rem; letter-spacing: 0; }
  #bottomnav .nav-btn:hover:not(.active) { background: var(--surface-2); color: var(--ink-soft); }
  .nav-summary { display: grid; gap: 9px; padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
  .nav-summary > div:not(.progress-track) { display: grid; grid-template-columns: 22px auto 1fr; align-items: baseline; gap: 6px; }
  .nav-summary b { font-size: 0.95rem; }
  .nav-summary small { font-size: 0.68rem; color: var(--muted); }
  .nav-summary .progress-track { height: 6px; }
  .nav-seal { display: block; margin-top: auto; text-align: center; font-family: var(--hanzi); font-size: 2.4rem; line-height: 1.15; color: color-mix(in srgb, var(--jade) 18%, transparent); user-select: none; }

  .home {
    max-width: 1480px;
    padding: 24px 40px 40px;
    grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
    gap: 28px;
    align-items: start;
  }
  .home-side { position: sticky; top: 0; }
  .home-cards { display: grid; margin: 0; padding: 0; overflow: visible; }
  .hc { flex: none; }
  .deco { font-size: 3rem; opacity: 0.55; }
  .home-main .section-head { margin-top: 0; }
  .units { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 22px 18px; align-items: start; }
  .words-card { display: block; }

  .hero-card h1 { font-size: 1.9rem; }
  .hero-card { padding: 24px; }

  .page { max-width: 1040px; padding: 24px 40px 40px; }
  .stat-grid { grid-template-columns: repeat(6, 1fr); }

  .lesson { max-width: 860px; padding: 30px 40px 40px; }
  .intro-card, .q-card, .write-card { padding: 30px 34px; }
  .hanzi { font-size: 120px; }
  .intro-hanzi { font-size: 140px; }
  .writer-box { width: 320px; }
  .results { max-width: 600px; }
  .story-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .story-card { flex-direction: column; }
  .story-cover { flex: 0 0 170px; }
  .story-cover .zh { font-size: 3.2rem; }
  .word-items { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .page.practice { max-width: 760px; }
  .reader { padding-top: 20px; }
  .rd-w span, .rd-punct { font-size: 2rem; }
  .jump-wrap { padding-right: 28px; bottom: 22px; }
}

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