/* The handwriting font is served from this site, so it loads fast on any network. */
@font-face {
  font-family: 'Caveat';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/caveat-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Caveat';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/caveat-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --paper: #fdfcf8;
  --ink: #171717;
  --red: #e0362c;
  --muted: #6f6b63;
  --wash: #f3f0e6;
  --hand: 'Caveat', 'Bradley Hand', 'Segoe Print', 'Comic Sans MS', cursive;
  --wobble: 255px 15px 225px 15px / 15px 225px 15px 255px;
  --wobble-2: 15px 225px 15px 255px / 255px 15px 225px 15px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { height: 100%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  /* at least the full screen, and free to grow: nothing gets squashed on short screens */
  min-height: 100%;
  min-height: 100dvh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  /* faint paper grain */
  background-image:
    radial-gradient(rgba(0, 0, 0, 0.035) 1px, transparent 1px),
    radial-gradient(rgba(0, 0, 0, 0.025) 1px, transparent 1px);
  background-size: 23px 23px, 37px 37px;
  background-position: 0 0, 11px 17px;
  color: var(--ink);
  font-family: var(--hand);
  font-size: 24px;
  line-height: 1.25;
  -webkit-tap-highlight-color: transparent;
}
/* no double-tap zoom delay on anything you can press */
button, a, input, select, .cells { touch-action: manipulation; }

.defs { position: absolute; }
a { color: inherit; }
b, strong { font-weight: 700; }
.muted { color: var(--muted); }
.center { text-align: center; }
.red { color: var(--red); }

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

.nav {
  flex-shrink: 0;
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 18px;
  padding: 8px 20px;
  min-height: 52px;
  background: var(--paper);
  border-bottom: 2.5px solid var(--ink);
  border-radius: 0 0 40px 12px / 0 0 6px 10px;
  animation: slide-down 0.5s ease both;
}
@keyframes slide-down { from { transform: translateY(-100%); opacity: 0; } }
.brand { font-size: 32px; font-weight: 700; text-decoration: none; line-height: 1; white-space: nowrap; }
.brand b { color: var(--red); }
.nav-links { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 18px; font-size: 23px; }
.nav-links a { text-decoration: none; position: relative; }
.nav-links a::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2.5px;
  background: var(--ink);
  border-radius: 50% 40% 60% 30%;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}
.nav-links a:hover::after, .nav-links a.current::after { transform: scaleX(1); }
.nav-links a.current::after { background: var(--red); }
.pool {
  margin-left: auto;
  padding: 0 12px 2px;
  font-size: 23px;
  white-space: nowrap;
  border: 2.5px solid var(--ink);
  border-radius: var(--wobble);
  background: var(--wash);
  transform: rotate(-1.5deg);
}
.pool b { color: var(--red); }
.who { color: var(--muted); display: inline-flex; align-items: baseline; gap: 6px; max-width: 46vw; white-space: nowrap; }
.who-email { overflow: hidden; text-overflow: ellipsis; }

/* the menu button only exists on small screens */
.menu-toggle {
  display: none;
  width: 46px;
  height: 42px;
  padding: 3px;
  background: var(--paper);
  border: 2.5px solid var(--ink);
  border-radius: var(--wobble-2);
  box-shadow: 2px 3px 0 var(--ink);
  cursor: pointer;
}
.menu-toggle svg { display: block; width: 100%; height: 100%; overflow: visible; }
.menu-toggle path { fill: none; stroke: var(--ink); stroke-width: 4; stroke-linecap: round; transition: transform 0.25s ease, opacity 0.2s ease; transform-origin: 20px 17px; }
.menu-toggle:focus-visible { outline: 3px dashed var(--red); outline-offset: 3px; }

