/*
 * Boli — neobrutalist.
 *
 * Warm paper ground, near-black outlines on everything, hard offset
 * shadows with no blur, bright flat colour blocks, and heavy type. The
 * markup and classes are unchanged; this file carries the whole look.
 */

/* ---------------------------------------------------------------- Tokens */
:root {
  --bg:        #f6edd8;
  --surface:   #fffaef;
  --sunken:    #efe3c8;
  --ink:       #1b1813;
  --muted:     #5f5647;
  --faint:     #8b7f68;
  --border:    #1b1813;

  --yellow:    #ffd23f;
  --red:       #ff6a45;
  --teal:      #2fbfa8;
  --purple:    #b389f0;
  --lime:      #bfe04a;
  --pink:      #ff93b7;

  --accent:    var(--red);
  --learned:   var(--teal);

  --sh:    3px 3px 0 var(--border);
  --sh-lg: 5px 5px 0 var(--border);
  --sh-xl: 7px 7px 0 var(--border);

  --font-ui:    "Archivo", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --font-display: var(--font-ui);
  --font-glyph: "Nirmala UI", "Kalinga", "Gautami", "Raavi",
                "Noto Sans Oriya", "Noto Sans Telugu", "Noto Sans Gurmukhi", serif;

  --radius: 9px;
  --nav-h: 68px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:      #201d18;
    --surface: #2b2721;
    --sunken:  #171410;
    --ink:     #f4ecd9;
    --muted:   #b9ac91;
    --faint:   #877b63;
    --border:  #f4ecd9;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg:      #201d18;
  --surface: #2b2721;
  --sunken:  #171410;
  --ink:     #f4ecd9;
  --muted:   #b9ac91;
  --faint:   #877b63;
  --border:  #f4ecd9;
  color-scheme: dark;
}

/* ----------------------------------------------------------------- Reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1.5;
  font-weight: 500;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 800; line-height: 1.02; letter-spacing: -0.02em; }
p { margin: 0 0 0.9em; }
a { color: var(--ink); text-decoration: none; }
button { font-family: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.script { font-family: var(--font-glyph); }
.label {
  font-family: var(--font-ui);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 800;
  font-size: 0.68rem;
  color: var(--muted);
}

/* --------------------------------------------------------------- Masthead */
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.15rem;
  background: var(--surface);
  border-bottom: 3px solid var(--border);
}
.wordmark { display: inline-flex; align-items: center; gap: 0.5rem; }
.wordmark b { font-size: 1.5rem; font-weight: 900; letter-spacing: -0.03em; }
.wordmark .mark-script {
  font-family: var(--font-glyph);
  font-size: 1.15rem;
  line-height: 1;
  color: var(--ink);
  background: var(--yellow);
  border: 2px solid var(--border);
  border-radius: 6px;
  padding: 2px 7px;
  box-shadow: var(--sh);
}
.masthead .top-nav { display: none; }
@media (min-width: 780px) {
  .masthead .top-nav { display: flex; gap: 0.5rem; align-items: center; }
  .top-nav a {
    font-family: var(--font-ui);
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 0.72rem;
    color: var(--ink);
    padding: 6px 10px;
    border: 2px solid transparent;
    border-radius: 7px;
  }
  .top-nav a.active { background: var(--yellow); border-color: var(--border); box-shadow: var(--sh); }
}

