/* food-guessr design system
   Warm, appetising, playful. A recipe card meets a game show.
   Mobile first. Both themes via prefers-color-scheme. */

/* ---------- tokens ---------- */

:root {
  color-scheme: light dark;

  --bg: #fff6ec;
  --bg-deep: #f6e5d2;
  --surface: #ffffff;
  --surface-2: #fffaf3;
  --sunk: #f6ebe0;
  --ink: #2a1a11;
  --ink-soft: #715746;
  --line: #ecd9c6;
  --line-strong: #dcc1a8;

  --brand: #d4482a;
  --brand-deep: #ab3519;
  --brand-soft: #fde6df;
  --on-brand: #fff8f4;

  --accent: #e3960d;
  --accent-soft: #fdefd2;

  --good: #1f7a4d;
  --good-soft: #dff4e8;
  --bad: #b8242b;
  --bad-soft: #fbe2e2;

  --shadow-1: 0 1px 2px rgb(88 48 24 / 0.08), 0 2px 8px rgb(88 48 24 / 0.06);
  --shadow-2: 0 2px 4px rgb(88 48 24 / 0.08), 0 12px 28px rgb(88 48 24 / 0.12);
  --shadow-pop: 0 10px 30px rgb(168 60 24 / 0.28);

  /* type scale */
  --t-2xs: 0.6875rem;
  --t-xs: 0.78125rem;
  --t-sm: 0.875rem;
  --t-md: 1rem;
  --t-lg: 1.1875rem;
  --t-xl: 1.5rem;
  --t-2xl: 2rem;
  --t-3xl: 2.75rem;
  --t-4xl: 4.5rem;

  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: var(--sans);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

  /* space */
  --s1: 0.25rem;
  --s2: 0.5rem;
  --s3: 0.75rem;
  --s4: 1rem;
  --s5: 1.5rem;
  --s6: 2rem;
  --s7: 3rem;

  --r-sm: 0.5rem;
  --r-md: 0.875rem;
  --r-lg: 1.25rem;
  --r-xl: 1.75rem;
  --r-pill: 999px;

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-back: cubic-bezier(0.34, 1.56, 0.64, 1);
  --fast: 140ms;
  --mid: 260ms;
  --slow: 480ms;

  --tabbar-h: 0rem;
  --wrap: 62rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17100b;
    --bg-deep: #100a06;
    --surface: #221811;
    --surface-2: #2a1d15;
    --sunk: #1b120c;
    --ink: #f8ece0;
    --ink-soft: #c0a794;
    --line: #3a281d;
    --line-strong: #4e3728;

    --brand: #ff7f5c;
    --brand-deep: #ff9d80;
    --brand-soft: #3a1b12;
    --on-brand: #2a0f07;

    --accent: #f8bd4a;
    --accent-soft: #3a2a0e;

    --good: #55d497;
    --good-soft: #10331f;
    --bad: #ff7b79;
    --bad-soft: #3a1414;

    --shadow-1: 0 1px 2px rgb(0 0 0 / 0.4), 0 2px 8px rgb(0 0 0 / 0.3);
    --shadow-2: 0 2px 4px rgb(0 0 0 / 0.4), 0 12px 28px rgb(0 0 0 / 0.5);
    --shadow-pop: 0 10px 30px rgb(0 0 0 / 0.6);
  }
}

/* ---------- reset ---------- */

* { box-sizing: border-box; }
* { -webkit-tap-highlight-color: transparent; }

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

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--t-md) / 1.55 var(--sans);
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--display);
  font-weight: 750;
  letter-spacing: -0.025em;
  line-height: 1.12;
  text-wrap: balance;
}

h1 { font-size: var(--t-2xl); }
h2 { font-size: var(--t-xl); }
h3 { font-size: var(--t-lg); }

p { margin: 0 0 var(--s3); text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

a { color: var(--brand); text-underline-offset: 0.2em; }

img { max-width: 100%; display: block; }

/* A display rule from a utility class must never beat hidden. */
[hidden] { display: none !important; }

button, input, select, textarea { font: inherit; color: inherit; }

ul, ol { margin: 0; padding: 0; list-style: none; }

:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

.skip {
  position: absolute; left: var(--s3); top: -4rem; z-index: 60;
  background: var(--surface); color: var(--ink);
  padding: var(--s2) var(--s4); border-radius: var(--r-md);
  box-shadow: var(--shadow-2); transition: top var(--fast) var(--ease);
}
.skip:focus { top: var(--s3); }

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

.shell {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.main {
  flex: 1;
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: var(--s4) var(--s4) calc(env(safe-area-inset-bottom) + var(--s7));
}

.main--flush { padding-left: 0; padding-right: 0; }

/* One bar, the same at every size: logo, two words, your picture. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s2) var(--s3);
  padding-top: calc(var(--s2) + env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  min-height: 2.75rem;
  padding: 0 var(--s2) 0 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: var(--t-lg);
  letter-spacing: -0.03em;
  color: var(--ink);
  text-decoration: none;
  border-radius: var(--r-pill);
}
.brand .dot {
  width: 1.75rem; height: 1.75rem;
  border-radius: var(--r-pill);
  background: radial-gradient(circle at 32% 28%, var(--accent), var(--brand) 70%);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--brand-deep) 40%, transparent);
  flex: none;
}
.brand em { font-style: normal; color: var(--brand); }
.brand[aria-current="page"] .dot { box-shadow: inset 0 0 0 2px var(--brand-deep), 0 0 0 3px var(--brand-soft); }

.topnav { display: flex; gap: var(--s1); margin-left: auto; }

.topnav a {
  display: inline-flex; align-items: center;
  min-height: 2.75rem; padding: 0 var(--s3);
  border-radius: var(--r-pill);
  color: var(--ink-soft); text-decoration: none;
  font-weight: 650; font-size: var(--t-sm);
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.topnav a:hover { background: var(--sunk); color: var(--ink); }
.topnav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-deep); }

.avatar-btn {
  position: relative;
  display: inline-grid; place-items: center;
  width: 2.75rem; height: 2.75rem;
  flex: none;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  text-decoration: none;
}
.avatar-btn[aria-current="page"] { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.avatar-btn .badge {
  position: absolute; top: -0.25rem; right: -0.25rem;
  min-width: 1.15rem; height: 1.15rem; padding: 0 0.22rem;
  border-radius: var(--r-pill);
  background: var(--brand); color: var(--on-brand);
  font-size: 0.625rem; font-weight: 800; line-height: 1.15rem; text-align: center;
  border: 2px solid var(--bg);
}

@media (min-width: 52rem) {
  .topbar { padding: var(--s3) var(--s5); }
  .topnav { margin-left: var(--s4); margin-right: auto; }
}

/* ---------- primitives ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}

.card--pad { padding: var(--s4); }

.eyebrow {
  font-size: var(--t-2xs);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.muted { color: var(--ink-soft); }
.nums { font-variant-numeric: tabular-nums; }

.stack { display: flex; flex-direction: column; gap: var(--s4); }
.stack--tight { gap: var(--s2); }
.row { display: flex; align-items: center; gap: var(--s2); }
.row--wrap { flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 2.75rem;
  padding: 0.6rem var(--s4);
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  font-size: var(--t-sm);
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--fast) var(--ease), background var(--fast) var(--ease),
    box-shadow var(--fast) var(--ease), opacity var(--fast) var(--ease);
}
.btn svg { width: 1.15rem; height: 1.15rem; flex: none; }
.btn--lg svg { width: 1.35rem; height: 1.35rem; }
.btn:active { transform: translateY(1px) scale(0.985); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.btn[disabled]:active { transform: none; }

.btn--primary {
  background: linear-gradient(170deg, var(--brand) 0%, var(--brand-deep) 100%);
  color: var(--on-brand);
  box-shadow: var(--shadow-pop);
}
.btn--ghost { border-color: var(--line-strong); background: transparent; color: var(--ink); }
.btn--quiet { background: var(--sunk); color: var(--ink); }
.btn--good { background: var(--good); color: #fff; }
.btn--bad { background: var(--bad); color: #fff; }
@media (prefers-color-scheme: dark) {
  .btn--good, .btn--bad { color: #160d08; }
}

.btn--lg { min-height: 3.5rem; font-size: var(--t-lg); padding: 0 var(--s6); border-radius: var(--r-pill); }
.btn--block { width: 100%; }

.pill {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border-radius: var(--r-pill);
  background: var(--sunk);
  color: var(--ink-soft);
  font-size: var(--t-xs);
  font-weight: 700;
}
.pill--brand { background: var(--brand-soft); color: var(--brand-deep); }
.pill--good { background: var(--good-soft); color: var(--good); }
.pill--bad { background: var(--bad-soft); color: var(--bad); }

.avatar {
  border-radius: var(--r-pill);
  background: var(--sunk);
  object-fit: cover;
  flex: none;
  aspect-ratio: 1;
}
.avatar--sm { width: 1.75rem; height: 1.75rem; }
.avatar--md { width: 2.25rem; height: 2.25rem; }
.avatar--lg { width: 4rem; height: 4rem; }
.avatar--xl { width: 5.5rem; height: 5.5rem; }

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--s3); margin-bottom: var(--s3);
}

/* ---------- landing ---------- */

.landing { position: relative; min-height: 100dvh; display: grid; place-items: center; padding: var(--s5); }

.wall {
  position: absolute; inset: 0; z-index: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr));
  gap: 6px;
  filter: blur(14px) saturate(1.2);
  opacity: 0.55;
  overflow: hidden;
}
.wall > * { aspect-ratio: 1; border-radius: var(--r-md); }
.wall::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 8%, var(--bg) 78%);
}