@media (max-width: 820px) {
  .nav { padding: 6px 12px; gap: 4px 10px; flex-wrap: wrap; }
  .brand { font-size: 27px; }
  .pool { font-size: 20px; padding: 0 9px 2px; }
  .menu-toggle { display: block; animation: menu-shake 2s ease-in-out infinite; }
  .nav.open .menu-toggle { animation: none; background: var(--ink); }
  .nav.open .menu-toggle path { stroke: var(--paper); }
  /* the three bars become a cross */
  .nav.open .menu-toggle path:nth-child(1) { transform: translateY(10px) rotate(45deg); }
  .nav.open .menu-toggle path:nth-child(2) { opacity: 0; }
  .nav.open .menu-toggle path:nth-child(3) { transform: translateY(-10px) rotate(-45deg); }

  .nav-links { display: none; }
  /* the menu drops down over the page as its own sheet of paper */
  .nav.open .nav-links {
    position: absolute;
    top: calc(100% + 8px);
    left: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
    gap: 0;
    font-size: 27px;
    padding: 4px 16px 8px;
    background: var(--paper);
    border: 2.5px solid var(--ink);
    border-radius: var(--wobble);
    box-shadow: 5px 6px 0 var(--ink);
    animation: menu-open 0.3s cubic-bezier(0.3, 1.4, 0.5, 1) both;
  }
  .nav.open .nav-links > * { padding: 8px 2px 10px; text-align: left; }
  .nav.open .nav-links > * + * { border-top: 1.5px dashed rgba(23, 23, 23, 0.3); }
  .nav.open .nav-links a::after { display: none; }
  .nav.open .nav-links a.current { color: var(--red); font-weight: 700; }
  .who { max-width: none; }
}
/* a quick wiggle at the start of every 2 seconds, then still */
@keyframes menu-shake {
  0%, 22%, 100% { transform: rotate(0); }
  4% { transform: rotate(-11deg) scale(1.08); }
  9% { transform: rotate(10deg) scale(1.08); }
  14% { transform: rotate(-7deg); }
  18% { transform: rotate(4deg); }
}
@keyframes menu-open { from { opacity: 0; transform: translateY(-10px); } }
@media (max-width: 360px) {
  .brand { font-size: 23px; }
  .pool { font-size: 18px; padding: 0 7px 2px; }
}
@media (prefers-reduced-motion: reduce) {
  .menu-toggle { animation: none !important; }
}

.test-banner { flex-shrink: 0; background: var(--ink); color: var(--paper); text-align: center; font-size: 20px; padding: 1px 10px 3px; }

.linkish {
  font: inherit;
  color: var(--ink);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: wavy;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
}
.linkish:hover { color: var(--red); }

/* ---------- strokes ---------- */

.board-svg { display: block; width: 100%; height: auto; overflow: visible; }
.board-svg path, .underline path, .chart path {
  fill: none;
  stroke: var(--ink);
  stroke-linecap: round;
  stroke-linejoin: round;
}
.grid path { stroke-width: 5.5; }
.grid path.ghost { stroke-width: 2.5; opacity: 0.45; }
.mark-x-stroke { stroke-width: 8.5; }
.board-svg path.mark-o-stroke { stroke: var(--red); stroke-width: 8; }
.board-svg path.strike { stroke: var(--red); stroke-width: 13; opacity: 0.92; }
.board-svg path.strike.ghost { stroke-width: 5; opacity: 0.5; }

.mark { transform-box: fill-box; transform-origin: center; }
.mark.win { animation: wiggle 0.5s ease-in-out 3; }
@keyframes wiggle {
  0%, 100% { transform: rotate(0) scale(1); }
  30% { transform: rotate(-9deg) scale(1.14); }
  70% { transform: rotate(8deg) scale(1.14); }
}

.underline { display: block; width: 100%; height: 12px; margin-top: -4px; overflow: visible; }
.underline path { stroke-width: 3.5; stroke: var(--red); }

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