/* ------------------------------------------------------------------ Shell */
main {
  max-width: 940px;
  margin: 0 auto;
  padding: 1.25rem 1.15rem calc(var(--nav-h) + 2rem);
}
@media (min-width: 780px) { main { padding-bottom: 3rem; } }
.view { animation: pop 0.2s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* -------------------------------------------------------- Bottom thumb-nav */
.tab-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: flex;
  height: var(--nav-h);
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 3px solid var(--border);
}
.tab-nav a {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--ink);
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 0.62rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-right: 2px solid var(--border);
  -webkit-tap-highlight-color: transparent;
}
.tab-nav a:last-child { border-right: none; }
.tab-nav a svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; }
.tab-nav a.active { background: var(--accent); color: #1b1813; }
.tab-nav a.active svg { stroke: #1b1813; }
@media (min-width: 780px) { .tab-nav { display: none; } }

/* ------------------------------------------------------------------- Hero */
.hero { padding: 1.4rem 0 0.4rem; }
.hero-art { display: none; }
@media (min-width: 780px) {
  .hero { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 2rem; align-items: center; }
  .hero-art {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
  }
  .hero-art .art-g {
    font-family: var(--font-glyph);
    font-size: clamp(3rem, 6vw, 4.5rem);
    line-height: 1;
    width: 1.7em; height: 1.7em;
    display: flex; align-items: center; justify-content: center;
    color: #1b1813;
    border: 3px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--sh-xl);
    transition: transform 0.1s, box-shadow 0.1s;
  }
  .hero-art .art-g:nth-child(1) { background: var(--red); transform: rotate(-4deg); }
  .hero-art .art-g:nth-child(2) { background: var(--teal); transform: rotate(3deg); }
  .hero-art .art-g:nth-child(3) { background: var(--yellow); transform: rotate(-2deg); }
  .hero-art .art-g:hover { transform: rotate(0) translate(-2px, -2px); }
  .hero-art .art-g:active { transform: rotate(0) translate(3px, 3px); box-shadow: none; }
}
.hero .eyebrow { margin-bottom: 0.9rem; }
.hero h1 {
  font-size: clamp(2.6rem, 12vw, 4.8rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  margin-bottom: 0.6rem;
}
.hero h1 .say {
  display: block;
  width: fit-content;
  font-family: var(--font-glyph);
  font-size: 0.44em;
  font-weight: 700;
  color: #1b1813;
  background: var(--yellow);
  border: 2px solid var(--border);
  border-radius: 7px;
  box-shadow: var(--sh);
  padding: 0.05em 0.3em;
  margin-bottom: 0.5rem;
  transform: rotate(-2deg);
}
.hero .lede { font-size: 1.18rem; max-width: 34ch; color: var(--ink); }
.hero .lede b {
  font-weight: 800;
  background: var(--lime);
  border: 2px solid var(--border);
  border-radius: 5px;
  padding: 0 0.2em;
  box-shadow: 2px 2px 0 var(--border);
}

/* Living type-specimen: rows of letters drifting past, full-bleed. */
.specimen-wall {
  margin: 1.5rem -1.15rem 0.5rem;
  padding: 0.9rem 0;
  background: var(--purple);
  border-top: 3px solid var(--border);
  border-bottom: 3px solid var(--border);
  overflow: hidden;
}
/* The wall clips the drifting track horizontally; the rows must not clip,
 * or they would cut the hard shadows off the letter tiles. */
.marq-row + .marq-row { margin-top: 0.5rem; }
.marq-track {
  display: flex;
  align-items: center;
  gap: clamp(0.7rem, 3vw, 1.4rem);
  width: max-content;
  padding-left: clamp(0.7rem, 3vw, 1.4rem);
  animation: marq 46s linear infinite;
  will-change: transform;
}
.marq-track.rev { animation-direction: reverse; }
.specimen-wall:hover .marq-track { animation-play-state: paused; }
@keyframes marq { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.marq-g {
  font-family: var(--font-glyph);
  font-size: clamp(1.9rem, 8vw, 2.7rem);
  line-height: 1;
  color: #1b1813;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 8px;
  box-shadow: 2px 2px 0 var(--border);
  padding: 0.1rem 0.4rem;
  flex: none;
}
.marq-g.accent { background: var(--yellow); }
.marq-g:active { transform: translate(2px, 2px); box-shadow: none; }
.wall-caption { display: block; text-align: center; margin-bottom: 0.5rem; }
@media (prefers-reduced-motion: reduce) { .marq-track { animation: none; } }

.section-head { display: flex; align-items: center; gap: 0.7rem; margin: 1.8rem 0 0.9rem; }
.section-head h2 { font-size: 1.4rem; }
.section-head .rule { flex: 1; height: 3px; background: var(--border); }
.section-head .count { font-family: var(--font-ui); font-weight: 800; font-size: 0.72rem; color: var(--muted); }

/* ------------------------------------------------------- Language choosing */
.lang-list { display: grid; gap: 1.1rem; }
.lang-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
  width: 100%;
  text-align: left;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 3px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--sh-lg);
  color: var(--ink);
  transition: transform 0.1s, box-shadow 0.1s;
}
.lang-card:hover { transform: translate(-2px, -2px); box-shadow: var(--sh-xl); }
.lang-card:active { transform: translate(3px, 3px); box-shadow: none; }
.lang-card .big {
  font-family: var(--font-glyph);
  font-size: 2.5rem;
  line-height: 1;
  width: 1.5em;
  height: 1.5em;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1b1813;
  border: 2px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--sh);
}
.lang-list .lang-card:nth-child(1) .big { background: var(--red); }
.lang-list .lang-card:nth-child(2) .big { background: var(--teal); }
.lang-list .lang-card:nth-child(3) .big { background: var(--yellow); }
.lang-card .native { font-family: var(--font-glyph); font-size: 1.3rem; }
.lang-card .name { font-size: 1.2rem; font-weight: 800; }
.lang-card .desc { color: var(--muted); font-size: 0.92rem; font-weight: 500; }
.lang-card .go {
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  white-space: nowrap;
}
.lang-card .prog-bar {
  grid-column: 1 / -1;
  height: 12px;
  background: var(--sunken);
  border: 2px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin-top: 0.2rem;
}
.lang-card .prog-bar span { display: block; height: 100%; background: var(--learned); }