.landing-card {
  position: relative; z-index: 1;
  max-width: 26rem; width: 100%;
  padding: var(--s6) var(--s5);
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-2);
}
.landing-card h1 { font-size: var(--t-2xl); margin-bottom: var(--s2); }
.landing-card .lede { color: var(--ink-soft); margin-bottom: var(--s5); }

.discord-btn {
  background: #5865f2;
  color: #fff;
  box-shadow: 0 10px 24px rgb(88 101 242 / 0.35);
}
.discord-btn svg { width: 1.4rem; height: 1.4rem; }

.landing-stats { display: flex; justify-content: center; gap: var(--s5); margin-top: var(--s5); }
.landing-stats div { text-align: center; }
.landing-stats b { display: block; font-size: var(--t-xl); font-weight: 780; letter-spacing: -0.03em; }
.landing-stats span { font-size: var(--t-xs); color: var(--ink-soft); }

/* ---------- home / play start ---------- */

.hero {
  position: relative;
  overflow: hidden;
  padding: var(--s6) var(--s5);
  border-radius: var(--r-xl);
  background:
    radial-gradient(120% 90% at 12% 0%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 62%),
    linear-gradient(160deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
  text-align: center;
}
.hero h1 { font-size: clamp(2rem, 8vw, 2.75rem); margin-bottom: var(--s2); }
.hero .lede { color: var(--ink-soft); max-width: 30ch; margin: 0 auto var(--s5); }

.tickets { display: flex; justify-content: center; gap: 0.4rem; margin-bottom: var(--s5); }
.tickets i {
  width: 0.7rem; height: 0.7rem; border-radius: var(--r-pill);
  background: var(--line-strong); display: block;
}

.statgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
  gap: var(--s3);
}
.stat {
  padding: var(--s3) var(--s4);
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
}
.stat b { display: block; font-size: var(--t-xl); font-weight: 780; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat span { font-size: var(--t-xs); color: var(--ink-soft); }

/* ---------- play: full screen photo, game on top ---------- */

/* Playing takes the whole screen. The app chrome is hidden and the page
   does not scroll: the sheet scrolls instead. */
body.is-playing { overflow: hidden; }
body.is-playing .topbar { display: none; }
body.is-playing .main { padding: 0; max-width: none; }
body.is-playing .toasts { bottom: calc(env(safe-area-inset-bottom) + var(--s3)); z-index: 80; }

.immersive {
  position: fixed;
  inset: 0;
  z-index: 10;
  overflow: hidden;
  background: hsl(var(--tint-h) var(--tint-s) 5%);
  color: #fdf4ec;
}

.photo-layer {
  position: absolute;
  inset: 0;
  cursor: zoom-in;
  touch-action: none;
}
.photo-layer[data-zoomed="1"] { cursor: grab; }
.photo-layer[data-zoomed="1"] .photo { padding: 0; }
/* A blurred copy of the same photo is a kinder letterbox than flat black. */
.photo-blur {
  position: absolute;
  inset: -10%;
  width: 120%;
  height: 120%;
  object-fit: cover;
  filter: blur(46px) saturate(1.35) brightness(0.42);
  transform: scale(1.06);
}
.photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: padding var(--mid) var(--ease);
  padding: 3.5rem 0 var(--s4);
  padding-top: calc(3.5rem + env(safe-area-inset-top));
}
/* With the sheet open the photo sits in the space above it. */
.immersive:has(.sheet[data-state="open"]) .photo {
  padding-bottom: 52dvh;
}

.hud-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s2) var(--s3);
  padding-top: calc(var(--s2) + env(safe-area-inset-top));
  background: linear-gradient(180deg, hsl(var(--tint-h) var(--tint-s) 6% / 0.78), transparent);
}
.hud-top .pips { flex: 1; }
.hud-top .pips i { background: rgb(255 255 255 / 0.3); }
.hud-top .count {
  font-size: var(--t-xs);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  color: rgb(255 255 255 / 0.85);
}

.hud-btn {
  display: grid; place-items: center;
  width: 2.75rem; height: 2.75rem;
  flex: none;
  border: 0; border-radius: var(--r-pill);
  background: rgb(255 255 255 / 0.14);
  color: #fff;
  text-decoration: none;
  font-size: var(--t-md);
  cursor: pointer;
}
.hud-btn:hover { background: rgb(255 255 255 / 0.24); }

.hud-tags {
  position: absolute;
  left: var(--s3); right: var(--s3);
  top: calc(3.6rem + env(safe-area-inset-top));
  z-index: 2;
  display: flex; gap: var(--s2); flex-wrap: wrap;
  pointer-events: none;
}
.hud-tags .pill {
  background: rgb(10 6 4 / 0.6);
  color: #fff8f2;
  backdrop-filter: blur(6px);
}

