/* Off By One — graph-paper worksheet aesthetic */

:root {
  --paper: #fafbf8;
  --card: #ffffff;
  --grid: #d9e4ef;
  --ink: #1b2a41;
  --ink-soft: #46566e;
  --ink-faint: #8694a8;
  --pencil: #d03a2b;
  --pencil-soft: #e8d2cf;
  --truth: #2f7d52;
  --highlight: #f2b63b;
  --rule: #e2e8ee;
  --shadow: rgba(27, 42, 65, 0.1);
  --shadow-green: rgba(47, 125, 82, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0e1424;
    --card: #151e33;
    --grid: #1a2440;
    --ink: #e9eef7;
    --ink-soft: #afbcd3;
    --ink-faint: #65748d;
    --pencil: #e25445;
    --pencil-soft: #4a2622;
    --truth: #46a878;
    --highlight: #e5b23c;
    --rule: #28344e;
    --shadow: rgba(0, 0, 0, 0.45);
    --shadow-green: rgba(0, 0, 0, 0.45);
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--paper);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
  color: var(--ink);
  font-family: 'Atkinson Hyperlegible', sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

.wrap {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 20px;
}

main {
  flex: 1;
  padding-bottom: 48px;
}

.mono,
.kicker,
.chip,
.btn,
.result,
.pct,
.fine,
.countdown,
.wk,
.src,
.arch-meta,
.arch-res,
.tile span,
.hero-label,
.badge-stat {
  font-family: 'JetBrains Mono', monospace;
}

/* ---------- a11y ---------- */

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 8px 14px;
  z-index: 100;
}

.skip:focus {
  left: 8px;
}

:focus-visible {
  outline: 2.5px dashed var(--pencil);
  outline-offset: 3px;
  border-radius: 2px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* ---------- topbar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1.5px solid var(--ink);
}

.bar-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 4px;
  padding-bottom: 4px;
  gap: 4px;
}

.homelink {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding-right: 8px;
  white-space: nowrap;
}

.homelink span {
  font-size: 20px;
  line-height: 1;
  margin-right: 3px;
}

.homelink:hover {
  color: var(--pencil);
}

.logo {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 700;
  font-size: 21px;
  letter-spacing: -0.02em;
  color: var(--ink);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 4px;
  min-height: 44px;
  white-space: nowrap;
  margin-right: auto;
}

.logo sup {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.56em;
  font-weight: 500;
  color: var(--pencil);
  margin-left: 2px;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.topnav button {
  background: none;
  border: 1.5px solid transparent;
  border-radius: 6px;
  color: var(--ink-soft);
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.topnav button svg {
  width: 20px;
  height: 20px;
}

.topnav button:hover {
  color: var(--ink);
  border-color: var(--rule);
}

.topnav button.active {
  color: var(--pencil);
  border-color: var(--ink);
  box-shadow: 2.5px 2.5px 0 var(--shadow);
}

.chip {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  padding: 5px 10px 5px 7px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--card);
  box-shadow: 2.5px 2.5px 0 var(--shadow);
  margin-right: 4px;
  white-space: nowrap;
}

.chip b {
  margin-left: 3px;
}

/* ---------- shared ---------- */

.view {
  padding-top: 30px;
}

.kicker {
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-align: center;
  margin-bottom: 16px;
}

.kicker.sub {
  margin-top: 30px;
}

.sheet {
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  padding: 28px 26px;
  box-shadow: 8px 8px 0 var(--shadow);
  margin-bottom: 22px;
}

.q {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 600;
  font-size: clamp(22px, 4.6vw, 29px);
  line-height: 1.25;
  text-align: center;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}

.def {
  text-align: center;
  font-size: 13.5px;
  color: var(--ink-faint);
  font-style: italic;
  margin-bottom: 26px;
  max-width: 52ch;
  margin-left: auto;
  margin-right: auto;
}

.hint {
  text-align: center;
  font-size: 13px;
  color: var(--ink-faint);
  margin: 18px 0;
}

.hint b {
  color: var(--ink-soft);
}

.btn {
  display: block;
  width: 100%;
  min-height: 48px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 15px 18px;
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}

.btn.primary {
  background: var(--pencil);
  color: #fff;
  box-shadow: 5px 5px 0 var(--shadow);
}

.btn.ghost {
  background: transparent;
  color: var(--ink);
  box-shadow: 5px 5px 0 var(--shadow);
}

.btn:not(:disabled):hover {
  transform: translate(-1px, -1px);
  box-shadow: 6px 6px 0 var(--shadow);
}

.btn:not(:disabled):active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 var(--shadow);
}

