/* Poco a Poco — mobile-first styles. Colours are tokens on :root with a dark set.
   Brand colours come from logo-es.svg: red #AA151B, gold #F1BF00, navy #1F2A44, grey #6B7280,
   on a warm off-white background. Red leads; gold is the accent. */

:root {
  color-scheme: light;
  --bg: #faf7f2;
  --surface: #ffffff;
  --surface-2: #f3efe8;
  --border: #e6e0d6;
  --ink: #1f2a44;           /* logo navy */
  --ink-2: #4a5263;
  --ink-3: #6b7280;         /* logo grey */
  --accent: #aa151b;        /* primary: logo red */
  --accent-hover: #8f1117;
  --accent-strong: #aa151b; /* red for text; dark enough on light backgrounds */
  --accent-ink: #ffffff;
  --accent-soft: #f7e3e3;
  --yellow: #f1bf00;        /* accent: logo gold (backgrounds and marks, never text) */
  --yellow-soft: #fdf3cf;
  --yellow-ink: #1f2a44;
  --good: #0f7a3a;
  --good-soft: #e3f4e8;
  --warn: #9a5b00;
  --warn-soft: #fdf1d8;
  --bad: #b42323;
  --bad-soft: #fbe4e4;
  --shadow: 0 1px 2px rgb(31 42 68 / 0.06), 0 4px 16px rgb(31 42 68 / 0.06);
  --radius: 14px;
  --sidebar-w: 248px;

  /* Charts: one blue ramp for magnitude and order; blue/orange for the two accuracy series. */
  --viz-empty: #ebe9e4;
  --viz-1: #cde2fb;
  --viz-2: #86b6ef;
  --viz-3: #3987e5;
  --viz-4: #1c5cab;
  --viz-bar: #2a78d6;
  --viz-bar-soft: #9ec5f4;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --rest: #c99a00;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-display: Georgia, "Times New Roman", serif; /* same serif as the logo wordmark */
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #141a2a;
    --surface: #1c2438;
    --surface-2: #252e46;
    --border: #34405e;
    --ink: #eef0f5;
    --ink-2: #b4bac8;
    --ink-3: #8a93a8;
    --accent: #d63a41;
    --accent-hover: #e2535a;
    --accent-strong: #f28b90;
    --accent-ink: #ffffff;
    --accent-soft: #3a1f2a;
    --yellow: #f1bf00;
    --yellow-soft: #3a3317;
    --yellow-ink: #1f2a44;
    --good: #5fcf86;
    --good-soft: #1d3326;
    --warn: #f0b544;
    --warn-soft: #3a2e14;
    --bad: #f07a7a;
    --bad-soft: #3d1f1f;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 4px 16px rgb(0 0 0 / 0.25);
    --viz-empty: #2a3350;
    --viz-1: #104281;
    --viz-2: #1c5cab;
    --viz-3: #3987e5;
    --viz-4: #86b6ef;
    --viz-bar: #3987e5;
    --viz-bar-soft: #1c5cab;
    --series-1: #3987e5;
    --series-2: #d95926;
    --rest: #f1bf00;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141a2a; --surface: #1c2438; --surface-2: #252e46; --border: #34405e;
  --ink: #eef0f5; --ink-2: #b4bac8; --ink-3: #8a93a8;
  --accent: #d63a41; --accent-hover: #e2535a; --accent-strong: #f28b90; --accent-ink: #ffffff; --accent-soft: #3a1f2a;
  --yellow: #f1bf00; --yellow-soft: #3a3317; --yellow-ink: #1f2a44;
  --good: #5fcf86; --good-soft: #1d3326; --warn: #f0b544; --warn-soft: #3a2e14; --bad: #f07a7a; --bad-soft: #3d1f1f;
  --viz-empty: #2a3350; --viz-1: #104281; --viz-2: #1c5cab; --viz-3: #3987e5; --viz-4: #86b6ef;
  --viz-bar: #3987e5; --viz-bar-soft: #1c5cab; --series-1: #3987e5; --series-2: #d95926; --rest: #f1bf00;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font);
}
a { color: var(--accent-strong); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 1.75rem; margin: 0 0 0.25rem; }
h2 { font-size: 1.2rem; margin: 0 0 0.5rem; }
/* A short gold rule under page titles. */
.page > h1::after { content: ''; display: block; width: 44px; height: 4px; margin-top: 8px; border-radius: 2px; background: var(--yellow); }
h3 { font-size: 1.05rem; margin: 1rem 0 0.4rem; }
.muted { color: var(--ink-2); }
.small { font-size: 0.875rem; }
.center { text-align: center; }
.ok { color: var(--good); font-weight: 600; }
kbd {
  font: 0.7rem/1 var(--font);
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid currentColor;
  opacity: 0.55;
  margin-left: 6px;
}
@media (hover: none) { kbd { display: none; } }
pre { background: var(--surface-2); padding: 12px; border-radius: 8px; overflow-x: auto; }
.loading { text-align: center; padding: 4rem 0; color: var(--ink-3); }
::selection { background: var(--yellow); color: var(--yellow-ink); }

/* ---------- Layout & navigation ---------- */

