/* शब्दिका · छापाखाना (the print shop)
   Press-black ground, one printed proof sheet, metal sorts, inked impressions,
   rani-pink annotation ink reserved for what is under examination. */

/* Tokens live in tokens.css (loaded first). */

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--press);
  color: var(--on-press);
  font-family: var(--f-ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}
::selection { background: var(--rani); color: var(--on-rani); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--rani); outline-offset: 2px; }
.sr-only, .ime { position: absolute !important; top: 0; left: 0; margin: 0; padding: 0; border: 0; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; opacity: 0; pointer-events: none; }
.dev { font-family: var(--f-type); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- frame ---------- */
.app {
  height: 100dvh;
  max-width: 540px;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}

.top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 54px;
  padding: 0 8px;
}
.top-r { display: flex; justify-content: flex-end; gap: 2px; }
.icon-btn {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 0; border-radius: 10px;
  background: transparent; color: var(--on-press-2);
  cursor: pointer;
  transition: color .15s, background-color .15s;
}
.icon-btn svg { width: 24px; height: 24px; }
.icon-btn:hover { color: var(--on-press); background: var(--press-2); }
.icon-btn:active { background: var(--press-3); }

.mast {
  margin: 0;
  font-family: var(--f-mast);
  font-weight: 400;
  font-size: 34px;
  line-height: 1;
  letter-spacing: 0;
  color: var(--on-press);
  white-space: nowrap;
  padding-top: 4px;
}
.mast b { font-weight: 400; color: var(--rani); }
.mast a { color: inherit; text-decoration: none; border-radius: 6px; }
.mast a:hover b { color: #ff4d93; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 50; padding: 10px 14px; background: var(--paper); color: var(--ink); font-weight: 700; border-radius: 6px; text-decoration: none; }
.skip:focus { top: 8px; }

/* ---------- the proof sheet ---------- */
.press {
  min-height: 0;
  display: flex;
  padding: 6px 16px 14px;
}
.sheet {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  background: var(--paper);
  color: var(--ink);
  border-radius: 2px;
  padding: 10px 14px 8px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .6), 0 22px 34px -20px rgba(0, 0, 0, .9);
}
.sheet::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid var(--rule);
  pointer-events: none;
}
/* printer's crop marks just outside each corner */
.crop { position: absolute; width: 10px; height: 10px; pointer-events: none; }
.crop::before, .crop::after { content: ""; position: absolute; background: var(--press-4); }
.crop::before { width: 10px; height: 1px; }
.crop::after { width: 1px; height: 10px; }
.crop.tl { top: -12px; left: -12px; } .crop.tl::before { top: 11px; } .crop.tl::after { left: 11px; }
.crop.tr { top: -12px; right: -12px; } .crop.tr::before { top: 11px; right: 0; } .crop.tr::after { left: 0; }
.crop.bl { bottom: -12px; left: -12px; } .crop.bl::before { top: 0; } .crop.bl::after { left: 11px; top: 0; }
.crop.br { bottom: -12px; right: -12px; } .crop.br::before { top: 0; right: 0; } .crop.br::after { left: 0; top: 0; }

.slug {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  font-size: 13.5px;
  line-height: 1.2;
  color: var(--ink-2);
  padding: 0 4px;
}
.top-slug { font-weight: 700; color: var(--ink); }
.top-slug #slugTries { font-weight: 400; color: var(--ink-2); }
.bottom-slug { min-height: 36px; }
.bottom-slug #slugLen { margin-left: auto; }