.btn:disabled {
  background: var(--card);
  color: var(--ink-faint);
  border-color: var(--ink-faint);
  box-shadow: none;
  cursor: default;
}

.btn.mini {
  width: auto;
  min-width: 64px;
  min-height: 44px;
  font-size: 12px;
  padding: 7px 14px;
  background: var(--pencil);
  color: #fff;
  box-shadow: 3px 3px 0 var(--shadow);
  flex-shrink: 0;
}

.actions {
  display: grid;
  gap: 12px;
  margin: 4px 0 10px;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.actions.in {
  opacity: 1;
}

.fine {
  font-size: 12px;
  color: var(--ink-faint);
  text-align: center;
  letter-spacing: 0.04em;
  margin-top: 4px;
}

.fine.center {
  margin: 14px 0;
}

/* ---------- readout ---------- */

.readout {
  text-align: center;
  margin-bottom: 10px;
  min-height: 76px;
  transition: opacity 0.2s ease;
}

.readout.idle {
  opacity: 0.45;
}

.ro-sci {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(30px, 7vw, 40px);
  font-weight: 700;
  color: var(--pencil);
  letter-spacing: -0.01em;
}

.ro-human {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13.5px;
  color: var(--ink-soft);
  margin-top: 2px;
}

/* ---------- log slider ---------- */

.ls {
  touch-action: pan-y;
  padding: 6px 10px 0;
  border-radius: 6px;
}

.ls-rail {
  position: relative;
  height: 96px;
  cursor: grab;
}

.ls.dragging .ls-rail {
  cursor: grabbing;
}

.ls.locked .ls-rail {
  cursor: default;
  opacity: 0.85;
}

.ls-axis {
  position: absolute;
  left: 0;
  right: 0;
  top: 56px;
  height: 2.5px;
  background: var(--ink);
  border-radius: 2px;
}

.ls-tick {
  position: absolute;
  background: var(--ink);
  transform: translateX(-50%);
}

.ls-tick.major {
  top: 47px;
  width: 2px;
  height: 20px;
  transform-origin: bottom center;
}

.ls-tick.minor {
  top: 52px;
  width: 1.5px;
  height: 10px;
  background: var(--ink-faint);
}

.ls-tick.major.pulse {
  animation: tickpulse 0.32s ease-out;
}

@keyframes tickpulse {
  0% {
    transform: translateX(-50%) scaleY(1);
    background: var(--ink);
  }
  40% {
    transform: translateX(-50%) scaleY(1.9);
    background: var(--pencil);
  }
  100% {
    transform: translateX(-50%) scaleY(1);
    background: var(--ink);
  }
}

.ls-tlabel {
  position: absolute;
  top: 72px;
  transform: translateX(-50%);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13.5px;
  color: var(--ink-soft);
  white-space: nowrap;
  user-select: none;
}

.ls-tlabel sup {
  font-size: 0.9em;
  line-height: 0;
}

.ls-thumb {
  position: absolute;
  top: 8px;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
  width: 64px;
}

.ls-flag {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #fff;
  background: var(--pencil);
  border-radius: 4px;
  padding: 3px 9px;
  box-shadow: 2px 2px 0 var(--shadow);
}

.ls-stem {
  display: block;
  width: 2.5px;
  height: 22px;
  margin: 0 auto;
  background: var(--pencil);
}

.ls-dot {
  display: block;
  width: 13px;
  height: 13px;
  margin: -2px auto 0;
  background: var(--pencil);
  border: 2.5px solid var(--card);
  border-radius: 50%;
  box-shadow: 0 0 0 1.5px var(--pencil);
}

/* ---------- result ruler ---------- */
/* YOU hangs above the axis, TRUTH below it (and below the tick labels), so the
   two tags never collide however close the guess is. */

.rr {
  position: relative;
  height: 150px;
  margin: 6px 6px 4px;
}

.rr-axis {
  position: absolute;
  left: 0;
  right: 0;
  top: 56px;
  height: 2.5px;
  background: var(--ink);
  border-radius: 2px;
}

.rr-tick {
  position: absolute;
  top: 48px;
  width: 2px;
  height: 18px;
  background: var(--ink);
  transform: translateX(-50%);
}

.rr-tlabel {
  position: absolute;
  top: 70px;
  transform: translateX(-50%);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--ink-soft);
  white-space: nowrap;
  background: var(--card);
  padding: 0 2px;
  z-index: 2;
}