/* --------------------------------------------------------- Language header */
.lang-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.8rem;
  border-bottom: 3px solid var(--border);
  margin-bottom: 0.4rem;
}
.lang-header .native { font-family: var(--font-glyph); font-size: 2rem; line-height: 1.1; }
.lang-header h1 { font-size: 1.8rem; }
.lang-header .region { color: var(--muted); font-size: 0.9rem; }
.lang-switch {
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #1b1813;
  background: var(--yellow);
  border: 2px solid var(--border);
  border-radius: 7px;
  box-shadow: var(--sh);
  padding: 7px 11px;
}
.lang-switch:active { transform: translate(2px, 2px); box-shadow: none; }

/* --------------------------------------------------------- Specimen chart */
.group { margin-top: 1.6rem; }
.group h3 { font-size: 1.15rem; }
.group .group-note { color: var(--muted); font-size: 0.9rem; margin: 0.1rem 0 0.9rem; }

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 0.6rem;
}
@media (min-width: 480px) {
  .chart-grid { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 0.7rem; }
}
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  padding: 0.7rem 0.3rem 0.55rem;
  min-height: 86px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--sh);
  color: var(--ink);
  transition: transform 0.08s, box-shadow 0.08s, background 0.1s;
}
.tile:hover { transform: translate(-1px, -1px); box-shadow: var(--sh-lg); }
.tile:active { transform: translate(2px, 2px); box-shadow: none; }
.tile .g { font-family: var(--font-glyph); font-size: 2.2rem; line-height: 1; }
.tile .r { font-family: var(--font-ui); font-weight: 700; font-size: 0.72rem; color: var(--muted); }
.tile .pip {
  position: absolute;
  top: 6px; right: 7px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: transparent;
  border: 2px solid var(--border);
}
.tile.seen .pip { background: var(--yellow); }
.tile.mastered .pip { background: var(--learned); }
.tile.mastered { background: color-mix(in srgb, var(--learned) 20%, var(--surface)); }
.tile.playing { background: var(--yellow); transform: translate(2px, 2px); box-shadow: none; }

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 0.66rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}
.chart-legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.chart-legend i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--border); }
.chart-legend i.lg-new { background: var(--surface); }
.chart-legend i.lg-seen { background: var(--yellow); }
.chart-legend i.lg-mastered { background: var(--learned); }

