/* ====== Tokens ====== */
@import url('./fonts/lxgw/lxgwwenkai-regular.css');

:root {
  --bg: #FFF7EC;
  --bg-soft: #FDEBCE;
  --card: #FFFFFF;
  --ink: #1B1B2A;
  --ink-soft: #6B6B7B;
  --line: #EFE4D1;

  --primary: #FF5C4D;
  --primary-press: #E84A3D;
  --yellow: #FFCB47;
  --mint: #4BD0A0;
  --blue: #5B8DEF;
  --lilac: #B79CFF;

  --tone-1: #E94B4B;
  --tone-2: #F2A93B;
  --tone-3: #3FB66B;
  --tone-4: #3D7BD9;
  --tone-5: #9AA0A6;

  --shadow-sm: 0 1px 0 rgba(27,27,42,.04), 0 2px 6px rgba(27,27,42,.05);
  --shadow-md: 0 2px 0 rgba(27,27,42,.05), 0 8px 24px rgba(27,27,42,.08);
  --shadow-btn: 0 4px 0 rgba(0,0,0,.12);

  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 28px;

  --font-ui: "Nunito", system-ui, -apple-system, sans-serif;
  --font-han: "LXGW WenKai", "Kaiti SC", "STKaiti", "KaiTi", "DFKai-SB", "Noto Sans SC", serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

/* ====== App shell ====== */
.app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  position: relative;
}

.frame {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg);
}

@media (min-width: 720px) {
  body {
    background: linear-gradient(180deg, #FFF7EC 0%, #FDE3C0 100%);
  }
  .app { padding: 24px 0; }
  .frame {
    max-width: 440px;
    min-height: calc(100dvh - 48px);
    border-radius: 32px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    border: 1px solid var(--line);
  }
}

/* ====== Topbar ====== */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px 8px;
}
.iconbtn {
  appearance: none;
  border: none;
  background: var(--card);
  width: 36px; height: 36px;
  border-radius: 999px;
  display: grid; place-items: center;
  cursor: pointer;
  color: var(--ink-soft);
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease;
}
.iconbtn:hover { color: var(--ink); }
.iconbtn:active { transform: scale(.94); }

.progress {
  flex: 1;
  height: 14px;
  background: #F1E2C8;
  border-radius: 999px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.06);
}
.progress > span {
  position: absolute; inset: 0 auto 0 0;
  background: linear-gradient(90deg, var(--mint), #5BD9AC);
  border-radius: 999px;
  transition: width .35s cubic-bezier(.2,.8,.2,1);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.08), inset 0 2px 0 rgba(255,255,255,.35);
}
.progress::after {
  content: ""; position: absolute; inset: 2px 4px auto 4px; height: 3px;
  background: rgba(255,255,255,.45); border-radius: 999px;
}

.streak {
  font-weight: 800;
  color: var(--primary);
  display: flex; align-items: center; gap: 4px;
  font-size: 16px;
}

.today-pill {
  flex: 1;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: .01em;
}
.today-pill b {
  color: var(--primary);
  font-weight: 900;
  font-size: 16px;
  margin: 0 2px;
}

/* ====== Card / Hanzi ====== */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
}

.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 6px 8px 12px;
  gap: 10px;
}