.rr-band {
  position: absolute;
  top: 56px;
  height: 2.5px;
  width: 0;
  background: repeating-linear-gradient(90deg, var(--highlight) 0 6px, transparent 6px 11px);
  transition: width 0.5s ease-out;
  z-index: 1;
}

.rr-band.in {
  width: var(--w);
}

.rr-marker {
  position: absolute;
  transform: translateX(-50%);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.rr-you {
  top: 8px;
}

.rr-truth {
  top: 56px;
}

.rr-flag {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.3;
  color: #fff;
  border-radius: 4px;
  padding: 3px 8px;
  white-space: nowrap;
  box-shadow: 2px 2px 0 var(--shadow);
}

.rr-stem {
  display: block;
  width: 2.5px;
}

.rr-pin {
  display: block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid var(--card);
}

.rr-you .rr-stem {
  height: 22px;
  background: var(--pencil);
}

.rr-you .rr-flag,
.rr-you .rr-pin {
  background: var(--pencil);
}

.rr-you .rr-pin {
  margin-top: -3px;
  box-shadow: 0 0 0 1.5px var(--pencil);
}

.rr-truth .rr-pin {
  background: var(--truth);
  box-shadow: 0 0 0 1.5px var(--truth);
  margin-top: -4.5px;
  position: relative;
  z-index: 3;
}

.rr-truth .rr-stem {
  height: 66px;
  background: var(--truth);
  margin-top: -2px;
}

.rr-truth .rr-flag {
  background: var(--truth);
}

.rr-truth {
  opacity: 0;
  translate: 0 -10px;
  transition: opacity 0.35s ease, translate 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.rr-truth.in {
  opacity: 1;
  translate: 0 0;
}

/* ---------- verdict ---------- */

.result {
  font-size: 14px;
  text-align: center;
  margin-top: 18px;
  letter-spacing: 0.04em;
}

.result b {
  color: var(--pencil);
  font-size: 17px;
}

.verdict {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 700;
  font-size: clamp(26px, 6vw, 34px);
  letter-spacing: 0.01em;
  text-align: center;
  margin-top: 14px;
  opacity: 0;
  scale: 0.9;
  transition: opacity 0.3s ease, scale 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.verdict.in {
  opacity: 1;
  scale: 1;
}

.verdict .swash {
  background: linear-gradient(transparent 58%, color-mix(in srgb, var(--highlight) 55%, transparent) 58% 92%, transparent 92%);
  padding: 0 6px;
}

.verdict.v-money .swash {
  background: linear-gradient(transparent 58%, color-mix(in srgb, var(--truth) 30%, transparent) 58% 92%, transparent 92%);
}

.verdict.v-universe .swash {
  background: linear-gradient(transparent 58%, color-mix(in srgb, var(--pencil) 28%, transparent) 58% 92%, transparent 92%);
}

.blurb {
  text-align: center;
  color: var(--ink-soft);
  font-size: 15px;
  margin-top: 8px;
  opacity: 0;
  transition: opacity 0.4s ease 0.1s;
}

.blurb.in {
  opacity: 1;
}

.pct {
  font-family: 'JetBrains Mono', monospace;
  text-align: center;
  margin-top: 14px;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.pct-head {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
}

.pct.tone-good .pct-head {
  color: var(--truth);
}

.pct-sub {
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 3px;
}

.pct.in {
  opacity: 1;
}

/* ---------- workings ---------- */

.workings {
  background: var(--card);
  border-left: 4px solid var(--highlight);
  border-top: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  border-radius: 0 6px 6px 0;
  padding: 20px 22px;
  margin-bottom: 22px;
  opacity: 0;
  translate: 0 10px;
  transition: opacity 0.45s ease, translate 0.45s ease;
}

.workings.in {
  opacity: 1;
  translate: 0 0;
}

.wk {
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 10px;
  font-weight: 700;
}

.workings .step {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13.5px;
  color: var(--ink-soft);
  padding: 7px 0;
  border-bottom: 1px dashed var(--rule);
  opacity: 0;
  translate: -6px 0;
  transition: opacity 0.35s ease, translate 0.35s ease;
}

.workings .step.in {
  opacity: 1;
  translate: 0 0;
}

.workings .step b {
  color: var(--ink);
}

.workings .step:last-of-type {
  border-bottom: none;
}

.workings .step:last-of-type b {
  color: var(--truth);
}

.src {
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  margin-top: 12px;
}

.src a {
  color: var(--ink-soft);
  text-decoration-color: var(--highlight);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.src a:hover {
  color: var(--ink);
}

.fun {
  font-size: 14px;
  font-style: italic;
  color: var(--ink-soft);
  margin-top: 12px;
}

.countdown {
  text-align: center;
  font-size: 12.5px;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  padding: 12px;
}

.countdown b {
  color: var(--ink);
}

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

.sheet.hero {
  text-align: center;
}

.hero-label {
  font-size: 12px;
  letter-spacing: 0.22em;
  color: var(--ink-faint);
  font-weight: 700;
}

.hero-n {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(56px, 14vw, 84px);
  font-weight: 700;
  color: var(--pencil);
  line-height: 1.1;
}

.hero-sub {
  font-size: 13px;
  color: var(--ink-soft);
  max-width: 40ch;
  margin: 0 auto;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}

.tiles.three {
  grid-template-columns: repeat(3, 1fr);
}

.tile {
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  box-shadow: 4px 4px 0 var(--shadow);
  text-align: center;
  padding: 14px 6px 10px;
}

.tile b {
  font-family: 'JetBrains Mono', monospace;
  font-size: 26px;
  display: block;
}

.tile span {
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
}

.spark {
  width: 100%;
  height: auto;
  display: block;
}

.sp-path {
  fill: none;
  stroke: var(--ink-soft);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.sp-dot {
  fill: var(--pencil);
}

.sp-money {
  fill: var(--truth);
}

.sp-line {
  stroke: var(--truth);
  stroke-width: 1.5;
  stroke-dasharray: 5 5;
  opacity: 0.7;
}

.sp-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  fill: var(--truth);
}

.badges {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.badge {
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  box-shadow: 4px 4px 0 var(--shadow);
  padding: 12px 14px;
}

.badge-name {
  font-weight: 700;
  font-size: 14.5px;
}

.badge-stat {
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 3px;
}

/* ---------- archive ---------- */

.arch-list {
  display: grid;
  gap: 10px;
}

.arch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  box-shadow: 4px 4px 0 var(--shadow);
  padding: 12px 16px;
}

.arch-meta {
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
}

.arch-q {
  font-size: 14.5px;
  color: var(--ink);
}

.arch-res {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  border: 1.5px solid var(--rule);
  border-radius: 4px;
  padding: 5px 9px;
  white-space: nowrap;
  flex-shrink: 0;
}

.arch-res.money {
  color: #fff;
  background: var(--truth);
  border-color: var(--truth);
}

.arch-tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 16px;
}

.arch-tab {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  min-height: 44px;
  padding: 0 14px;
  background: var(--card);
  color: var(--ink-soft);
  border: 1.5px solid var(--rule);
  border-radius: 6px;
  cursor: pointer;
}

.arch-tab.on {
  color: var(--ink);
  border-color: var(--ink);
  box-shadow: 3px 3px 0 var(--shadow);
}

.arch-more {
  margin-top: 16px;
}

.arch-text {
  min-width: 0;
}

/* ---------- modal ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--ink) 45%, transparent);
  display: grid;
  place-items: center;
  padding: 20px;
}

/* Dismissal toggles the [hidden] attribute; this author rule must beat the
   `.modal { display: grid }` above (which otherwise overrides the UA
   [hidden] rule, leaving the overlay permanently visible). */
.modal[hidden] {
  display: none;
}

.modal-panel {
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  box-shadow: 10px 10px 0 var(--shadow);
  max-width: 520px;
  width: 100%;
  max-height: 88svh;
  overflow: auto;
  padding: 30px 28px;
}

.modal-panel h2 {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 700;
  font-size: clamp(24px, 5vw, 30px);
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin-bottom: 18px;
}

.steps {
  list-style: none;
  counter-reset: step;
  margin-bottom: 16px;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding: 9px 0 9px 40px;
  color: var(--ink-soft);
  font-size: 15px;
  border-bottom: 1px dashed var(--rule);
}

.steps li:last-child {
  border-bottom: none;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 11px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  background: var(--pencil);
  border-radius: 6px;
}

.steps b {
  color: var(--ink);
}

.money-text {
  color: var(--truth);
}

.modal-foot {
  font-size: 13.5px;
  color: var(--ink-faint);
  margin-bottom: 20px;
}

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

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 16px);
  background: var(--ink);
  color: var(--paper);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  padding: 11px 18px;
  border-radius: 6px;
  box-shadow: 4px 4px 0 var(--shadow);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 60;
  pointer-events: none;
}

.toast.in {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- confetti ---------- */

.cf-wrap {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 70;
}

.cf {
  position: absolute;
  top: -4vh;
  display: block;
  animation: cf-fall linear forwards;
}

@keyframes cf-fall {
  to {
    transform: translateY(116vh) translateX(calc(var(--dx) * 140px)) rotate(620deg);
    opacity: 0.7;
  }
}

/* ---------- empty / footer ---------- */

.sheet.empty {
  text-align: center;
  color: var(--ink-soft);
}

.sheet.empty p {
  margin-bottom: 16px;
}

footer {
  border-top: 1.5px solid var(--ink);
  text-align: center;
  padding: 22px 16px 30px;
}

footer a {
  color: inherit;
  display: inline-block;
  padding: 10px 2px;
}

footer p {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-faint);
  letter-spacing: 0.08em;
}

/* ---------- small screens ---------- */

@media (max-width: 560px) {
  body {
    font-size: 16px;
    background-size: 24px 24px;
  }
  .wrap {
    padding: 0 14px;
  }
  .sheet {
    padding: 18px 14px;
    box-shadow: 6px 6px 0 var(--shadow);
  }
  .tiles {
    grid-template-columns: repeat(2, 1fr);
  }
  .tiles.three {
    grid-template-columns: repeat(3, 1fr);
  }
  .logo {
    font-size: 17px;
  }
  .logo sup {
    display: none;
  }
  .chip {
    font-size: 12px;
    padding: 4px 7px 4px 5px;
    margin-right: 2px;
  }
  .view {
    padding-top: 16px;
  }
  .kicker {
    margin-bottom: 10px;
  }
  .def {
    margin-bottom: 14px;
  }
  .hint {
    margin: 10px 0;
  }
}

/* phone held sideways: very little height, plenty of width */
@media (max-height: 520px) and (orientation: landscape) {
  .topbar {
    position: static;
  }
  .view {
    padding-top: 12px;
  }
  .kicker {
    margin-bottom: 8px;
  }
  .sheet {
    padding: 14px 18px;
    margin-bottom: 14px;
  }
  .q {
    font-size: 20px;
    margin-bottom: 4px;
  }
  .def {
    margin-bottom: 8px;
    font-size: 13px;
  }
  .readout {
    min-height: 0;
    margin-bottom: 0;
  }
  .ro-sci {
    font-size: 26px;
    display: inline;
  }
  .ro-human {
    display: inline;
    margin-left: 10px;
    font-size: 13px;
  }
  .ls-rail {
    height: 92px;
  }
  .hint {
    display: none;
  }
  .btn.primary {
    min-height: 44px;
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .verdict {
    font-size: 24px;
    margin-top: 8px;
  }
  .modal-panel {
    padding: 18px 22px;
    max-height: 94svh;
  }
  main {
    padding-bottom: 20px;
  }
  .wrap {
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }
}

.src a {
  display: inline-block;
  padding: 14px 2px;
  margin: -14px 0;
}

@media (max-width: 420px) {
  .topbar .wrap {
    padding-left: 6px;
    padding-right: 6px;
  }
  .homelink {
    padding-right: 4px;
  }
  .logo {
    font-size: 16px;
    padding: 0 2px;
  }
  .topnav {
    gap: 0;
  }
  .topnav .chip {
    margin-right: 0;
  }
  /* banked-freeze chip tucks in beside the streak instead of a second pill */
  #chip-freeze {
    border: 0;
    box-shadow: none;
    background: none;
    padding-left: 2px;
    padding-right: 4px;
  }
}