/* Shared detail styling, used on the teach card. */
.detail-name { text-align: center; color: var(--muted); font-size: 0.95rem; }
.detail-hint { text-align: center; color: var(--ink); margin: 0.9rem auto 1.2rem; max-width: 30ch; }
.detail-actions { display: flex; gap: 0.7rem; }
.detail-actions .btn { flex: 1; }

/* ------------------------------------------------------------ Lesson path */
.path { margin-top: 1.2rem; display: grid; gap: 0.8rem; }
.lesson-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.9rem;
  padding: 0.9rem 1rem;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 9px;
  box-shadow: var(--sh);
}
.lesson-row[role="button"] { cursor: pointer; transition: transform 0.08s, box-shadow 0.08s; }
.lesson-row[role="button"]:hover { transform: translate(-2px, -2px); box-shadow: var(--sh-lg); }
.lesson-row[role="button"]:active { transform: translate(2px, 2px); box-shadow: none; }
.lesson-row .seal {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  font-family: var(--font-ui);
  font-weight: 900;
  font-size: 1.05rem;
  color: var(--ink);
  flex: none;
  box-shadow: 2px 2px 0 var(--border);
}
.lesson-row .seal svg { width: 22px; height: 22px; stroke: #1b1813; fill: none; stroke-width: 2.6; }
.lesson-row.done .seal { background: var(--learned); }
.lesson-row.current .seal { background: var(--yellow); }
.lesson-row.locked { opacity: 0.55; box-shadow: none; }
.lesson-row.current { background: color-mix(in srgb, var(--yellow) 22%, var(--surface)); }
.lesson-title { display: flex; align-items: center; gap: 0.5rem; font-size: 1.15rem; font-weight: 800; }
.lesson-title .script { font-size: 1.2rem; }
.lesson-title .tag {
  font-family: var(--font-ui);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #1b1813;
  background: var(--pink);
  border: 2px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
}
.lesson-sub { color: var(--muted); font-size: 0.88rem; }
.lesson-go {
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 0.64rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  white-space: nowrap;
}

/* ------------------------------------------------------------- Teach card */
.teach-card, .prompt-card {
  background: var(--surface);
  border: 3px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--sh-xl);
  padding: 2rem 1.3rem 1.6rem;
  text-align: center;
}
.teach-card .label { margin-bottom: 1rem; }
.teach-glyph { font-family: var(--font-glyph); font-size: clamp(4.5rem, 26vw, 6.5rem); line-height: 1; color: var(--ink); }
.teach-roman {
  display: inline-block;
  font-size: 1.6rem;
  font-weight: 800;
  color: #1b1813;
  background: var(--yellow);
  border: 2px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--sh);
  padding: 0.1em 0.5em;
  margin-top: 0.6rem;
}
.teach-card .detail-actions { margin-top: 1.5rem; }
.done-seal {
  width: 70px; height: 70px; margin: 0 auto 0.6rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--learned);
  border: 3px solid var(--border);
  box-shadow: var(--sh);
}
.done-seal svg { width: 36px; height: 36px; stroke: #1b1813; fill: none; stroke-width: 3; }

/* --------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 50px;
  padding: 0 1.2rem;
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
  border-radius: 9px;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--sh);
  transition: transform 0.08s, box-shadow 0.08s;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: var(--sh-lg); }
.btn:active { transform: translate(3px, 3px); box-shadow: none; }
.btn.primary { background: var(--accent); color: #1b1813; }
.btn.ghost { background: var(--surface); }
.btn.danger { background: var(--red); color: #1b1813; }
.btn.block { width: 100%; }
.btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2.2; }
.cta-row { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 0.4rem; }

/* -------------------------------------------------------------- Review */
.review-wrap { max-width: 460px; margin: 0 auto; }
.review-top { display: flex; align-items: center; justify-content: space-between; gap: 0.9rem; margin-bottom: 1.2rem; }
.review-top .quit {
  background: var(--surface); border: 2px solid var(--border); border-radius: 7px;
  box-shadow: 2px 2px 0 var(--border);
  color: var(--ink); font-family: var(--font-ui); font-weight: 800;
  font-size: 0.68rem; letter-spacing: 0.05em; text-transform: uppercase; padding: 7px 10px;
}
.review-top .quit:active { transform: translate(2px, 2px); box-shadow: none; }
.progress-track {
  flex: 1; height: 16px;
  background: var(--sunken);
  border: 2px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.progress-track span { display: block; height: 100%; background: var(--accent); transition: width 0.3s; }
.review-top .tally { font-family: var(--font-ui); font-weight: 800; font-size: 0.72rem; color: var(--muted); white-space: nowrap; }

.prompt-card { padding: 2.2rem 1.2rem; }
.prompt-card .ask { margin-bottom: 0.8rem; }
.prompt-card .prompt-glyph { font-family: var(--font-glyph); font-size: clamp(4rem, 24vw, 6.5rem); line-height: 1.1; color: var(--ink); }
.prompt-card .prompt-hint { color: var(--muted); font-size: 0.95rem; min-height: 1.4em; margin-top: 0.6rem; }

.options { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; margin-top: 1.1rem; }
.option {
  min-height: 62px;
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 1.05rem;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 9px;
  box-shadow: var(--sh);
  color: var(--ink);
  transition: transform 0.08s, box-shadow 0.08s;
}
.option:hover { transform: translate(-1px, -1px); box-shadow: var(--sh-lg); }
.option:active { transform: translate(2px, 2px); box-shadow: none; }
.option.correct { background: var(--learned); color: #1b1813; }
.option.wrong { background: var(--red); color: #1b1813; }
.option.muted { opacity: 0.45; }
.option:disabled { cursor: default; transform: none; }
.option.correct, .option.wrong { box-shadow: var(--sh); }

.review-feedback { text-align: center; min-height: 2.4rem; margin-top: 1.1rem; font-size: 1.05rem; font-weight: 700; }
.review-feedback .fb-right { color: var(--learned); }
.review-feedback .fb-wrong { color: var(--accent); }
.review-feedback .fb-meaning { color: var(--muted); font-size: 0.9rem; margin-top: 0.25rem; font-weight: 600; }
.review-feedback b.script { font-family: var(--font-glyph); }
.next-row { margin-top: 0.9rem; }

.session-done { text-align: center; padding: 2.4rem 1rem; }
.session-done .big-num { display: none; }
.session-done h2 { font-size: 1.7rem; margin: 0.4rem 0; }
.session-done p { color: var(--muted); }

/* ----------------------------------------------------------- Progress */
.streak-band {
  display: flex;
  gap: 0.8rem;
  margin: 0.6rem 0 1.2rem;
}
.streak-band .cell {
  flex: 1;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 9px;
  box-shadow: var(--sh);
  padding: 0.8rem 0.7rem;
}
.streak-band .cell:nth-child(1) { background: color-mix(in srgb, var(--yellow) 30%, var(--surface)); }
.streak-band .cell:nth-child(2) { background: color-mix(in srgb, var(--pink) 26%, var(--surface)); }
.streak-band .cell:nth-child(3) { background: color-mix(in srgb, var(--teal) 26%, var(--surface)); }
.streak-band .cell .n { font-family: var(--font-display); font-weight: 900; font-size: 2.1rem; line-height: 1; }
.streak-band .cell .n .accent { color: var(--ink); }
.streak-band .cell .label { margin-top: 0.3rem; }

.ledger { display: grid; gap: 1rem; }
.ledger .row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.8rem;
  padding: 1rem;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 9px;
  box-shadow: var(--sh);
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s;
}
.ledger .row:hover { transform: translate(-2px, -2px); box-shadow: var(--sh-lg); }
.ledger .row .lname { display: flex; align-items: baseline; gap: 0.6rem; }
.ledger .row .lname .native { font-family: var(--font-glyph); font-size: 1.3rem; }
.ledger .row .lname .en { font-size: 1.15rem; font-weight: 800; }
.ledger .row .stat-num { font-family: var(--font-display); font-weight: 900; font-size: 1.4rem; text-align: right; }
.ledger .row .stat-num small { display: block; font-family: var(--font-ui); font-weight: 800; font-size: 0.6rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.ledger .bar { grid-column: 1 / -1; display: flex; height: 14px; border: 2px solid var(--border); border-radius: 7px; overflow: hidden; background: var(--sunken); }
.ledger .bar i { display: block; height: 100%; }
.ledger .bar i.m { background: var(--learned); }
.ledger .bar i.r { background: var(--lime); }
.ledger .bar i.l { background: var(--yellow); }
.ledger .legend { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 0.9rem; font-family: var(--font-ui); font-weight: 800; font-size: 0.64rem; letter-spacing: 0.03em; color: var(--muted); text-transform: uppercase; }
.ledger .legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.ledger .legend i { width: 12px; height: 12px; border-radius: 3px; border: 2px solid var(--border); }
.ledger .legend i.m { background: var(--learned); }
.ledger .legend i.r { background: var(--lime); }
.ledger .legend i.l { background: var(--yellow); }
.ledger .legend i.u { background: var(--sunken); }

/* ---------------------------------------------------------------- Settings */
.setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem 1rem;
  flex-wrap: wrap;
  padding: 1rem;
  margin-bottom: 0.9rem;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 9px;
  box-shadow: var(--sh);
}
.setting .s-text { flex: 1 1 55%; min-width: 0; }
.setting .seg, .setting .stepper { flex: none; }
.setting .s-text .s-title { font-weight: 800; }
.setting .s-text .s-note { color: var(--muted); font-size: 0.86rem; }
.seg { display: inline-flex; border: 2px solid var(--border); border-radius: 8px; overflow: hidden; box-shadow: var(--sh); }
.seg button {
  min-height: 42px;
  padding: 0 0.9rem;
  background: var(--surface);
  border: none;
  border-right: 2px solid var(--border);
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 0.75rem;
  color: var(--ink);
}
.seg button:last-child { border-right: none; }
.seg button.on { background: var(--accent); color: #1b1813; }
.stepper { display: inline-flex; align-items: center; gap: 0.7rem; }
.stepper button { width: 44px; height: 44px; border: 2px solid var(--border); border-radius: 8px; background: var(--surface); box-shadow: 2px 2px 0 var(--border); font-size: 1.3rem; font-weight: 800; line-height: 1; }
.stepper button:active { transform: translate(2px, 2px); box-shadow: none; }
.stepper .val { font-family: var(--font-display); font-weight: 900; font-size: 1.5rem; min-width: 1.4ch; text-align: center; }

.danger-zone { margin-top: 1.8rem; padding: 1.2rem; background: color-mix(in srgb, var(--red) 16%, var(--surface)); border: 3px solid var(--border); border-radius: 10px; box-shadow: var(--sh-lg); }
.danger-zone h3 { font-size: 1.1rem; margin-bottom: 0.4rem; }
.danger-zone p { color: var(--ink); font-size: 0.9rem; }
.confirm-actions { display: flex; gap: 0.7rem; margin-top: 1.1rem; flex-wrap: wrap; }

.about { margin-top: 1.8rem; color: var(--muted); font-size: 0.92rem; }
.about a { border-bottom: 2px solid var(--accent); }

footer.foot {
  margin-top: 2.4rem;
  padding-top: 1.2rem;
  border-top: 3px solid var(--border);
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: var(--faint);
  text-transform: uppercase;
}

.hidden { display: none !important; }