/* The flag stripe: red / yellow (double) / red. */
.flag-stripe {
  flex: none;
  height: 6px;
  background: linear-gradient(var(--accent) 0 25%, var(--yellow) 25% 75%, var(--accent) 75% 100%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.brand em { color: var(--accent-strong); font-style: italic; font-weight: 400; }
.brand-mark { height: 30px; width: auto; flex: none; }
.sidebar .brand { font-size: 1.08rem; gap: 8px; }
.sidebar .brand-mark { height: 26px; }

/* Phone: top bar with a menu button; the sidebar slides in as a drawer. */
.mobile-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.menu-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.menu-btn:hover { background: var(--surface-2); }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 260px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  transform: translateX(-100%);
  transition: transform 0.2s ease, width 0.2s ease;
  overflow-x: hidden;
  overflow-y: auto;
}
body.nav-open .sidebar { transform: none; box-shadow: var(--shadow); }
.scrim {
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgb(0 0 0 / 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
body.nav-open .scrim { opacity: 1; pointer-events: auto; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 10px 12px 14px; }

.nav { display: flex; flex-direction: column; gap: 2px; padding: 4px 10px 16px; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-2);
  font: 500 0.95rem/1.2 var(--font);
  text-decoration: none;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}
.nav-item svg { flex: none; width: 20px; height: 20px; }
.nav-item:hover, .nav-subitem:hover { background: var(--accent-soft); color: var(--ink); }
.nav-item.active, .nav-subitem.active {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  box-shadow: inset 4px 0 0 var(--yellow);
}
.nav-subitem.active small { color: inherit; opacity: 0.8; }
.nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-chevron { width: 16px !important; height: 16px !important; transition: transform 0.2s; }
.nav-group.open .nav-chevron { transform: rotate(90deg); }
.nav-group.has-active > .nav-toggle { color: var(--accent-strong); font-weight: 600; }
.nav-sub { display: none; flex-direction: column; gap: 1px; padding: 2px 0 6px 30px; }
.nav-group.open .nav-sub { display: flex; }
.nav-subitem {
  display: block;
  padding: 7px 12px;
  border-radius: 8px;
  color: var(--ink-2);
  font-size: 0.9rem;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-subitem small { color: var(--ink-3); margin-left: 4px; }
.nav-note { color: var(--ink-3); font-size: 0.75rem; margin-left: 4px; }
.collapse-btn { display: none; }

.content { min-width: 0; }
main { max-width: 960px; margin: 0 auto; padding: 0 16px; outline: none; }
.page { padding: 16px 0 32px; }
.page > * + * { margin-top: 16px; }

/* Desktop: the sidebar is always on the left; it can be folded to an icon rail. */
@media (min-width: 900px) {
  .mobile-bar, .scrim, .sidebar .close-btn, .mobile-only { display: none; }
  .sidebar { transform: none; width: var(--sidebar-w); }
  .content { margin-left: var(--sidebar-w); transition: margin-left 0.2s ease; }
  main { padding: 0 32px; }
  .collapse-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 10px 14px;
    padding: 10px 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--ink-3);
    font: 0.85rem var(--font);
    cursor: pointer;
    white-space: nowrap;
  }
  .collapse-btn:hover { background: var(--surface-2); color: var(--ink); }
  .collapse-btn svg { flex: none; width: 20px; height: 20px; transition: transform 0.2s; }
  body.nav-collapsed { --sidebar-w: 68px; }
  body.nav-collapsed .nav-label,
  body.nav-collapsed .nav-note,
  body.nav-collapsed .nav-chevron,
  body.nav-collapsed .nav-group .nav-sub,
  body.nav-collapsed .collapse-btn span { display: none; }
  body.nav-collapsed .collapse-btn svg { transform: rotate(180deg); }
  body.nav-collapsed .sidebar-head { padding: 16px 0 12px; justify-content: center; }
  body.nav-collapsed .brand-text { display: none; }
  body.nav-collapsed .brand-mark { height: 26px; }
  body.nav-collapsed .nav-item { justify-content: center; padding: 10px 0; }
  body.nav-collapsed .nav-group.has-active > .nav-toggle { background: var(--accent); color: var(--accent-ink); box-shadow: inset 4px 0 0 var(--yellow); }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.muted-card { background: var(--surface-2); box-shadow: none; }
.grid-2 { display: grid; gap: 16px; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font: 600 1rem/1.2 var(--font);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.05s, background 0.15s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.danger { color: var(--bad); border-color: var(--bad); background: transparent; }
.btn.big { min-height: 52px; padding: 14px 24px; font-size: 1.05rem; }
.link-btn {
  background: none;
  border: 0;
  padding: 8px 0 0;
  color: var(--ink-2);
  text-decoration: underline;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
  vertical-align: middle;
  flex: none;
}
.icon-btn:hover { background: var(--border); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

/* ---------- Today ---------- */

.plan-stats { display: flex; gap: 8px; margin: 12px 0 16px; }
.plan-stats div {
  flex: 1;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}
.plan-stats strong { display: block; font-size: 1.6rem; line-height: 1.1; }
.plan-stats span { font-size: 0.8rem; color: var(--ink-2); }
.plan-card .actions .btn { flex: 1 1 200px; }
.all-done { flex-basis: 100%; margin: 0; font-weight: 600; }
.notice {
  margin: 12px 0 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--yellow-soft);
  border-left: 4px solid var(--yellow);
  font-size: 0.95rem;
}

.progress { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; flex: 1; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width 0.3s; }

/* ---------- Flashcard deck ---------- */

.deck { max-width: 640px; margin: 0 auto; padding: 8px 0 24px; }
.deck-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.deck-count, .deck-clock { font-size: 0.875rem; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.deck-card .card { padding: 24px 20px; }
.card-tag { margin: 0 0 12px; font-size: 0.8rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; }
.card-prompt {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 6vw, 2.2rem);
  line-height: 1.25;
  text-align: center;
  margin: 16px 0 8px;
  overflow-wrap: anywhere;
}
.card-answer {
  font-size: 1.3rem;
  font-weight: 600;
  text-align: center;
  margin: 16px 0 8px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
  overflow-wrap: anywhere;
}
.card-answer mark { background: var(--yellow); color: inherit; border-bottom: 2px solid var(--warn); padding: 0 2px; }
.example { background: var(--surface-2); border-radius: 10px; padding: 10px 14px; margin: 12px 0; }
.example p { margin: 0; }
.example p + p { margin-top: 2px; font-size: 0.9rem; }
.example .icon-btn { width: 28px; height: 28px; font-size: 0.8rem; }
.notes { font-size: 0.9rem; color: var(--ink-2); margin: 8px 0; }
.card-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 20px; }
.card-actions .btn.primary { min-width: 160px; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em; }
.badge.new { background: var(--yellow); color: var(--yellow-ink); }
.badge.again { background: var(--bad-soft); color: var(--bad); }

.grade-buttons { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 20px; }
@media (min-width: 520px) { .grade-buttons { grid-template-columns: repeat(4, 1fr); } }
.btn.grade { flex-direction: column; border-radius: 12px; padding: 8px; min-height: 60px; gap: 0; }
.btn.grade small { font-weight: 400; font-size: 0.75rem; color: var(--ink-2); }
.btn.grade kbd { margin: 2px 0 0; }
.btn.grade.again { border-color: var(--bad); color: var(--bad); }
.btn.grade.hard { border-color: var(--warn); color: var(--warn); }
.btn.grade.good { border-color: var(--good); color: var(--good); }
.btn.grade.easy { border-color: var(--series-1); color: var(--series-1); }

.answer-form { margin-top: 16px; }
.answer-input {
  width: 100%;
  font: 1.2rem/1.4 var(--font);
  padding: 12px 14px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--ink);
}
.answer-input:focus { outline: none; border-color: var(--accent); }
.accent-keys { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; justify-content: center; }
.key {
  min-width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink);
  font: 1.05rem var(--font);
  cursor: pointer;
}
.verdict { text-align: center; font-weight: 700; font-size: 1.15rem; margin: 16px 0 4px; padding: 8px; border-radius: 10px; }
.verdict.good { background: var(--good-soft); color: var(--good); }
.verdict.hard { background: var(--warn-soft); color: var(--warn); }
.verdict.wrong { background: var(--bad-soft); color: var(--bad); }
.note { text-align: center; margin: 4px 0; color: var(--ink-2); }
.your-answer { text-align: center; margin: 8px 0 0; color: var(--ink-2); }
.your-answer span { color: var(--ink); font-weight: 600; }

