/* Singlish Kaki — design system.
 * Ink and paper. One accent. No gradients, no glass, no webfonts.
 * Every dimension on the 8px scale unless it is a hairline or type size.
 */

:root {
  --ink: #14110F;
  --paper: #FAF6EF;
  --paper-deep: #F2EBDD;
  --accent: #C8452B;
  --accent-dark: #AD3E24;
  --accent-wash: #F7E8E2;
  --muted: #67605A;
  --rule: rgba(20, 17, 15, .14);
  --rule-soft: rgba(20, 17, 15, .07);
  --ok: #2E6B4F;
  --bad: #A33A22;
  --tile: #EFE3CC;
  --tile-edge: #C9B79A;
  --tile-ink: #221E19;
  --serif: Georgia, "Iowan Old Style", "Times New Roman", Times, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --pad: 24px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper-deep);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
}

body { overscroll-behavior-y: none; }

h1, h2, h3, p, ul, ol, figure, blockquote { margin: 0; }

a { color: var(--accent-dark); text-decoration-thickness: 1px; text-underline-offset: 3px; }

button { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- shell ---------- */

.root { min-height: 100vh; min-height: 100dvh; }

.screen {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: calc(env(safe-area-inset-top) + 16px) var(--pad) calc(env(safe-area-inset-bottom) + 24px);
  background: var(--paper);
  animation: screenIn 160ms ease-out both;
}

@keyframes screenIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.screen > .grow { flex: 1 1 auto; }

/* ---------- top bar ---------- */

.top {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin-left: -8px;
}

.top--plain { grid-template-columns: 1fr auto; margin-left: 0; }

.back {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.back:hover { background: rgba(20, 17, 15, .04); border-color: var(--rule-soft); }
.back svg { display: block; }

.kicker {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent);
}
.kicker--muted { color: var(--muted); }

.top-meta {
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

/* ---------- type ---------- */

.h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(30px, 8.4vw, 38px);
  line-height: 1.1;
  letter-spacing: -.03em;
  text-wrap: balance;
}
.h1 em { font-style: italic; color: var(--accent-dark); }

.h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 26px;
  line-height: 1.16;
  letter-spacing: -.02em;
}

.lead { font-size: 17px; line-height: 1.55; color: var(--muted); }

.micro {
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.lbl {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--muted);
}

.num { font-variant-numeric: tabular-nums; }

.rule { height: 1px; background: var(--rule); border: 0; margin: 0; }

/* ---------- buttons ---------- */

.btn {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -.005em;
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 140ms ease, border-color 140ms ease, transform 80ms ease;
}
.btn:active { transform: scale(.985); }
.btn[disabled] { opacity: .38; cursor: default; filter: saturate(.5); }
.band-reading { text-align: center; margin-top: 16px; max-width: 30ch; margin-left: auto; margin-right: auto; }
.btn--primary[disabled] {
  background: transparent;
  border-color: var(--rule);
  color: var(--muted);
  font-weight: 500;
}