.screen {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 16px 26px;
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.screen.leaving { opacity: 0; transform: translateY(-14px) scale(0.98); }
.screen.entering { opacity: 0; transform: translateY(14px); }

/* ---------- intro ---------- */

.title {
  margin: 0;
  font-size: 128px; /* for browsers without clamp() */
  font-size: clamp(58px, 19vw, 128px);
  font-weight: 700;
  line-height: 1.05;
  text-align: center;
  white-space: nowrap;
}
/* Each word is uncovered left to right, as if being written. */
.word {
  display: inline-block;
  padding: 0 0.07em;
  -webkit-clip-path: inset(-20% 100% -20% -10%);
  clip-path: inset(-20% 100% -20% -10%);
}
.w1 { transform: rotate(-6deg); }
.w2 { transform: rotate(3deg); color: var(--red); }
.w3 { transform: rotate(-4deg); }
.ready .word { animation: write 0.75s cubic-bezier(0.5, 0.1, 0.3, 1) forwards; }
.ready .w1 { animation-delay: 0.1s; }
.ready .w2 { animation-delay: 0.6s; }
.ready .w3 { animation-delay: 1.1s; }
@keyframes write {
  to { -webkit-clip-path: inset(-20% -10% -20% -10%); clip-path: inset(-20% -10% -20% -10%); }
}
.title-underline { display: block; width: 100%; height: 0.2em; margin-top: -0.08em; overflow: visible; }
.title-underline path { fill: none; stroke: var(--ink); stroke-width: 6; stroke-linecap: round; }

#demo-board { width: 250px; width: min(56vw, 34vh, 250px); }

.tagline { margin: 4px 0 0; color: var(--muted); text-align: center; opacity: 0; transition: opacity 0.6s ease; }
.tagline.show { opacity: 1; }
.tagline b { color: var(--red); }

/* ---------- buttons and form fields ---------- */

.btn {
  font: 700 34px var(--hand);
  color: var(--ink);
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: var(--wobble);
  padding: 4px 44px 8px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  box-shadow: 3px 4px 0 var(--ink);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, color 0.15s ease, opacity 0.5s ease;
}
.btn.small { font-size: 27px; padding: 2px 26px 6px; }
.btn.tiny { font-size: 22px; padding: 0 14px 3px; border-width: 2.5px; box-shadow: 2px 3px 0 var(--ink); }
.btn.red { border-color: var(--red); color: var(--red); box-shadow: 3px 4px 0 var(--red); }
.btn:hover:not(:disabled) { background: var(--ink); color: var(--paper); transform: translate(-1px, -2px) rotate(-1deg); box-shadow: 5px 7px 0 var(--ink); }
.btn.red:hover:not(:disabled) { background: var(--red); color: var(--paper); box-shadow: 5px 7px 0 var(--red); }
.btn:active:not(:disabled) { transform: translate(2px, 3px); box-shadow: 0 0 0 var(--ink); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:focus-visible, .cells button:focus-visible, .linkish:focus-visible, a:focus-visible,
input:focus-visible, select:focus-visible { outline: 3px dashed var(--red); outline-offset: 3px; }

#play { opacity: 0; pointer-events: none; }
#play.show { opacity: 1; pointer-events: auto; animation: nudge 2.4s ease-in-out 1s infinite; }
@keyframes nudge {
  0%, 100% { transform: rotate(0); }
  50% { transform: rotate(-2deg) scale(1.05); }
}

.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.field { display: flex; flex-direction: column; gap: 2px; font-size: 22px; text-align: left; }
.field > span { color: var(--muted); }
input[type='text'], input[type='email'], input[type='password'], input[type='url'], input[type='file'], select, textarea {
  font: 500 25px var(--hand);
  color: var(--ink);
  background: #fff;
  border: 2.5px solid var(--ink);
  border-radius: var(--wobble-2);
  padding: 4px 14px 6px;
  width: 100%;
  min-width: 0;
}
input[type='file'] { font-size: 21px; padding: 8px 12px; }
input::file-selector-button {
  font: 700 21px var(--hand);
  color: var(--ink);
  background: var(--wash);
  border: 2px solid var(--ink);
  border-radius: var(--wobble);
  padding: 0 12px 2px;
  margin-right: 10px;
  cursor: pointer;
}
.error { color: var(--red); margin: 0; min-height: 0; font-weight: 700; }
.error:empty { display: none; }

/* ---------- cards and popups ---------- */

.card {
  position: relative;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: var(--wobble);
  box-shadow: 7px 8px 0 rgba(23, 23, 23, 0.9);
  padding: 20px 24px 26px;
}
.card h2 { margin: 0; font-size: 44px; line-height: 1.05; }
.card h3 { margin: 0; font-size: 32px; line-height: 1.1; }
.card p { margin: 0; }

.overlay {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 20;
  /* flex + auto margins centres the card but still lets a tall one scroll from its top */
  display: flex;
  padding: 14px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: rgba(253, 252, 248, 0.88);
  animation: fade 0.3s ease both;
}
@keyframes fade { from { opacity: 0; } }
.modal-card {
  margin: auto;
  width: 440px;
  max-width: 100%;
  width: min(94vw, 440px);
  animation: drop 0.45s cubic-bezier(0.3, 1.5, 0.5, 1) both;
}
.modal-card.wide { width: min(94vw, 620px); }
@keyframes drop { from { transform: translateY(30px) rotate(-3deg) scale(0.9); opacity: 0; } }
.close {
  position: absolute;
  top: 6px;
  right: 12px;
  font: 700 26px var(--hand);
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
}
.close:hover { color: var(--red); transform: rotate(90deg); transition: transform 0.2s ease; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 40;
  transform: translateX(-50%) rotate(-1deg);
  max-width: min(92vw, 520px);
  padding: 6px 22px 9px;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--wobble);
  text-align: center;
  animation: toast-in 0.35s cubic-bezier(0.3, 1.5, 0.5, 1) both;
}
@keyframes toast-in { from { transform: translate(-50%, 40px); opacity: 0; } }

/* choosing how to play */
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.choice {
  font: inherit;
  color: inherit;
  text-align: center;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: var(--wobble);
  padding: 12px 12px 16px;
  cursor: pointer;
  box-shadow: 4px 5px 0 var(--ink);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.choice:nth-child(2) { border-radius: var(--wobble-2); }
.choice:hover { transform: translate(-2px, -3px) rotate(-1deg); box-shadow: 7px 9px 0 var(--ink); }
.choice.prize { border-color: var(--red); box-shadow: 4px 5px 0 var(--red); }
.choice.prize:hover { box-shadow: 7px 9px 0 var(--red); }
.choice big { display: block; font-size: 40px; font-weight: 700; line-height: 1.05; }
.choice.prize big { color: var(--red); }
.choice small { display: block; font-size: 21px; color: var(--muted); line-height: 1.15; margin-top: 4px; }
.rules { margin: 0; padding-left: 26px; font-size: 22px; }
.rules li::marker { content: '✕  '; color: var(--red); font-weight: 700; }

/* ---------- game ---------- */

.scorebar {
  width: min(94vw, 500px);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}
.side { display: flex; align-items: baseline; gap: 10px; }
.side.right { justify-content: flex-end; }
.name { font-size: 28px; font-weight: 700; line-height: 1; }
.mark-o { color: var(--red); }
.points { font-size: 50px; font-weight: 700; line-height: 0.9; }
.points.bump { animation: pop 0.5s cubic-bezier(0.3, 1.7, 0.5, 1); }
.side.right .points { color: var(--red); }
@keyframes pop { from { transform: scale(0.3) rotate(-20deg); } }
.round { font-size: 24px; color: var(--muted); text-align: center; line-height: 1.05; }
.round small { display: block; font-size: 19px; }
.badge-prize { color: var(--red); font-weight: 700; }

.board-wrap { position: relative; width: 92vw; max-width: 500px; width: min(92vw, 60vh, 500px); }
.cells {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  display: grid;
  grid-template-columns: repeat(var(--n, 6), 1fr);
  grid-template-rows: repeat(var(--n, 6), 1fr);
}
.cells button {
  border: 0;
  background: transparent;
  padding: 0;
  font: 500 clamp(26px, 8vw, 46px) var(--hand);
  color: var(--ink);
  cursor: default;
}
.cells.open button:not(.taken) { cursor: pointer; }
.cells.open button:not(.taken)::after { content: '✕'; opacity: 0; transition: opacity 0.15s ease; }
@media (hover: hover) {
  .cells.open button:not(.taken):hover::after { opacity: 0.14; }
}

.status { margin: 2px 0 0; min-height: 1.3em; font-size: 29px; font-weight: 700; text-align: center; }
.status.thinking::after {
  content: '';
  display: inline-block;
  width: 1.2em;
  text-align: left;
  animation: dots 1s steps(4, end) infinite;
}
@keyframes dots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}

.timer { width: min(80vw, 320px); height: 9px; border: 2px solid var(--ink); border-radius: var(--wobble); overflow: hidden; }
.timer span { display: block; height: 100%; width: 100%; background: var(--ink); transform-origin: left; }
.timer.low span { background: var(--red); }
.timer.low { animation: shake 0.4s linear infinite; }
@keyframes shake { 25% { transform: translateX(-2px) rotate(-0.6deg); } 75% { transform: translateX(2px) rotate(0.6deg); } }

/* ---------- end of match and the ad ---------- */

.end-card { text-align: center; }
.end-card h2 { font-size: 56px; }
.end-card.lost h2 { color: var(--red); }
.end-score { font-size: 46px; font-weight: 700; }
.prize-note {
  margin: 10px 0 !important;
  padding: 6px 14px 9px;
  border: 2.5px dashed var(--red);
  border-radius: var(--wobble-2);
  transform: rotate(-1deg);
}

.burst { position: absolute; left: 50%; top: 40%; pointer-events: none; }
.burst span { position: absolute; font-size: 30px; font-weight: 700; animation: fly 1.3s cubic-bezier(0.15, 0.7, 0.3, 1) both; }
@keyframes fly {
  from { transform: translate(-50%, -50%) scale(0.3); opacity: 1; }
  to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(var(--rot)) scale(1); opacity: 0; }
}