.summary { text-align: center; }
.summary-emoji { font-size: 3rem; margin: 0; }
.summary-stats { list-style: none; padding: 0; display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 24px; }
.summary-stats strong { font-size: 1.4rem; display: block; }

/* ---------- Practice ---------- */

.filters, .drill-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 720px) { .filters { grid-template-columns: repeat(4, minmax(0, 1fr)); } .drill-options { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.filters select, .drill-options select { width: 100%; }
.filters label, .drill-options label { display: flex; flex-direction: column; font-size: 0.8rem; color: var(--ink-2); gap: 4px; }
select, input[type="number"] {
  font: 1rem var(--font);
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  min-height: 40px;
  min-width: 0;
}
.drill-setup p { margin: 0 0 12px; }
.drill-setup .btn { margin-top: 12px; width: 100%; }
.item-list { list-style: none; margin: 16px 0 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.item-list li {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.item-list li:last-child { border-bottom: 0; }
@media (min-width: 720px) { .item-list li { grid-template-columns: 1.2fr 1fr auto; align-items: center; } }
.item-es { font-weight: 600; }
.item-en { color: var(--ink-2); font-size: 0.95rem; }
.item-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.item-meta .icon-btn { width: 30px; height: 30px; font-size: 0.85rem; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.75rem; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.pill.learning { background: var(--accent-soft); color: var(--accent-strong); }
.pill.half { background: var(--warn-soft); color: var(--warn); }
.pill.mastered { background: var(--good-soft); color: var(--good); }
.pill.difficult { background: var(--bad-soft); color: var(--bad); }

/* ---------- Settings ---------- */

.settings-form { display: grid; gap: 16px; }
fieldset { margin: 0; min-width: 0; }
legend { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; padding: 0 4px; }
.settings-sub { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-3); margin: 14px 0 2px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; }
.row input[type="number"] { width: 80px; }
.row select { max-width: 60%; }
.row.check { justify-content: flex-start; }
.row.check input { width: 20px; height: 20px; flex: none; }
.row input[type="range"] { flex: 1; max-width: 240px; accent-color: var(--accent); }
.saved-toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.saved-toast.show { opacity: 1; }

/* ---------- Dashboard ---------- */

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}
.stat strong { font-size: 1.8rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat strong small { font-size: 1rem; color: var(--ink-3); font-weight: 400; }
.stat span { color: var(--ink-2); font-size: 0.9rem; }
.stat small { color: var(--ink-3); font-size: 0.8rem; }

.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 0.8rem; color: var(--ink-2); margin: 10px 0; }
.legend .swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; margin-right: 10px; white-space: nowrap; }
.legend-gap { width: 12px; }

.heatmap-wrap { display: flex; gap: 6px; margin-top: 8px; }
.heatmap-days { display: grid; grid-template-rows: repeat(7, 1fr); gap: 3px; font-size: 0.65rem; color: var(--ink-3); }
.heatmap-days span { display: flex; align-items: center; }
.heatmap { flex: 1; display: grid; grid-template-rows: repeat(7, 1fr); grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; max-width: 320px; }
.cell { aspect-ratio: 1; border-radius: 3px; background: var(--viz-empty); display: inline-block; }
.legend .cell { width: 12px; height: 12px; }
.cell.l1 { background: var(--viz-1); }
.cell.l2 { background: var(--viz-2); }
.cell.l3 { background: var(--viz-3); }
.cell.l4 { background: var(--viz-4); }
.cell.rest { box-shadow: inset 0 0 0 2px var(--rest); }
.cell.today { outline: 2px solid var(--ink); outline-offset: 1px; }
.cell.future { background: transparent; }

.vchart { position: relative; display: flex; align-items: flex-end; gap: 2px; height: 140px; margin-top: 12px; border-bottom: 1px solid var(--border); }
.vchart.short { height: 100px; gap: 8px; }
.vbar-slot { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; position: relative; }
.vbar { background: var(--viz-bar); border-radius: 4px 4px 0 0; min-height: 0; }
.vbar.below { background: var(--viz-bar-soft); }
.vbar-value { text-align: center; font-size: 0.75rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.goal-line { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--ink-3); pointer-events: none; z-index: 1; }
.goal-line span { position: absolute; right: 0; top: -1.2em; font-size: 0.7rem; color: var(--ink-2); background: var(--surface); padding: 0 4px; }
.vchart-axis { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--ink-3); margin-top: 4px; }
.vchart-axis.spread span { flex: 1; text-align: center; }

.hbar-row, .acc-row { display: grid; grid-template-columns: 2.5rem 1fr auto; align-items: center; gap: 10px; margin: 8px 0; }
.acc-row { grid-template-columns: 7.5rem 1fr; }
.hbar-label { font-size: 0.85rem; font-weight: 600; }
.hbar-value { font-size: 0.8rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.stack { display: flex; gap: 2px; height: 18px; border-radius: 4px; overflow: hidden; }
.seg { min-width: 2px; }
.s-mastered { background: var(--viz-4); }
.s-half { background: var(--viz-3); }
.s-learning { background: var(--viz-2); }
.s-new { background: var(--viz-empty); }
.acc-bars { display: grid; gap: 3px; }
.acc-bar { position: relative; height: 16px; background: var(--surface-2); border-radius: 4px; display: flex; align-items: center; }
.acc-fill { height: 100%; border-radius: 0 4px 4px 0; }
.acc-fill.acc-week, .swatch.acc-week { background: var(--series-1); }
.acc-fill.acc-all, .swatch.acc-all { background: var(--series-2); }
.acc-bar span { position: absolute; right: 6px; font-size: 0.72rem; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

.data-table { margin-top: 10px; font-size: 0.85rem; }
.data-table summary { cursor: pointer; color: var(--ink-2); }
.data-table table { border-collapse: collapse; margin-top: 8px; width: 100%; max-height: 240px; }
.data-table th, .data-table td { text-align: left; padding: 3px 8px; border-bottom: 1px solid var(--border); }

.difficult-list { padding-left: 1.4em; margin: 8px 0 16px; }
.difficult-list li { padding: 4px 0; }
.difficult-list li span + span { margin-left: 8px; }
.difficult-list span[lang] { font-weight: 600; }

.tooltip {
  position: absolute;
  z-index: 20;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.8rem;
  padding: 5px 9px;
  border-radius: 6px;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: var(--shadow);
}
[data-tip] { cursor: default; }

/* ---------- Familiarity ---------- */

.pill.skipped { background: var(--surface-2); color: var(--ink-3); text-decoration: line-through; }
.item-meta select { min-height: 32px; padding: 4px 8px; font-size: 0.85rem; margin-left: auto; }
.bulk-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.bulk-row select { flex: 1 1 200px; }
.drill-setup h2, .bulk-familiarity h2 { margin-bottom: 4px; }

/* ---------- Quiz (tests and grammar drills) ---------- */

.quiz-prompt {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 4.5vw, 1.6rem);
  line-height: 1.4;
  text-align: center;
  margin: 12px 0 8px;
  overflow-wrap: anywhere;
}
.blank {
  display: inline-block;
  min-width: 3.5em;
  border-bottom: 3px solid var(--accent);
  color: transparent;
  line-height: 1;
}
.filled { background: var(--yellow); color: var(--yellow-ink); padding: 0 4px; border-radius: 4px; }
.choices { display: grid; gap: 8px; margin-top: 16px; }
@media (min-width: 560px) { .choices { grid-template-columns: 1fr 1fr; } }
.btn.choice { justify-content: flex-start; text-align: left; border-radius: 12px; font-weight: 500; min-height: 52px; }
.btn.choice kbd { margin: 0 10px 0 0; }
.btn.choice.right { border-color: var(--good); background: var(--good-soft); color: var(--good); opacity: 1; }
.btn.choice.wrong { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); opacity: 1; }
.btn.choice:disabled { cursor: default; }
.quiz-feedback { margin-top: 16px; }
.explanation {
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--yellow-soft);
  border-left: 4px solid var(--yellow);
  font-size: 0.95rem;
}
.explanation p { margin: 0 0 4px; }
.score { font-family: var(--font-display); font-size: 3rem; font-weight: 700; margin: 0; }
.score.good { color: var(--good); }
.score.ok-ish { color: var(--warn); }
.score.low { color: var(--bad); }
.mistakes { text-align: left; margin-top: 16px; }
.mistakes ul { list-style: none; padding: 0; margin: 0; }
.mistakes li { display: flex; flex-direction: column; gap: 2px; padding: 10px 0; border-top: 1px solid var(--border); }
.mistake-q { color: var(--ink-2); }
.mistake-a { font-weight: 600; }
.mistake-q .icon-btn { display: none; }
.drill-progress { max-width: 360px; margin: 12px auto 0; text-align: left; }