.btn--primary { background: var(--accent); color: #FBF7EF; }
.btn--primary:hover { background: var(--accent-dark); }

.btn--second { border-color: rgba(20, 17, 15, .24); color: var(--ink); }
.btn--second:hover { border-color: rgba(20, 17, 15, .44); background: rgba(20, 17, 15, .025); }

.btn--quiet {
  min-height: 48px;
  border-color: transparent;
  color: var(--muted);
  font-weight: 500;
  font-size: 15px;
}
.btn--quiet:hover { color: var(--ink); }

.btn--choice {
  justify-content: flex-start;
  text-align: left;
  font-weight: 500;
  font-size: 15.5px;
  line-height: 1.4;
  border-color: rgba(20, 17, 15, .20);
  min-height: 56px;
}
.btn--choice:hover { border-color: rgba(20, 17, 15, .40); }
.btn--choice .letter {
  flex: none;
  width: 22px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--muted);
  align-self: baseline;
  padding-top: 4px;
}
.btn--choice[data-mark="ok"] {
  border-color: var(--ok);
  background: var(--accent-wash);
}
.btn--choice[data-mark="no"] { border-color: var(--bad); background: #F6E8E2; }
.btn--choice .tag {
  margin-left: auto;
  flex: none;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.btn--choice[data-mark="ok"] .tag { color: var(--ok); }
.btn--choice[data-mark="no"] .tag { color: var(--bad); }

.actions { display: flex; flex-direction: column; gap: 8px; }
.actions--row { flex-direction: row; }
.actions--row > .btn { flex: 1 1 0; }

/* ---------- home ---------- */

.home { gap: 0; }
.home-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--rule);
}
.wordmark {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.wordmark em { font-style: italic; }
.home-head .kicker { color: var(--muted); }

.home-h1 { margin-top: 20px; font-size: 46px; line-height: 1.02; letter-spacing: -.03em; }

.picks { display: grid; gap: 12px; margin-top: 16px; }

.pick {
  display: block;
  width: 100%;
  text-align: left;
  padding: 16px 16px 14px;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: #FCF8F0;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 140ms ease, transform 100ms ease;
}
.pick:hover { border-color: rgba(20, 17, 15, .32); }
.pick:active { transform: scale(.992); }

.pick--lead {
  border-color: rgba(200, 69, 43, .55);
  border-width: 1.5px;
  border: 1.5px solid var(--accent);
  background: #FCF8F0;
  padding: 16px 16px 14px;
}
.pick-k {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}
.pick--lead .pick-k { color: var(--accent); }
.pick-n {
  display: block;
  font-family: var(--serif);
  font-size: 25px;
  line-height: 1.1;
  letter-spacing: -.015em;
  margin-top: 6px;
}
.pick--lead .pick-n { font-size: 29px; }
.pick-d {
  display: block;
  font-size: 14px;
  line-height: 1.48;
  color: var(--muted);
  margin-top: 6px;
  max-width: 36ch;
}
.pick-m {
  display: block;
  font-size: 11.5px;
  letter-spacing: .04em;
  color: var(--muted);
  margin-top: 12px;
  font-variant-numeric: tabular-nums;
}
.pick-go {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--accent);
}
.pick-go .arrow { font-size: 17px; }

.home-foot {
  margin-top: auto;
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.home-foot a { font-size: 13px; color: var(--muted); text-underline-offset: 4px; }
.home-foot .micro { font-size: 12px; color: rgba(20, 17, 15, .42); }

.notice {
  margin-top: 16px;
  padding: 12px 14px;
  border-left: 2px solid var(--bad);
  background: #F7EAE4;
  font-size: 14px;
  line-height: 1.45;
}

/* ---------- tiles: word objects ---------- */

.tiles {
  display: inline-flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: calc(var(--t) * .06);
  align-items: center;
  max-width: 100%;
  line-height: 0;
}

.tiles .lt {
  position: relative;
  display: inline-grid;
  place-items: center;
  vertical-align: middle;
  width: var(--t);
  height: var(--t);
  border-radius: calc(var(--t) * .24);
  background: var(--tile);
  border: 1px solid var(--tile-edge);
  color: var(--tile-ink);
  font-family: var(--serif);
  font-weight: 700;
  font-size: calc(var(--t) * .5);
  line-height: 1;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .8);
  box-shadow:
    0 calc(var(--t) * .11) 0 #CBB99C,
    0 calc(var(--t) * .14) 0 #B9A68A,
    0 calc(var(--t) * .24) calc(var(--t) * .32) rgba(20, 17, 15, .20),
    inset 0 calc(var(--t) * .055) 0 #FFF9EC,
    inset 0 calc(var(--t) * -.055) 0 #DCCBAB;
  animation: tileBob 3.6s ease-in-out infinite;
  animation-delay: calc(var(--i) * -.13s);
  will-change: transform;
}
@keyframes tileBob { 0%,100% { transform: translateY(0) rotate(-.5deg) } 50% { transform: translateY(-3px) rotate(.5deg) } }
@media (prefers-reduced-motion: reduce) { .tiles .lt { animation: none } }
.tiles .lt.gap {
  margin: 0;
  width: calc(var(--t) * .34);
  height: 1px;
  background: none;
  border: 0;
  box-shadow: none;
  font-size: 1px;
  line-height: 1px;
  color: transparent;
}

.tiles--word { margin: 0 auto; }

.tiles--drop .lt {
  animation: tileIn 220ms cubic-bezier(.2, 1.3, .35, 1) both;
  animation-delay: calc(var(--i) * 16ms);
}
@keyframes tileIn {
  from { opacity: 0; transform: translateY(-10px) rotate(-4deg) scale(.9); }
  to { opacity: 1; transform: none; }
}

/* ---------- stamp ---------- */

.stamp {
  display: inline-block;
  align-self: center;
  padding: 12px 14px 14px;
  border: 3px double var(--accent);
  border-radius: 4px;
  color: var(--accent);
  transform: rotate(-3deg);
  animation: stampIn 240ms cubic-bezier(.2, 1.4, .4, 1) both;
}
.stamp .tiles .lt { font-size: calc(var(--t) * .56); }
@keyframes stampIn {
  from { opacity: 0; transform: rotate(-9deg) scale(1.12); }
  to { opacity: 1; transform: rotate(-3deg) scale(1); }
}