.pips { display: flex; gap: 0.35rem; align-items: center; }
.pips i {
  width: 100%; max-width: 2.5rem; height: 0.3rem;
  border-radius: var(--r-pill);
  background: var(--line-strong);
  transition: background var(--mid) var(--ease), transform var(--mid) var(--ease-back);
}
.pips i[data-state="good"] { background: var(--good); }
.pips i[data-state="bad"] { background: var(--bad); }
.pips i[data-state="now"] { background: #fff; transform: scaleY(1.9); }

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

/* Tinted from the photo. Only the hue moves: lightness stays with the
   theme, so contrast holds whatever colour the food is. */
.immersive { --tint-h: 24; --tint-s: 30%; }

.cand-filter { position: sticky; top: 0; z-index: 2; padding-bottom: var(--s2); background: inherit; }
.cand-filter input {
  width: 100%;
  min-height: 2.75rem;
  padding: 0 var(--s3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--t-sm);
}
.cand-filter input:focus { border-color: var(--brand); }
.grid-candidates[data-empty="1"]::after {
  content: "No match";
  grid-column: 1 / -1;
  padding: var(--s3);
  text-align: center;
  color: var(--ink-soft);
  font-size: var(--t-sm);
}

.sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  max-height: 62dvh;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  background: color-mix(in srgb, var(--surface) 88%, hsl(var(--tint-h) var(--tint-s) 50% / 0.16));
  backdrop-filter: blur(24px) saturate(1.5);
  border-top: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  box-shadow: 0 -8px 40px rgb(0 0 0 / 0.45);
  color: var(--ink);
  padding-bottom: env(safe-area-inset-bottom);
}

.sheet-handle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  min-height: 2.75rem;
  padding: var(--s2) var(--s4) var(--s1);
  border: 0;
  background: transparent;
  cursor: pointer;
  flex: none;
}
.sheet-handle .grip {
  width: 2.25rem; height: 0.25rem;
  border-radius: var(--r-pill);
  background: var(--line-strong);
}
.sheet-head {
  display: flex;
  align-items: center;
  gap: var(--s2);
  width: 100%;
}
.sheet-title {
  flex: 1;
  text-align: left;
  font-family: var(--display);
  font-weight: 750;
  font-size: var(--t-md);
  letter-spacing: -0.02em;
  color: var(--ink);
}

/* Three guesses, worth 3, 2 then 1. */
.attempts { display: inline-flex; gap: 0.3rem; align-items: center; flex: none; }
.attempts i {
  width: 0.5rem; height: 0.5rem; border-radius: var(--r-pill);
  background: var(--brand);
  transition: background var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.attempts i[data-used="1"] { background: var(--line-strong); transform: scale(0.72); }

.points-badge {
  flex: none;
  display: grid; place-items: center;
  min-width: 1.85rem; height: 1.85rem;
  padding: 0 0.35rem;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: #26170a;
  font-family: var(--display);
  font-weight: 820;
  font-size: var(--t-sm);
  font-variant-numeric: tabular-nums;
}

.points-line {
  margin: 0;
  flex: none;
  font-family: var(--display);
  font-weight: 820;
  font-size: var(--t-xl);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.verdict--good .points-line { color: var(--good); }
.verdict--bad .points-line { color: var(--ink-soft); }
.verdict-who { flex: 1; min-width: 0; }
.verdict-who h2 { overflow: hidden; text-overflow: ellipsis; }

.hud-top .count .of { opacity: 0.55; }

.sheet-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: var(--s2) var(--s4) 0;
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  transition: max-height var(--mid) var(--ease), opacity var(--fast) var(--ease), padding var(--mid) var(--ease);
}

.sheet[data-state="peek"] .sheet-body {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  overflow: hidden;
}

.sheet-foot {
  flex: none;
  padding: var(--s3) var(--s4) var(--s4);
}

/* ---------- candidates ---------- */

.grid-candidates {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(3.9rem, 1fr));
  gap: 0.4rem;
}
@media (min-width: 40rem) {
  .grid-candidates { grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr)); gap: var(--s2); }
}

.cand {
  display: flex; flex-direction: column; align-items: center; gap: 0.2rem;
  min-height: 4.4rem;
  padding: 0.3rem 0.15rem;
  border: 2px solid transparent;
  border-radius: var(--r-md);
  background: var(--surface);
  cursor: pointer;
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease),
    transform var(--fast) var(--ease-back), box-shadow var(--fast) var(--ease), opacity var(--mid) var(--ease);
}
.cand img { width: 2.25rem; height: 2.25rem; border-radius: var(--r-pill); background: var(--sunk); }
.cand span {
  font-size: 0.625rem; font-weight: 650; line-height: 1.1;
  text-align: center; color: var(--ink-soft);
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  word-break: break-word;
}
.cand:hover { border-color: var(--line-strong); }
.cand[aria-pressed="true"] {
  border-color: var(--brand);
  background: var(--brand-soft);
  transform: translateY(-2px);
  box-shadow: var(--shadow-pop);
}
.cand[aria-pressed="true"] span { color: var(--brand-deep); font-weight: 800; }

/* A miss: the avatar shakes, then greys out and stops being pickable. */
.cand[data-out="1"] {
  opacity: 0.32;
  pointer-events: none;
  background: transparent;
}
.cand[data-out="1"] img { filter: grayscale(1); }
.cand.is-missed { animation: cand-miss var(--slow) var(--ease) both; }

@keyframes cand-miss {
  0% { transform: translateX(0); border-color: var(--bad); opacity: 1; }
  15% { transform: translateX(-6px); }
  30% { transform: translateX(6px); }
  45% { transform: translateX(-4px); }
  60% { transform: translateX(3px); }
  100% { transform: none; border-color: transparent; }
}

/* ---------- reveal ---------- */

.verdict {
  display: flex; align-items: center; gap: var(--s4);
  padding: var(--s3) var(--s4);
  border-radius: var(--r-lg);
  border: 2px solid;
}
.verdict--good { background: var(--good-soft); border-color: var(--good); }
.verdict--bad { background: var(--bad-soft); border-color: var(--bad); }
.verdict h2 { font-size: var(--t-lg); }
.verdict--good h2 { color: var(--good); }
.verdict--bad h2 { color: var(--bad); }
.verdict .who { display: flex; align-items: center; gap: var(--s2); margin-top: var(--s1); font-weight: 700; font-size: var(--t-sm); color: var(--ink); }

.flip {
  position: relative; flex: none;
  width: 3.5rem; height: 3.5rem;
  animation: flip-in var(--slow) var(--ease-back) both;
}
.flip img { width: 100%; height: 100%; border-radius: var(--r-pill); }
.flip::after {
  content: ""; position: absolute; inset: -5px;
  border-radius: var(--r-pill);
  border: 3px solid currentColor;
}
.verdict--good .flip { color: var(--good); }
.verdict--bad { animation: shake var(--slow) var(--ease) both; }
.verdict--bad .flip { color: var(--bad); }

@keyframes flip-in {
  from { transform: rotateY(-180deg) scale(0.6); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-9px); }
  30% { transform: translateX(8px); }
  45% { transform: translateX(-6px); }
  60% { transform: translateX(4px); }
  80% { transform: translateX(-2px); }
}