.ad-card { text-align: center; }
.ad-frame {
  margin: 10px 0;
  border: 3px solid var(--ink);
  border-radius: 14px 18px 12px 20px / 18px 12px 20px 14px;
  overflow: hidden;
  background: #000;
  display: grid;
  place-items: center;
  transform: rotate(-0.6deg);
}
.ad-frame img, .ad-frame video { display: block; width: 100%; max-height: 46vh; object-fit: contain; }
.ad-label { font-size: 20px; color: var(--muted); letter-spacing: 0.5px; }

/* ---------- pages (ads, algorithm, admin) ---------- */

.page { flex: 1; width: min(94vw, 980px); margin: 0 auto; padding: 22px 0 60px; }
.page.narrow { width: min(94vw, 760px); }
.page h1 { display: inline-block; margin: 0 0 6px; font-size: 62px; line-height: 1; }
.page h2 { margin: 30px 0 8px; font-size: 40px; line-height: 1.05; width: -webkit-fit-content; width: fit-content; }
.page > p, .lead { max-width: 62ch; }
.lead { font-size: 27px; margin: 6px 0 14px; }
.rise { animation: rise 0.6s cubic-bezier(0.2, 0.8, 0.3, 1) both; }
.rise:nth-child(2) { animation-delay: 0.07s; }
.rise:nth-child(3) { animation-delay: 0.14s; }
.rise:nth-child(4) { animation-delay: 0.21s; }
.rise:nth-child(5) { animation-delay: 0.28s; }
.rise:nth-child(n + 6) { animation-delay: 0.35s; }
@keyframes rise { from { opacity: 0; transform: translateY(18px) rotate(0.8deg); } }