/* ---------- hud ---------- */

.hud {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
  flex-wrap: wrap;
}
.hud-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.hud-item b {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.bar { height: 3px; background: rgba(20, 17, 15, .10); border-radius: 2px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); transition: width 120ms linear; }
.bar.low i { background: var(--bad); }

/* ---------- zhun bo play ---------- */

.play { gap: 0; }
.play .q {
  font-size: 17px;
  line-height: 1.4;
  color: var(--muted);
  text-align: center;
  max-width: 26ch;
  margin: 0 auto;
}
.card-zone {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 24px;
  min-height: 220px;
  padding: 56px 0 24px;
  overflow: auto;
}

/* feedback reads as one block, centred in the space above the action */
.fb-word { text-align: center; }
.fb-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: safe center;
  gap: 24px;
  padding: 24px 0;
  min-height: 0;
}

/* ---------- feedback ---------- */

.verdict { text-align: center; }
.verdict-k {
  display: block;
  font-family: var(--serif);
  font-size: clamp(28px, 8vw, 34px);
  line-height: 1.1;
  letter-spacing: -.02em;
}
.verdict--ok .verdict-k { color: var(--ok); }
.verdict--no .verdict-k { color: var(--bad); }
.verdict-s {
  display: block;
  margin-top: 6px;
  font-size: 14px;
  color: var(--muted);
}

