/* Mimzo: the script is the identity.
   Layout: one narrow column on white. The header is part of the page, not a bar: the
   name stands upright in Mongol bichig beside the Latin name, and the line under it is
   today's goal, filling as XP comes in. Ink outlines and a hard shadow mark only things
   you can press. Flag blue for actions, flag red for "you are here", gold for progress. */
@font-face {
  font-family: "Mimzo Mongolian";
  src: url("fonts/NotoSansMongolian.woff2") format("woff2");
  font-display: block;
}
:root {
  --paper: #ffffff;      /* page */
  --paper-2: #e7ecf3;    /* tracks, wells */
  --sheet: #ffffff;      /* raised surfaces */
  --ink: #0f2140;        /* text, outlines: deep navy */
  --muted: #5a6a84;
  --rule: #d5deea;
  --seal: #d7202f;       /* flag red */
  --seal-d: #8e1420;
  --seal-l: #fde3e5;
  --blue: #0b4ea2;       /* flag blue: actions */
  --blue-l: #e0eafa;
  --gold: #f2b705;       /* soyombo gold: progress, highlights */
  --green: #128a55;      /* correct */
  --green-d: #0b5c38;
  --green-l: #dcf3e8;
  --font-display: "Rubik", system-ui, sans-serif;
  --font-ui: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mn: "Mimzo Mongolian", "Noto Sans Mongolian", "Mongolian Baiti", serif;
  --bw: 2px;
  --press: 0 3px 0 var(--ink);
  --r: 14px;
  --tab-h: 62px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
html { background: var(--paper); }
body {
  font: 400 16px/1.5 var(--font-ui);
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none;
  overflow-x: hidden;
}
button { font-family: inherit; color: inherit; cursor: pointer; }
button:focus-visible, textarea:focus-visible, input:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
h2, h3 { font-family: var(--font-display); font-weight: 700; margin: 0 0 6px; text-wrap: balance; }
[hidden] { display: none !important; }
b, strong { font-weight: 600; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Mongolian script: top to bottom, columns left to right */
.mn { font-family: var(--font-mn); writing-mode: vertical-lr; -webkit-writing-mode: vertical-lr; line-height: 1.25; }
/* Centre script in its box. Vertical Mongolian sits against one edge of its column, so
   each box is a centring grid with a tight column (line-height 1). The red highlight copy
   uses the same grid so it stays exactly on top of the word. */
.prompt .mn, .choice .mn, .tile .mn, .lt .mn, .forms .mn, .node .mn, .build-preview, .hlw-top { display: grid; place-items: center; line-height: 1; }
/* A word with one letter lit: a red copy on top, clipped to that letter (app.js paintHighlights). */
.hlw { position: relative; }
.hlw-top { position: absolute; inset: 0; padding: inherit; color: var(--seal); pointer-events: none; clip-path: inset(0 0 100% 0); }

/* ---------- top bar ---------- */
.masthead {
  position: sticky; top: 0; z-index: 10;
  display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 4px 12px;
  padding: max(12px, env(safe-area-inset-top)) 16px 0;
  background: var(--paper);
}
.brand { display: flex; align-items: flex-end; gap: 10px; padding-bottom: 10px; }
/* The memorable thing: the name written the way the script is written, top to bottom. */
.brand-script { font-size: 26px; line-height: 1; height: 62px; color: var(--seal); }
.brand-name { font: 700 22px/1 var(--font-display); padding-bottom: 4px; }
.today { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; padding-bottom: 12px; text-align: right; }
.today b { font: 700 16px/1.2 var(--font-display); }
.today span { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.goal-line { grid-column: 1 / -1; height: 4px; margin: 0 -16px; background: var(--paper-2); }
.goal-line i { display: block; height: 100%; width: 0; background: var(--gold); transition: width .5s; }
.goal-line.met i { background: var(--green); }

main { max-width: 600px; margin: 0 auto; padding: 18px 16px calc(var(--tab-h) + 30px + env(safe-area-inset-bottom)); }
.screen { display: none; }
.screen.active { display: block; }
.page-title { font-size: 26px; margin-top: 4px; }
.sub { color: var(--muted); margin: 0 0 18px; max-width: 34em; }
.credit { color: var(--muted); font-size: 12px; margin-top: 24px; }

.bar { height: 10px; border-radius: 999px; background: var(--paper-2); overflow: hidden; flex: 1; }
.bar i { display: block; height: 100%; width: 0; background: var(--gold); border-radius: inherit; transition: width .4s; }
.bar.big { height: 14px; }
.bar.big i { background: var(--green); }

.panel { border-top: 1px solid var(--rule); padding: 18px 0 6px; margin-top: 18px; }
.panel h3 { font-size: 18px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: var(--bw) solid var(--ink); border-radius: var(--r); padding: 12px 20px; font-weight: 600; font-size: 16px;
  background: var(--sheet); box-shadow: var(--press); transition: transform .06s, box-shadow .06s;
}
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.btn:disabled { opacity: .4; cursor: default; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-green { background: var(--green); color: #fff; }
.btn-red { background: var(--seal); color: #fff; }
.btn-wide { width: 100%; }
.btn-small { padding: 7px 12px; font-size: 14px; }
.btn-ghost { box-shadow: none; }
.danger { color: var(--seal); border-color: var(--seal); margin-top: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; margin-top: 16px; }

/* ---------- front page ---------- */
.front { position: fixed; inset: 0; z-index: 20; background: var(--paper); overflow-y: auto; }
.front-inner {
  max-width: 520px; min-height: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 22px;
  padding: max(16px, env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
}
.front .brand { padding-bottom: 0; }
.front-hero { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: center; margin-top: 8px; }
.front-script { font-size: 54px; line-height: 1.15; color: var(--seal); max-height: 320px; }
.front h1 { font: 700 25px/1.2 var(--font-display); margin: 0 0 10px; text-wrap: balance; }
.front-hero .sub { margin: 0; }
.front-steps { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.front-steps li { padding: 12px 0; border-bottom: 1px solid var(--rule); color: var(--muted); font-size: 15px; }
.front-steps b { display: block; color: var(--ink); font: 700 17px/1.3 var(--font-display); margin-bottom: 2px; }
.front-actions { display: flex; flex-direction: column; gap: 6px; }
.front-note { margin: 0; font-size: 13px; color: var(--muted); text-align: center; }
.front .legal-links { justify-content: center; margin-top: auto; }

/* ---------- daily reading ---------- */
.daily { display: flex; align-items: center; gap: 14px; width: 100%; margin: 4px 0 10px; padding: 12px 14px; border: var(--bw) solid var(--ink); border-radius: var(--r); background: var(--sheet); }
.daily-script { font-size: 26px; max-height: 96px; color: var(--seal); flex: none; display: grid; place-items: center; line-height: 1; }
.daily-text { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.daily-text b { font: 700 17px/1.2 var(--font-display); }
.daily-text small { color: var(--muted); font-size: 13px; }
.daily.done { border-color: var(--rule); }
.daily.done .daily-script { color: var(--ink); }
.daily.locked { border: 1px dashed var(--rule); }
.daily-ok { width: 32px; height: 32px; border-radius: 50%; background: var(--green-l); color: var(--green-d); display: grid; place-items: center; flex: none; }
.daily-ok .ic { width: 18px; height: 18px; stroke-width: 2.5; }

/* ---------- path ---------- */
.path-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding-top: 2px; }
.due { min-width: 20px; background: var(--seal); color: #fff; border-radius: 999px; font-size: 12px; padding: 0 6px; line-height: 20px; }
.due:empty { display: none; }

.unit { margin: 30px 0 0; }
.unit-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding-bottom: 10px; border-bottom: var(--bw) solid var(--ink); }
.unit-num { font-size: 14px; font-weight: 600; color: var(--seal); }
.unit-head b { display: block; font: 700 22px/1.2 var(--font-display); }
.unit-head small { display: block; color: var(--muted); font-size: 14px; margin-top: 2px; }
.auto-badge { flex: none; font-size: 12px; font-weight: 600; color: var(--muted); border: 1px solid var(--rule); border-radius: 999px; padding: 2px 9px; }
.nodes { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 24px 0 4px; }
.node-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.node {
  position: relative; width: 70px; height: 70px; border-radius: 50%;
  border: var(--bw) solid var(--ink); box-shadow: 0 5px 0 var(--ink);
  background: var(--sheet); color: var(--ink); display: grid; place-items: center;
  transition: transform .06s, box-shadow .06s;
}
.node .ic { width: 28px; height: 28px; }
.node:active:not(.locked) { transform: translateY(5px); box-shadow: 0 0 0 var(--ink); }
.node.done { background: var(--green); color: #fff; }
.node.current { background: var(--seal); color: #fff; }
.node.locked { background: var(--paper-2); color: var(--muted); border-color: var(--rule); box-shadow: 0 5px 0 var(--rule); cursor: default; }
.node .mn { font-size: 24px; max-height: 54px; overflow: hidden; }
.node-label { font-size: 14px; font-weight: 600; }
.node-wrap.locked .node-label { color: var(--muted); }
.pips { display: flex; gap: 3px; height: 6px; }
.pips i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.start-tip { font-size: 14px; font-weight: 600; color: var(--seal); }

/* ---------- alphabet ---------- */
.letter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.lt {
  background: var(--sheet); border: var(--bw) solid var(--ink); border-radius: var(--r); box-shadow: var(--press);
  padding: 10px 6px 8px; display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.lt:active { transform: translateY(3px); box-shadow: none; }
.lt .mn { font-size: 34px; height: 54px; }
.lt b { font: 700 17px/1.2 var(--font-display); }
.lt small { color: var(--muted); font-size: 12px; }
.dots { display: flex; gap: 3px; margin-top: 2px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--paper-2); }
.dots i.on { background: var(--gold); }
.forms { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 14px; margin: 14px 0 6px; }
.forms div { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.forms .mn { font-size: 40px; min-height: 64px; max-height: 190px; padding: 6px 14px; background: var(--sheet); border-radius: 10px; border: 1px solid var(--rule); }
.forms small { color: var(--muted); font-size: 13px; }

/* ---------- words ---------- */
.word-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin-bottom: 8px; }
.wd { border: 1px solid var(--rule); border-radius: 10px; background: var(--sheet); padding: 10px 6px; display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; }
.wd .mn { font-size: 28px; height: 96px; }
.wd b { font: 700 15px/1.2 var(--font-display); }
.wd small { color: var(--muted); font-size: 11px; }
.wd.locked { background: transparent; }
.wd.locked .mn { opacity: .25; filter: blur(2px); }
.wd.locked b { color: var(--muted); }
.wd.locked .ic { width: 16px; height: 16px; color: var(--muted); }
.mn-input {
  width: 100%; font-family: var(--font-mn); font-size: 22px; padding: 10px 12px; border: var(--bw) solid var(--ink); border-radius: var(--r);
  background: var(--sheet); color: var(--ink); user-select: text; -webkit-user-select: text; resize: vertical;
}
.text-input {
  width: 100%; font: 400 18px/1.4 var(--font-ui); color: var(--ink); background: var(--sheet); resize: vertical;
  border: var(--bw) solid var(--ink); border-radius: var(--r); padding: 10px 12px; user-select: text; -webkit-user-select: text;
}
/* The result reads like a page of Mongol bichig: columns top to bottom, left to right. */
.conv-paper { margin-top: 12px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--sheet); overflow-x: auto; padding: 16px 18px; }
.conv-text { font-size: 40px; height: 340px; line-height: 1.6; white-space: pre-wrap; user-select: text; -webkit-user-select: text; }
.conv-text:empty::before { content: "ᠮᠣᠩᠭᠣᠯ"; opacity: .15; }
.conv-text .approx { text-decoration: underline dotted var(--muted); text-decoration-thickness: 2px; text-underline-offset: 6px; }
.conv-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.conv-size { margin-left: auto; display: flex; gap: 4px; }
.conv-size .btn { border-color: var(--rule); min-width: 44px; }
.conv-note { margin-top: 10px; }
.conv-words { margin-top: 14px; }
.conv-words summary { cursor: pointer; font-weight: 600; color: var(--blue); }
.cyr-out { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.cyr-word { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.cyr-word .mn { font-size: 32px; min-width: 56px; min-height: 56px; max-height: 220px; padding: 8px 12px; border: 1px solid var(--rule); border-radius: 12px; background: var(--sheet); display: grid; place-items: center; line-height: 1; }
.cyr-word small { font-size: 13px; color: var(--muted); }
.cyr-word.approx .mn { border-style: dashed; }
.roman-out { margin-top: 10px; font: 700 18px/1.4 var(--font-display); color: var(--blue); min-height: 1.4em; word-break: break-word; }

/* ---------- profile ---------- */
.level { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; margin: 8px 0 18px; }
.level-badge { width: 56px; height: 56px; border-radius: 50%; border: var(--bw) solid var(--ink); display: grid; place-items: center; font: 700 24px/1 var(--font-display); background: var(--sheet); }
.level-info small { color: var(--muted); font-size: 13px; }
.level-info .bar { margin: 6px 0 4px; }
.facts { display: grid; grid-template-columns: 1fr auto; margin: 0; }
.facts dt, .facts dd { padding: 10px 0; border-bottom: 1px solid var(--rule); margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.facts + .panel { border-top: 0; margin-top: 6px; }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.seg button { border: var(--bw) solid var(--ink); border-radius: 10px; background: var(--sheet); padding: 8px 4px; font-weight: 600; font-size: 14px; line-height: 1.3; display: flex; flex-direction: column; align-items: center; }
.seg button small { color: var(--muted); font-weight: 400; font-size: 11px; }
.seg button.on { background: var(--blue); color: #fff; }
.seg button.on small { color: #e6ecf7; }
.toggle { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-weight: 600; }
.toggle input { width: 20px; height: 20px; accent-color: var(--blue); }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--paper); border-top: 1px solid var(--rule);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab { background: none; border: 0; height: var(--tab-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 12px; font-weight: 600; color: var(--muted); }
.tab .ic { width: 24px; height: 24px; }
.tab-glyph { font-size: 22px; height: 24px; line-height: 24px; display: grid; place-items: center; }
.tab.active { color: var(--blue); }

/* ---------- lesson ---------- */
.lesson { position: fixed; inset: 0; z-index: 30; background: var(--paper); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); }
.lesson-top { display: flex; align-items: center; gap: 12px; padding: 14px 16px; max-width: 600px; width: 100%; margin: 0 auto; }
.close { background: none; border: 0; color: var(--muted); width: 36px; height: 36px; display: grid; place-items: center; padding: 0; }
.close .ic { width: 24px; height: 24px; }
.combo { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 40px; justify-content: flex-end; }
.combo.hot { color: var(--gold); }
.combo .ic { width: 18px; height: 18px; }
.ls-body { flex: 1; overflow-y: auto; padding: 8px 16px 20px; max-width: 600px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; }
.ex-title { font: 700 21px/1.3 var(--font-display); margin: 6px 0 18px; text-wrap: balance; }
.ex-title .again { display: block; font: 600 14px/1.4 var(--font-ui); color: var(--seal); margin-bottom: 4px; }
.prompt { align-self: center; display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 4px 0 22px; }
.prompt .mn { font-size: 64px; min-height: 110px; max-height: 260px; padding: 12px 20px; background: var(--sheet); border: 1px solid var(--rule); border-radius: 14px; }
.prompt .big-plain { font: 700 38px/1.2 var(--font-display); padding: 8px 20px; }
.prompt .sub { margin: 0; font-size: 14px; }
.choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.choice {
  min-height: 80px; border: var(--bw) solid var(--ink); border-radius: var(--r); background: var(--sheet); box-shadow: var(--press);
  font: 700 26px/1.2 var(--font-display); display: grid; place-items: center; padding: 10px; position: relative;
}
.choice .mn { font-size: 40px; max-height: 150px; font-weight: 400; }
.choice .k { position: absolute; top: 6px; left: 8px; font: 600 11px/1.4 var(--font-ui); color: var(--muted); }
.choice.sel { background: var(--blue-l); border-color: var(--blue); box-shadow: 0 3px 0 var(--blue); }
.choice.right { background: var(--green-l); border-color: var(--green); box-shadow: 0 3px 0 var(--green); }
.choice.wrong { background: var(--seal-l); border-color: var(--seal); box-shadow: 0 3px 0 var(--seal); animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* help: a soft button, never alarming */
.ex-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ex-head .ex-title { flex: 1; }
.help-btn {
  flex: none; display: inline-flex; align-items: center; gap: 5px; margin-top: 6px;
  border: 1px solid var(--rule); border-radius: 999px; background: var(--sheet); color: var(--blue);
  padding: 6px 12px 6px 9px; font-size: 14px; font-weight: 600;
}
.help-btn .q { width: 20px; height: 20px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center; font: 700 13px/1 var(--font-display); }
.help-btn.used { background: var(--blue-l); border-color: var(--blue-l); }
.help-sheet h4 { font: 600 14px/1.4 var(--font-ui); color: var(--muted); margin: 16px 0 8px; }
.help-tip { display: flex; align-items: center; gap: 14px; background: var(--blue-l); border-radius: 12px; padding: 12px 14px; margin-top: 8px; }
.help-tip p { margin: 0; line-height: 1.5; }
.help-tip .mn { font-size: 40px; max-height: 150px; flex: none; display: grid; place-items: center; line-height: 1; }
.help-chart { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; max-height: 210px; overflow-y: auto; }
.help-chart div { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border: 1px solid var(--rule); border-radius: 10px; }
.help-chart .mn { font-size: 26px; height: 40px; display: grid; place-items: center; line-height: 1; }
.help-chart small { font-size: 12px; color: var(--muted); }
.help-note { font-size: 13px; color: var(--muted); margin: 14px 0 0; }
.help-sheet .row.end { flex-direction: column-reverse; }
.help-sheet .row.end .btn { width: 100%; }
.tile.gone { visibility: hidden; }
@media (max-width: 520px) {
  /* On phones help opens from the bottom, like a sheet, within thumb reach. */
  .modal:has(.help-sheet) { place-items: end center; padding: 0; }
  .help-sheet { border-radius: 18px 18px 0 0; border-bottom: 0; max-width: none; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
}

/* intro card */
.intro .ex-title { margin-bottom: 10px; }
.intro .prompt .mn { font-size: 96px; }
.intro .hint { line-height: 1.55; margin: 10px 0 0; max-width: 34em; }
ul.hint { padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.sum { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 4px 0 10px; }
.sum > div { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.sum .mn { font-size: 52px; min-width: 72px; min-height: 84px; padding: 8px 16px; background: var(--sheet); border: 1px solid var(--rule); border-radius: 12px; display: grid; place-items: center; line-height: 1; }
.sum > div:last-child .mn { border: var(--bw) solid var(--ink); color: var(--seal); }
.sum small { font: 700 16px/1 var(--font-display); }
.sum .op { font: 700 26px/1 var(--font-display); color: var(--muted); padding-bottom: 22px; }
.forms-head { font: 600 14px/1.4 var(--font-ui); color: var(--muted); margin: 12px 0 0; text-align: center; }

/* build */
.build-answer { min-height: 120px; border-bottom: var(--bw) solid var(--ink); display: flex; align-items: flex-start; gap: 14px; padding: 8px 4px 14px; margin-bottom: 18px; }
.build-preview { min-width: 64px; min-height: 100px; font-size: 52px; padding: 4px 8px; border-radius: 10px; background: var(--sheet); border: 1px solid var(--rule); }
.build-preview:empty::before { content: "?"; font-family: var(--font-display); writing-mode: horizontal-tb; color: var(--rule); font-size: 34px; }
.picked { display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; flex: 1; }
.bank { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.tile { width: 56px; height: 70px; border: var(--bw) solid var(--ink); border-radius: 10px; background: var(--sheet); box-shadow: var(--press); display: grid; place-items: center; }
.tile .mn { font-size: 32px; }
.tile.used { visibility: hidden; }
.picked .tile { width: 44px; height: 56px; }
.picked .tile .mn { font-size: 24px; }

/* pairs */
.pairs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pairs .col { display: flex; flex-direction: column; gap: 12px; }
.pair { min-height: 74px; }
.pair .mn { font-size: 30px; max-height: 120px; }
.choice.gone { opacity: .2; pointer-events: none; box-shadow: none; }

/* footer + feedback */
.ls-foot { border-top: 1px solid var(--rule); padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); background: var(--paper); }
.ls-foot > * { max-width: 600px; margin-left: auto; margin-right: auto; display: block; }
.ls-foot.ok { background: var(--green-l); border-top-color: var(--green); }
.ls-foot.bad { background: var(--seal-l); border-top-color: var(--seal); }
.feedback { margin-bottom: 12px; display: none; }
.ls-foot.ok .feedback, .ls-foot.bad .feedback { display: block; }
.feedback b { font: 700 20px/1.3 var(--font-display); display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.feedback b .ic { width: 22px; height: 22px; stroke-width: 2.5; }
.ls-foot.ok .feedback b { color: var(--green-d); }
.ls-foot.bad .feedback b { color: var(--seal-d); }
.feedback .ans { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.feedback .ans .mn { font-size: 30px; max-height: 110px; }
.feedback p { margin: 4px 0 0; font-size: 15px; }

/* result */
.result { justify-content: space-between; }
.result-inner { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; justify-content: center; gap: 10px; padding: 20px 16px; max-width: 600px; width: 100%; margin: 0 auto; }
.result-glyph { font-size: 72px; max-height: 230px; color: var(--seal); align-self: center; animation: pop .5s; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.result-inner h2 { font-size: 28px; }
.result-facts { margin-top: 6px; }
.result-inner .sub { margin-top: 8px; }

/* modal + toast */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(15, 33, 64, .45); display: grid; place-items: center; padding: 20px; }
.modal-card { max-width: 380px; width: 100%; background: var(--sheet); border: var(--bw) solid var(--ink); border-radius: 16px; padding: 20px; }
.modal-card h3 { font-size: 20px; }
.modal-card .sub { margin-bottom: 0; }
.toast { position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 76px); transform: translateX(-50%); z-index: 60; background: var(--ink); color: var(--sheet); padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: 14px; white-space: nowrap; }

@media (min-width: 700px) {
  .choices { grid-template-columns: repeat(4, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- sign in / account ---------- */
.auth-body { flex: 1; overflow-y: auto; padding: 0 16px 32px; max-width: 440px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.auth-script { font-size: 34px; height: 82px; color: var(--seal); }
.auth-view { display: flex; flex-direction: column; gap: 14px; }
.auth-view h2 { font-size: 26px; margin: 0; }
.auth-view .sub { margin: 0; }
.auth-actions { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
.field input {
  font: 400 17px/1.3 var(--font-ui); color: var(--ink); background: var(--sheet);
  border: var(--bw) solid var(--ink); border-radius: 10px; padding: 12px 12px;
  -webkit-user-select: text; user-select: text;
}
.field small { color: var(--muted); font-weight: 400; }
.form-note { font-size: 13px; color: var(--muted); margin: 0; }
.form-note a, .legal-links a { color: var(--blue); }
.form-error { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--seal-l); color: var(--seal-d); font-size: 14px; }
.link-btn { border-color: transparent; background: none; color: var(--blue); font-weight: 600; padding: 8px; }

.account { padding: 4px 0 18px; border-bottom: 1px solid var(--rule); margin-bottom: 18px; display: flex; flex-direction: column; gap: 12px; }
.account h3 { font-size: 18px; margin: 0; }
.account .sub { margin: 0; }
.who { display: flex; align-items: center; gap: 12px; }
.avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center; font: 700 20px/1 var(--font-display); flex: none; }
.who-text { display: flex; flex-direction: column; min-width: 0; }
.who-text b { font: 700 18px/1.2 var(--font-display); }
.who-text small { color: var(--muted); overflow-wrap: anywhere; }
.badge-ok { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; font-size: 13px; font-weight: 600; color: var(--green-d); }
.badge-ok .ic { width: 16px; height: 16px; stroke-width: 2.5; }
.verified-mark { width: 56px; height: 56px; border-radius: 50%; background: var(--green-l); color: var(--green-d); display: grid; place-items: center; margin: 0 auto 10px; }
.verified-mark .ic { width: 30px; height: 30px; stroke-width: 2.5; }
.sync { margin: 0; font-size: 13px; color: var(--green-d); }
.sync.saving { color: var(--muted); }
.sync.error { color: var(--seal-d); }
.name-form { display: flex; align-items: flex-end; gap: 10px; }
.name-form .field { flex: 1; min-width: 0; }
.name-form .btn { margin-bottom: 3px; }
.legal-links { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 22px; font-size: 14px; font-weight: 600; }

/* ---------- privacy policy and terms ---------- */
.legal-page { background: var(--paper); }
.legal-head { max-width: 680px; margin: 0 auto; padding: max(14px, env(safe-area-inset-top)) 16px 6px; }
.legal-head .back { color: var(--blue); font-weight: 600; text-decoration: none; }
.legal { max-width: 680px; margin: 0 auto; padding: 8px 16px calc(40px + env(safe-area-inset-bottom)); line-height: 1.65; }
.legal h1 { font: 700 30px/1.2 var(--font-display); margin: 12px 0 4px; text-wrap: balance; }
.legal h2 { font-size: 19px; margin: 28px 0 6px; }
.legal p, .legal li { max-width: 38em; }
.legal ul { padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.legal .meta { color: var(--muted); font-size: 14px; margin-top: 0; }
.legal a { color: var(--blue); }
.legal-page, .legal-page * { -webkit-user-select: text; user-select: text; }