.hint-btn {
  position: relative;
  border: 1px solid var(--rani);
  background: transparent;
  color: var(--rani-ink);
  font-weight: 700;
  font-size: 13.5px;
  border-radius: 999px;
  padding: 4px 13px;
  min-height: 30px;
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.hint-btn::before { content: ""; position: absolute; inset: -8px -6px; }
.hint-btn:hover { background: var(--rani); color: var(--on-rani); }
.hint-btn:disabled { opacity: .45; cursor: default; background: transparent; color: var(--rani-ink); }
.hint-btn[hidden] { display: none; }
.hint-note {
  margin: 4px 4px 0;
  padding: 6px 10px;
  font-size: 14px;
  line-height: 1.35;
  color: var(--rani-ink);
  border-top: 1px dashed rgba(214, 36, 111, .55);
  display: flex; flex-wrap: wrap; gap: 4px 14px;
}
.hint-note[hidden] { display: none; }
.hint-note b { font-weight: 700; }
.hint-note .dev { font-size: 18px; font-weight: 700; color: var(--ink); }

/* ---------- board ---------- */
.board {
  --tile: 52px;
  min-height: 0;
  display: grid;
  grid-template-rows: repeat(6, var(--tile));
  align-content: center;
  justify-content: center;
  gap: var(--gap);
  padding: 6px 2px;
}
.row {
  display: grid;
  grid-template-columns: repeat(var(--cols, 4), var(--tile));
  gap: var(--gap);
  position: relative;
}
.tile {
  position: relative;
  width: var(--tile);
  height: var(--tile);
  display: grid;
  place-items: center;
  font-family: var(--f-type);
  font-weight: 700;
  font-size: calc(var(--tile) * .5);
  line-height: 1;
  color: var(--ink);
  border-radius: 3px;
  /* empty slot: a faint blind impression */
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--rule);
  user-select: none;
}
.tile .glyph { display: block; padding-top: .14em; transform: translateZ(0); }
.tile.long { font-size: calc(var(--tile) * .38); }

/* metal sorts: typed but not yet printed */
.tile[data-state="sort"] {
  background: var(--metal-lo);
  box-shadow: inset 0 0 0 1px rgba(26, 24, 21, .28), 0 1px 2px rgba(26, 24, 21, .25);
}
.row.current .tile.active {
  background: #f0eee8;
  outline: 2px solid var(--rani);
  outline-offset: 3px;
}
.row.current .tile.next::after {
  content: "";
  position: absolute;
  left: 22%; right: 22%; bottom: 7px;
  height: 2px;
  background: var(--rani);
  animation: caret 1.1s steps(2, start) infinite;
}
@keyframes caret { to { visibility: hidden; } }

/* inked impressions */
.tile[data-state="correct"] {
  background: var(--correct);
  color: var(--on-correct);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2), inset 0 0 7px rgba(0, 0, 0, .22);
}
.tile[data-state="present"] {
  background: var(--present);
  color: var(--on-present);
  box-shadow: inset 0 0 0 4px var(--present), inset 0 0 0 5.5px var(--paper), inset 0 0 0 1px rgba(0, 0, 0, .2);
}
.tile[data-state="partial"] {
  background:
    radial-gradient(circle, var(--partial) 1.25px, transparent 1.55px) 0 0 / 6px 6px,
    var(--paper);
  color: var(--ink);
  box-shadow: inset 0 0 0 2px var(--partial);
}
.tile[data-state="partial"] .glyph {
  text-shadow: 0 0 2px var(--paper), 0 0 4px var(--paper), 0 0 6px var(--paper), 0 0 8px var(--paper);
}
/* blind: pressed without ink. A flat, uninked tone that still reads (3.2:1). */
.tile[data-state="absent"] {
  background: var(--paper-2);
  color: var(--blind-ink);
  box-shadow: inset 0 1px 2px rgba(26, 24, 21, .16);
}

/* motion: a sort dropping into the stick, a rejected row, the roller pass */
.tile.drop { animation: drop .16s var(--ease-out); }
@keyframes drop { from { transform: translateY(-5px) scale(1.06); } }
.row.shake { animation: shake .36s cubic-bezier(.36, .07, .19, .97); }
@keyframes shake {
  20%, 60% { transform: translateX(-7px); }
  40%, 80% { transform: translateX(7px); }
}
.tile.inked { animation: impress .32s var(--ease-out); }
@keyframes impress {
  0% { transform: scale(.9); filter: brightness(1.15); }
  60% { transform: scale(1.02); }
  100% { transform: none; filter: none; }
}
.row.rolling::after {
  content: "";
  position: absolute;
  top: -6px; bottom: -6px;
  left: -14px;
  width: 16px;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(26, 24, 21, 0), rgba(26, 24, 21, .9) 40%, #3a352f 60%, rgba(26, 24, 21, 0));
  filter: blur(.4px);
  animation: roll var(--roll-ms, 700ms) cubic-bezier(.45, 0, .4, 1) forwards;
  pointer-events: none;
}
@keyframes roll {
  from { transform: translateX(0); opacity: 1; }
  92% { opacity: 1; }
  to { transform: translateX(calc(var(--cols) * (var(--tile) + var(--gap)) + 12px)); opacity: 0; }
}
.tile.lift { animation: lift .55s var(--ease-out) both; }
@keyframes lift { 35% { transform: translateY(-9px); } }