.fb-panel {
  border-top: 1px solid var(--rule);
  padding-top: 16px;
  display: grid;
  gap: 12px;
}
.fb-gloss { font-size: 17px; line-height: 1.5; }
.fb-row { display: grid; grid-template-columns: 72px 1fr; gap: 8px; align-items: baseline; }
.fb-row dt { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.fb-row dd { margin: 0; font-size: 14px; line-height: 1.5; }
.eg {
  font-family: var(--serif);
  font-size: 15.5px;
  line-height: 1.5;
  color: var(--ink);
  padding-left: 12px;
  border-left: 2px solid var(--rule);
}

/* ---------- results ---------- */

.results { text-align: center; }
.results .stamp { margin-top: 8px; }

.level-lbl { margin-top: 24px; }
.level-big {
  display: block;
  font-family: var(--serif);
  font-size: clamp(56px, 17vw, 72px);
  line-height: 1;
  letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
}
.level-big .pct { font-size: .48em; letter-spacing: 0; }
.level-sub {
  display: block;
  margin-top: 8px;
  font-size: 15px;
  color: var(--muted);
}
.stamp-range { display: block; font-family: var(--serif); font-size: 20px; line-height: 1.25; text-align: center; letter-spacing: -.01em; }
.stamp-range .to { display: block; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 2px 0; }
.ladder-all { margin-top: 28px; border-top: 1px solid var(--rule); padding-top: 16px; }
/* The ladder is the prototype's: five rows, a rail on the left carrying the
 * interval as a shaded column, a chip at the point estimate, and a mark line.
 * The shade is the honest part — it shows how much of the ladder the answer
 * could plausibly be, which a single highlighted row cannot. */
.ladder-wrap { border-radius: 10px; box-shadow: 0 0 0 1px var(--rule-soft); overflow: hidden; margin-top: 10px; }
.ladder { position: relative; }
.brow { position: relative; z-index: 1; height: 68px; padding: 8px 10px 8px 36px;
  border-bottom: 1px solid var(--rule-soft); overflow: hidden; }
.brow:last-of-type { border-bottom: 0; }
.brow-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.bname { font-size: 13.5px; font-weight: 600; letter-spacing: -.012em; line-height: 1.18; color: rgba(20,17,15,.50); }
.brange { font-size: 10.5px; flex: none; font-variant-numeric: tabular-nums; color: rgba(20,17,15,.34); }
.breading { margin: 3px 0 0; font-size: 11.5px; line-height: 1.35; color: rgba(20,17,15,.40);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.brow.is-you { background: rgba(200,69,43,.055); box-shadow: inset 0 0 0 1px var(--accent); }
.brow.is-you .bname { color: var(--ink); }
.brow.is-you .brange { color: var(--accent-dark); }
.brow.is-you .breading { color: rgba(20,17,15,.62); }
.brow.in-span .bname { color: rgba(20,17,15,.72); }
.ladder-rail { position: absolute; left: 0; top: 0; bottom: 0; width: 28px; z-index: 3;
  background: rgba(20,17,15,.035); border-right: 1px solid var(--rule-soft); }
.ladder-tick { position: absolute; left: 0; right: 0; height: 1px; background: var(--rule-soft); }
.ladder-shade { position: absolute; left: 9px; width: 10px; border-radius: 2px;
  background: rgba(200,69,43,.17); box-shadow: inset 0 0 0 1px rgba(200,69,43,.30); }
.ladder-chip { position: absolute; left: -1px; width: 30px; height: 18px; border-radius: 4px;
  background: var(--accent-dark); color: #FDFAF4; font-size: 9.5px; font-weight: 700;
  letter-spacing: .01em; font-variant-numeric: tabular-nums; text-align: center; line-height: 18px;
  box-shadow: 0 0 0 1px var(--paper); }
.ladder-mark { position: absolute; left: 0; right: 0; height: 2px; background: var(--accent); z-index: 2; }
@media (prefers-reduced-motion: reduce) { .ladder-mark, .ladder-shade { transition: none; } }
.audit-line { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); }
.margin-line {
  display: inline-block;
  margin-top: 8px;
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.record-line {
  margin-top: 16px;
  font-size: 14px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.nowrap { white-space: nowrap; }
.gap-line {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
  max-width: 30ch;
  margin-left: auto;
  margin-right: auto;
}

.gate {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
  text-align: left;
}
.gate-q { font-size: 17px; line-height: 1.4; }
.gate .actions { margin-top: 12px; }
.noted {
  margin-top: 12px;
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.3;
}

/* ---------- daily ---------- */

.daily-hud { display: grid; gap: 8px; }
.lives-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--muted);
}
.lives-row b { color: var(--ink); font-variant-numeric: tabular-nums; }
.pips { display: inline-flex; gap: 5px; }
.pip {
  width: 9px; height: 9px;
  border-radius: 50%;
  border: 1px solid var(--accent);
}
.pip--on { background: var(--accent); }
.pip--off { background: transparent; border-color: rgba(20, 17, 15, .28); }

.clock-row { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.clock-row .bar { flex: 1 1 auto; }
.clock-n {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  min-width: 34px;
  text-align: right;
}

.daily-word { text-align: center; font-size: 34px; letter-spacing: -.025em; }
.daily-q { text-align: center; font-size: 15px; color: var(--muted); margin-top: 8px; }

.opts { display: grid; gap: 8px; margin-top: 8px; }

.fb-line {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  font-size: 15px;
  line-height: 1.5;
}
.fb-line b { font-weight: 700; }
.fb-line.is-no { border-top-color: rgba(163, 58, 34, .35); }

/* ---------- marks / daily end ---------- */

.marks { display: flex; gap: 8px; justify-content: center; margin-top: 8px; }
.mark {
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-size: 19px;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--muted);
}
.mark--ok { background: var(--accent-wash); border-color: rgba(44, 100, 72, .35); color: var(--ok); }
.mark--no { background: #F6E8E2; border-color: rgba(163, 58, 34, .3); color: var(--bad); }
.mark--pend { border-style: dashed; }

.grade {
  font-family: var(--serif);
  font-size: 34px;
  line-height: 1.12;
  letter-spacing: -.02em;
  text-align: center;
}

.review { margin-top: 8px; }
.rev {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  padding: 12px 0;
  border-top: 1px solid var(--rule-soft);
}
.rev-w { font-family: var(--serif); font-size: 18px; line-height: 1.25; }
.rev-m { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; align-self: center; }
.rev-m.ok { color: var(--ok); }
.rev-m.no { color: var(--bad); }
.rev-g { grid-column: 1 / -1; font-size: 14px; line-height: 1.5; color: var(--muted); }

/* ---------- chop chop ---------- */

.gcard {
  position: relative;
  width: 100%;
  display: grid;
  place-items: center;
  min-height: 220px;
  padding: 24px 16px;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: #FCF8F0;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  will-change: transform;
}
.gword {
  font-family: var(--serif);
  font-size: clamp(34px, 10vw, 46px);
  line-height: 1.05;
  letter-spacing: -.03em;
  text-align: center;
  text-wrap: balance;
  overflow-wrap: break-word;
}
.gside {
  position: absolute;
  top: 12px;
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: .55;
}
.gside.l { left: 16px; }
.gside.r { right: 16px; }
.gverdict {
  position: absolute;
  bottom: 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.gverdict.ok { color: var(--ok); }
.gverdict.no { color: var(--bad); }
.gcard[data-flash="ok"] { border-color: rgba(44, 100, 72, .55); }
.gcard[data-flash="no"] { border-color: rgba(163, 58, 34, .5); }

.ghint {
  text-align: center;
  font-size: 12px;
  letter-spacing: .06em;
  color: var(--muted);
}

.gbtn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gbtn {
  min-height: 64px;
  border: 1px solid rgba(20, 17, 15, .22);
  border-radius: 12px;
  background: transparent;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  display: grid;
  place-items: center;
  gap: 2px;
}
.gbtn span { display: block; font-size: 11px; letter-spacing: .1em; color: var(--muted); font-weight: 500; }
.gbtn.l { color: var(--bad); }
.gbtn.r { color: var(--ok); }
.gbtn:active { transform: scale(.985); }

.gscore {
  font-family: var(--serif);
  font-size: clamp(64px, 18vw, 84px);
  line-height: 1;
  letter-spacing: -.04em;
  text-align: center;
  font-variant-numeric: tabular-nums;
  margin-top: 8px;
}
.gscore .u { font-size: .3em; letter-spacing: .04em; color: var(--muted); margin-left: 6px; }
.best-badge {
  display: inline-block;
  margin: 8px auto 0;
  padding: 5px 10px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.best-badge[hidden] { display: none; }

/* ---------- table ---------- */

.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  table-layout: fixed;
}
.tbl col.c0 { width: 36%; }
.tbl th {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .03em;
  line-height: 1.35;
  text-transform: uppercase;
  color: var(--muted);
  text-align: right;
  padding: 0 0 8px 8px;
  white-space: normal;
  border-bottom: 1px solid var(--rule);
}
.tbl th:first-child { text-align: left; }
.tbl td {
  padding: 9px 0 9px 8px;
  border-bottom: 1px solid var(--rule-soft);
  text-align: right;
  color: var(--muted);
}
.tbl td:first-child { text-align: left; color: var(--ink); }
.tbl tr.now td { color: var(--ink); font-weight: 700; }
.tbl .up { color: var(--ok); }
.tbl .dn { color: var(--bad); }
.tbl .delta { font-size: 10.5px; }

.legend { margin-top: 10px; font-size: 12px; line-height: 1.5; color: var(--muted); }

/* ---------- stats / about ---------- */

.block { display: grid; gap: 12px; }
.block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}

.stat-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: baseline; padding: 4px 0; }
.stat-row span { font-size: 15px; color: var(--muted); }
.stat-row b { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }

.cover { display: grid; gap: 6px; }
.cover .bar i { transition: width 200ms ease; min-width: 6px; }

.ladder { display: grid; gap: 0; }
.ladder-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--rule-soft);
  font-size: 14px;
}
.ladder-row b { font-weight: 600; }
.ladder-row span { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ladder-row.you { color: var(--accent-dark); }
.ladder-row.you b { font-weight: 700; }

.list { display: grid; gap: 10px; padding-left: 18px; font-size: 15px; line-height: 1.5; }
.list li { padding-left: 2px; }

.about-h { margin-top: 8px; }

/* ---------- sheet ---------- */

.sheet-wrap {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  align-items: end;
  background: rgba(20, 17, 15, .34);
  animation: fadeIn 140ms ease-out both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  background: var(--paper);
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  padding: 24px var(--pad) calc(env(safe-area-inset-bottom) + 24px);
  display: grid;
  gap: 8px;
  animation: sheetIn 180ms cubic-bezier(.2, .9, .3, 1) both;
}
@keyframes sheetIn { from { transform: translateY(16px); opacity: .6; } to { transform: none; opacity: 1; } }

.sheet-h { font-family: var(--serif); font-size: 23px; line-height: 1.2; }
.sheet-p { font-size: 15px; line-height: 1.5; color: var(--muted); }
.sheet .actions { margin-top: 16px; }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 24px);
  transform: translate(-50%, 12px);
  z-index: 60;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  max-width: calc(100% - 48px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- error / noscript ---------- */

.error { justify-content: center; gap: 16px; text-align: left; }
.error .h1 { font-size: 30px; }
.build-line {
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.noscript {
  padding: 24px;
  max-width: 520px;
  margin: 0 auto;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  display: grid;
  gap: 8px;
}

/* ---------- selftest overlay ---------- */

.selftest {
  position: fixed;
  inset: 0;
  z-index: 99;
  overflow: auto;
  background: var(--paper);
  color: var(--ink);
  padding: 16px;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
}
.selftest b { font-weight: 700; }

/* ---------- narrow / short guards ---------- */

@media (max-height: 680px) {
  .card-zone { min-height: 160px; padding: 16px 0; gap: 16px; }
  .gcard { min-height: 170px; }
  .level-big { font-size: 52px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