.burst { position: absolute; inset: -1.5rem; pointer-events: none; }
.burst i {
  position: absolute; top: 50%; left: 50%;
  width: 0.4rem; height: 0.4rem; border-radius: var(--r-pill);
  background: var(--accent);
  animation: burst var(--slow) var(--ease) both;
}
@keyframes burst {
  from { transform: translate(-50%, -50%) scale(0.4); opacity: 1; }
  to { transform: translate(var(--bx), var(--by)) scale(0); opacity: 0; }
}

/* The trail of guesses on a reveal. */
.trail { display: flex; gap: var(--s2); align-items: center; padding: 0; }
.trail li { position: relative; }
.trail img { width: 1.75rem; height: 1.75rem; border-radius: var(--r-pill); filter: grayscale(1); opacity: 0.55; }
.trail li[data-hit="1"] img { filter: none; opacity: 1; box-shadow: 0 0 0 2px var(--good); }
.trail li span {
  position: absolute; right: -2px; bottom: -2px;
  width: 0.9rem; height: 0.9rem; border-radius: var(--r-pill);
  display: grid; place-items: center;
  background: var(--ink); color: var(--bg);
  font-size: 0.5rem; font-weight: 800;
}

.reveal-meta {
  display: flex; align-items: center; gap: var(--s2);
  margin: 0; font-size: var(--t-xs); color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.reveal-meta a { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: var(--r-pill); background: var(--sunk); color: var(--ink-soft); }
.reveal-meta a:hover { color: var(--brand); }
.reveal-meta svg { width: 1rem; height: 1rem; }

.dish-line {
  margin: 0; text-align: center;
  font-family: var(--display); font-weight: 750; font-size: var(--t-md);
  letter-spacing: -0.02em; color: var(--brand);
}

.panel {
  padding: var(--s3) var(--s4);
  border-radius: var(--r-md);
  background: var(--sunk);
}

.breakdown li {
  display: grid;
  grid-template-columns: 1.75rem 1fr auto;
  align-items: center;
  gap: var(--s2);
  padding: 0.3rem 0;
}
.breakdown img { width: 1.75rem; height: 1.75rem; border-radius: var(--r-pill); }
.breakdown .track { position: relative; height: 1.5rem; border-radius: var(--r-pill); background: var(--surface); overflow: hidden; }
.breakdown .fill {
  position: absolute; inset: 0 auto 0 0;
  border-radius: var(--r-pill);
  background: var(--line-strong);
  transition: width var(--slow) var(--ease);
}
.breakdown .fill[data-poster="1"] { background: linear-gradient(90deg, var(--good), color-mix(in srgb, var(--good) 65%, var(--accent))); }
.breakdown .name {
  position: absolute; inset: 0; display: flex; align-items: center;
  padding: 0 var(--s3); font-size: var(--t-xs); font-weight: 700;
  color: var(--ink);
}
.breakdown .n { font-size: var(--t-xs); font-weight: 750; color: var(--ink-soft); font-variant-numeric: tabular-nums; min-width: 1.25rem; text-align: right; }

.caption {
  margin: 0;
  padding: var(--s2) var(--s3);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: var(--accent-soft);
  font-size: var(--t-sm);
  font-style: italic;
}

.photo-tools { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
.star, .flag {
  min-width: 2.5rem; min-height: 2.5rem;
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: var(--r-pill);
  background: var(--surface); cursor: pointer;
  font-size: var(--t-md); color: var(--ink-soft);
}
.star[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.flag:disabled { opacity: 0.45; }
.tag {
  display: inline-flex; align-items: center;
  min-height: 2.5rem; padding: 0 var(--s3);
  border-radius: var(--r-pill);
  background: var(--sunk); color: var(--ink-soft);
  font-size: var(--t-xs); font-weight: 700; text-decoration: none;
}
.tag:hover { color: var(--brand); }
.tag::before { content: "#"; opacity: 0.5; margin-right: 0.15rem; }

.tag-row { display: contents; }
.tag--chip { padding-right: 0.2rem; gap: 0.15rem; }
.tag--chip a { color: inherit; text-decoration: none; }
.tag-x {
  width: 1.5rem; height: 1.5rem; display: grid; place-items: center;
  border: 0; border-radius: var(--r-pill); background: transparent;
  color: var(--ink-soft); cursor: pointer; font-size: var(--t-md); line-height: 1;
}
.tag-x:hover { background: var(--bad-soft); color: var(--bad); }
.tag-input {
  min-height: 2.5rem; width: 6rem;
  padding: 0 var(--s3);
  border: 1px dashed var(--line-strong); border-radius: var(--r-pill);
  background: transparent; color: var(--ink); font-size: var(--t-xs);
}
.tag-input:focus { border-style: solid; border-color: var(--brand); }

.tile-star {
  position: absolute; top: var(--s2); right: var(--s2); z-index: 1;
  color: var(--accent); font-size: var(--t-md);
  text-shadow: 0 1px 4px rgb(0 0 0 / 0.6);
}

.reactions { display: flex; gap: var(--s2); flex-wrap: wrap; }
.react {
  display: inline-flex; align-items: center; gap: 0.3rem;
  min-height: 2.5rem; padding: 0 var(--s3);
  border: 1px solid var(--line); border-radius: var(--r-pill);
  background: var(--surface); cursor: pointer;
  font-size: var(--t-sm); font-weight: 700;
}
.react:hover { border-color: var(--line-strong); background: var(--surface-2); }
.react .n { color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* ---------- desktop: photo beside the panel ---------- */

@media (min-width: 52rem) {
  .immersive {
    display: grid;
    grid-template-columns: 1fr 24rem;
  }
  .photo-layer { position: relative; grid-column: 1; grid-row: 1; }
  .photo { padding: var(--s6); }
  .immersive:has(.sheet[data-state="open"]) .photo { padding-bottom: var(--s6); }
  .hud-top { right: 24rem; }
  .hud-tags { right: calc(24rem + var(--s3)); }
  .sheet {
    position: relative;
    grid-column: 2; grid-row: 1;
    max-height: none;
    height: 100dvh;
    border-radius: 0;
    border-top: 0;
    border-left: 1px solid var(--line);
    backdrop-filter: none;
    background: var(--bg);
  }
  /* No dragging on desktop, but the title and the attempts stay. */
  .sheet-handle { cursor: default; padding-top: var(--s5); }
  .sheet-handle .grip { display: none; }
  .sheet-title { font-size: var(--t-lg); }
  .sheet-body { padding-top: var(--s4); }
  .sheet[data-state="peek"] .sheet-body { max-height: none; opacity: 1; padding-top: var(--s5); overflow-y: auto; }
}

/* ---------- result ---------- */

.result { text-align: center; display: flex; flex-direction: column; gap: var(--s5); padding-top: var(--s5); }


.score-dial {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  width: 11rem; height: 11rem; margin: 0 auto;
  border-radius: var(--r-pill);
  background:
    radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--accent) 35%, transparent), transparent 70%),
    var(--surface);
  border: 3px solid var(--brand);
  box-shadow: var(--shadow-pop);
  animation: pop var(--slow) var(--ease-back) both;
}
.score-dial b {
  font-family: var(--display);
  font-size: var(--t-4xl); font-weight: 820; line-height: 1;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
  color: var(--brand);
}
.score-dial span { font-size: var(--t-sm); font-weight: 700; color: var(--ink-soft); margin-top: 0.2rem; }

@keyframes pop {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.verdict-line { font-size: var(--t-xl); font-weight: 780; letter-spacing: -0.02em; }
.verdict-sub { color: var(--ink-soft); font-size: var(--t-sm); }

.recap { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--s2); }
@media (max-width: 26rem) { .recap { grid-template-columns: repeat(3, 1fr); } }

.recap-item { display: flex; flex-direction: column; gap: 0.3rem; text-align: center; }
.recap-item .shot {
  position: relative; aspect-ratio: 1; border-radius: var(--r-md);
  overflow: hidden; border: 2px solid;
}
.recap-item img { width: 100%; height: 100%; object-fit: cover; }
.recap-item[data-ok="1"] .shot { border-color: var(--good); }
.recap-item[data-ok="0"] .shot { border-color: var(--bad); }
.recap-item .mark {
  position: absolute; right: 2px; bottom: 2px;
  width: 1.4rem; height: 1.4rem; border-radius: var(--r-pill);
  display: grid; place-items: center; font-size: 0.75rem; font-weight: 900; color: #fff;
  font-variant-numeric: tabular-nums;
}
.recap-item[data-ok="1"] .mark { background: var(--good); }
.recap-item[data-ok="0"] .mark { background: var(--bad); }
.recap-item small { font-size: var(--t-2xs); color: var(--ink-soft); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.confetti i {
  position: absolute; top: -5vh;
  width: 0.55rem; height: 0.85rem; border-radius: 2px;
  animation: fall 2.6s linear both;
}
@keyframes fall {
  to { transform: translateY(115vh) rotate(720deg); opacity: 0; }
}

/* ---------- upload ---------- */

.drop {
  position: relative;
  display: grid; place-items: center; gap: var(--s3);
  min-height: 14rem;
  padding: var(--s5);
  text-align: center;
  border: 2px dashed var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease);
}
.drop:hover, .drop.is-over { border-color: var(--brand); background: var(--brand-soft); }
.drop svg { width: 2.5rem; height: 2.5rem; color: var(--brand); }
.drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* the upload queue */
.queue {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
  gap: var(--s2);
}
@media (min-width: 40rem) {
  .queue { grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr)); }
}