/* ---------- toast: a printed slip ---------- */
.toast {
  position: absolute;
  left: 50%; top: 38px;
  z-index: 5;
  transform: translate(-50%, -6px);
  max-width: calc(100% - 28px);
  padding: 8px 16px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.3;
  text-align: center;
  border-radius: 3px;
  box-shadow: 0 8px 18px -6px rgba(0, 0, 0, .55);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .25s var(--ease-out);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- the type case ---------- */
.kb {
  background: var(--press-2);
  border-top: 1px solid #000;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
  padding: 8px 6px calc(10px + env(safe-area-inset-bottom));
  display: grid;
  gap: 7px;
  user-select: none;
  touch-action: manipulation;
}
.stick, .krow { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); gap: 4px; }
.case { display: grid; gap: 5px; }
.krow.last { grid-template-columns: 1.7fr repeat(6, minmax(0, 1fr)) 1.15fr 1.45fr; }

.stick {
  padding: 4px;
  border: 1.5px solid var(--rani);
  border-radius: 7px;
  background: var(--press);
}

.key {
  position: relative;
  min-width: 0;
  height: var(--key-h);
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 5px;
  padding: 0;
  background: linear-gradient(180deg, var(--key-hi), var(--key-lo));
  color: var(--ink);
  box-shadow: 0 2px 1.5px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .55);
  font-family: var(--f-type);
  font-weight: 700;
  font-size: clamp(16px, 2.7dvh, 21px);
  line-height: 1;
  cursor: pointer;
  transition: transform .08s, background-color .2s, color .2s, box-shadow .08s;
}
.key .kg { padding-top: .16em; white-space: nowrap; }
.key.down, .key:active { transform: translateY(1.5px); box-shadow: 0 .5px 1px rgba(0, 0, 0, .5); }
.key.long .kg { font-size: .78em; }
.key .kl {
  position: absolute;
  top: 2px; right: 3px;
  font-family: var(--f-ui);
  font-weight: 400;
  font-size: 11px;
  line-height: 1;
  color: var(--ink-2);
  display: none;
}
body.show-latin .key .kl { display: block; }
@media (hover: hover) { .key:hover { filter: brightness(1.05); } }