.test-setup { display: grid; gap: 14px; }
.test-setup label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--ink-2); }
.test-setup select { width: 100%; }
.test-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }

/* ---------- Grammar ---------- */

.tense-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.tense-card .progress { margin-top: 12px; }
.tense-card.done { border-left: 4px solid var(--good); }
.tense-head { display: flex; gap: 14px; align-items: flex-start; }
.tense-head h2 { margin: 0 0 2px; }
.tense-head h2 a { color: var(--ink); text-decoration: none; }
.tense-head h2 a:hover { color: var(--accent-strong); }
.tense-head p { margin: 0; }
.tense-num {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--yellow-ink);
  font-weight: 700;
}
.tense-card.done .tense-num { background: var(--good); color: #fff; }
.crumbs { margin: 0; font-size: 0.9rem; color: var(--ink-3); }
.lead { font-size: 1.1rem; color: var(--ink-2); margin: 4px 0 0; }
.signal-words { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { padding: 3px 10px; border-radius: 999px; background: var(--yellow-soft); border: 1px solid var(--yellow); color: var(--ink); font-size: 0.85rem; }
.lesson-text { line-height: 1.65; }
.lesson-text ul { padding-left: 1.2em; margin: 8px 0; }
.lesson-text li { margin: 6px 0; }
.lesson-text i { color: var(--accent-strong); }
.lesson-block.highlight { box-shadow: 0 0 0 3px var(--yellow), var(--shadow); }
.lesson-block { scroll-margin-top: 72px; }
.table-scroll { overflow-x: auto; }
.conj { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
.conj th, .conj td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.conj thead th { color: var(--accent-strong); font-family: var(--font-display); font-size: 1rem; }
.conj tbody th { color: var(--ink-3); font-weight: 500; font-size: 0.85rem; }
.lesson-nav { display: flex; justify-content: space-between; gap: 12px; }
.practice-cta .progress { margin-top: 8px; }

/* ---------- Dashboard additions ---------- */

.s-skipped { background: repeating-linear-gradient(45deg, var(--viz-empty) 0 3px, var(--border) 3px 6px); }
.ladder { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.ladder li { display: grid; grid-template-columns: minmax(0, 11rem) 1fr 5.5rem; align-items: center; gap: 10px; font-size: 0.9rem; }
.ladder a { color: var(--ink); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ladder a:hover { color: var(--accent-strong); }
.ladder-bar { height: 10px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.ladder-bar div { height: 100%; background: var(--viz-3); border-radius: 0 4px 4px 0; }
.ladder li.done .ladder-bar div { background: var(--good); }
.ladder-status { font-size: 0.8rem; color: var(--ink-2); text-align: right; font-variant-numeric: tabular-nums; }
.ladder li.done .ladder-status { color: var(--good); font-weight: 600; }

/* ---------- Reading ---------- */

.article-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
@media (min-width: 720px) { .article-list { grid-template-columns: 1fr 1fr; } }
.article-card { padding: 0; transition: transform 0.1s, box-shadow 0.15s; }
.article-card:hover { transform: translateY(-2px); box-shadow: 0 0 0 2px var(--yellow), var(--shadow); }
.article-link { display: block; padding: 18px 20px; color: inherit; text-decoration: none; height: 100%; }
.article-link h2 { margin: 8px 0 4px; }
.article-link p { margin: 0; }
.article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pill.level { background: var(--accent); color: var(--accent-ink); font-weight: 600; }

.article { position: relative; max-width: 720px; }
.article-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.article-body { font-family: var(--font-display); font-size: 1.15rem; line-height: 1.85; }
.article-body p { margin: 0 0 1em; }
.article-body p:last-child { margin-bottom: 0; }
.w { cursor: pointer; border-radius: 3px; transition: background 0.1s; }
.w:hover, .w:focus-visible { background: var(--yellow-soft); outline: none; }
.w.in-list { box-shadow: inset 0 -3px 0 var(--yellow); }
.w.selected { background: var(--yellow); color: var(--yellow-ink); }

.word-pop {
  position: absolute;
  z-index: 30;
  width: min(320px, calc(100vw - 32px));
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--accent);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgb(31 42 68 / 0.18);
}
.pop-head { display: flex; align-items: center; gap: 6px; }
.pop-word { flex: 1; margin: 0; font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; }
.pop-lemma { margin: 2px 0 0; color: var(--ink-3); font-size: 0.9rem; }
.pop-en { margin: 8px 0 4px; font-size: 1.05rem; font-weight: 600; }
.pop-note { margin: 0 0 8px; font-size: 0.88rem; color: var(--ink-2); }
.small-btn { min-height: 38px; padding: 8px 14px; font-size: 0.9rem; width: 100%; margin-top: 6px; }
.btn.added { background: var(--yellow-soft); border-color: var(--yellow); color: var(--ink); }
/* Phones: the word card becomes a bottom sheet. */
@media (max-width: 600px) {
  .word-pop {
    position: fixed;
    left: 0 !important;
    right: 0;
    top: auto !important;
    bottom: 0;
    width: auto;
    border-radius: 16px 16px 0 0;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
}
.quiz-cta h2 { margin-bottom: 2px; }

.practice-review { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.practice-review + .practice-top { margin-top: 16px; }
.big-number { font-family: var(--font-display); font-size: 2.6rem; font-weight: 700; line-height: 1; margin: 0; color: var(--accent-strong); }
.practice-review p { margin: 4px 0 0; }
.side-task { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-left: 4px solid var(--yellow); }
.side-task h2 { margin: 0; }
.side-task p { margin: 2px 0 0; }
.empty { text-align: center; }

/* ---------- Las noticias ---------- */

.news-layout { display: grid; gap: 20px; }
@media (min-width: 900px) {
  .news-layout { grid-template-columns: 240px minmax(0, 1fr); align-items: start; }
  .news-side { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; }
  .archive-wrap > summary { pointer-events: none; list-style: none; }
  .archive-wrap > summary::-webkit-details-marker { display: none; }
}
.archive-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 10px; box-shadow: var(--shadow); }
.archive-title { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; padding: 2px 6px 8px; cursor: pointer; }
.archive ul { list-style: none; margin: 0; padding: 0; }
.archive ul ul { padding-left: 14px; }
.archive summary { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 8px; cursor: pointer; }
.archive summary { list-style: none; }
.archive summary::-webkit-details-marker { display: none; }
.archive summary::before {
  content: '';
  flex: none;
  width: 7px;
  height: 7px;
  margin: 0 4px 0 2px;
  border-right: 2px solid var(--ink-3);
  border-bottom: 2px solid var(--ink-3);
  transform: rotate(-45deg);
  transition: transform 0.15s;
}
.archive details[open] > summary::before { transform: rotate(45deg); }
.archive summary a { flex: 1; color: var(--ink); text-decoration: none; font-size: 0.92rem; }
.archive details > ul { margin: 2px 0 6px; }
.archive > ul > li > details > summary a { font-weight: 600; }
.archive a.day {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 8px;
  color: var(--ink-2);
  text-decoration: none;
  font-size: 0.88rem;
}
.archive a:hover { color: var(--accent-strong); }
.archive a.day:hover { background: var(--accent-soft); }
.archive a.active { color: var(--accent-ink) !important; background: var(--accent); border-radius: 6px; padding: 2px 6px; }
.archive a.day.active { padding: 5px 8px; box-shadow: inset 4px 0 0 var(--yellow); }
.archive .count { font-size: 0.75rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.archive a.active .count { color: inherit; opacity: 0.85; }
.archive .count.done { color: var(--good); font-weight: 600; }
.archive .count.done::before { content: '✓ '; }

.news-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.seg { display: inline-flex; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.seg a { padding: 6px 14px; border-radius: 999px; color: var(--ink-2); text-decoration: none; font-size: 0.9rem; font-weight: 500; }
.seg a:hover { color: var(--ink); background: var(--surface-2); }
.seg a.active { background: var(--accent); color: var(--accent-ink); }
.level-filter { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--ink-2); }
.news-range { margin: 18px 0 10px; font-size: 1.35rem; }
.news-range::after { content: ''; display: block; width: 36px; height: 3px; margin-top: 6px; border-radius: 2px; background: var(--yellow); }
.news-week { margin: 22px 0 6px; font-size: 1.1rem; color: var(--accent-strong); }
.news-day { margin: 12px 0 8px; font-family: var(--font); font-size: 0.95rem; font-weight: 600; }
.news-day a { color: var(--ink-2); text-decoration: none; }
.news-day a:hover { color: var(--accent-strong); }
.news .article-list { grid-template-columns: 1fr; }
@media (min-width: 1200px) { .news .article-list { grid-template-columns: 1fr 1fr; } }

.sources h2 { margin-bottom: 4px; }
.sources ul { margin: 8px 0 0; padding-left: 1.1em; }
.sources li { margin: 4px 0; font-size: 0.92rem; }

/* ---------- Streak card (Hoy and Progreso) ---------- */

.today-head h1 { margin: 0; }
.today-head p { margin: 2px 0 0; }
.streak-card { display: flex; flex-wrap: wrap; align-items: center; gap: 20px 28px; }
.streak-ring { position: relative; width: 112px; height: 112px; flex: none; }
.ring-track { stroke: var(--surface-2); }
.ring-fill { stroke: var(--accent); transition: stroke-dashoffset 0.6s ease; }
.streak-num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.streak-num strong { font-family: var(--font-display); font-size: 2.3rem; color: var(--ink); }
.streak-num span { font-size: 0.8rem; color: var(--ink-2); margin-top: 4px; }
.streak-info { flex: 1 1 260px; min-width: 0; }
.streak-info h2 { margin: 0; }
.streak-info > p { margin: 2px 0 0; }
.week-strip { list-style: none; display: flex; gap: 8px; margin: 14px 0 10px; padding: 0; }
.week-strip li { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 0.75rem; color: var(--ink-3); }
.week-strip .dot {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border);
  font-weight: 700;
  font-size: 0.85rem;
  color: transparent;
}
.week-strip .studied .dot { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.week-strip .rest .dot { background: var(--yellow); border-color: var(--yellow); color: var(--yellow-ink); }
.week-strip .missed .dot { background: var(--surface-2); }
.week-strip .today .dot { border-style: dashed; border-color: var(--accent); }
.week-strip .future .dot { opacity: 0.45; }
.week-strip .is-today .dow { color: var(--accent-strong); font-weight: 700; }
.streak-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; color: var(--ink-2); }
.streak-meta strong { color: var(--ink); }

/* ---------- Hoy ---------- */

.today-grid { align-items: start; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.news-mini { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.news-mini a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}
.news-mini a:hover { border-color: var(--yellow); background: var(--yellow-soft); }
.news-mini-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.news-mini-text strong { font-family: var(--font-display); font-weight: 600; line-height: 1.3; }
.news-mini-go { font-size: 1.4rem; color: var(--accent); }

/* ---------- Progreso ---------- */

.progress-top { display: grid; gap: 16px; }
.metrics { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 520px) { .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.metric {
  display: flex;
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.metric-icon { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-strong); }
.metric-icon svg { width: 22px; height: 22px; }
.metric-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.metric-body strong { font-size: 1.7rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.metric-body strong small { font-size: 0.95rem; color: var(--ink-3); font-weight: 500; }
.metric-label { color: var(--ink-2); font-size: 0.9rem; }
.metric-body small { color: var(--ink-3); font-size: 0.78rem; margin-top: 2px; }
.metric-bar { height: 6px; margin-top: 8px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.metric-bar div { height: 100%; background: var(--yellow); border-radius: 3px; }

.cal-head { display: flex; align-items: center; gap: 10px; margin: 4px 0 10px; }
.cal-head h3 { margin: 0; flex: 1; text-align: center; }
.cal-head .icon-btn { font-size: 1.2rem; }
.cal-head .icon-btn:disabled { opacity: 0.35; cursor: default; }
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; max-width: 460px; margin: 0 auto; }
.mhead { text-align: center; font-size: 0.75rem; color: var(--ink-3); font-weight: 600; }
.mcell {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  background: var(--viz-empty);
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 4px 6px;
}
.mcell.mcell-empty { background: transparent; }
.mcell.future { background: transparent; border: 1px dashed var(--border); }
.mcell.l1 { background: var(--viz-1); }
.mcell.l2 { background: var(--viz-2); }
.mcell.l3 { background: var(--viz-3); }
.mcell.l4 { background: var(--viz-4); }
.mcell.rest { box-shadow: inset 0 0 0 3px var(--rest); }
.mcell.today { outline: 2px solid var(--accent); outline-offset: 1px; }
.mnum { font-size: 0.78rem; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.mcell.l3 .mnum, .mcell.l4 .mnum { color: #fff; }
.mcell.done::after {
  content: '';
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--surface);
}
.cal-summary { text-align: center; margin: 10px 0 0; }
.done-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; }
.calendar-card .legend { justify-content: center; }

/* ---------- Palabras / Frases ---------- */

.practice-top { display: grid; gap: 16px; align-items: start; }
@media (min-width: 720px) { .practice-top { grid-template-columns: minmax(200px, 260px) 1fr; } }
.filter-stack { display: grid; gap: 10px; }
.filter-btn {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s;
}
.filter-btn:hover, .filter-btn:focus-within { border-color: var(--accent); }
.filter-btn span { font-size: 0.75rem; font-weight: 600; color: var(--accent-strong); text-transform: uppercase; letter-spacing: 0.04em; }
.filter-btn select { border: 0; padding: 0; min-height: 28px; font-weight: 600; background: transparent; cursor: pointer; }
.drill-box { border: 2px solid var(--ink); }
.drill-count { margin: 0 0 12px; font-size: 1.05rem; }
.drill-count strong { font-family: var(--font-display); font-size: 1.6rem; }
.drill-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: stretch; }
.drill-box .drill-options { flex: 1 1 280px; display: grid; grid-template-columns: 1fr; gap: 8px; }
.drill-box .drill-options label { display: grid; grid-template-columns: 90px 1fr; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--ink-2); }
.start-btn { flex: 1 1 160px; min-height: 96px; font-size: 1.3rem; border-radius: 14px; }
.word-table .table-head { font-size: 0.75rem; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; display: none; }
@media (min-width: 720px) {
  .word-table li { grid-template-columns: 1.2fr 1.2fr 1fr 190px; }
  .word-table .table-head { display: grid; }
}
.item-actions { display: flex; align-items: center; gap: 6px; }
.item-actions .icon-btn { width: 30px; height: 30px; font-size: 0.85rem; }
.item-actions select { min-height: 32px; padding: 4px 8px; font-size: 0.85rem; }

/* ---------- Flashcard deck: "I know this word" ---------- */

.know-bar { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; margin-top: 12px; }
.know-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font: 0.85rem var(--font);
  color: var(--ink-2);
  cursor: pointer;
}
.know-btn:hover { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-soft); }
.deck-toast {
  margin: 12px auto 0;
  max-width: 560px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--yellow-soft);
  border-left: 4px solid var(--yellow);
  font-size: 0.9rem;
}

/* ---------- Historias ---------- */

.story-filters { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 420px; }
.chip-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 12px;
  font: 500 0.88rem var(--font);
  cursor: pointer;
}
.chip-btn small { color: var(--ink-3); margin-left: 2px; font-variant-numeric: tabular-nums; }
.chip-btn:hover { border-color: var(--accent); }
.chip-btn.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip-btn.active small { color: inherit; opacity: 0.85; }
.story-group h2 { margin: 26px 0 10px; display: flex; align-items: baseline; gap: 10px; }
.story-group h2 small { font-family: var(--font); font-size: 0.85rem; font-weight: 400; }

/* ---------- Escuchar ---------- */

.listen-intro { margin: 4px 0 16px; color: var(--ink-2); }
.player-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-bottom: 14px; }
.player-controls .btn { min-width: 132px; }
.check-label { display: inline-flex; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--ink-2); cursor: pointer; }
.line-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.line { display: flex; align-items: flex-start; gap: 10px; padding: 6px 8px; border-radius: 10px; transition: background 0.15s; }
.line.playing { background: var(--yellow-soft); }
.line-play {
  flex: none;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent-strong);
  font-size: 0.75rem;
  cursor: pointer;
}
.line-play:hover, .line-play:focus-visible { border-color: var(--accent); outline: none; }
.line.playing .line-play { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.line-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding-top: 5px; }
.line-speaker { font-size: 0.75rem; font-weight: 600; color: var(--accent-strong); text-transform: uppercase; letter-spacing: 0.04em; }
.line-text { font-family: var(--font-display); font-size: 1.1rem; line-height: 1.6; }
.line-hidden { display: block; height: 10px; margin: 6px 0; border-radius: 999px; background: var(--surface-2); cursor: pointer; }
.player-hint { margin: 12px 0 0; }