.qitem {
  position: relative;
  aspect-ratio: 1;
  min-height: 5.5rem;
  padding: 0;
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: var(--r-md);
  background: var(--sunk);
  cursor: pointer;
  transition: border-color var(--fast) var(--ease), opacity var(--mid) var(--ease);
}
.qitem img { width: 100%; height: 100%; object-fit: cover; }
.qitem[data-state="working"] { border-color: var(--accent); }
.qitem[data-state="working"]::after {
  content: "";
  position: absolute; left: 0; bottom: 0; height: 0.25rem;
  width: var(--p, 0%);
  background: var(--accent);
  transition: width var(--fast) linear;
}
.qitem[data-state="done"] { border-color: var(--good); }
.qitem[data-state="done"] img { opacity: 0.55; }
.qitem[data-state="failed"] { border-color: var(--bad); }

.qmark {
  position: absolute; top: 0.25rem; right: 0.25rem;
  min-width: 1.4rem; height: 1.4rem; padding: 0 0.25rem;
  display: grid; place-items: center;
  border-radius: var(--r-pill);
  font-size: 0.75rem; font-weight: 900; color: #fff;
  background: rgb(20 12 8 / 0.5);
}
.qitem[data-state="done"] .qmark { background: var(--good); }
.qitem[data-state="failed"] .qmark { background: var(--bad); }
.qitem[data-state="working"] .qmark { background: var(--accent); color: #26170a; }
.qitem[data-state="waiting"] .qmark { display: none; }

.qname, .qerr {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: var(--s3) 0.3rem 0.25rem;
  background: linear-gradient(0deg, rgb(20 12 8 / 0.82), transparent);
  color: #fff8f2; font-size: 0.625rem; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.qerr { color: #ffd9d9; }

.queue-count {
  margin: 0;
  font-size: var(--t-sm);
  font-weight: 750;
  color: var(--ink-soft);
}

.edit-dialog {
  width: min(28rem, calc(100vw - 2rem));
  padding: var(--s4);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--ink);
}
.edit-dialog::backdrop { background: rgb(14 9 6 / 0.7); }
.edit-shot {
  width: 100%;
  max-height: 14rem;
  object-fit: contain;
  border-radius: var(--r-md);
  background: var(--sunk);
}

.field { display: flex; flex-direction: column; gap: var(--s1); }
.field label { font-size: var(--t-xs); font-weight: 750; color: var(--ink-soft); }
.field input, .field textarea {
  min-height: 2.75rem;
  padding: 0.6rem var(--s3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
}
.field textarea { min-height: 5rem; resize: vertical; }
.field input:focus, .field textarea:focus { border-color: var(--brand); }
.field .hint { font-size: var(--t-2xs); color: var(--ink-soft); }

.progress { height: 0.5rem; border-radius: var(--r-pill); background: var(--sunk); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--brand)); transition: width var(--fast) linear; }

.notice {
  display: flex; gap: var(--s3); align-items: flex-start;
  padding: var(--s3) var(--s4);
  border-radius: var(--r-md);
  font-size: var(--t-sm);
}
.notice--bad { background: var(--bad-soft); color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent); }
.notice--good { background: var(--good-soft); color: var(--good); border: 1px solid color-mix(in srgb, var(--good) 35%, transparent); }
.notice--info { background: var(--accent-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }

/* ---------- library ---------- */

.filters { display: flex; gap: var(--s2); overflow-x: auto; padding-bottom: var(--s1); scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters a, .filters button {
  flex: none; min-height: 2.5rem; padding: 0 var(--s4);
  border: 1px solid var(--line); border-radius: var(--r-pill);
  background: var(--surface); color: var(--ink-soft);
  font-size: var(--t-sm); font-weight: 700; text-decoration: none;
  display: inline-flex; align-items: center; cursor: pointer;
}
/* The second rank of chips under the admin tabs. */
.filters--sub a { min-height: 2.25rem; padding: 0 var(--s3); font-size: var(--t-xs); }
.filters--sub b { margin-left: 0.3rem; opacity: 0.7; }

.pick::after { content: " ▾"; opacity: 0.6; }

.picker-dialog {
  width: min(22rem, calc(100vw - 2rem));
  padding: var(--s4);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); color: var(--ink);
}
.picker-dialog::backdrop { background: rgb(14 9 6 / 0.7); }
.picker-dialog .filters { flex-wrap: wrap; overflow: visible; }

.filters [aria-current="true"], .filters [aria-pressed="true"] {
  background: var(--ink); color: var(--bg); border-color: var(--ink);
}

.month + .month { margin-top: var(--s5); }
.month-head {
  position: sticky; top: calc(3.5rem + env(safe-area-inset-top));
  z-index: 5;
  margin: 0 0 var(--s2);
  padding: var(--s2) 0;
  font-size: var(--t-md);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
}

.more-row { display: flex; justify-content: center; min-height: 3rem; align-items: center; }
.more-row[data-state="failed"] .btn::after { content: " · retry"; }

.spinner {
  width: 1.5rem; height: 1.5rem;
  border-radius: var(--r-pill);
  border: 3px solid var(--line-strong);
  border-top-color: var(--brand);
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#sentinel { height: 1px; }

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: var(--s2);
}
@media (min-width: 40rem) { .tiles { gap: var(--s3); } }

.tile {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  cursor: pointer;
  aspect-ratio: 1;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--sunk);
  border: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile--locked img { filter: blur(16px) saturate(0.6) brightness(0.85); transform: scale(1.2); }
.tile--locked::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(0deg, rgb(20 12 8 / 0.45), transparent 60%);
}
.tile .lock {
  position: absolute; inset: 0; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.3rem;
  color: #fff9f4; text-shadow: 0 1px 6px rgb(0 0 0 / 0.6);
  font-size: var(--t-2xs); font-weight: 750; text-align: center; padding: var(--s2);
}
.tile .lock svg { width: 1.25rem; height: 1.25rem; }