.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 22px; }
.grid-cards > .card:nth-child(even) { border-radius: var(--wobble-2); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; }
.tile {
  background: #fff;
  border: 2.5px solid var(--ink);
  border-radius: var(--wobble);
  padding: 6px 14px 10px;
  box-shadow: 4px 5px 0 var(--ink);
}
.tile:nth-child(even) { border-radius: var(--wobble-2); transform: rotate(0.6deg); }
.tile:nth-child(3n) { transform: rotate(-0.7deg); }
.tile span { display: block; color: var(--muted); font-size: 21px; line-height: 1.1; }
.tile b { display: block; font-size: 42px; line-height: 1.05; }
.tile.hot b { color: var(--red); }
.tile small { color: var(--muted); font-size: 19px; }

.badge {
  display: inline-block;
  padding: 0 10px 2px;
  font-size: 20px;
  font-weight: 700;
  border: 2px solid var(--ink);
  border-radius: var(--wobble);
  transform: rotate(-2deg);
  white-space: nowrap;
}
.badge.good { background: var(--ink); color: var(--paper); }
.badge.warn { border-color: var(--red); color: var(--red); }
.badge.dim { border-style: dashed; color: var(--muted); border-color: var(--muted); }

.thumb {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 56.25%; /* 16:9, done the way old phones understand */
  border: 2.5px solid var(--ink);
  border-radius: 12px 16px 10px 18px / 16px 10px 18px 12px;
  overflow: hidden;
  background: #111;
  margin: 8px 0;
}
.thumb img, .thumb video { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: contain; display: block; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; text-align: center; margin: 6px 0; }
.stats b { display: block; font-size: 34px; line-height: 1; }
.stats span { font-size: 19px; color: var(--muted); line-height: 1.05; display: block; }

.chart { width: 100%; height: 70px; overflow: visible; display: block; }
.chart path.bar { stroke-width: 7; }
.chart path.axis { stroke-width: 2; }
.chart-note { font-size: 18px; color: var(--muted); }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 22px; }
th { text-align: left; color: var(--muted); font-weight: 500; border-bottom: 2.5px solid var(--ink); padding: 2px 10px; white-space: nowrap; }
td { padding: 5px 10px; border-bottom: 1.5px dashed rgba(23, 23, 23, 0.3); vertical-align: middle; }
td.num, th.num { text-align: right; }

.steps { counter-reset: step; display: grid; gap: 14px; padding: 0; list-style: none; }
.steps li { position: relative; padding-left: 58px; }
.steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: -2px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 28px;
  border: 2.5px solid var(--ink);
  border-radius: 58% 42% 55% 45% / 48% 58% 42% 52%;
  padding-bottom: 4px;
}
.steps li:nth-child(even)::before { border-color: var(--red); color: var(--red); transform: rotate(8deg); }