.prompt-card {
  flex: 0 0 auto;
  background: var(--card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  padding: 8px 6px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.prompt-card::before { content: none; }
.prompt-card::after { content: none; }

.label-pill {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: var(--bg-soft);
  padding: 6px 12px;
  border-radius: 999px;
  z-index: 1;
  margin-top: 4px;
}

.hanzi {
  font-family: var(--font-han);
  font-size: clamp(140px, 42vw, 210px); /* fallback si no se aplica una size-* */
  line-height: 0.95;
  font-weight: 600;
  color: var(--ink);
  z-index: 1;
  user-select: none;
  text-align: center;
  letter-spacing: 0;
  white-space: nowrap;
  max-width: 100%;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .01em;
  flex-wrap: nowrap;
  writing-mode: horizontal-tb;
  text-orientation: mixed;
}
.hanzi span { display: inline-block; }
.hanzi.compact { font-size: clamp(92px, 29vw, 150px); }
.hanzi.size-1 { font-size: clamp(170px, 52vw, 250px); }
.hanzi.size-2 { font-size: clamp(120px, 36vw, 180px); }
.hanzi.size-many { font-size: clamp(82px, 22vw, 120px); }

/* Stroke writer */
.writer-wrap {
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.writer-char {
  background: linear-gradient(180deg,#FFFDF6,#FFF6E2);
  border: 1.5px dashed #E5C97B;
  border-radius: 18px;
  padding: 4px;
}

.pinyin-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  z-index: 1;
}
.pinyin-syl {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .02em;
}
.t1 { color: var(--tone-1); }
.t2 { color: var(--tone-2); }
.t3 { color: var(--tone-3); }
.t4 { color: var(--tone-4); }
.t5 { color: var(--tone-5); }

.pinyin-hidden {
  display: inline-flex;
  gap: 4px;
}
.pinyin-hidden .dot {
  width: 38px; height: 8px;
  background: var(--line);
  border-radius: 999px;
}

.solution-text {
  font-size: 22px;
  font-weight: 800;
  color: var(--mint);
  z-index: 1;
  text-align: center;
}
.solution-text small {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-top: 4px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.solution-notes {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #FFF7EC;
  border: 1px solid var(--line);
  text-align: left;
}
.solution-notes span {
  display: block;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
  font-weight: 700;
}

.speaker-btn {
  appearance: none;
  border: none;
  background: var(--bg-soft);
  color: var(--ink);
  width: 44px; height: 44px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  z-index: 1;
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease, background .15s ease;
}
.speaker-btn:hover { background: #FFE9C2; }
.speaker-btn:active { transform: scale(.92); }
.hanzi-tools {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.toggle-mini {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 800;
  color: var(--ink-soft);
  background: var(--bg-soft);
  padding: 6px 8px;
  border-radius: 999px;
}
.toggle-mini-btn { border: none; cursor: pointer; }
.toggle-mini span { max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-switch {
  width: 34px;
  height: 20px;
  background: #E2D5BC;
  border-radius: 999px;
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
}
.mini-switch i {
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: white;
  border-radius: 999px;
  transition: transform .18s cubic-bezier(.2,.8,.2,1);
}
.mini-switch.is-on { background: var(--mint); }
.mini-switch.is-on i { transform: translateX(14px); }

/* ====== Inputs / actions ====== */
.input-wrap {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius-md);
  padding: 4px 6px 4px 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input-wrap:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(91,141,239,.15);
}
.input-wrap.is-correct { border-color: var(--mint); box-shadow: 0 0 0 4px rgba(75,208,160,.18); }
.input-wrap.is-wrong { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(255,92,77,.18); animation: shake .35s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.input-wrap input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  padding: 14px 0;
}
.input-wrap input::placeholder { color: #B5AEA0; font-weight: 500; }
.input-wrap { position: relative; }
.input-label {
  position: absolute;
  top: -8px;
  left: 14px;
  background: var(--bg);
  padding: 0 6px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--ink-soft);
  pointer-events: none;
  z-index: 1;
}
.ghost-btn.is-on-mint {
  background: #DDF6E8;
  border-color: #8FD2B3;
  color: #1B6E4D;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.06);
}
.ghost-btn.is-on-mint:hover {
  background: #C8EFD8;
  border-color: #6CC196;
}

.helper-row {
  display: flex;
  gap: 10px;
}
.ghost-btn {
  flex: 1;
  appearance: none;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: var(--radius-md);
  padding: 12px 10px;
  font: inherit;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform .1s ease, background .15s ease, border-color .15s ease;
}
.ghost-btn:hover { background: #FFFAF0; }
.ghost-btn.is-on:hover { background: #FFDF8A; border-color: #E0A700; }
.ghost-btn:active { transform: translateY(1px); }
.ghost-btn.is-on { background: #FFE7A8; border-color: #F2B400; color: #5A3D00; box-shadow: inset 0 -2px 0 rgba(0,0,0,.08); }
.ghost-btn.is-on-red { background: #FFE3E3; border-color: #F4A8A8; color: #7A1F1F; box-shadow: inset 0 -2px 0 rgba(0,0,0,.06); }
.ghost-btn.is-on-red:hover { background: #FFD2D2; border-color: #E88080; }
.ghost-btn--diff:not(.is-on-red) {
  background: #FFF4F0;
  border-color: #F2C7BE;
  color: #8B3A2E;
}
.ghost-btn--diff:not(.is-on-red):hover {
  background: #FFE9E1;
  border-color: #E89C90;
}
.ghost-btn--mast:not(.is-on-mint) {
  background: #F1FBF5;
  border-color: #BFE2D0;
  color: #1F6E4F;
}
.ghost-btn--mast:not(.is-on-mint):hover {
  background: #E2F7EC;
  border-color: #8BCCB1;
}
.ghost-btn .ico { font-size: 16px; }
.metrics-btn { margin-left: auto; flex: 0 0 auto; padding: 8px 12px; font-size: 13px; }

.primary-btn {
  appearance: none;
  border: none;
  width: 100%;
  background: var(--primary);
  color: white;
  font: inherit;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-size: 15px;
  padding: 18px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 4px 0 var(--primary-press);
  transition: transform .08s ease, box-shadow .08s ease, background .15s ease;
}
.primary-btn:hover { background: #FF6E60; }
.primary-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--primary-press); }
.primary-btn:disabled {
  background: #E8E0D0;
  color: #B0A89A;
  box-shadow: 0 4px 0 #D5CCB8;
  cursor: not-allowed;
}
.primary-btn.is-correct { background: var(--mint); box-shadow: 0 4px 0 #2FA37A; }
.primary-btn.is-correct:hover { background: #5BD9AC; }
.primary-btn.is-wrong { background: var(--primary); box-shadow: 0 4px 0 var(--primary-press); }

/* ====== Feedback banner ====== */
.feedback {
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 2px solid transparent;
  animation: pop .25s cubic-bezier(.2,.8,.2,1);
}
@keyframes pop {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.feedback.ok { background: #E9FBF2; border-color: var(--mint); color: #1B6E4D; }
.feedback.ko { background: #FFEDE9; border-color: var(--primary); color: #8B2A20; }
.feedback .title { font-weight: 900; font-size: 16px; }
.feedback .meaning-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .12em;
  opacity: .7;
  display: block;
  margin-bottom: 2px;
}
.feedback .sub { font-size: 14px; font-weight: 600; opacity: .9; }
.feedback .sub b { font-family: var(--font-han); font-weight: 700; }
.feedback .han-mini {
  font-family: var(--font-han);
  font-weight: 700;
  font-size: 18px;
  margin: 0 4px;
}
.feedback .pin-mini {
  display: inline-flex;
  vertical-align: middle;
}
.feedback .pin-mini .pinyin-row { display: inline-flex; gap: 4px; }
.feedback .pin-mini .pinyin-syl { font-size: 14px; font-weight: 700; }

/* ====== Home ====== */
.home {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px 20px 24px;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  width: 48px; height: 48px;
  border-radius: 14px;
  background: var(--primary);
  color: white;
  display: grid; place-items: center;
  font-family: var(--font-han);
  font-size: 28px;
  font-weight: 700;
  box-shadow: 0 3px 0 var(--primary-press);
  transform: rotate(-4deg);
}
.home.metrics-screen > .brand .brand-mark {
  width: auto;
  min-width: 48px;
  padding-left: 8px;
  padding-right: 16px;
}
.brand-name {
  font-size: 30px;
  font-weight: 900;
  letter-spacing: -.01em;
}
.brand-sub {
  font-size: 13px;
  color: var(--ink-soft);
  font-weight: 600;
  margin-top: -2px;
  white-space: nowrap;
}

.hero {
  background: linear-gradient(160deg, #FFCB47 0%, #FF9E4F 100%);
  border-radius: var(--radius-lg);
  padding: 22px 22px 26px;
  color: #2A1B05;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.hero::before {
  content: "学";
  font-family: var(--font-han);
  position: absolute;
  font-size: 220px;
  right: -30px; bottom: -80px;
  opacity: .15;
  font-weight: 700;
  line-height: 1;
}
.hero h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -.01em;
  line-height: 1.15;
}
.hero p {
  margin: 8px 0 18px;
  font-weight: 600;
  font-size: 14px;
  opacity: .8;
  max-width: 22ch;
}
.hero .start {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--ink);
  color: #FFF6E0;
  border: none;
  padding: 14px 20px;
  border-radius: 999px;
  font: inherit;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 4px 0 #000;
  transition: transform .08s ease, box-shadow .08s ease;
}
.hero .start:hover { background: #2A2A3D; }
.hero .start:active { transform: translateY(3px); box-shadow: 0 1px 0 #000; }

.section-title {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--ink-soft);
  margin: 6px 0 8px;
}

.deck-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.deck-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--card);
  border: 2px solid var(--line);
  cursor: pointer;
  transition: border-color .15s ease, transform .08s ease;
  text-align: left;
  font: inherit;
  width: 100%;
}
.deck-row:hover { border-color: #DCC9A5; }
.deck-row.is-active { border-color: var(--primary); background: #FFF6F2; }
.deck-row:active { transform: scale(.99); }

.deck-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid; place-items: center;
  font-family: var(--font-han);
  font-weight: 700;
  font-size: 22px;
  color: white;
  flex-shrink: 0;
}
.deck-name { font-weight: 800; font-size: 15px; }
.deck-meta { font-size: 12px; color: var(--ink-soft); font-weight: 600; }

.deck-actions { margin-left: auto; }

/* ====== Big start CTA ====== */
.start-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 4px 0 2px;
}
.big-start {
  appearance: none;
  border: none;
  width: 100%;
  background: var(--primary);
  color: white;
  font: inherit;
  font-weight: 900;
  font-size: 22px;
  letter-spacing: .02em;
  padding: 28px 16px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-shadow: 0 6px 0 var(--primary-press), var(--shadow-md);
  transition: transform .08s ease, box-shadow .08s ease, background .15s ease;
}
.big-start:hover { background: #FF6E60; }
.big-start:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--primary-press); }
.big-start:disabled {
  background: #E8E0D0;
  color: #B0A89A;
  box-shadow: 0 6px 0 #D5CCB8;
  cursor: not-allowed;
}
.big-start svg { width: 22px; height: 22px; }
.start-meta {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: .02em;
  text-align: center;
}

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.filter-row {
  flex: 1;
  min-width: 140px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 14px;
}
.filter-label {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.info-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--line);
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
  cursor: help;
}
.filter-select {
  border: none;
  background: transparent;
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  outline: none;
  text-align: right;
  max-width: 60%;
}
.toggle-row .toggle {
  appearance: none;
  width: 38px;
  height: 22px;
  background: #E2D5BC;
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background .18s ease;
}
.toggle-row .toggle::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  background: white;
  border-radius: 999px;
  transition: transform .18s cubic-bezier(.2,.8,.2,1);
  box-shadow: 0 1px 3px rgba(0,0,0,.18);
}
.toggle-row .toggle:checked { background: var(--mint); }
.toggle-row .toggle:checked::after { transform: translateX(16px); }

/* ====== Date dropdown (custom) ====== */
.date-dd {
  flex: 1;
  min-width: 180px;
  position: relative;
}
.date-dd__trigger {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  width: 100%;
  text-align: left;
  transition: border-color .15s ease, background .15s ease;
}
.date-dd__trigger:hover { border-color: #DCC9A5; background: #FFFDF7; }
.date-dd.is-open .date-dd__trigger {
  border-color: var(--primary);
  background: #FFF7F2;
}
.date-dd__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--bg-soft);
  color: var(--ink-soft);
  flex: 0 0 auto;
}
.date-dd.is-open .date-dd__icon { background: #FFE9D9; color: var(--primary); }
.date-dd__prefix {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: .02em;
  white-space: nowrap;
  flex: 0 0 auto;
}
@media (max-width: 899px) {
  .home > .filters .date-dd__prefix { display: none; }
  .home > .filters .date-dd__trigger { gap: 10px; padding: 10px 12px; }
  .home > .filters .date-dd__icon { width: 30px; height: 30px; }
  .home > .filters .date-dd__count { display: none; }
}
.date-dd__current {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: .01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1 1 auto;
}
.date-dd__count {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  white-space: nowrap;
  flex: 0 0 auto;
}
.date-dd__caret {
  display: inline-flex;
  color: var(--ink-soft);
  transition: transform .18s ease;
  flex: 0 0 auto;
}
.date-dd.is-open .date-dd__caret { transform: rotate(180deg); color: var(--primary); }

.date-dd__panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0,0,0,.14), 0 2px 6px rgba(0,0,0,.06);
  padding: 6px;
  z-index: 30;
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: ddFadeIn .14s ease;
}
@keyframes ddFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.date-dd__option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: transparent;
  border: none;
  font: inherit;
  font-weight: 700;
  width: 100%;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
  transition: background .12s ease;
}
.date-dd__option:hover { background: var(--bg-soft); }
.date-dd__option.is-selected {
  background: #FFF1E5;
}
.date-dd__option.is-selected .date-dd__label { color: var(--primary); }
.date-dd__check {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex: 0 0 auto;
}
.date-dd__label {
  font-size: 15px;
  font-weight: 800;
  flex: 1;
}
.date-dd__option--all .date-dd__label,
.date-dd__option--none .date-dd__label {
  font-style: italic;
  color: var(--ink-soft);
}
.date-dd__option--all.is-selected .date-dd__label,
.date-dd__option--none.is-selected .date-dd__label {
  color: var(--primary);
  font-style: normal;
}
.date-dd__optcount {
  margin-left: auto;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  background: var(--bg-soft);
  padding: 2px 10px;
  border-radius: 999px;
  min-width: 32px;
  text-align: center;
}
.date-dd__option.is-selected .date-dd__optcount {
  background: var(--primary);
  color: white;
}

/* ====== Manual add (modal) ====== */
.upload .uic.uic--orange { background: #FF9A3C; color: white; }
.upload.upload--diff { border-color: #F4A8A8; background: #FFF1F1; border-style: solid; }
.upload.upload--diff:hover { background: #FFE3E3; }
.upload.upload--mastered { border-color: #BFE7D5; background: #F1FCF6; border-style: solid; }
.upload.upload--mastered:hover { background: #E2F7EC; }
.upload.upload--mastered { margin-top: 8px; }
.upload .uic.uic--mint { background: var(--mint); color: var(--ink); }
.upload .uic.uic--yellow { background: var(--yellow); color: var(--ink); }
.upload .uic.uic--red { background: #FF8A3D; color: white; }
.upload .uic.uic--green { background: #4BD0A0; color: white; }

.diff-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 50dvh;
  overflow-y: auto;
  padding-right: 4px;
}
.diff-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: #FFFDF6;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.diff-item .han {
  font-family: var(--font-han);
  font-size: 26px;
  font-weight: 700;
}
.diff-item .meta { flex: 1; min-width: 0; }
.diff-item .meta b { font-size: 14px; }
.diff-item .meta small { display: block; font-size: 12px; color: var(--ink-soft); font-weight: 600; }

.manual-input {
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  background: #FFFDF6;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
  width: 100%;
}
.manual-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(91,141,239,.15); }
.manual-input.han { font-family: var(--font-han); font-size: 28px; text-align: center; font-weight: 700; }
.manual-input::placeholder { color: #B5AEA0; font-weight: 500; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(27,27,42,.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
  animation: fade .2s ease;
}
@media (min-width: 720px) {
  .modal-backdrop { align-items: center; padding: 24px; }
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: 100%;
  max-width: 460px;
  background: var(--card);
  border-radius: 28px 28px 0 0;
  padding: 8px 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 -10px 40px rgba(0,0,0,.18);
  animation: slide-up .25s cubic-bezier(.2,.8,.2,1);
  max-height: 92dvh;
  overflow-y: auto;
}
@media (min-width: 720px) {
  .modal { border-radius: 28px; animation: pop-in .22s cubic-bezier(.2,.8,.2,1); }
}
@keyframes slide-up {
  from { transform: translateY(40px); opacity: .8; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes pop-in {
  from { transform: scale(.94); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.modal.shake { animation: shake .35s ease; }
.modal::before {
  content: "";
  display: block;
  width: 44px;
  height: 5px;
  background: var(--line);
  border-radius: 999px;
  margin: 4px auto 4px;
}
@media (min-width: 720px) {
  .modal::before { display: none; }
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 4px;
}
.modal-head h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 900;
}
.modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--ink-soft);
}
.modal-foot {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

/* CSV upload */
.upload {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 2px dashed #E5C97B;
  background: #FFF9EC;
  cursor: pointer;
  transition: background .15s ease;
  text-align: left;
  font: inherit;
  width: 100%;
}
.upload:hover { background: #FEF1D2; }
.upload-with-info { position: relative; }
.info-btn {
  display: inline-grid;
  place-items: center;
  border: 2px solid #E5C97B;
  background: #FFF9EC;
  color: var(--ink-soft);
  width: 28px;
  height: 28px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 16px;
  cursor: pointer;
  flex: 0 0 auto;
}
.json-help {
  margin: 0;
  background: #FFFDF6;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font-size: 12px;
  overflow: auto;
}
.upload .uic {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--yellow);
  display: grid; place-items: center;
  flex-shrink: 0;
  font-size: 20px;
}
.upload b { display: block; font-size: 17px; }
.upload small { display: block; color: var(--ink-soft); font-size: 14px; font-weight: 600; }

.upload-pair {
  display: flex;
  gap: 10px;
  width: 100%;
}
.upload-pair > .upload { flex: 1; min-width: 0; }
.upload .upload-text { flex: 1; min-width: 0; }
.upload.upload--compact {
  padding: 10px;
  gap: 8px;
}
.upload.upload--compact .uic {
  width: 30px;
  height: 30px;
  font-size: 14px;
}
.upload.upload--compact b {
  font-size: 12px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.upload.upload--compact small {
  font-size: 10px;
  line-height: 1.2;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.csv-help {
  font-size: 12px;
  color: var(--ink-soft);
  font-weight: 600;
  background: #FFF;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  line-height: 1.6;
}

/* ====== Results ====== */
.result {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 28px 22px 32px;
  gap: 18px;
  text-align: center;
  align-items: center;
  justify-content: center;
}
.result .trophy {
  width: 120px; height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #FFE7A3, var(--yellow));
  display: grid; place-items: center;
  font-size: 64px;
  box-shadow: 0 8px 0 #E0A52A, var(--shadow-md);
  margin-bottom: 8px;
  animation: bounce .6s cubic-bezier(.2,.8,.2,1);
}
@keyframes bounce {
  0% { transform: scale(.4); opacity: 0; }
  60% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); }
}
.result h2 { margin: 0; font-size: 26px; font-weight: 900; }
.result p { margin: 0; color: var(--ink-soft); font-weight: 600; }
.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
  margin-top: 14px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 8px;
  box-shadow: var(--shadow-sm);
}
.stat .num { font-size: 24px; font-weight: 900; }
.stat .lbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-soft); margin-top: 4px; }
.stat.ok .num { color: var(--mint); }
.stat.ko .num { color: var(--primary); }
.stat.acc .num { color: var(--blue); }
.stat.pct .num { color: #E0A700; }

.practices-chart {
  position: relative;
  height: 220px;
  width: 100%;
}

.metrics-reset-btn {
  margin-left: auto;
  flex: 0 0 auto;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--primary);
  border-color: #F4A8A8;
  background: #FFF4F0;
}
.metrics-reset-btn:hover {
  background: #FFE3E3;
  border-color: #E88080;
}
.metrics-reset-btn + .metrics-btn { margin-left: 8px; }

.review-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
}
.review-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  text-align: left;
}
.review-item .han {
  font-family: var(--font-han);
  font-size: 28px;
  font-weight: 700;
}
.review-item .meta { flex: 1; min-width: 0; }
.review-item .meta b { font-size: 14px; }
.review-item .meta small { display: block; font-size: 12px; color: var(--ink-soft); font-weight: 600; }
.review-item .badge {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 14px;
  color: white;
  flex-shrink: 0;
}
.review-item .badge.ok { background: var(--mint); }
.review-item .badge.ko { background: var(--primary); }

/* utility */
.row { display: flex; align-items: center; gap: 8px; }
.spacer { flex: 0 0 6px; }
.hidden { display: none !important; }

/* Action pane: agrupa input/feedback/botones — flex column igual que .stage en mobile */
.action-pane {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ====== Vocabulary screen ====== */
.upload .uic.uic--blue { background: var(--blue); color: white; }
.upload.upload--vocab { border-color: #BFD3F4; background: #F2F6FE; border-style: solid; }
.upload.upload--vocab:hover { background: #E5EDFC; }

.vocab {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 6px 14px 18px;
  gap: 12px;
  min-height: 0;
}

.vocab-toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.vocab-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0 10px 0 14px;
  color: var(--ink-soft);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.vocab-search:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(91,141,239,.15);
  color: var(--ink);
}
.vocab-search input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  padding: 12px 0;
}
.vocab-search input::placeholder { color: #B5AEA0; font-weight: 500; }
.vocab-search-clear {
  appearance: none;
  border: none;
  background: var(--bg-soft);
  color: var(--ink-soft);
  width: 26px; height: 26px;
  border-radius: 999px;
  display: grid; place-items: center;
  cursor: pointer;
}
.vocab-search-clear:hover { color: var(--ink); }
.vocab-date-select {
  appearance: none;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  cursor: pointer;
  outline: none;
}
.vocab-date-select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(91,141,239,.15); }

.vocab-add-btn {
  appearance: none;
  border: none;
  background: var(--primary);
  color: white;
  font: inherit;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: .03em;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 3px 0 var(--primary-press);
  transition: transform .08s ease, box-shadow .08s ease, background .15s ease;
  flex: 0 0 auto;
}
.vocab-add-btn:hover { background: #FF6E60; }
.vocab-add-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--primary-press); }

.translate-btn {
  width: 100%;
  background: linear-gradient(160deg, #FFE7A8 0%, #FFCB47 100%);
  border-color: #F2B400;
  color: #5A3D00;
  font-weight: 900;
  margin-top: -2px;
}
.translate-btn:hover { background: linear-gradient(160deg, #FFDF8A 0%, #FFB627 100%); }
.translate-btn:disabled {
  background: #F0EAD8;
  border-color: var(--line);
  color: #B5AEA0;
  cursor: not-allowed;
}

.vocab-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding-right: 2px;
}
.vocab-empty {
  padding: 24px;
  text-align: center;
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
}

.vocab-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 12px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: border-color .15s ease;
}
.vocab-item.is-mastered { border-color: #BFE7D5; background: #F8FCFA; }
.vocab-item.is-diff { border-color: #F4A8A8; background: #FFFAF8; }
.vocab-item.is-mastered.is-diff { border-color: #E0C9A0; background: #FCF8EE; }

.vocab-han {
  appearance: none;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 12px;
  font-family: var(--font-han);
  font-weight: 700;
  font-size: 36px;
  line-height: 1;
  color: var(--ink);
  align-self: center;
  min-width: 56px;
  text-align: center;
  transition: background .12s ease, transform .08s ease;
}
.vocab-han:hover { background: var(--bg-soft); }
.vocab-han:active { transform: scale(.96); }
.vocab-han:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* Modal de preview con animación de trazos */
.modal.vocab-preview .modal-head h3 {
  font-size: 22px;
  text-align: center;
  flex: 1;
}
.vocab-preview-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 4px 0 8px;
}
.vocab-preview-body .pinyin-syl { font-size: 22px; }
.vocab-preview-notes {
  background: #FFF7EC;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
  text-align: left;
  width: 100%;
}
.vocab-preview-hint {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: .04em;
}
.vocab-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.vocab-meta .pinyin-row { justify-content: flex-start; }
.vocab-meta .pinyin-syl { font-size: 16px; }
.vocab-meaning {
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
}
.vocab-notes {
  font-size: 13px;
  color: var(--ink-soft);
  font-weight: 600;
  line-height: 1.35;
}
.vocab-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}
.vocab-tag {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-soft);
  background: var(--bg-soft);
  padding: 3px 8px;
  border-radius: 999px;
}
.vocab-tag--stat { background: #E8F0FE; color: #2C5BB8; }
.vocab-tag--mast { background: #DDF6E8; color: #1B6E4D; }
.vocab-tag--diff { background: #FFE0DA; color: #8B2A20; }

.vocab-cat--sust  { background: #E1ECFB; color: #1F4E9C; }
.vocab-cat--verb  { background: #DDF6E8; color: #1B6E4D; }
.vocab-cat--adj   { background: #FFF3CC; color: #7A5A00; }
.vocab-cat--adv   { background: #FFE6CC; color: #8A4A00; }
.vocab-cat--pron  { background: #FCE0EE; color: #9C2A6E; }
.vocab-cat--clas  { background: #ECE0FB; color: #5A2A9C; }
.vocab-cat--part  { background: #ECECEC; color: #555; }
.vocab-cat--conj  { background: #ECDCC8; color: #6E4A1F; }
.vocab-cat--frase { background: #FFE0DA; color: #8B2A20; }
.vocab-cat--other { background: var(--bg-soft); color: var(--ink-soft); }

.vocab-actions {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 6px;
  align-self: center;
}
.vocab-actions .iconbtn {
  width: 34px;
  height: 34px;
}
.vocab-actions .iconbtn.is-on-mint { background: var(--mint); color: white; }
.vocab-actions .iconbtn.is-on-red { background: var(--primary); color: white; }

/* ================================================================
   DESKTOP / TABLET HORIZONTAL LAYOUT  (≥ 900px)
   El layout móvil (<900px) se mantiene tal cual.
   ================================================================ */
@media (min-width: 900px) {
  /* ---- Frame: ancho aprovechando la pantalla ---- */
  .app {
    padding: 0;
  }
  .frame {
    max-width: none;
    width: 100%;
    min-height: 100dvh;
    margin: 0;
    border-radius: 0;
    border: none;
    box-shadow: none;
    background: transparent;
    overflow: visible;
  }

  /* ---- Topbar centrada con ancho máximo ---- */
  .topbar {
    max-width: 1180px;
    width: 100%;
    margin: 0 auto;
    padding: 14px 32px 6px;
    gap: 16px;
  }
  .iconbtn {
    width: 40px;
    height: 40px;
  }
  .today-pill {
    font-size: 15px;
  }
  .today-pill b {
    font-size: 17px;
  }

  /* ---- Hanzi en desktop: usamos vmin para que también responda al alto ---- */
  .hanzi.size-1 { font-size: clamp(140px, 22vmin, 220px); }
  .hanzi.size-2 { font-size: clamp(110px, 17vmin, 175px); }
  .hanzi.size-many { font-size: clamp(85px, 12vmin, 135px); }

  /* ============================================================
     HOME — grid de 2 columnas con hero a la izquierda
     ============================================================ */
  /* Home redesign: hero full-width arriba, filtros como franja, 3 listas en
     grid 3-col, y gestión (subir/añadir) en 2-col al final */
  .home {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: 16px;
    row-gap: 16px;
    max-width: 1180px;
    margin: 0 auto;
    padding: 18px 32px 28px;
    align-items: start;
    align-content: start;
  }

  .home > .brand {
    grid-column: 1 / -1;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 2px;
  }
  .home > .brand .brand-mark {
    width: 46px;
    height: 46px;
    font-size: 26px;
    border-radius: 14px;
  }
  .home > .brand .brand-name {
    font-size: 26px;
  }

  /* Hero: full-width, layout interno 2-col (CTA + 学 decorativo) */
  .home > .start-block {
    grid-column: 1 / -1;
    background: linear-gradient(160deg, #FFCB47 0%, #FF9E4F 100%);
    border-radius: var(--radius-lg);
    padding: 28px 32px;
    box-shadow: var(--shadow-md);
    color: #2A1B05;
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(280px, 440px) 1fr;
    align-items: center;
    column-gap: 24px;
    row-gap: 10px;
  }
  .home > .start-block::before {
    content: "学";
    font-family: var(--font-han);
    position: absolute;
    font-size: 140px;
    right: 32px;
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
    opacity: .22;
    font-weight: 700;
    line-height: 1;
    pointer-events: none;
  }
  .home > .start-block .big-start {
    grid-column: 1;
    grid-row: 1;
    background: var(--ink);
    color: #FFF6E0;
    box-shadow: 0 5px 0 #000, var(--shadow-md);
    font-size: 20px;
    padding: 20px 24px;
    position: relative;
    z-index: 1;
  }
  .home > .start-block .big-start:hover { background: #2A2A3D; }
  .home > .start-block .start-meta {
    grid-column: 1;
    grid-row: 2;
    color: #2A1B05;
    font-size: 14px;
    text-align: left;
    position: relative;
    z-index: 1;
  }

  /* Filtros: franja propia bajo el hero, ocupan todo el ancho */
  .home > .filters {
    grid-column: 1 / -1;
    margin-top: 0;
    gap: 12px;
  }
  .home > .filters .filter-row {
    padding: 12px 14px;
    flex: 1;
  }
  .home > .spacer { display: none; }

  /* Listas: 3 cards equivalentes en una sola fila */
  .home > .upload--vocab,
  .home > .upload--diff,
  .home > .upload--mastered {
    padding: 14px 16px;
    margin-top: 0;
  }
  .home > .upload--vocab    { grid-column: 1; }
  .home > .upload--diff     { grid-column: 2; }
  .home > .upload--mastered { grid-column: 3; }
  .home > .upload--vocab .uic,
  .home > .upload--diff .uic,
  .home > .upload--mastered .uic {
    width: 38px;
    height: 38px;
  }
  .home > .upload--vocab b,
  .home > .upload--diff b,
  .home > .upload--mastered b {
    font-size: 16px;
  }
  .home > .upload--vocab small,
  .home > .upload--diff small,
  .home > .upload--mastered small {
    font-size: 13px;
  }

  /* Gestión: title full-width, 2 botones de subir/añadir en línea */
  .home > .update-section {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 12px;
    row-gap: 8px;
    margin-top: 6px;
  }
  .home > .update-section .section-title {
    grid-column: 1 / -1;
    margin: 4px 0 0;
  }
  .home > .update-section .upload {
    padding: 14px 16px;
    margin-top: 0 !important;
  }
  .home > .update-section .upload .uic {
    width: 36px;
    height: 36px;
  }
  .home > .update-section .upload b {
    font-size: 15px;
  }
  .home > .update-section .upload small {
    font-size: 13px;
  }

  /* ============================================================
     MÉTRICAS — sobreescribe el grid de .home para layout vertical
     ============================================================ */
  .home.metrics-screen {
    grid-template-columns: 1fr;
    max-width: 1100px;
  }
  .home.metrics-screen > .brand,
  .home.metrics-screen > .stat-row,
  .home.metrics-screen > .card {
    grid-column: 1 / -1;
  }
  .home.metrics-screen .stat { padding: 22px 16px; }
  .home.metrics-screen .stat .num { font-size: 36px; }
  .home.metrics-screen .stat .lbl { font-size: 13px; }
  .home.metrics-screen .card { padding: 20px 22px !important; }
  .home.metrics-screen .card > b { font-size: 18px; }
  .home.metrics-screen .practices-chart { height: 320px; }

  /* ============================================================
     PRACTICE — prompt-card a la izquierda, controles a la derecha
     ============================================================ */
  .stage {
    display: grid;
    grid-template-columns: minmax(420px, 1.1fr) minmax(360px, 1fr);
    column-gap: 32px;
    row-gap: 10px;
    max-width: 1180px;
    width: 100%;
    margin: 0 auto;
    padding: 8px 32px 18px;
    align-items: start;
    align-content: start;
  }
  .stage > .prompt-card {
    grid-column: 1;
    grid-row: 1;
    align-self: start;
    padding: 16px 20px 18px;
    justify-content: flex-start;
    gap: 10px;
  }
  .stage > .prompt-card .label-pill {
    font-size: 11px;
    padding: 5px 12px;
    margin-top: 2px;
  }
  .stage > .prompt-card .speaker-btn {
    width: 44px;
    height: 44px;
    margin-top: 10px;
  }
  .stage > .prompt-card .pinyin-syl {
    font-size: 26px;
  }
  .stage > .prompt-card .pinyin-hidden .dot {
    width: 46px;
    height: 9px;
  }
  .stage > .prompt-card .solution-text {
    font-size: 24px;
  }
  .stage > .prompt-card .solution-text small {
    font-size: 13px;
  }
  .stage > .prompt-card .solution-notes {
    margin-top: 6px;
    padding: 8px 10px;
  }

  /* Pista + Solución bajo el hanzi, en columna izquierda */
  .stage > .helper-row.pre-check {
    grid-column: 1;
    align-self: start;
  }

  /* Action pane (input + comprobar / feedback + botones) en columna derecha */
  .stage > .action-pane {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
    gap: 10px;
  }

  .stage .input-wrap input {
    font-size: 17px;
    padding: 12px 0;
  }
  .stage .primary-btn {
    font-size: 15px;
    padding: 16px 16px;
  }
  .stage .ghost-btn {
    font-size: 14px;
    padding: 12px 10px;
  }
  .stage .feedback {
    padding: 14px 16px;
  }
  .stage .feedback .title { font-size: 17px; }
  .stage .feedback .sub   { font-size: 14px; }

  /* ============================================================
     RESULT — trophy/stats a la izquierda, review a la derecha
     ============================================================ */
  .result {
    display: grid;
    grid-template-columns: minmax(360px, 1fr) minmax(360px, 1.1fr);
    column-gap: 36px;
    row-gap: 14px;
    max-width: 1180px;
    margin: 0 auto;
    padding: 32px 32px 48px;
    align-items: start;
    text-align: left;
  }
  .result > .trophy {
    grid-column: 1;
    grid-row: 1;
    justify-self: center;
  }
  .result > h2 {
    grid-column: 1;
    grid-row: 2;
    text-align: center;
    font-size: 32px;
  }
  .result > p {
    grid-column: 1;
    grid-row: 3;
    text-align: center;
  }
  .result > .stat-row {
    grid-column: 1;
    grid-row: 4;
  }
  .result > .review-list {
    grid-column: 2;
    grid-row: 1 / span 5;
    max-height: calc(100dvh - 180px);
    margin-top: 0;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 14px;
    box-shadow: var(--shadow-sm);
  }
  .result > .result-actions {
    grid-column: 1;
    grid-row: 5;
    margin-top: 14px !important;
  }

  /* ============================================================
     VOCAB — toolbar horizontal, lista en 2 columnas
     ============================================================ */
  .vocab {
    max-width: 1180px;
    width: 100%;
    margin: 0 auto;
    padding: 8px 32px 24px;
    gap: 14px;
  }
  .vocab-toolbar {
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }
  .vocab-search { flex: 0 1 320px; min-width: 220px; }
  .vocab-date-select { flex: 0 0 200px; }
  .vocab-toolbar > .date-dd { flex: 1 1 260px; min-width: 240px; }
  .vocab-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 16px;
  }
  .vocab-item {
    padding: 12px 14px;
  }
  .vocab-han {
    font-size: 40px;
  }

  /* ============================================================
     MODAL — un poco más grande en desktop
     ============================================================ */
  .modal {
    max-width: 520px;
    padding: 8px 24px 24px;
  }
}

@media (min-width: 1280px) {
  .vocab-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ---- Pantallas muy anchas: limitamos para que no se estire en exceso ---- */
@media (min-width: 1400px) {
  .topbar,
  .home,
  .stage,
  .result {
    max-width: 1280px;
  }
}

/* ---- ≥ 1600px: aprovechamos espacio extra ---- */
@media (min-width: 1600px) {
  .topbar,
  .home,
  .stage,
  .result {
    max-width: 1500px;
  }
  .topbar { padding: 18px 36px 8px; }
  .iconbtn { width: 46px; height: 46px; }
  .today-pill { font-size: 17px; }
  .today-pill b { font-size: 19px; }

  /* Home — Brand */
  .home > .brand { padding-bottom: 14px; }
  .home > .brand .brand-mark { width: 54px; height: 54px; font-size: 30px; }
  .home > .brand .brand-name { font-size: 30px; }
  .home > .brand .ghost-btn { font-size: 15px; padding: 12px 16px; }

  /* Home — Hero */
  .home { padding: 22px 36px 30px; column-gap: 18px; row-gap: 18px; }
  .home > .start-block {
    padding: 34px 40px;
    grid-template-columns: minmax(320px, 500px) 1fr;
    column-gap: 32px;
  }
  .home > .start-block::before { font-size: 150px; right: 44px; }
  .home > .start-block .big-start { font-size: 24px; padding: 26px 30px; }
  .home > .start-block .big-start svg { width: 26px; height: 26px; }
  .home > .start-block .start-meta { font-size: 16px; }

  /* Home — Filtros */
  .home > .filters .filter-row { padding: 14px 18px; }
  .home > .filters .filter-label { font-size: 16px; }
  .home > .filters .filter-select { font-size: 15px; }
  .home > .filters .date-dd__trigger { padding: 12px 16px; gap: 14px; }
  .home > .filters .date-dd__icon { width: 38px; height: 38px; }
  .home > .filters .date-dd__prefix { font-size: 14px; }
  .home > .filters .date-dd__current { font-size: 17px; }
  .home > .filters .date-dd__count { font-size: 13px; }
  .home > .filters .date-dd__option { padding: 12px 14px; }
  .home > .filters .date-dd__label { font-size: 16px; }
  .home > .filters .date-dd__optcount { font-size: 14px; padding: 3px 12px; }

  /* Home — Listas */
  .home > .upload--vocab,
  .home > .upload--diff,
  .home > .upload--mastered { padding: 18px 20px; gap: 14px; }
  .home > .upload--vocab .uic,
  .home > .upload--diff .uic,
  .home > .upload--mastered .uic { width: 46px; height: 46px; }
  .home > .upload--vocab b,
  .home > .upload--diff b,
  .home > .upload--mastered b { font-size: 18px; }
  .home > .upload--vocab small,
  .home > .upload--diff small,
  .home > .upload--mastered small { font-size: 14px; }

  /* Home — Gestión */
  .home > .update-section .section-title { font-size: 13px; }
  .home > .update-section .upload { padding: 18px 20px; gap: 14px; }
  .home > .update-section .upload .uic { width: 42px; height: 42px; }
  .home > .update-section .upload b { font-size: 17px; }
  .home > .update-section .upload small { font-size: 14px; }

  /* Stage */
  .stage {
    grid-template-columns: minmax(520px, 1.1fr) minmax(440px, 1fr);
    column-gap: 44px;
  }
  .stage .hanzi.size-1   { font-size: clamp(180px, 22vmin, 280px); }
  .stage .hanzi.size-2   { font-size: clamp(140px, 17vmin, 220px); }
  .stage .hanzi.size-many{ font-size: clamp(105px, 12vmin, 165px); }
  .stage .hanzi.compact  { font-size: clamp(100px, 14vmin, 180px); }
  .stage > .prompt-card .speaker-btn { width: 52px; height: 52px; margin-top: 14px; }
  .stage > .prompt-card .pinyin-syl { font-size: 30px; }
  .stage > .prompt-card .pinyin-hidden .dot { width: 54px; height: 10px; }
  .stage > .prompt-card .solution-text { font-size: 28px; }
  .stage > .prompt-card .solution-text small { font-size: 14px; }
  .stage .input-wrap input { font-size: 19px; padding: 14px 0; }
  .stage .input-label { font-size: 13px; }
  .stage .primary-btn { font-size: 17px; padding: 18px 18px; }
  .stage .ghost-btn { font-size: 15px; padding: 14px 12px; }
  .stage .feedback { padding: 16px 18px; }
  .stage .feedback .title { font-size: 19px; }
  .stage .feedback .sub   { font-size: 15px; }

  /* Métricas */
  .home.metrics-screen { max-width: 1300px; }
  .home.metrics-screen .stat { padding: 28px 18px; }
  .home.metrics-screen .stat .num { font-size: 44px; }
  .home.metrics-screen .stat .lbl { font-size: 14px; }
  .home.metrics-screen .card { padding: 26px 28px !important; }
  .home.metrics-screen .card > b { font-size: 20px; }
  .home.metrics-screen .practices-chart { height: 380px; }
}

/* ---- ≥ 1920px: 1440p / monitores grandes con escala Windows ---- */
@media (min-width: 1920px) {
  .topbar,
  .home,
  .stage,
  .result {
    max-width: 1900px;
  }
  .topbar { padding: 28px 56px 12px; }
  .iconbtn { width: 60px; height: 60px; }
  .today-pill { font-size: 24px; padding: 14px 24px; }
  .today-pill b { font-size: 27px; }

  /* Home — Brand */
  .home > .brand { padding-bottom: 22px; gap: 20px; }
  .home > .brand .brand-mark { width: 76px; height: 76px; font-size: 44px; border-radius: 20px; }
  .home > .brand .brand-name { font-size: 46px; }
  .home > .brand .ghost-btn { font-size: 20px; padding: 16px 24px; }

  /* Home — Hero */
  .home { padding: 34px 56px 48px; column-gap: 28px; row-gap: 26px; }
  .home > .start-block {
    padding: 56px 68px;
    grid-template-columns: minmax(440px, 720px) 1fr;
    column-gap: 48px;
    row-gap: 16px;
  }
  .home > .start-block::before { font-size: 220px; right: 64px; }
  .home > .start-block .big-start { font-size: 36px; padding: 38px 44px; gap: 18px; }
  .home > .start-block .big-start svg { width: 36px; height: 36px; }
  .home > .start-block .start-meta { font-size: 22px; }

  /* Home — Filtros */
  .home > .filters { gap: 20px; }
  .home > .filters .filter-row { padding: 22px 26px; }
  .home > .filters .filter-label { font-size: 22px; }
  .home > .filters .filter-select { font-size: 21px; }
  .home > .filters .toggle { transform: scale(1.5); transform-origin: right center; }
  .home > .filters .date-dd { min-width: 260px; }
  .home > .filters .date-dd__trigger { padding: 20px 24px; gap: 18px; border-radius: 16px; }
  .home > .filters .date-dd__icon { width: 52px; height: 52px; border-radius: 14px; }
  .home > .filters .date-dd__icon svg { width: 26px; height: 26px; }
  .home > .filters .date-dd__prefix { font-size: 18px; }
  .home > .filters .date-dd__current { font-size: 22px; }
  .home > .filters .date-dd__count { font-size: 17px; }
  .home > .filters .date-dd__caret svg { width: 22px; height: 22px; }
  .home > .filters .date-dd__panel { padding: 10px; border-radius: 16px; top: calc(100% + 10px); }
  .home > .filters .date-dd__option { padding: 16px 18px; gap: 14px; border-radius: 12px; }
  .home > .filters .date-dd__check { width: 24px; height: 24px; }
  .home > .filters .date-dd__check svg { width: 20px; height: 20px; }
  .home > .filters .date-dd__label { font-size: 22px; }
  .home > .filters .date-dd__optcount { font-size: 17px; padding: 5px 16px; min-width: 44px; }

  /* Home — Listas */
  .home > .upload--vocab,
  .home > .upload--diff,
  .home > .upload--mastered { padding: 30px 32px; gap: 22px; }
  .home > .upload--vocab .uic,
  .home > .upload--diff .uic,
  .home > .upload--mastered .uic { width: 68px; height: 68px; border-radius: 16px; }
  .home > .upload--vocab .uic svg,
  .home > .upload--diff .uic svg,
  .home > .upload--mastered .uic svg { width: 34px; height: 34px; }
  .home > .upload--vocab b,
  .home > .upload--diff b,
  .home > .upload--mastered b { font-size: 26px; }
  .home > .upload--vocab small,
  .home > .upload--diff small,
  .home > .upload--mastered small { font-size: 18px; }

  /* Home — Gestión */
  .home > .update-section { row-gap: 12px; column-gap: 16px; margin-top: 10px; }
  .home > .update-section .section-title { font-size: 18px; }
  .home > .update-section .upload { padding: 30px 32px; gap: 22px; }
  .home > .update-section .upload .uic { width: 62px; height: 62px; }
  .home > .update-section .upload .uic svg { width: 30px; height: 30px; }
  .home > .update-section .upload b { font-size: 24px; }
  .home > .update-section .upload small { font-size: 18px; }
  .home > .update-section .info-btn { width: 42px; height: 42px; font-size: 24px; }

  /* Stage */
  .stage {
    grid-template-columns: minmax(720px, 1.1fr) minmax(600px, 1fr);
    column-gap: 68px;
  }
  .stage .hanzi.size-1   { font-size: clamp(280px, 22vmin, 400px); }
  .stage .hanzi.size-2   { font-size: clamp(220px, 17vmin, 320px); }
  .stage .hanzi.size-many{ font-size: clamp(160px, 12vmin, 230px); }
  .stage .hanzi.compact  { font-size: clamp(150px, 14vmin, 260px); }
  .stage > .prompt-card .speaker-btn { width: 72px; height: 72px; margin-top: 20px; }
  .stage > .prompt-card .pinyin-syl { font-size: 42px; }
  .stage > .prompt-card .pinyin-hidden .dot { width: 76px; height: 14px; }
  .stage > .prompt-card .solution-text { font-size: 40px; }
  .stage > .prompt-card .solution-text small { font-size: 19px; }
  .stage .input-wrap input { font-size: 26px; padding: 22px 0; }
  .stage .input-label { font-size: 18px; }
  .stage .primary-btn { font-size: 24px; padding: 26px 26px; }
  .stage .ghost-btn { font-size: 20px; padding: 22px 18px; }
  .stage .feedback { padding: 24px 26px; }
  .stage .feedback .title { font-size: 28px; }
  .stage .feedback .sub   { font-size: 20px; }

  /* Métricas */
  .home.metrics-screen { max-width: 1500px; }
  .home.metrics-screen .stat { padding: 36px 24px; }
  .home.metrics-screen .stat .num { font-size: 56px; }
  .home.metrics-screen .stat .lbl { font-size: 17px; }
  .home.metrics-screen .card { padding: 34px 36px !important; }
  .home.metrics-screen .card > b { font-size: 24px; }
  .home.metrics-screen .card small { font-size: 15px !important; }
  .home.metrics-screen .practices-chart { height: 460px; }
}

/* ---- ≥ 2400px: monitores 4K nativos ---- */
@media (min-width: 2400px) {
  .topbar,
  .home,
  .stage,
  .result {
    max-width: 2200px;
  }
  .topbar { padding: 36px 72px 14px; }
  .iconbtn { width: 72px; height: 72px; }
  .today-pill { font-size: 28px; padding: 16px 30px; }
  .today-pill b { font-size: 32px; }

  .home > .brand .brand-mark { width: 92px; height: 92px; font-size: 54px; border-radius: 24px; }
  .home > .brand .brand-name { font-size: 56px; }
  .home > .brand .ghost-btn { font-size: 24px; padding: 18px 28px; }

  .home { padding: 44px 72px 60px; column-gap: 32px; row-gap: 30px; }
  .home > .start-block {
    padding: 68px 84px;
    grid-template-columns: minmax(520px, 860px) 1fr;
    column-gap: 56px;
  }
  .home > .start-block::before { font-size: 280px; right: 80px; }
  .home > .start-block .big-start { font-size: 44px; padding: 46px 52px; gap: 22px; }
  .home > .start-block .big-start svg { width: 42px; height: 42px; }
  .home > .start-block .start-meta { font-size: 26px; }

  .home > .filters { gap: 26px; }
  .home > .filters .filter-row { padding: 28px 32px; }
  .home > .filters .filter-label { font-size: 26px; }
  .home > .filters .filter-select { font-size: 25px; }
  .home > .filters .toggle { transform: scale(1.8); }
  .home > .filters .date-dd { min-width: 320px; }
  .home > .filters .date-dd__trigger { padding: 26px 30px; gap: 22px; border-radius: 18px; }
  .home > .filters .date-dd__icon { width: 64px; height: 64px; border-radius: 16px; }
  .home > .filters .date-dd__icon svg { width: 32px; height: 32px; }
  .home > .filters .date-dd__prefix { font-size: 21px; }
  .home > .filters .date-dd__current { font-size: 26px; }
  .home > .filters .date-dd__count { font-size: 20px; }
  .home > .filters .date-dd__caret svg { width: 26px; height: 26px; }
  .home > .filters .date-dd__panel { padding: 12px; border-radius: 18px; top: calc(100% + 12px); }
  .home > .filters .date-dd__option { padding: 20px 22px; gap: 18px; border-radius: 14px; }
  .home > .filters .date-dd__check { width: 28px; height: 28px; }
  .home > .filters .date-dd__check svg { width: 24px; height: 24px; }
  .home > .filters .date-dd__label { font-size: 26px; }
  .home > .filters .date-dd__optcount { font-size: 20px; padding: 6px 18px; min-width: 52px; }

  .home > .upload--vocab,
  .home > .upload--diff,
  .home > .upload--mastered { padding: 38px 40px; gap: 26px; }
  .home > .upload--vocab .uic,
  .home > .upload--diff .uic,
  .home > .upload--mastered .uic { width: 84px; height: 84px; border-radius: 20px; }
  .home > .upload--vocab .uic svg,
  .home > .upload--diff .uic svg,
  .home > .upload--mastered .uic svg { width: 42px; height: 42px; }
  .home > .upload--vocab b,
  .home > .upload--diff b,
  .home > .upload--mastered b { font-size: 32px; }
  .home > .upload--vocab small,
  .home > .upload--diff small,
  .home > .upload--mastered small { font-size: 22px; }

  .home > .update-section .section-title { font-size: 22px; }
  .home > .update-section .upload { padding: 38px 40px; gap: 26px; }
  .home > .update-section .upload .uic { width: 76px; height: 76px; }
  .home > .update-section .upload .uic svg { width: 36px; height: 36px; }
  .home > .update-section .upload b { font-size: 30px; }
  .home > .update-section .upload small { font-size: 22px; }
  .home > .update-section .info-btn { width: 52px; height: 52px; font-size: 30px; }

  .stage {
    grid-template-columns: minmax(880px, 1.1fr) minmax(740px, 1fr);
    column-gap: 84px;
  }
  .stage .hanzi.size-1   { font-size: clamp(340px, 22vmin, 480px); }
  .stage .hanzi.size-2   { font-size: clamp(270px, 17vmin, 390px); }
  .stage .hanzi.size-many{ font-size: clamp(195px, 12vmin, 280px); }
  .stage .hanzi.compact  { font-size: clamp(185px, 14vmin, 320px); }
  .stage > .prompt-card .speaker-btn { width: 88px; height: 88px; margin-top: 26px; }
  .stage > .prompt-card .pinyin-syl { font-size: 52px; }
  .stage > .prompt-card .pinyin-hidden .dot { width: 94px; height: 17px; }
  .stage > .prompt-card .solution-text { font-size: 48px; }
  .stage > .prompt-card .solution-text small { font-size: 23px; }
  .stage .input-wrap input { font-size: 32px; padding: 26px 0; }
  .stage .input-label { font-size: 22px; }
  .stage .primary-btn { font-size: 30px; padding: 32px 30px; }
  .stage .ghost-btn { font-size: 24px; padding: 26px 22px; }
  .stage .feedback { padding: 28px 32px; }
  .stage .feedback .title { font-size: 34px; }
  .stage .feedback .sub   { font-size: 24px; }

  /* Métricas */
  .home.metrics-screen { max-width: 1800px; }
  .home.metrics-screen .stat { padding: 46px 30px; }
  .home.metrics-screen .stat .num { font-size: 72px; }
  .home.metrics-screen .stat .lbl { font-size: 20px; }
  .home.metrics-screen .card { padding: 42px 46px !important; }
  .home.metrics-screen .card > b { font-size: 30px; }
  .home.metrics-screen .card small { font-size: 18px !important; }
  .home.metrics-screen .practices-chart { height: 560px; }
}