.tile .foot {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1;
  display: flex; align-items: center; gap: 0.35rem;
  padding: var(--s3) var(--s2) var(--s2);
  background: linear-gradient(0deg, rgb(20 12 8 / 0.78), transparent);
  color: #fff8f2; font-size: var(--t-2xs); font-weight: 700;
}
.tile .foot img { width: 1.25rem; height: 1.25rem; border-radius: var(--r-pill); flex: none; }
.tile .foot span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .mine { position: absolute; top: var(--s2); left: var(--s2); z-index: 1; }

/* ---------- modes, daily, reverse ---------- */

.modes { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.mode {
  display: flex; flex-direction: column; gap: 0.15rem;
  padding: var(--s4);
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
  text-decoration: none; color: inherit;
}
.mode:hover { border-color: var(--brand); }
.mode b { font-family: var(--display); font-weight: 780; font-size: var(--t-lg); letter-spacing: -0.02em; }
.mode small { font-size: var(--t-xs); color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.mode-icon {
  width: 2.25rem; height: 2.25rem; margin-bottom: var(--s2);
  display: grid; place-items: center;
  border-radius: var(--r-pill);
  background: var(--accent-soft); color: var(--brand);
}
.mode-icon svg { width: 1.25rem; height: 1.25rem; }

/* The daily is the hero: biggest thing, first thing. */
.daily-hero {
  display: flex; flex-direction: column; gap: var(--s3);
  padding: var(--s5) var(--s4);
  border-radius: var(--r-xl);
  background:
    radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 66%),
    var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
  text-align: center;
}
.daily-hero .eyebrow { font-size: var(--t-sm); letter-spacing: 0.14em; }
.daily-hero .pips { justify-content: center; }
.daily-hero-score {
  font-family: var(--display);
  font-size: var(--t-3xl); font-weight: 820; line-height: 1;
  letter-spacing: -0.04em; color: var(--brand);
  font-variant-numeric: tabular-nums;
}
.daily-hero-score span { font-size: var(--t-xl); opacity: 0.5; }
.daily-next { margin: 0; font-size: var(--t-xs); color: var(--ink-soft); }

/* Today's five, for someone who has finished them. Five across at 390 with
   no horizontal scroll, bigger where there is room. */
.dstrip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.35rem;
}
.dstrip-item {
  display: flex; flex-direction: column; align-items: center; gap: 0.2rem;
  width: 100%; padding: 0;
  border: 0; background: none; cursor: pointer;
  border-radius: var(--r-md);
}
.dstrip-shot { position: relative; width: 100%; display: block; }
.dstrip-shot > img:first-child {
  width: 100%; height: auto; aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--r-md);
  background: var(--sunk);
  border: 1px solid var(--line);
}
.dstrip-face {
  position: absolute; left: -2px; bottom: -4px;
  width: 1.4rem; height: 1.4rem;
  border-radius: var(--r-pill);
  border: 2px solid var(--bg);
  background: var(--sunk);
}
.dstrip-pip {
  position: absolute; right: 3px; top: 3px;
  width: 0.3rem; border-radius: 1px; display: block;
  background: var(--line-strong);
  box-shadow: 0 0 0 2px rgb(20 12 8 / 0.35);
}
.dstrip-pip[data-points="3"] { height: 0.9rem; background: var(--good); }
.dstrip-pip[data-points="2"] { height: 0.65rem; background: color-mix(in srgb, var(--good) 60%, var(--accent)); }
.dstrip-pip[data-points="1"] { height: 0.4rem; background: var(--accent); }
.dstrip-pip[data-points="0"] { height: 0.18rem; background: var(--line-strong); }
.dstrip-name {
  font-size: 0.625rem; font-weight: 650; color: var(--ink-soft);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dstrip-stat {
  display: flex; gap: 0.25rem; align-items: baseline;
  font-size: 0.625rem; font-variant-numeric: tabular-nums; line-height: 1.1;
}
.dstrip-stat b { font-weight: 780; color: var(--ink); }
.dstrip-stat span { color: var(--ink-soft); }

@media (min-width: 40rem) {
  .dstrip { gap: var(--s2); }
  .dstrip-name { font-size: var(--t-xs); }
  .dstrip-stat { font-size: var(--t-xs); }
  .dstrip-face { width: 1.75rem; height: 1.75rem; }
}

.mini-board { padding: var(--s3) var(--s4); border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); }
.mini-board ul { display: flex; flex-direction: column; gap: 0.15rem; }
.mini-row {
  display: grid; grid-template-columns: 1.25rem auto 1fr 2.6rem 2.2rem;
  align-items: center; gap: var(--s2);
  padding: 0.25rem 0.35rem; border-radius: var(--r-sm);
  font-size: var(--t-sm);
}
.mini-row[data-you="1"] { background: var(--brand-soft); }
.mini-row .rank { font-size: var(--t-xs); font-weight: 750; color: var(--ink-soft); text-align: center; font-variant-numeric: tabular-nums; }
.mini-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.mini-row[data-state="playing"] img { opacity: 0.6; }

/* The score is a fixed, right aligned cell wide enough for "15", and the
   graph is a fixed cell of its own, so every row's pips start at the same x. */
.day-score {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 780;
}
.day-score[data-kind="progress"], .day-score[data-kind="hidden"] {
  font-weight: 650;
  font-size: var(--t-xs);
  color: var(--ink-soft);
}
.day-graph { width: 1.9rem; display: flex; justify-content: flex-start; }

/* A pip a photo. The score is in the height as well as the colour, so it
   reads without relying on hue. */
.day-pips { display: inline-flex; align-items: flex-end; gap: 2px; height: 0.9rem; }
.day-pips i {
  width: 0.3rem;
  border-radius: 1px;
  background: var(--line-strong);
  display: block;
}
.day-pips i[data-points="3"] { height: 0.9rem; background: var(--good); }
.day-pips i[data-points="2"] { height: 0.65rem; background: color-mix(in srgb, var(--good) 60%, var(--accent)); }
.day-pips i[data-points="1"] { height: 0.4rem; background: var(--accent); }
.day-pips i[data-points="0"] { height: 0.18rem; background: var(--line-strong); }



.upload-panel { display: flex; flex-direction: column; gap: var(--s3); }
.upload-panel .upload-body { display: block; }
.upload-panel .confirm-bar { position: static; box-shadow: none; border: 0; background: none; padding: 0; backdrop-filter: none; }