.case .key[data-state="correct"] { background: var(--correct); color: var(--on-correct); box-shadow: 0 2px 1.5px rgba(0, 0, 0, .55); }
.case .key[data-state="present"] { background: var(--present); color: var(--on-present); box-shadow: 0 2px 1.5px rgba(0, 0, 0, .55); }
.case .key[data-state="absent"] { background: var(--press-3); color: #a09789; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .5); }
.key[data-state="correct"] .kl, .key[data-state="absent"] .kl { color: inherit; opacity: .75; }

/* stick keys: darker compartments, glyphs in paper */
.stick .key {
  background: var(--press-3);
  color: var(--on-press);
  box-shadow: 0 1.5px 1px rgba(0, 0, 0, .6);
  font-size: clamp(15px, 2.5dvh, 20px);
}
.stick .key .kl { color: var(--on-press-2); }
.stick .key[data-state="correct"] { background: var(--correct); color: var(--on-correct); }
.stick .key[data-state="present"] { background: var(--present); color: var(--on-present); }
.stick .key[data-state="partial"] { background: var(--press-3); box-shadow: inset 0 0 0 2px var(--correct); }
.stick .key[data-state="absent"] { background: transparent; color: #8a8172; box-shadow: none; }
.stick.reset .key .kg { animation: set .22s var(--ease-out) both; }
.stick.reset .key:nth-child(2) .kg { animation-delay: 12ms; }
.stick.reset .key:nth-child(3) .kg { animation-delay: 24ms; }
.stick.reset .key:nth-child(4) .kg { animation-delay: 36ms; }
.stick.reset .key:nth-child(5) .kg { animation-delay: 48ms; }
.stick.reset .key:nth-child(6) .kg { animation-delay: 60ms; }
.stick.reset .key:nth-child(7) .kg { animation-delay: 72ms; }
.stick.reset .key:nth-child(8) .kg { animation-delay: 84ms; }
.stick.reset .key:nth-child(9) .kg { animation-delay: 96ms; }
.stick.reset .key:nth-child(10) .kg { animation-delay: 108ms; }
.stick.reset .key:nth-child(11) .kg { animation-delay: 120ms; }
@keyframes set { from { transform: translateY(-6px); opacity: 0; } }

.key.enter {
  background: var(--rani);
  color: var(--on-rani);
  box-shadow: 0 2px 1.5px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .25);
  font-family: var(--f-ui);
  font-weight: 700;
  font-size: 16px;
}
.key.del, .key.swap {
  background: var(--press-4);
  color: var(--on-press);
  box-shadow: 0 2px 1.5px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .08);
}
.key.del svg { width: 24px; height: 24px; }
.key.swap { display: grid; grid-template-rows: 1fr auto; place-items: center; padding: 3px 0 4px; }
.key.swap .kg { font-size: 19px; align-self: end; }
.key.swap .cap { font-family: var(--f-ui); font-weight: 400; font-size: 10.5px; line-height: 1; color: var(--on-press-2); }
.key.half { display: grid; grid-template-rows: 1fr auto; place-items: center; padding: 3px 0 4px; }
.key.half .kg { align-self: end; }
.key.half .cap { font-family: var(--f-ui); font-weight: 700; font-size: 10.5px; line-height: 1; color: var(--ink-2); }
.stick .key.half { box-shadow: inset 0 0 0 1.5px var(--rani), 0 1.5px 1px rgba(0, 0, 0, .6); }
.stick .key.half .cap { color: #ffb3d1; }
.seq { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 10px 0; }
.seq i { font-style: normal; color: var(--ink-2); }
.key-ex.hl { box-shadow: inset 0 0 0 2px var(--rani); }
.key.swap:disabled { opacity: .38; cursor: default; transform: none; }

/* ---------- sheets (dialog) ---------- */
.paper-sheet {
  border: 0;
  padding: 0;
  margin: auto auto 0;
  width: min(100%, 540px);
  max-height: min(92dvh, 860px);
  background: var(--paper);
  color: var(--ink);
  border-radius: 10px 10px 0 0;
  box-shadow: 0 -18px 40px -10px rgba(0, 0, 0, .6);
  overflow: auto;
  overscroll-behavior: contain;
  color-scheme: light;
  scrollbar-color: var(--rule) transparent;
}
.paper-sheet::backdrop { background: rgba(14, 12, 10, .62); }
.paper-sheet[open] { animation: rise .32s var(--ease-out); }
.paper-sheet[open]::backdrop { animation: fade .25s ease-out; }
.paper-sheet.closing { animation: sink .18s ease-in forwards; }
@keyframes rise { from { transform: translateY(36px); opacity: 0; } }
@keyframes sink { to { transform: translateY(28px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
@media (min-width: 620px) and (min-height: 640px) {
  .paper-sheet { margin: auto; border-radius: 4px; }
}
.sheet-body { position: relative; padding: 0 20px calc(22px + env(safe-area-inset-bottom)); }
.sheet-body::before { content: ""; position: absolute; inset: 7px; border: 1px solid var(--rule); pointer-events: none; border-radius: 2px; }
.sheet-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 0 -20px 6px;
  padding: 18px 14px 10px 24px;
  background: var(--paper);
}
.sheet-head h2 {
  margin: 0;
  font-family: var(--f-mast);
  font-weight: 400;
  font-size: 27px;
  line-height: 1.15;
  text-wrap: balance;
}
.sheet-head h2:focus { outline: none; }
.sheet-close {
  flex: none;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: transparent; color: var(--ink-2);
  cursor: pointer;
}
.sheet-close:hover { background: var(--paper-2); color: var(--ink); }
.sheet-close svg { width: 22px; height: 22px; }
.paper-sheet h3 { font-size: 18px; line-height: 1.3; margin: 0 0 4px; font-weight: 700; }
.paper-sheet p { margin: 0 0 10px; }
.muted { color: var(--ink-2); }
.credit { font-size: 12.5px; color: var(--ink-2); margin-top: 18px !important; padding: 0 4px; }

/* help panels */
.panels { list-style: none; margin: 0; padding: 0 4px; display: grid; gap: 18px; }
.panels li { display: grid; grid-template-columns: 32px 1fr; gap: 12px; align-items: start; }
.pn {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  font-weight: 700; font-size: 15px;
}
.pb { color: #3b362f; font-size: 15.5px; }
.pb p { margin: 6px 0; display: flex; gap: 10px; align-items: baseline; }
.sw { flex: none; display: inline-block; width: 18px; height: 18px; border-radius: 3px; transform: translateY(3px); }
.sw[data-state="correct"] { background: var(--correct); }
.sw[data-state="present"] { background: var(--present); box-shadow: inset 0 0 0 2px var(--present), inset 0 0 0 3px var(--paper); }
.sw[data-state="partial"] { background: radial-gradient(circle, var(--partial) 1px, transparent 1.3px) 0 0 / 4.5px 4.5px, var(--paper); box-shadow: inset 0 0 0 1.5px var(--partial); }
.sw[data-state="absent"] { background: var(--paper-2); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .2); }
.ex-row { display: flex; gap: 6px; margin: 10px 0 4px; }
/* a type-case key shown inside help text */
.key-ex {
  flex: none;
  display: inline-grid; place-items: center;
  min-width: 30px; height: 30px; padding: 0 4px;
  border-radius: 5px;
  font-family: var(--f-type); font-weight: 700; font-size: 17px; line-height: 1;
  background: #ddd7cb; color: var(--ink);
  box-shadow: 0 1.5px 1px rgba(0, 0, 0, .35);
}
.key-ex span { padding-top: .16em; }
.key-ex[data-state="present"] { background: var(--present); color: var(--on-present); }
.key-ex[data-state="correct"] { background: var(--correct); color: var(--on-correct); }
.pb .pair { white-space: nowrap; }
.pb code { font-family: var(--f-ui); font-weight: 700; background: var(--paper-2); padding: 0 4px; border-radius: 3px; }
.tile.mini { --tile: 44px; }

/* exploded akshar figure */
.figure { display: flex; flex-wrap: wrap; gap: 10px 14px; justify-content: center; margin: 12px 0 6px; color: var(--ink); }
.fig { display: grid; justify-items: center; min-width: 54px; }
.fig-ak { font-family: var(--f-type); font-weight: 700; font-size: 34px; line-height: 1.15; padding-top: .1em; }
.leader { width: 44px; height: 16px; color: var(--rani); }
.fig-parts { display: flex; align-items: baseline; gap: 3px; font-family: var(--f-type); font-size: 19px; font-weight: 600; }
.fig-parts i { font-style: normal; font-family: var(--f-ui); color: var(--ink-2); font-size: 14px; }
.fig-n { font-size: 11px; color: var(--ink-2); margin-top: 2px; letter-spacing: .04em; }
.fig-n::before { content: "चित्र "; }
html[lang="en"] .fig-n::before { content: "Fig. "; }
.fig-title { margin-top: 18px !important; text-align: center; font-size: 15px !important; color: var(--ink-2); font-weight: 400 !important; }

/* result proof */
.proof { text-align: center; padding: 4px 6px 2px; }
.proof .muted { margin: 0; font-size: 14px; }
.answer { font-size: clamp(48px, 15vw, 72px); font-weight: 800; line-height: 1.15; margin: 2px 0 6px !important; padding-top: .1em; }
.proof .roman, .proof .meaning { font-size: 17px; margin: 0 0 4px !important; }
.proof .roman span, .proof .meaning span { color: var(--ink-2); font-size: 14px; }
.proof .meaning { font-weight: 700; }
.share-grid {
  margin: 16px auto 10px;
  padding: 10px 14px;
  width: max-content; max-width: 100%;
  background: var(--paper-2);
  border-radius: 4px;
  font-family: var(--f-ui);
  font-size: 13.5px;
  line-height: 1.35;
  white-space: pre-wrap;
  color: var(--ink);
}
.next-daily { text-align: center; color: var(--ink-2); margin-top: 14px !important; }
.next-daily b { color: var(--ink); font-variant-numeric: tabular-nums; font-size: 18px; }

/* buttons */
.btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.btn {
  min-height: 48px;
  display: grid; place-items: center;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1.5px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font-weight: 700;
  font-size: 16px;
  line-height: 1.2;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: background-color .15s, transform .08s;
}
.btn:hover { background: var(--paper-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--rani); border-color: var(--rani); color: var(--on-rani); }
.btn.primary:hover { background: #bd1d61; }
.btn.ink { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn.ink:hover { background: #34302a; }
.link-btn {
  display: inline-block;
  margin: 8px auto 0;
  padding: 6px 4px;
  border: 0; background: none;
  color: var(--rani-ink);
  font-weight: 700;
  font-size: 15px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* stats */
.stat-block { padding: 6px 4px 14px; }
.stat-block + .stat-block { border-top: 1px solid var(--rule); padding-top: 16px; }
.nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0 14px; }
.nums div { display: grid; text-align: center; }
.nums dd { margin: 0; order: -1; font-family: var(--f-type); font-weight: 700; font-size: 30px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.nums dt { font-size: 12.5px; color: var(--ink-2); line-height: 1.25; }
.stat-block h4 { margin: 0 0 6px; font-size: 14px; color: var(--ink-2); font-weight: 400; }
.dist { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.dist li { display: grid; grid-template-columns: 18px 1fr; gap: 8px; align-items: center; }
.dn { font-weight: 700; font-size: 14px; text-align: right; font-variant-numeric: tabular-nums; }
.bar {
  width: var(--w); min-width: 26px;
  padding: 1px 8px;
  background: var(--ink-2); color: var(--paper);
  font-weight: 700; font-size: 13.5px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  border-radius: 2px;
}
.bar.hl { background: var(--correct); color: var(--on-correct); }

/* settings */
.set-list { display: grid; }
.set-row {
  display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center;
  padding: 14px 4px;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
}
.set-row span { display: grid; gap: 2px; }
.set-row b { font-size: 16.5px; }
.set-row small { font-size: 13.5px; color: var(--ink-2); line-height: 1.35; }
.set-row.disabled { opacity: .6; }
.set-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch {
  position: relative;
  width: 48px; height: 28px;
  border-radius: 999px;
  background: var(--rule);
  transition: background-color .2s;
}
.switch::after {
  content: "";
  position: absolute; top: 3px; left: 3px;
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
  transition: transform .22s var(--ease-out);
}
.set-row input:checked + .switch { background: var(--correct); }
.set-row input:checked + .switch::after { transform: translateX(20px); }
.set-row input:focus-visible + .switch { outline: 2px solid var(--rani); outline-offset: 2px; }
.seg { display: inline-flex; border: 1.5px solid var(--ink); border-radius: 7px; overflow: hidden; }
.seg button {
  border: 0; background: transparent; color: var(--ink);
  padding: 7px 13px; min-height: 40px;
  font-weight: 700; font-size: 15px; cursor: pointer;
}
.seg button + button { border-left: 1.5px solid var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.wide-seg { display: grid; grid-template-columns: repeat(3, 1fr); margin: 4px 0 14px; }

/* modes */
.mode-card {
  display: grid; gap: 2px;
  width: 100%;
  margin: 0 0 12px;
  padding: 14px 16px;
  text-align: left;
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
button.mode-card:hover { background: var(--paper-2); }
.mode-card[aria-pressed="true"] { border-color: var(--rani); box-shadow: inset 0 0 0 1px var(--rani); }
.mc-title { font-weight: 700; font-size: 18px; }
.mc-sub { color: var(--ink-2); font-size: 14.5px; }
.lens { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.mode-len {
  display: grid; justify-items: center; gap: 0;
  padding: 10px 4px 8px;
  border: 0; border-radius: 6px;
  background: var(--ink); color: var(--paper);
  cursor: pointer;
}
.mode-len b { font-family: var(--f-type); font-size: 28px; line-height: 1.1; }
.mode-len span { font-size: 14px; }
.mode-len small { font-size: 12px; color: #b9b0a1; }
.mode-len[aria-pressed="true"] { background: var(--rani); color: var(--on-rani); }
.mode-len[aria-pressed="true"] small { color: var(--on-rani); }
.mode-len:hover { filter: brightness(1.15); }

/* challenge */
.ch-picks { display: grid; gap: 8px; }
.ch-pick {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 10px 14px; min-height: 52px;
  border: 1.5px solid var(--ink); border-radius: 7px;
  background: transparent; color: var(--ink); text-align: left; cursor: pointer;
}
.ch-pick:hover { background: var(--paper-2); }
.ch-pick[aria-pressed="true"] { border-color: var(--rani); box-shadow: inset 0 0 0 1px var(--rani); background: #fbf3f6; }
.ch-pick .dev { font-size: 24px; font-weight: 700; padding-top: .1em; }
.ch-pick small { color: var(--ink-2); font-size: 13.5px; text-align: right; }
.ch-own { display: grid; gap: 6px; margin-top: 14px; font-size: 14.5px; color: var(--ink-2); }
.ch-own input {
  min-height: 48px; padding: 8px 12px;
  border: 1.5px solid var(--ink); border-radius: 7px;
  background: #fbf8f2; color: var(--ink);
  font-family: var(--f-type); font-size: 22px;
}
.ch-own input::placeholder { color: #8b8274; }
.ch-err { color: var(--rani-ink); font-weight: 700; margin-top: 8px !important; }
.ch-out { margin-top: 14px; padding: 12px; border: 1.5px dashed var(--rani); border-radius: 8px; }
.ch-out code { display: block; font-size: 12.5px; word-break: break-all; color: var(--ink-2); margin: 4px 0; }

/* ---------- small and short screens ---------- */
@media (max-height: 700px) {
  :root { --key-h: clamp(34px, 6.2dvh, 44px); --gap: 5px; }
  .top { height: 46px; }
  .mast { font-size: 28px; }
  .press { padding: 2px 12px 10px; }
  .sheet { padding: 6px 10px 4px; }
  .slug { min-height: 22px; font-size: 12.5px; }
  .bottom-slug { min-height: 30px; }
  .hint-btn { min-height: 26px; padding: 2px 11px; font-size: 12.5px; }
  .kb { gap: 5px; padding-top: 6px; }
  .case { gap: 4px; }
}
@media (max-width: 360px) {
  .kb { padding-left: 3px; padding-right: 3px; }
  .stick, .krow { gap: 3px; }
  .key { font-size: 16px; }
}
@media (min-width: 700px) {
  .app { max-width: 600px; }
  .press { padding: 10px 28px 22px; }
  .kb { border: 1px solid #000; border-bottom: 0; border-radius: 10px 10px 0 0; padding: 10px 10px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .row.current .tile.next::after { animation: none; }
}

/* announcement from the admin console */
.announce { position: fixed; z-index: 30; left: 50%; top: calc(56px + env(safe-area-inset-top)); transform: translateX(-50%); width: min(94vw, 520px);
  display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; border-radius: 8px; background: var(--rani); color: var(--on-rani);
  font-weight: 700; font-size: 14.5px; line-height: 1.35; box-shadow: 0 10px 24px -8px rgba(0, 0, 0, .6); }
.announce[hidden] { display: none; }
.announce a, .announce span { flex: 1; color: inherit; }
.announce button { flex: none; width: 36px; height: 36px; border: 0; border-radius: 6px; background: rgba(0, 0, 0, .18); color: inherit; font-size: 20px; cursor: pointer; }
/* feedback sheet */
.stars { display: flex; gap: 6px; margin: 4px 0 12px; }
.stars button { width: 46px; height: 46px; border: 1.5px solid var(--rule); border-radius: 8px; background: transparent; color: var(--rule); font-size: 24px; cursor: pointer; transition: color .15s, border-color .15s; }
.stars button[aria-checked="true"] { color: var(--present); border-color: var(--present); }
.ch-own textarea { min-height: 96px; padding: 10px 12px; border: 1.5px solid var(--ink); border-radius: 7px; background: #fbf8f2; color: var(--ink); font: 16px/1.5 var(--f-ui); resize: vertical; }
.fb-send, .fb-open { width: 100%; margin-top: 12px; }
.fb-done { margin-top: 10px !important; font-weight: 700; }
a.mode-card { text-decoration: none; }