pre.code {
  font: 13.5px/1.55 ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  background: #fff;
  border: 2.5px solid var(--ink);
  border-radius: 12px 18px 10px 20px / 18px 10px 20px 12px;
  box-shadow: 6px 7px 0 var(--ink);
  padding: 16px 18px;
  overflow: auto;
  max-height: 75vh;
  tab-size: 2;
}

.empty { border: 2.5px dashed var(--muted); border-radius: var(--wobble); padding: 18px; text-align: center; color: var(--muted); }

@media (max-width: 560px) {
  body { font-size: 21px; }
  .name { font-size: 23px; }
  .points { font-size: 40px; }
  .status { font-size: 25px; }
  .choices { grid-template-columns: 1fr; }
  .page h1 { font-size: 48px; }
  .end-card h2 { font-size: 46px; }
  .card { padding: 16px 16px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0s !important; transition-duration: 0.01ms !important; }
}

.narrow-card { max-width: 440px; }
.stack > .btn { align-self: center; }
.choice:focus-visible, .close:focus-visible { outline: 3px dashed var(--red); outline-offset: 3px; }
.modal-card:focus { outline: none; }

/* ---------- loading ring ---------- */
.progress-card { align-items: center; text-align: center; padding: 10px 0 4px; }
.progress-ring { width: 130px; height: 130px; overflow: visible; }
.progress-ring path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.progress-ring .track { stroke: var(--wash); stroke-width: 9; }
.progress-ring .ring { stroke: var(--ink); stroke-width: 9; transition: stroke-dashoffset 0.35s ease; }
.progress-ring.finished .ring { stroke: var(--red); }
.progress-ring .tick { stroke: var(--red); stroke-width: 10; }
.progress-ring.spin { animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress-text { font-size: 30px; font-weight: 700; margin: 0; }

/* ---------- advertiser extras ---------- */
.row.spread { justify-content: space-between; }
.stats.four { grid-template-columns: repeat(4, 1fr); }
.updates { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.updates li { padding: 2px 0 6px 14px; border-left: 3px solid var(--wash); }
.updates li.new { border-left-color: var(--red); }
.nav-item { display: inline-flex; align-items: center; gap: 6px; }
.dot {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px 2px;
  font-size: 18px;
  font-weight: 700;
  color: var(--paper);
  background: var(--red);
  border-radius: 58% 42% 55% 45% / 48% 58% 42% 52%;
  animation: pop 0.5s cubic-bezier(0.3, 1.7, 0.5, 1) both;
}
@media (max-width: 560px) {
  .stats.four { grid-template-columns: repeat(2, 1fr); gap: 12px 6px; }
  .grid-cards { grid-template-columns: 1fr; }
}

/* ---------- admin ---------- */
.admin-nav .nav-links a { padding: 0 2px; }
.admin-tag { font-size: 20px; color: var(--muted); margin-left: 8px; font-weight: 500; }
.admin-login { flex: 1; display: grid; place-items: center; padding: 20px 16px; }
.admin-login .card { width: min(92vw, 420px); animation: drop 0.45s cubic-bezier(0.3, 1.5, 0.5, 1) both; }
.admin-login h1 { margin: 0 0 4px; font-size: 50px; line-height: 1; text-align: center; }
.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 18px; }
.setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 20px;
  padding: 12px 0;
  border-bottom: 1.5px dashed rgba(23, 23, 23, 0.3);
}
.setting:last-child { border-bottom: 0; }
.setting > div:first-child { flex: 1 1 280px; }
.setting p { margin: 0; }
.setting input[type='text'] { width: 170px; }
/* a hand-drawn on/off switch */
.switch {
  position: relative;
  width: 78px;
  height: 40px;
  flex: none;
  background: #fff;
  border: 2.5px solid var(--ink);
  border-radius: var(--wobble);
  cursor: pointer;
  transition: background 0.2s ease;
}
.switch::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 5px;
  width: 27px;
  height: 27px;
  background: var(--ink);
  border-radius: 58% 42% 55% 45% / 48% 58% 42% 52%;
  transition: transform 0.25s cubic-bezier(0.3, 1.5, 0.5, 1), background 0.2s ease;
}
.switch[aria-checked='true'] { background: var(--ink); }
.switch[aria-checked='true']::after { transform: translateX(36px) rotate(40deg); background: var(--red); }
.switch:focus-visible { outline: 3px dashed var(--red); outline-offset: 3px; }
.switch:disabled { opacity: 0.5; cursor: wait; }
.quick { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