.daily-score {
  display: grid; place-items: center;
  padding: var(--s5);
  border-radius: var(--r-xl);
  background: radial-gradient(100% 80% at 50% 0%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 62%), var(--surface);
  border: 1px solid var(--line);
}
.daily-score b {
  font-family: var(--display); font-size: var(--t-3xl); font-weight: 820;
  letter-spacing: -0.04em; color: var(--brand); font-variant-numeric: tabular-nums;
}

.rev { display: flex; flex-direction: column; background: var(--bg); color: var(--ink); }
.rev .hud-top { position: relative; background: none; border-bottom: 1px solid var(--line); }
.rev .hud-top .pips i { background: var(--line-strong); }
.rev .hud-top .pips i[data-state="now"] { background: var(--brand); }
.rev .hud-btn { background: var(--sunk); color: var(--ink); }
.rev .count { color: var(--ink); }

.rev-subject {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s3) var(--s4);
}
.rev-subject h2 { font-size: var(--t-xl); }

.rev-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 2px;
}
.rev-opt {
  position: relative;
  padding: 0; border: 0; overflow: hidden;
  background: var(--sunk); cursor: pointer;
  outline-offset: -4px;
}
.rev-opt img { width: 100%; height: 100%; object-fit: cover; }
.rev-opt::after {
  content: ""; position: absolute; inset: 0;
  border: 4px solid transparent;
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease);
}
.rev-opt[aria-pressed="true"]::after { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 18%, transparent); }
.rev-zoom {
  position: absolute; top: var(--s2); right: var(--s2);
  width: 2.25rem; height: 2.25rem;
  display: grid; place-items: center;
  border-radius: var(--r-pill);
  background: rgb(20 12 8 / 0.55); color: #fff;
  font-size: var(--t-sm);
}

.rev-foot {
  flex: none;
  padding: var(--s3) var(--s4) calc(var(--s4) + env(safe-area-inset-bottom));
}

.rev-answer { flex: 1; min-height: 0; overflow-y: auto; padding: var(--s3) var(--s4); display: flex; flex-direction: column; gap: var(--s3); }
.rev-shot { margin: 0; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line); background: var(--sunk); }
.rev-shot img { width: 100%; max-height: 42dvh; object-fit: contain; cursor: zoom-in; }
.rev-shot figcaption { display: flex; flex-direction: column; gap: 0.15rem; padding: var(--s3); background: var(--surface); font-size: var(--t-sm); }
.rev-shot figcaption span { color: var(--ink-soft); font-style: italic; }

@media (min-width: 52rem) {
  .rev-grid { grid-template-columns: repeat(4, 1fr); grid-template-rows: 1fr; }
  .rev-answer { max-width: 44rem; margin: 0 auto; width: 100%; }
  .rev-foot { max-width: 30rem; margin: 0 auto; width: 100%; }
}

/* ---------- board ---------- */

.board { display: flex; flex-direction: column; gap: var(--s2); }

.board-row {
  display: grid;
  grid-template-columns: 2rem 2.5rem 1fr auto;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3);
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  text-decoration: none; color: inherit;
}
.board-row:hover { border-color: var(--line-strong); }

/* The daily list has two more cells than the leaderboard: the score, then
   the graph, both fixed so the pips line up down the column. */