.lq { padding: 14px 0; border-top: 1px solid var(--border); }
.lq:first-child { border-top: 0; padding-top: 4px; }
.lq-q { display: flex; gap: 10px; margin: 0; font-weight: 600; font-size: 1.05rem; }
.lq-n {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.8rem;
}
.lq .choices { margin-top: 10px; }
.lq-feedback .verdict { margin: 10px 0 0; }
.lq-feedback .explanation { margin-top: 8px; }
.lq-quote { display: flex; align-items: flex-start; gap: 10px; margin: 8px 0 0; padding: 8px 10px; border-left: 3px solid var(--yellow); background: var(--surface); border-radius: 0 8px 8px 0; font-family: var(--font-display); }
.lq-quote span { padding-top: 5px; }
.listen-score { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; border-left: 4px solid var(--accent); }
.listen-score > div { flex: 1 1 260px; }
.listen-score h2 { margin: 0 0 4px; }

.listen-more { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 16px 0 8px; }
.listen-link { display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--ink); border-left: 4px solid var(--yellow); }
.listen-link:hover { border-color: var(--accent); }
.listen-link strong { font-family: var(--font-display); font-size: 1.15rem; }

.audio-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 10px 0 6px; }
.dict-hint { display: block; text-align: center; }
.card-answer mark.near { background: var(--yellow-soft); border-bottom-style: dashed; }
.pair-compare { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.hear-btn { min-height: 36px; padding: 6px 12px; font-size: 0.9rem; }

.listen-start .chip-row { margin: 16px 0; }
.pair-start { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.pair-start .drill-count { margin: 0; }
.pair-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.pair { display: flex; flex-direction: column; gap: 10px; }
.pair p { margin: 0; }
.pair .pill { align-self: flex-start; }
.pair-words { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pair-word {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.pair-word span { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; }
.pair-word small { color: var(--ink-3); }
.pair-word:hover, .pair-word:focus-visible { border-color: var(--accent); outline: none; }
.article.listen { max-width: 1120px; }
.listen-intro, .listen .voice-tip { max-width: 720px; }
.listen-grid { display: grid; gap: 16px; }
.listen-result:not(:empty) { margin-top: 16px; }
.listen-result .listen-score { margin: 0; box-shadow: none; border: 1px solid var(--border); border-left: 4px solid var(--accent); }
@media (min-width: 1100px) {
  .listen-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
  .listen-grid > .card { margin: 0; }
  .listen-grid .player { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; }
}
.lq .choices { grid-template-columns: 1fr; }

/* ---------- Cuenta (account) ---------- */
.page.narrow { max-width: 560px; }
.auth-tabs { margin: 16px 0; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form h2 { margin: 0; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; }
.auth-form input[type="email"], .auth-form input[type="password"] {
  font: 1rem var(--font);
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  min-height: 44px;
}
.auth-form input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.auth-form label.check { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; font-size: 0.9rem; }
.auth-form label.check input { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.auth-form .btn { align-self: flex-start; }
.human-check:empty { display: none; }
.form-msg { margin: 0; font-size: 0.9rem; }
.form-msg:empty { display: none; }
.form-msg.ok, .notice.good { color: var(--good); }
.form-msg.bad { color: var(--bad); }
.notice.good { background: var(--good-soft); border-left-color: var(--good); }
.notice.bad { background: var(--bad-soft); border-left-color: var(--bad); color: var(--bad); }
.account .card + .card, .account .card + form, .account form + .card { margin-top: 16px; }
.legal-links { margin-top: 24px; }
.ai-note { margin-top: 12px; }