#daily-board .board-row { grid-template-columns: 2rem 2.5rem 1fr 2.8rem 2.2rem; }
#daily-board .day-score { font-size: var(--t-lg); letter-spacing: -0.02em; }
#daily-board .day-score[data-kind="progress"],
#daily-board .day-score[data-kind="hidden"] { font-size: var(--t-sm); }
.board-row .rank { font-weight: 800; font-size: var(--t-sm); color: var(--ink-soft); text-align: center; font-variant-numeric: tabular-nums; }
.board-row[data-rank="1"] .rank { color: var(--accent); font-size: var(--t-lg); }
.board-row[data-rank="2"] .rank, .board-row[data-rank="3"] .rank { color: var(--brand); }
.board-row .who { min-width: 0; }
.board-row .who b { display: block; font-size: var(--t-sm); font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-row .who small {
  display: block; font-size: var(--t-2xs); color: var(--ink-soft);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.board-row .acc { text-align: right; }
.board-row .acc b { display: block; font-size: var(--t-lg); font-weight: 780; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.board-row .acc small { font-size: var(--t-2xs); color: var(--ink-soft); }

/* ---------- profile ---------- */

.profile-head {
  display: flex; align-items: center; gap: var(--s4);
  padding: var(--s5) var(--s4);
  border-radius: var(--r-xl);
  background: radial-gradient(110% 80% at 18% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%), var(--surface);
  border: 1px solid var(--line);
}
.profile-head h1 { font-size: var(--t-xl); }

.chart {
  margin: 0;
  padding: var(--s3) var(--s4);
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  position: relative;
}
.chart svg { width: 100%; height: 6rem; overflow: visible; }
.chart-area { fill: color-mix(in srgb, var(--brand) 14%, transparent); stroke: none; }
.chart-line { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart-dot { fill: var(--brand); stroke: var(--surface); stroke-width: 2; }
.chart figcaption {
  position: absolute; top: var(--s3); right: var(--s4);
  font-size: var(--t-xs); font-weight: 750; color: var(--ink-soft);
}

.badges { display: flex; gap: var(--s2); flex-wrap: wrap; }
.badge-item {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.35rem var(--s3);
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: var(--t-xs);
}
.badge-item[data-earned="1"] { border-color: var(--accent); background: var(--accent-soft); }
.badge-item[data-earned="0"] { opacity: 0.45; }
.badge-mark { color: var(--accent); }
.badge-item[data-earned="0"] .badge-mark { color: var(--ink-soft); }

.confused { display: flex; gap: var(--s3); overflow-x: auto; padding-bottom: var(--s2); }
.confused figure { margin: 0; text-align: center; flex: none; width: 4.5rem; }
.confused img { width: 3.25rem; height: 3.25rem; border-radius: var(--r-pill); margin: 0 auto; }
.confused figcaption { font-size: var(--t-2xs); color: var(--ink-soft); margin-top: 0.25rem; }

/* ---------- review queue ---------- */

.review-bar {
  position: sticky;
  top: calc(3.5rem + env(safe-area-inset-top));
  z-index: 25;
  display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap;
  padding: var(--s3);
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
}
.review-bar .count { font-size: var(--t-sm); font-weight: 750; font-variant-numeric: tabular-nums; }
.review-bar .grow { flex: 1; }
.review-bar .btn { min-height: 2.5rem; padding: 0 0.7rem; font-size: var(--t-xs); line-height: 1; }

.review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
  gap: var(--s2);
}
@media (min-width: 40rem) { .review-grid { grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr)); } }

.rv {
  position: relative; aspect-ratio: 1;
  border: 3px solid transparent; border-radius: var(--r-md);
  overflow: hidden; background: var(--sunk); padding: 0; cursor: pointer;
  transition: border-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.rv img { width: 100%; height: 100%; object-fit: cover; }
.rv .who {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: var(--s3) 0.3rem 0.25rem;
  background: linear-gradient(0deg, rgb(20 12 8 / 0.8), transparent);
  color: #fff8f2; font-size: 0.625rem; font-weight: 750;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rv .tick {
  position: absolute; top: 0.25rem; right: 0.25rem;
  width: 1.4rem; height: 1.4rem; border-radius: var(--r-pill);
  background: rgb(20 12 8 / 0.35); border: 2px solid rgb(255 255 255 / 0.8);
  display: grid; place-items: center; color: transparent; font-size: 0.7rem; font-weight: 900;
}
.rv-flag {
  position: absolute; top: 0.25rem; left: 0.25rem;
  padding: 0.05rem 0.3rem;
  border-radius: var(--r-pill);
  background: var(--bad); color: #fff;
  font-size: 0.625rem; font-weight: 800;
}

.picker {
  min-height: 2.75rem; padding: 0 var(--s3);
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink); font-size: var(--t-sm);
}

.people { display: flex; flex-direction: column; gap: var(--s2); }
.person {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--s2);
  padding: var(--s2); border-radius: var(--r-md); background: var(--sunk);
}
.person .who { min-width: 0; }
.person .who b { display: block; font-size: var(--t-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person .who small { font-size: var(--t-2xs); color: var(--ink-soft); }
.person .btn { min-height: 2.25rem; padding: 0 var(--s3); font-size: var(--t-xs); }

.confirm-dialog {
  width: min(24rem, calc(100vw - 2rem));
  padding: var(--s5);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); color: var(--ink);
}
.confirm-dialog::backdrop { background: rgb(14 9 6 / 0.7); }
.confirm-dialog h2 { font-size: var(--t-lg); }
.confirm-dialog p { font-size: var(--t-sm); color: var(--ink-soft); }

.rv[aria-pressed="true"] { border-color: var(--brand); transform: scale(0.95); }
.rv[aria-pressed="true"] .tick { background: var(--brand); border-color: #fff; color: #fff; }
.rv.is-gone { opacity: 0.25; pointer-events: none; }

.swipe-stage {
  position: relative;
  border-radius: var(--r-lg); overflow: hidden;
  background: var(--sunk); border: 1px solid var(--line);
  touch-action: pan-y;
}
.swipe-stage img { width: 100%; height: min(52dvh, 28rem); object-fit: contain; }
.swipe-stage .stamp {
  position: absolute; top: var(--s5); padding: 0.4rem var(--s4);
  border: 4px solid; border-radius: var(--r-md);
  font-weight: 900; font-size: var(--t-lg); letter-spacing: 0.06em;
  opacity: 0; transition: opacity var(--fast) var(--ease);
}
.swipe-stage .stamp--yes { left: var(--s4); color: var(--good); rotate: -12deg; }
.swipe-stage .stamp--no { right: var(--s4); color: var(--bad); rotate: 12deg; }

.keyhints { display: flex; gap: var(--s3); flex-wrap: wrap; font-size: var(--t-xs); color: var(--ink-soft); }
kbd {
  display: inline-block; min-width: 1.6rem; padding: 0.1rem 0.4rem;
  border: 1px solid var(--line-strong); border-bottom-width: 2px;
  border-radius: var(--r-sm); background: var(--surface);
  font: 600 var(--t-2xs) var(--mono); text-align: center;
}

/* ---------- empty, error, skeleton, toast ---------- */

.empty {
  display: flex; flex-direction: column; align-items: center; gap: var(--s3);
  padding: var(--s7) var(--s4);
  text-align: center;
}
.empty .glyph {
  width: 4.5rem; height: 4.5rem; border-radius: var(--r-pill);
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--brand);
}
.empty .glyph svg { width: 2.25rem; height: 2.25rem; }
.empty h2 { font-size: var(--t-lg); }
.empty p { color: var(--ink-soft); max-width: 32ch; }

.errpage { display: grid; place-items: center; min-height: 70dvh; text-align: center; padding: var(--s5); }
.errpage .code {
  font-family: var(--display); font-size: var(--t-4xl); font-weight: 820;
  letter-spacing: -0.06em; color: var(--brand); line-height: 1;
}

.skeleton {
  border-radius: var(--r-md);
  background: linear-gradient(100deg, var(--sunk) 30%, var(--surface-2) 50%, var(--sunk) 70%);
  background-size: 300% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { to { background-position: -300% 0; } }

.toasts {
  position: fixed; z-index: 70;
  left: 50%; translate: -50% 0;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + var(--s3));
  display: flex; flex-direction: column; gap: var(--s2);
  width: min(26rem, calc(100vw - 2rem));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: var(--s2);
  padding: var(--s3) var(--s4);
  border-radius: var(--r-md);
  background: var(--ink); color: var(--bg);
  box-shadow: var(--shadow-2);
  font-size: var(--t-sm); font-weight: 650;
  animation: toast-in var(--mid) var(--ease-back) both;
}
.toast--bad { background: var(--bad); color: #fff; }
.toast--good { background: var(--good); color: #fff; }
.toast.is-out { animation: toast-out var(--mid) var(--ease) both; }
@keyframes toast-in { from { transform: translateY(1rem); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(0.5rem); opacity: 0; } }

@media (min-width: 52rem) {
  .toasts { bottom: var(--s5); left: auto; right: var(--s5); translate: none; }
}

/* ---------- lightbox ---------- */

dialog.lightbox {
  border: 0; padding: 0; max-width: 100vw; max-height: 100dvh;
  width: 100vw; height: 100dvh;
  background: rgb(14 9 6 / 0.94);
}
dialog.lightbox::backdrop { background: rgb(14 9 6 / 0.9); }
dialog.lightbox img { width: 100%; height: 100dvh; object-fit: contain; }
dialog.lightbox .lightbox-meta {
  position: absolute; left: 0; right: 0;
  bottom: calc(var(--s4) + env(safe-area-inset-bottom));
  display: flex; align-items: center; justify-content: center; gap: var(--s3);
  color: #fff8f2; font-size: var(--t-sm); font-weight: 650;
  text-shadow: 0 1px 8px rgb(0 0 0 / 0.7);
}
dialog.lightbox .lightbox-meta a { color: inherit; text-decoration: none; }
dialog.lightbox .lightbox-meta time { opacity: 0.75; font-weight: 500; }
dialog.lightbox .lightbox-meta svg { width: 1.1rem; height: 1.1rem; display: block; }

dialog.lightbox .lightbox-who {
  position: absolute; left: 0; right: 0;
  bottom: calc(var(--s4) + env(safe-area-inset-bottom));
  text-align: center; color: #fff8f2;
  font-size: var(--t-sm); font-weight: 750;
  text-decoration: none; text-shadow: 0 1px 8px rgb(0 0 0 / 0.7);
}

dialog.lightbox .close {
  position: absolute; top: calc(var(--s3) + env(safe-area-inset-top)); right: var(--s3);
  width: 2.75rem; height: 2.75rem; border: 0; border-radius: var(--r-pill);
  background: rgb(255 255 255 / 0.15); color: #fff; cursor: pointer; font-size: 1.25rem;
}

/* ---------- dev index ---------- */

.devlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: var(--s3); }
.devlist a { display: block; padding: var(--s3) var(--s4); border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 650; font-size: var(--t-sm); }
.devlist a small { display: block; color: var(--ink-soft); font-weight: 400; font-size: var(--t-2xs); }
.devlist a:hover { border-color: var(--brand); }

/* ---------- motion preference ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .confetti, .burst { display: none; }
  .btn:active, .cand[aria-pressed="true"], .rv[aria-pressed="true"] { transform: none; }
}
