/* One primary color, #44547f. Light mode is vibrant: an off-white page, with buttons, the
   site's own text and shadows in the primary color; what raffle creators wrote (the name,
   prize, host, About) is near-black (.user-text). Dark mode is soothing: the page is a dark
   shade of the primary, and text and buttons are off-white turned down to let it through.
   js/theme.js sets data-theme on <html>. */
:root {
  --primary: #44547f;
  --off-white: #f6f5f1;
  --bg: var(--off-white);
  --surface: #ffffff;
  --ink: var(--primary);
  --muted: color-mix(in srgb, var(--primary) 78%, var(--off-white));
  --user: #15171c;
  --line: color-mix(in srgb, var(--primary) 14%, transparent);
  --slot-line: color-mix(in srgb, var(--primary) 26%, transparent); /* empty slots on the board */
  --card-line: color-mix(in srgb, var(--primary) 24%, transparent); /* raffle, prize and form cards */
  --cover-line: color-mix(in srgb, var(--primary) 14%, transparent); /* frames photos against the light page */
  --tint: color-mix(in srgb, var(--primary) 5%, transparent);
  --tint-strong: color-mix(in srgb, var(--primary) 10%, transparent);
  --button: var(--primary);
  --on-button: var(--off-white);
  --link: var(--primary);
  --shadow-sm: 0 1px 2px color-mix(in srgb, var(--primary) 7%, transparent),
    0 6px 18px -6px color-mix(in srgb, var(--primary) 18%, transparent);
  --shadow-lg: 0 22px 44px -18px color-mix(in srgb, var(--primary) 60%, transparent),
    0 4px 12px -4px color-mix(in srgb, var(--primary) 20%, transparent);
  --good: #0b8763;
  --bad: #c42f4d;
  --die: var(--primary);
  --die-pip: var(--off-white);
  --on-group: #1c2233;
  --p1: #ef476f;
  --p2: #f78c3b;
  --p3: #ffd166;
  --p4: #06d6a0;
  --p5: #3fa7f5;
  --p6: #9b6dff;
  --ease-out: cubic-bezier(0.19, 1, 0.22, 1);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #171c2b;
  --surface: rgb(246 245 241 / 0.045);
  --ink: rgb(246 245 241 / 0.8);
  --muted: rgb(246 245 241 / 0.5);
  /* Icons: the same colors, but solid, faded as a whole (see "Icons" below). */
  --icon-ink: var(--off-white); --icon-ink-alpha: 0.8;
  --icon-muted: var(--off-white); --icon-muted-alpha: 0.5;
  --user: rgb(246 245 241 / 0.88);
  --line: rgb(246 245 241 / 0.1);
  --slot-line: var(--line);
  --card-line: var(--line);
  --cover-line: transparent; /* the dark page frames photos already */
  --tint: rgb(246 245 241 / 0.035);
  --tint-strong: rgb(246 245 241 / 0.07);
  --button: rgb(246 245 241 / 0.82);
  --on-button: #171c2b;
  --link: rgb(246 245 241 / 0.88);
  --shadow-sm: none;
  --shadow-lg: 0 22px 44px -18px rgb(0 0 0 / 0.55);
  --good: #7fd4b5;
  --bad: #f19aab;
  --die: #dcdbd6;
  --die-pip: #2a3350;
  --p1: #e57c93;
  --p2: #e9a26e;
  --p3: #e6cd85;
  --p4: #74cdb0;
  --p5: #7fb3e3;
  --p6: #ab97e3;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* Don't let iOS enlarge text it thinks is too small (it breaks layouts sized on purpose, like the
   staff sign's preview). */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

a { color: var(--link); }
.user-text { color: var(--user); }
/* A heading that links back (the watch page's raffle name): looks like the heading until hovered. */
.title-link { text-decoration: none; text-underline-offset: 0.12em; text-decoration-thickness: 2px; }
.title-link[href]:hover { text-decoration-line: underline; }

.topbar { position: relative; display: flex; align-items: center; gap: 16px; min-height: 36px; padding: 14px 24px; }
.site-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.site-session { position: relative; display: flex; align-items: center; gap: 18px; }
.top-link { color: var(--muted); font-weight: 600; font-size: 15px; text-decoration: none; }
.top-link[aria-current="page"] { color: var(--ink); }
@media (hover: hover) and (pointer: fine) { .top-link:hover { color: var(--ink); } }

/* Icons: drawn in a solid color and faded as a whole. In dark mode the text colors are
   see-through, so lines drawn in them would stack where they cross or meet and show brighter;
   opacity on the whole <svg> composites it once. Light mode's colors are solid already. */
:root { --icon-ink: var(--ink); --icon-ink-alpha: 1; --icon-muted: var(--muted); --icon-muted-alpha: 1; }
.nav-link svg, .tl-empty-mark svg, .tl-line svg { color: var(--icon-muted); opacity: var(--icon-muted-alpha); }
.nav-link[aria-current="page"] svg, .signin-mark svg { color: var(--icon-ink); opacity: var(--icon-ink-alpha); }
@media (hover: hover) and (pointer: fine) { .nav-link:hover svg { color: var(--icon-ink); opacity: var(--icon-ink-alpha); } }

/* Signed in: the page links, each an icon and its name, starting where the content starts. */
.site-nav { display: flex; align-items: center; gap: 22px; }
.nav-link { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-weight: 600; font-size: 15px; text-decoration: none; }
.nav-link[aria-current="page"] { color: var(--ink); }
@media (hover: hover) and (pointer: fine) { .nav-link:hover { color: var(--ink); } }
@media (min-width: 760px) {
  .is-signed-in .site-nav { position: absolute; left: max(var(--content-left, 0px), 104px); top: 50%; transform: translateY(-50%); }
}
@media (max-width: 759px) {
  .site-nav { gap: 18px; margin-left: 8px; }
  .nav-label { display: none; } /* phones: icons only */
}

/* The session timer, and its popover: the signed-in contact and Sign Out. */
.session-timer {
  border: 0; background: none; padding: 4px 2px; cursor: pointer;
  color: var(--muted); font: inherit; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums;
}
@media (hover: hover) and (pointer: fine) { .session-timer:hover { color: var(--ink); } }
.session-popover {
  position: absolute; top: calc(100% + 10px); right: -8px; z-index: 30; min-width: 220px;
  padding: 14px 16px; border: 1px solid var(--card-line); border-radius: 12px;
  background: linear-gradient(var(--surface), var(--surface)), var(--bg); box-shadow: var(--shadow-lg);
  text-align: left;
}
.session-contact { margin: 0 0 10px; color: var(--user); font-weight: 600; overflow-wrap: anywhere; }
.session-signout { border: 0; background: none; padding: 0; color: var(--link); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .session-signout:hover { text-decoration: underline; } }
.theme-toggle {
  display: grid; place-items: center; width: 36px; height: 36px; padding: 0;
  border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--ink); cursor: pointer;
  transition: transform 150ms cubic-bezier(0.25, 0.46, 0.45, 0.94), background-color 150ms ease;
}
.theme-toggle:active { transform: scale(0.94); }
@media (hover: hover) and (pointer: fine) { .theme-toggle:hover { background: var(--tint-strong); } }
.theme-toggle .icon-sun, [data-theme="dark"] .theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
.brand { color: var(--ink); font-weight: 700; letter-spacing: 0.02em; text-decoration: none; font-size: 20px; }

main { max-width: 880px; margin: 0 auto; padding: 24px; }
.site-footer {
  margin-top: 48px; padding: 20px 0 8px; border-top: 1px solid var(--line);
  text-align: center; font-size: 13px; color: var(--muted);
}
h1 { margin: 0 0 4px; font-size: 28px; }
.meta { color: var(--muted); margin: 0; }
.badge {
  display: inline-block;
  vertical-align: middle;
  margin-left: 6px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* --- Home --------------------------------------------------------------- */

.raffle-list { display: grid; gap: 16px; margin-top: 20px; }
.empty { color: var(--muted); }
.raffle-card { background: var(--surface); border: 1px solid var(--card-line); border-radius: 14px; padding: 20px; box-shadow: var(--shadow-sm); }
.raffle-card h2 { margin: 0 0 4px; font-size: 22px; }
.countdown { font-size: 32px; font-variant-numeric: tabular-nums; font-weight: 700; margin: 12px 0; }
.commitment { color: var(--muted); font-size: 12px; word-break: break-all; margin: 0 0 16px; }
.commitment code { color: var(--ink); }

.watch-button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 28px;
  border: 0; border-radius: 999px;
  background: var(--button); color: var(--on-button);
  box-shadow: var(--shadow-sm);
  font: inherit; font-weight: 700; font-size: 18px; text-decoration: none;
  cursor: pointer;
  transition: transform 150ms cubic-bezier(0.25, 0.46, 0.45, 0.94), filter 150ms ease;
}
.watch-button:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) {
  .watch-button:hover { filter: brightness(1.08); }
}

/* --- Watch -------------------------------------------------------------- */

.watch { text-align: center; max-width: 960px; }
.raffle-head { margin-bottom: 16px; }

/* The box or die, the status text and their buttons: sticky, so they stay at the top of the
   screen while the board scrolls under them. The page's background hides what passes under. */
.stage-dock {
  position: sticky; top: 0; z-index: 5;
  margin: 0 -24px; padding: 8px 24px 0;
  background: var(--bg);
  transition: box-shadow 200ms ease;
}
.stage-dock.is-stuck { box-shadow: 0 1px 0 var(--line), 0 10px 20px -16px color-mix(in srgb, var(--primary) 45%, transparent); }
.stage-top { position: relative; height: 160px; display: grid; place-items: center; }
/* The raffle drum (watch.html): a cylinder turning on a horizontal axis, in plain CSS 3D.
   16 strips, each turned --i x 22.5deg around the axis and pushed out by the radius; a strip
   is as tall as one side of a 16-sided polygon (2r tan 11.25deg), plus a pixel so no seams
   show. Lines of text run along the axis, which doesn't curve, so each sits flat on a strip.
   The shading on top is fixed (it doesn't turn): dark at the top and bottom edges, a shine
   above the middle, which is what makes the surface read as round. */
.drum {
  --r: 56px;
  --facet: calc(2 * var(--r) * 0.19891 + 1px);
  --drum-turn: 7s;
  position: relative; width: 230px; height: calc(2 * var(--r));
}
.drum-body {
  position: absolute; inset: 0 14px;
  border-radius: 6px; overflow: hidden; /* clips the turning strips to the drum's outline */
  perspective: 700px;
  box-shadow: var(--shadow-lg);
}
.drum-spin {
  position: absolute; inset: 0;
  transform-style: preserve-3d;
  animation: drum-turn var(--drum-turn) linear infinite;
}
/* The front moves up: labels come from the bottom and go over the top. */
@keyframes drum-turn { to { transform: rotateX(360deg); } }
.drum-face {
  position: absolute; left: 0; right: 0; top: 50%;
  height: var(--facet); margin-top: calc(var(--facet) / -2);
  display: grid; place-items: center;
  transform: rotateX(calc(var(--i) * -22.5deg)) translateZ(var(--r));
  backface-visibility: hidden;
  background: var(--button); color: var(--on-button);
  font-size: 13px; font-weight: 800; letter-spacing: 0.16em; white-space: nowrap;
}
.drum-face:nth-child(even) { background: color-mix(in srgb, var(--button) 86%, var(--on-button)); }
.drum-shade {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to bottom, transparent 22%, rgb(255 255 255 / 0.2) 34%, transparent 46%),
    linear-gradient(to bottom, rgb(0 0 0 / 0.55), transparent 32%, transparent 64%, rgb(0 0 0 / 0.6));
}
/* The ends of the drum, seen edge-on, with the axle's hub. */
.drum-cap {
  position: absolute; top: -6px; bottom: -6px; width: 16px; z-index: 1;
  border-radius: 8px;
  background: linear-gradient(to right, color-mix(in srgb, var(--ink) 70%, var(--bg)), var(--ink) 55%, color-mix(in srgb, var(--ink) 80%, var(--bg)));
  box-shadow: var(--shadow-sm);
}
.drum-cap::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px;
  border-radius: 50%; background: var(--bg);
}
.drum-cap-left { left: 4px; }
.drum-cap-right { right: 4px; }
@media (prefers-reduced-motion: reduce) { .drum-spin { animation: none; } }
.dice-tray {
  /* Narrow, so the die lands near the middle where the light is. */
  position: absolute; top: 0; bottom: 0; left: 50%; width: min(460px, 100%); transform: translateX(-50%);
  border-radius: 16px;
  background: radial-gradient(ellipse at center, var(--tint-strong) 0%, transparent 72%);
}
.dice-tray canvas { display: block; }
.die-face {
  position: absolute; z-index: 1;
  width: 84px; height: 84px; border-radius: 16px;
  display: grid; place-items: center;
  background: var(--die); color: var(--die-pip); font-size: 44px; font-weight: 800;
  box-shadow: var(--shadow-lg);
}

.status { min-height: 84px; margin: 12px 0 0; padding-bottom: 14px; }
.stage-dock + .board-area { margin-top: 4px; }
.message { font-size: 26px; font-weight: 700; margin: 0; font-variant-numeric: tabular-nums; }
.submessage { color: var(--muted); margin: 4px 0 0; min-height: 1.5em; font-variant-numeric: tabular-nums; }
/* In the stage's corner, out of the layout flow: showing or hiding it never moves the board. */
.skip-button, .sound-button {
  position: absolute; right: 0; bottom: 8px; z-index: 2;
  min-height: 36px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 999px;
  background: transparent; color: var(--ink);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: transform 150ms cubic-bezier(0.25, 0.46, 0.45, 0.94), background-color 150ms ease;
}
.skip-button:active, .sound-button:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) { .skip-button:hover, .sound-button:hover { background: var(--surface); } }
/* The other corner from the skip button; dim while off. */
.sound-button { right: auto; left: 0; color: var(--muted); }
/* Icon-only: round, so they stay clear of the drum and the die. */
.icon-button { display: grid; place-items: center; width: 36px; min-height: 0; height: 36px; padding: 0; border-radius: 50%; }
.sound-button .icon-sound-on, .sound-button[aria-pressed="true"] .icon-sound-off { display: none; }
.sound-button[aria-pressed="true"] .icon-sound-on { display: block; }
.sound-button[aria-pressed="true"] { color: var(--ink); border-color: var(--ink); }

/* Board: 6 groups, each colored like its die face number. */
.group[data-group="1"] { --g: var(--p1); } .group[data-group="2"] { --g: var(--p2); }
.group[data-group="3"] { --g: var(--p3); } .group[data-group="4"] { --g: var(--p4); }
.group[data-group="5"] { --g: var(--p5); } .group[data-group="6"] { --g: var(--p6); }

.board { display: grid; gap: 14px; margin: 0 auto; }
.group {
  background: var(--surface); border: 2px solid color-mix(in srgb, var(--g) 45%, var(--line));
  border-radius: 14px; padding: 10px;
  box-shadow: var(--shadow-sm);
  transition: opacity 400ms ease, border-color 400ms ease, background-color 400ms ease, box-shadow 400ms ease;
}
.group-label {
  width: 28px; height: 28px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--g); color: var(--on-group); font-weight: 800;
}
/* Die-face dots (common.js pips): a 3x3 grid, sized by the box it sits in. */
.pips { display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); width: 72%; height: 72%; }
.pips > span { width: 78%; aspect-ratio: 1; place-self: center; border-radius: 50%; background: currentColor; }
.slots { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
/* --digits is the length of the largest entry number; long numbers shrink to fit. */
.slot, .ball { font-size: clamp(7px, calc(48px / max(var(--digits, 3), 3)), 14px); font-variant-numeric: tabular-nums; }
.slot {
  aspect-ratio: 1; border-radius: 50%;
  display: grid; place-items: center;
  /* Solid, not dashed: 216 dashed circles are expensive to repaint on every fill. */
  border: 1.5px solid var(--slot-line);
  font-weight: 600; overflow: hidden;
}
.slot.filled { border: 0; background: color-mix(in srgb, var(--g) 22%, var(--bg)); color: var(--ink); }

.board-blocks { grid-template-columns: repeat(3, 1fr); }
.board-blocks .group { display: grid; gap: 8px; justify-items: center; }
.board-blocks .slots { width: 100%; grid-template-columns: 1fr; transition: gap 450ms cubic-bezier(0.65, 0, 0.35, 1); }
.slot-row { position: relative; display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }

/* Splitting a picked block: the rows pull apart and a line is drawn between each, so each
   row reads as its own group of 6. */
.slot-row + .slot-row::before {
  content: ""; position: absolute; left: -6px; right: -6px; top: -7px; height: 2px; border-radius: 1px;
  background: var(--g);
  transform: scaleX(0);
  transition: transform 380ms cubic-bezier(0.19, 1, 0.22, 1), opacity 250ms ease;
  transition-delay: calc(250ms + var(--row) * 90ms);
}
.group.divided .slots { gap: 12px; }
.group.divided .slot-row::before { transform: scaleX(1); }

/* Releasing: the picked block's frame, label and lines fade while its entries move on. */
.group.releasing { border-color: transparent !important; background: transparent !important; box-shadow: none !important; transition-duration: 250ms; }
.group.releasing .group-label, .group.releasing .slot-row::before { opacity: 0; transition: opacity 250ms ease; }
@media (max-width: 760px) { .board-blocks { grid-template-columns: repeat(2, 1fr); } }
/* Phones: a compact dock, so most of the screen is left for the board. */
@media (max-width: 600px) {
  .watch { padding-top: 12px; }
  .raffle-head { margin-bottom: 4px; }
  .raffle-head h1 { font-size: 22px; }
  .stage-dock { margin: 0 -24px; padding: 4px 24px 0; }
  .stage-top { height: 112px; }
  .drum { --r: 40px; width: 156px; } /* narrow enough to clear the Sound button */
  .drum-face { font-size: 11px; }
  .die-face { width: 60px; height: 60px; border-radius: 12px; }
  .status { min-height: 52px; margin-top: 4px; padding-bottom: 10px; }
  .message { font-size: 19px; }
  .submessage { font-size: 14px; min-height: 1.4em; }
  .skip-button, .sound-button { bottom: 4px; }
  .icon-button { width: 32px; height: 32px; }
}
@media (max-width: 480px) { .board-blocks { grid-template-columns: 1fr; } }

.board-rows { max-width: 480px; }
.board-rows .group { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 12px; }
.board-rows .slot { font-size: clamp(8px, calc(56px / max(var(--digits, 3), 3)), 16px); }

.board-final { grid-template-columns: repeat(2, 1fr); max-width: 520px; }
.board-final .group { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 14px; padding: 16px; }
.board-final .group-label { width: 44px; height: 44px; border-radius: 12px; font-size: 24px; }
.board-final .slots { grid-template-columns: 1fr; }
.board-final .slot { aspect-ratio: auto; border-radius: 10px; padding: 10px 6px; font-size: clamp(16px, calc(110px / max(var(--digits, 3), 3)), 30px); font-weight: 800; }

/* After a roll: the picked group lights up, the others dim but stay visible. */
.has-pick .group:not(.picked) { opacity: 0.3; }
.has-pick .group.picked {
  border-color: var(--g);
  background: color-mix(in srgb, var(--g) 16%, var(--surface));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--g) 35%, transparent);
}

/* A group that won: its entries have gone up to the winners stage; its slots stay, blank and gray. */
.group.won { opacity: 0.55; background: transparent; border-color: var(--slot-line); box-shadow: none; }
.group.won .group-label { background: var(--slot-line); color: var(--muted); }
.group.won .slot { background: transparent; border: 1.5px solid var(--slot-line); }

/* The drawing is over: everything left on the board is grayed out; the winners are on the stage. */
.board.finished .group { opacity: 0.5; background: transparent; border-color: var(--slot-line); box-shadow: none; }
.board.finished .group-label { background: var(--slot-line); color: var(--muted); }
.board.finished .slot.filled { background: color-mix(in srgb, var(--muted) 16%, transparent); color: var(--muted); }

/* The winners stage, at the top of the pinned dock: a "?" slot per winner, with a crown and
   the place under it. --ws (the slot size) steps down as the number of winners grows. */
.winners-stage { padding: 4px 0 6px; }
.winners-stage[data-size="l"] { --ws: 46px; }
.winners-stage[data-size="m"] { --ws: 38px; }
.winners-stage[data-size="s"] { --ws: 32px; }
.winners-stage[data-size="xs"] { --ws: 26px; }
.winners-stage[data-size="xxs"] { --ws: 20px; }
.winners-label { margin: 0 0 6px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.winner-slots {
  list-style: none; margin: 0 auto; padding: 0; max-width: 760px;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px calc(var(--ws) * 0.22);
}
.winner-slot { display: grid; justify-items: center; gap: 2px; }
.winner-ball {
  width: var(--ws); height: var(--ws); border-radius: 50%;
  display: grid; place-items: center; overflow: hidden;
  border: 1.5px dashed var(--slot-line); color: var(--muted);
  font-weight: 800; font-variant-numeric: tabular-nums;
  font-size: clamp(7px, calc(var(--ws) * 1.15 / max(var(--digits, 3), 3)), 18px);
  transition: background-color 200ms ease, border-color 200ms ease;
}
.winner-ball.filled { border: 0; background: var(--button); color: var(--on-button); box-shadow: var(--shadow-sm); }
.winner-place { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); font-size: clamp(8px, calc(var(--ws) * 0.26), 11px); font-weight: 700; }
.winner-place svg { width: 1.1em; height: 1.1em; color: #c9a227; }
.winners-stage[data-size="xxs"] .winner-place span { display: none; } /* too small for "#n": the crown alone */

.flights { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
.ball {
  position: fixed; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--button); color: var(--on-button); font-weight: 700;
  box-shadow: var(--shadow-sm);
  will-change: transform;
}

.proof { text-align: left; margin-top: 32px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.proof h2 { margin: 0 0 8px; font-size: 18px; }
.proof .check { color: var(--good); margin: 0 0 12px; }
.proof .check.bad { color: var(--bad); }
.proof dt { color: var(--muted); font-size: 13px; margin-top: 8px; }
.proof dd { margin: 0; font-family: ui-monospace, monospace; font-size: 13px; word-break: break-all; }
.proof pre { margin: 14px 0 0; padding: 12px; background: var(--bg); border-radius: 8px; font-size: 12px; white-space: pre-wrap; word-break: break-all; }

/* --- Entry pages (/r/{id}, /enter/{token}) ----------------------------------- */

.entry-page { max-width: 560px; }
.raffle-hero { text-align: center; }
.raffle-image {
  display: block; width: 100%; max-height: 360px; object-fit: cover;
  border-radius: 14px; border: 1px solid var(--line); margin: 0 0 20px;
  background: var(--surface);
}
.prize { margin: 4px 0 0; font-size: 18px; }
.prize strong { color: var(--user); }
.description { color: var(--muted); margin: 12px 0 0; white-space: pre-line; }
.raffle-times {
  display: grid; grid-template-columns: auto 1fr; gap: 4px 16px;
  width: fit-content; margin: 16px auto 0; text-align: left; font-size: 14px;
}
.raffle-times dt { color: var(--muted); }
.raffle-times dd { margin: 0; }

.entry-panel {
  margin-top: 24px; padding: 20px;
  background: var(--surface); border: 1px solid var(--card-line); border-radius: 14px;
  box-shadow: var(--shadow-sm);
  text-align: center;
}
.entry-panel h1, .entry-panel h2 { margin: 0 0 6px; font-size: 22px; }
.entry-panel .countdown { margin: 0 0 16px; font-size: 26px; }
.hint { color: var(--muted); font-size: 14px; margin: 8px 0 0; }
.closed-note { margin: 0; }
.secondary-actions { margin: 16px 0 0; }

.link-form { display: grid; gap: 14px; justify-items: center; }
.methods { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.method {
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: transparent; color: var(--ink); font: inherit; font-size: 14px;
}
.method.is-active { background: var(--button); border-color: transparent; color: var(--on-button); font-weight: 600; }
.method:disabled { color: var(--muted); opacity: 0.6; cursor: not-allowed; }
.field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; width: 100%; max-width: 360px; text-align: left; font-size: 14px; color: var(--muted); }
/* width and min-width: an input's natural width comes from its size attribute (20 characters)
   at its font, which Safari counts in full: a big code field would push the form past a phone's
   screen. */
.field input {
  width: 100%; min-width: 0; min-height: 48px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--user); font: inherit; font-size: 16px;
}
.field input:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.cf-turnstile { min-height: 65px; }
.form-message { margin: 0; min-height: 1.5em; font-size: 14px; }
.form-message.good { color: var(--good); }
.form-message.bad { color: var(--bad); }
/* A callout that should stand out, like "You had already entered." */
.form-message.notice {
  margin-top: 18px; padding: 10px 14px; border-radius: 9px;
  background: var(--tint-strong); border-left: 3px solid var(--ink);
  color: var(--ink); font-size: 15px; font-weight: 700;
}

.check { display: inline-flex; gap: 10px; align-items: flex-start; text-align: left; margin-bottom: 16px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--primary); }
.watch-button:disabled { opacity: 0.45; cursor: not-allowed; }
.watch-button:disabled:active { transform: none; }

.entered-as { margin: 0; color: var(--muted); }
.your-number { margin: 4px 0 12px; font-size: 22px; }
.your-number strong { display: block; font-size: 56px; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.action-button {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px;
  border: 1px solid var(--line); border-radius: 999px; color: var(--ink); text-decoration: none; font-weight: 600;
}
@media (hover: hover) and (pointer: fine) {
  .action-button:hover { border-color: var(--ink); background: var(--tint); }
}
.raffle-card .actions-row { display: flex; flex-wrap: wrap; gap: 10px; }
.raffle-card .card-thumb { width: 100%; max-height: 180px; object-fit: cover; border-radius: 10px; margin-bottom: 12px; }
@media (max-width: 420px) {
  .entry-panel { padding: 16px; }
  .entry-panel .countdown { font-size: 21px; }
}

/* --- Prizes (claim page, My Wins) ------------------------------------------- */

.eyebrow { margin: 0 0 4px; color: var(--muted); font-weight: 700; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; }
.check-prizes { margin-top: 32px; }
.code-form { display: grid; gap: 14px; justify-items: center; }
.code-input { font-variant-numeric: tabular-nums; letter-spacing: 0.4em; text-align: center; font-size: 24px !important; }
.link-button { background: none; border: 0; padding: 0; color: var(--link); font: inherit; font-size: 14px; text-decoration: underline; cursor: pointer; }
.account-bar { color: var(--muted); font-size: 14px; margin: 0 0 16px; }
.prize-list { display: grid; gap: 16px; }
.prize-card { background: var(--surface); border: 1px solid var(--card-line); border-radius: 14px; padding: 20px; text-align: center; box-shadow: var(--shadow-sm); }
.prize-card.is-highlighted { border-color: var(--ink); }
.prize-card h2 { margin: 0 0 4px; font-size: 24px; }
.prize-status { margin: 12px 0; font-weight: 600; }
.prize-status.redeemed { color: var(--good); }
.prize-actions { margin-top: 16px; align-items: center; }
.prize-actions .watch-button { padding: 0 16px; font-size: 16px; }
.prize-actions .action-button { min-height: 48px; padding: 0 16px; border-color: var(--card-line); font-size: 16px; }

/* "Redeem prize…": the ways to redeem, in a dialog */
.redeem-dialog {
  width: min(420px, calc(100vw - 32px)); padding: 22px;
  border: 1px solid var(--card-line); border-radius: 16px;
  background: linear-gradient(var(--surface), var(--surface)), var(--bg); /* the surface is see-through in dark mode */
  color: var(--ink); box-shadow: var(--shadow-lg);
  text-align: center;
}
.redeem-dialog::backdrop { background: color-mix(in srgb, var(--primary) 35%, transparent); }
.redeem-dialog h2 { margin: 0 0 4px; font-size: 22px; }
.redeem-ways { list-style: none; margin: 16px 0; padding: 0; display: grid; gap: 10px; }
.redeem-way {
  display: grid; gap: 2px; width: 100%; padding: 12px 14px; text-align: left;
  border: 1px solid var(--card-line); border-radius: 12px; background: none; color: var(--ink); font: inherit;
}
.redeem-way:disabled { cursor: default; }
.redeem-way span { color: var(--muted); font-size: 14px; }
.redeem-way em { color: var(--muted); font-size: 12px; font-style: normal; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.check-prizes h2, #signed-out h2 { margin-bottom: 6px; }

/* Using a prize: press and hold (the fill grows while held), then the live "used" screen. */
.redeem-warning { margin: 16px 0; padding: 12px 14px; border-radius: 12px; background: var(--tint); color: var(--ink); font-weight: 600; }
.hold-button { position: relative; width: 100%; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.hold-fill { position: absolute; inset: 0; background: color-mix(in srgb, var(--good) 70%, var(--button)); transform: scaleX(0); transform-origin: left; }
.hold-button.is-holding .hold-fill { transform: scaleX(1); transition: transform 1.5s linear; }
.hold-text { position: relative; }
.redeem-dialog .form-message { margin-top: 10px; }
.redeem-qr { width: min(240px, 70vw); margin: 16px auto 10px; padding: 14px; border-radius: 12px; background: #fff; line-height: 0; }
.redeem-qr svg { width: 100%; height: auto; }
.redeem-qr .meta { line-height: 1.5; }

/* The used screen fills the phone: today's color (--day-hue), bands that keep moving, and the
   time since it was used, counting up. A screenshot or yesterday's screen looks different. */
.used-screen {
  width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; padding: 0 24px; border: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: hsl(var(--day-hue) 70% 42%); color: #fff; text-align: center;
}
.used-screen:not([open]) { display: none; }
.used-screen::backdrop { background: #000; }
.used-screen p { margin: 0; }
.used-band {
  align-self: stretch; height: 22px; margin: 18px -24px;
  background: repeating-linear-gradient(-45deg, rgb(255 255 255 / 0.85) 0 14px, transparent 14px 28px);
  background-size: 40px 40px; animation: used-band 1s linear infinite;
}
@keyframes used-band { to { background-position: 40px 0; } }
.used-screen .user-text { color: inherit; }
.used-label { font-size: 18px; font-weight: 800; letter-spacing: 0.3em; text-transform: uppercase; }
.used-prize { font-size: clamp(30px, 9vw, 48px); font-weight: 800; line-height: 1.1; }
.used-merchant { font-size: 22px; font-weight: 600; opacity: 0.9; }
.used-ago { margin-top: 14px !important; font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.used-when { font-size: 16px; opacity: 0.85; }
.used-close { position: absolute; top: max(16px, env(safe-area-inset-top)); right: 16px; padding: 8px 14px; border: 1px solid rgb(255 255 255 / 0.6); border-radius: 999px; background: none; color: #fff; font: inherit; font-weight: 600; cursor: pointer; }

/* A winner's code, scanned (/redeem/<token>) */
.redeem-page .signin-card h1 { margin-bottom: 12px; }
.redeem-image { display: block; width: 100%; max-height: 220px; object-fit: cover; margin: 0 0 16px; border-radius: 12px; }
.redeem-facts { display: grid; gap: 8px; margin: 0 0 16px; }
.redeem-facts div { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.redeem-facts dt { color: var(--muted); }
.redeem-facts dd { margin: 0; font-weight: 700; text-align: right; }
.redeem-status { margin: 0 0 14px; font-size: 20px; font-weight: 800; }
.redeem-status.is-ready { color: var(--good); }
.redeem-status.is-used, .redeem-status.is-other { color: var(--bad); }
.redeem-status.is-given { color: var(--good); font-size: 28px; }
.staff-link { margin-top: 18px; }
.staff-link summary { color: var(--muted); font-size: 14px; cursor: pointer; }
.staff-link[open] summary { margin-bottom: 12px; }

/* --- Raffle pages (/r/{id}, /enter/{token}): two columns on desktop, one on phones ---- */

.raffle-page { max-width: 1000px; padding: 32px 24px 64px; }
.raffle-layout {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  grid-template-areas: "cover main" "side main";
  grid-template-rows: auto 1fr;
  column-gap: 36px;
  align-items: start;
}
.raffle-layout.no-cover { grid-template-areas: "side main"; grid-template-rows: auto; }
.raffle-cover { grid-area: cover; margin-bottom: 24px; }
.raffle-cover img {
  display: block; width: 100%; aspect-ratio: 1; object-fit: cover;
  border: 1px solid var(--cover-line); border-radius: 12px; background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.raffle-side { grid-area: side; display: grid; gap: 24px; }
.raffle-main { grid-area: main; min-width: 0; }

.section-label {
  margin: 0 0 12px; padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  color: var(--muted); font-size: 14px; font-weight: 600;
}
.side-section .section-label [data-entry-count] { color: var(--ink); }
.host { display: flex; align-items: center; gap: 10px; margin: 0; font-weight: 600; }
.host-avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--button); color: var(--on-button);
  font-size: 13px; font-weight: 700;
}
.host-avatar.small { width: 20px; height: 20px; font-size: 11px; margin-right: 6px; vertical-align: -4px; }
.side-note { margin: 0; color: var(--muted); font-size: 14px; }
.side-links { display: grid; gap: 6px; font-size: 14px; }
.side-links a { color: var(--muted); text-decoration: none; }
@media (hover: hover) and (pointer: fine) {
  .side-links a:hover { color: var(--ink); }
}

.raffle-title { margin: 0 0 16px; font-size: 34px; line-height: 1.15; letter-spacing: -0.01em; text-wrap: balance; }
.mobile-meta { display: none; }

.facts { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 14px; }
.fact { display: flex; align-items: center; gap: 14px; }
.fact p { margin: 0; }
.fact-title { font-weight: 600; line-height: 1.3; }
.fact-sub { color: var(--muted); font-size: 14px; }
.fact-icon, .date-tile {
  flex: none; width: 42px; height: 42px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.fact-icon { display: grid; place-items: center; }
.date-tile { display: grid; grid-template-rows: 15px 1fr; overflow: hidden; text-align: center; }
.date-month {
  background: var(--tint-strong); color: var(--muted);
  font-size: 9px; font-weight: 700; letter-spacing: 0.06em; line-height: 15px;
}
.date-day { color: var(--ink); font-size: 15px; font-weight: 600; line-height: 26px; }

.action-card {
  margin-bottom: 28px; overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--card-line); border-radius: 12px;
  box-shadow: var(--shadow-sm);
}
.action-card-title {
  margin: 0; padding: 9px 16px;
  background: var(--tint); border-bottom: 1px solid var(--card-line);
  color: var(--muted); font-size: 14px; font-weight: 600;
}
.action-card-body { padding: 16px; }
.card-countdown { margin: 0 0 12px; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.card-countdown:empty { display: none; }
.card-countdown .more-winners { font-size: inherit; font-weight: inherit; }
.card-countdown.all-winners { font-size: 16px; line-height: 1.6; } /* the whole list: smaller, so many fit */
.card-lead { margin: 0 0 14px; }
.entries-full { display: flex; align-items: center; gap: 10px; margin: 0 0 4px; font-weight: 600; }
.entries-full svg { flex: none; color: var(--bad); }
.action-card .link-form { justify-items: stretch; gap: 14px; }
.action-card .link-form .card-lead { margin: 0; }
.action-card .methods { justify-content: flex-start; }
.action-card .field { max-width: none; }
.action-card .hint { margin-top: 10px; }
.action-card .check { margin-bottom: 14px; }
.action-card .actions { justify-content: flex-start; }
.action-card .entered-as { margin: 0; }
.action-card .your-number { margin: 2px 0 12px; }
.action-card .method, .action-card .field input { border-color: var(--card-line); }

/* After entering: ways to be reminded, one link per row, each anchored by an icon. */
.drawing-section { margin-top: 28px; padding-bottom: 32px; }
.drawing-section .reminder-links { margin-top: 4px; }
.reminders { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--card-line); }
.reminders-title { margin: 0 0 12px; font-size: 16px; }
.reminder-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.reminder-links li { display: flex; align-items: center; gap: 12px; }
.reminder-links .fact-icon, .reminder-links .date-tile { border-color: var(--card-line); }
.reminder-links a { font-weight: 600; text-underline-offset: 3px; }

.primary-button {
  display: flex; align-items: center; justify-content: center; width: 100%;
  min-height: 46px; padding: 0 20px; border: 0; border-radius: 9px;
  background: var(--button); color: var(--on-button);
  font: inherit; font-weight: 700; font-size: 16px; text-decoration: none; cursor: pointer;
  transition: transform 150ms cubic-bezier(0.25, 0.46, 0.45, 0.94), filter 150ms ease;
}
.primary-button:active { transform: scale(0.98); }
.primary-button:disabled { opacity: 0.45; cursor: not-allowed; }
.primary-button:disabled:active { transform: none; }
@media (hover: hover) and (pointer: fine) {
  .primary-button:not(:disabled):hover { filter: brightness(1.08); }
}

.about .prose { line-height: 1.6; }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose table { margin: 0 0 14px; }
.prose h1, .prose h2, .prose h3, .prose h4 { margin: 22px 0 8px; font-size: 17px; line-height: 1.3; }
.prose h1 { font-size: 20px; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 4px; }
.prose blockquote { padding-left: 12px; border-left: 3px solid var(--line); color: var(--muted); }
.prose code { padding: 1px 5px; border-radius: 5px; background: var(--tint-strong); font-size: 0.9em; }
.prose img { max-width: 100%; border-radius: 8px; }
.prose table { border-collapse: collapse; }
.prose th, .prose td { padding: 6px 10px; border: 1px solid var(--line); text-align: left; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

@media (max-width: 820px) {
  .raffle-page { padding: 16px 16px 48px; }
  .raffle-layout, .raffle-layout.no-cover {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "cover" "main" "side";
    grid-template-rows: auto;
  }
  .raffle-cover { margin-bottom: 20px; }
  .raffle-side .side-section { display: none; }  /* shown as one line under the title instead */
  .raffle-side { border-top: 1px solid var(--line); padding-top: 16px; }
  .raffle-title { font-size: 27px; margin-bottom: 10px; }
  .mobile-meta { display: flex; align-items: center; gap: 8px; margin: 0 0 18px; color: var(--muted); font-size: 14px; }
  .mobile-meta strong { color: var(--ink); font-weight: 600; }
  .mobile-meta .host-avatar.small { margin: 0; }
}
.action-card .form-message:empty { display: none; }


/* --- Landing (/) ------------------------------------------------------------ */

.landing { text-align: center; padding-top: 48px; }
.landing-gif { width: min(360px, 80vw); border-radius: 18px; box-shadow: var(--shadow-lg); }
.landing-title { margin: 28px 0 8px; font-size: clamp(88px, 22vw, 180px); line-height: 0.9; letter-spacing: -0.04em; }
.landing-note { margin: 0 auto; max-width: 440px; color: var(--muted); font-size: 17px; }

/* --- Sign in (/signin) --------------------------------------------------------- */

.signin-page { max-width: 440px; padding-top: 56px; }
.signin-card {
  padding: 28px 28px 24px; border: 1px solid var(--card-line); border-radius: 18px;
  background: var(--surface); box-shadow: var(--shadow-lg);
}
.signin-mark { display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 16px; border-radius: 50%; background: var(--tint-strong); color: var(--ink); }
.signin-card h1 { font-size: 24px; }
.signin-card .hint { margin: 0 0 20px; color: var(--muted); }
.signin-card .field { max-width: none; }
.signin-card .link-form, .signin-card .code-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; justify-items: stretch; }
.signin-card .watch-button { width: 100%; }
/* Product image upload (/admin/upload/<token>), on the sign-in card */
.upload-form { display: grid; gap: 14px; }
.drop-zone {
  position: relative; display: grid; place-items: center; min-height: 200px; padding: 12px; overflow: hidden;
  border: 1.5px dashed var(--card-line); border-radius: 14px; background: var(--tint); color: var(--muted);
  text-align: center; font-size: 15px; cursor: pointer; transition: border-color 160ms var(--ease-out), background 160ms var(--ease-out);
}
.drop-zone.is-over { border-color: var(--ink); background: var(--tint-strong); }
.drop-zone.is-done { cursor: default; border-style: solid; }
.drop-zone small { display: block; margin-top: 6px; font-size: 13px; }
.drop-zone img { max-width: 100%; max-height: 320px; border-radius: 10px; object-fit: contain; }
.drop-zone input { position: absolute; inset: 0; opacity: 0; cursor: inherit; }
.signin-card .upload-form .watch-button { width: 100%; }
.signin-or { display: flex; align-items: center; gap: 12px; margin: 22px 0 14px; color: var(--muted); font-size: 13px; }
.signin-or::before, .signin-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.signin-other { display: grid; gap: 10px; }
.signin-method {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  border: 1px solid var(--card-line); border-radius: 999px; background: transparent; color: var(--muted);
  font: inherit; font-weight: 600; cursor: not-allowed;
}
.signin-method small { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.8; }

/* --- Page title with tabs (Raffles, Discover, My Wins) ------------------------- */

.timeline-page { max-width: 880px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 8px 0 28px; }
.page-head h1 { margin: 0; font-size: 34px; }
.tabs { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--tint-strong); }
.tab {
  border: 0; border-radius: 8px; padding: 6px 16px; background: transparent; color: var(--muted);
  font: inherit; font-weight: 600; cursor: pointer;
}
.tab[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
[data-theme="dark"] .tab[aria-selected="true"] { background: var(--tint-strong); }

/* --- The timeline: raffles grouped by drawing date ------------------------------
   Desktop: the date on the left, a dot on a dashed line, the cards on the right.
   Phones: the date on its own line next to the dot, the cards under it. */

.timeline { display: grid; }
.tl-day { position: relative; display: grid; grid-template-columns: 150px 28px 1fr; padding-bottom: 28px; }
.tl-day::before { /* the dashed line, from this day's dot down to the next */
  content: ""; position: absolute; left: 163px; top: 18px; bottom: 0;
  border-left: 2px dashed var(--line);
}
.tl-day:last-child::before { bottom: 28px; }
.tl-date { display: grid; align-content: start; padding-top: 2px; }
.tl-date-day { font-size: 18px; font-weight: 700; }
.tl-weekday { color: var(--muted); font-size: 16px; }
.tl-dot { justify-self: center; width: 10px; height: 10px; margin-top: 9px; border-radius: 50%; background: var(--muted); position: relative; z-index: 1; }
.tl-cards { display: grid; gap: 14px; }
.tl-card {
  display: flex; gap: 18px; justify-content: space-between; align-items: flex-start;
  padding: 18px 20px; border: 1px solid var(--card-line); border-radius: 14px;
  background: var(--surface); box-shadow: var(--shadow-sm);
  color: inherit; text-decoration: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
@media (hover: hover) and (pointer: fine) { .tl-card:hover { border-color: var(--ink); } }
.tl-card.is-won { border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent), var(--shadow-sm); }
.tl-body { display: grid; gap: 4px; min-width: 0; }
.tl-time { margin: 0; color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; }
.tl-title { margin: 0; font-size: 20px; line-height: 1.25; }
.tl-line { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--muted); font-size: 15px; }
.tl-line svg { flex: none; }
.tl-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tl-thumb { flex: none; width: 112px; height: 112px; border-radius: 10px; object-fit: cover; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 6px; font-size: 13px; font-weight: 700; background: var(--tint-strong); color: var(--muted); }
.pill.good { background: var(--good); color: var(--bg); }
.pill.won { background: var(--button); color: var(--on-button); }
.pill.live { background: color-mix(in srgb, var(--p1) 85%, var(--bg)); color: var(--bg); }

.tl-empty { display: grid; justify-items: center; gap: 6px; padding: 56px 16px; text-align: center; }
.tl-empty-mark { display: grid; place-items: center; width: 84px; height: 84px; margin-bottom: 10px; border-radius: 22px; background: var(--surface); border: 1px solid var(--card-line); box-shadow: var(--shadow-lg); color: var(--muted); }
.tl-empty h2 { margin: 0; color: var(--muted); font-size: 22px; }
.tl-empty p { margin: 0; color: var(--muted); }

@media (max-width: 700px) {
  .page-head h1 { font-size: 28px; }
  .tl-day { grid-template-columns: 22px 1fr; grid-template-areas: "dot date" ". cards"; padding-bottom: 22px; }
  .tl-day::before { left: 4px; top: 16px; }
  .tl-dot { grid-area: dot; justify-self: start; margin-top: 8px; }
  .tl-date { grid-area: date; display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
  .tl-cards { grid-area: cards; }
  .tl-card { padding: 16px; }
  .tl-title { font-size: 18px; }
  .tl-thumb { width: 84px; height: 84px; }
}

/* --- My Wins: shorter rows, details on the left, the picture square on the right --- */

.win-list { display: grid; gap: 14px; }
.win-card {
  display: flex; gap: 18px; justify-content: space-between; align-items: flex-start;
  padding: 18px 20px; border: 1px solid var(--card-line); border-radius: 14px;
  background: var(--surface); box-shadow: var(--shadow-sm);
}
.win-card.is-highlighted { border-color: var(--ink); }
.win-body { display: grid; gap: 4px; min-width: 0; }
.win-body .eyebrow { margin: 0; }
.win-body h2 { margin: 0; font-size: 20px; line-height: 1.25; }
.win-body .meta { font-size: 15px; }
.win-body .prize-status { margin: 4px 0 0; }
.win-card .prize-actions { justify-content: flex-start; margin-top: 10px; }
.win-thumb { flex: none; width: 120px; height: 120px; border-radius: 10px; object-fit: cover; }
@media (max-width: 700px) {
  .win-card { padding: 16px; }
  .win-thumb { width: 84px; height: 84px; }
}

/* The account popover's switcher: yourself, or a merchant you're an admin of. */
.session-switch { margin: 0 0 12px; padding: 10px 0; border-block: 1px solid var(--line); }
.switch-label { margin: 0 0 4px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.switch-item { display: flex; align-items: center; gap: 6px; padding: 5px 0; color: var(--ink); font-weight: 600; font-size: 14px; text-decoration: none; }
.switch-check { width: 1em; color: var(--muted); }
@media (hover: hover) and (pointer: fine) { .switch-item:hover span:last-child { text-decoration: underline; } }

/* A merchant's page (/merchant/<id>). */
.merchant-select {
  max-width: 50%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 600;
}
.merchant-section { margin: 0 0 28px; padding: 20px; border: 1px solid var(--card-line); border-radius: 14px; background: var(--surface); }
.merchant-section h2 { margin: 0 0 4px; font-size: 20px; }
.admin-list { list-style: none; margin: 14px 0; padding: 0; }
.admin-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.admin-row:last-child { border-bottom: 1px solid var(--line); }
.admin-email { font-weight: 600; overflow-wrap: anywhere; }
.admin-you { padding: 1px 8px; border-radius: 999px; background: var(--line); font-size: 12px; font-weight: 700; }
@media (max-width: 559px) {
  .merchant-page .page-head { flex-direction: column; align-items: stretch; }
  .merchant-select { max-width: none; }
}
.merchant-actions { justify-content: flex-start; margin: 14px 0 6px; }
.merchant-actions .action-button { min-height: 48px; padding: 0 18px; border-color: var(--card-line); background: transparent; font: inherit; font-size: 16px; font-weight: 600; cursor: pointer; }
.row-end { margin-left: auto; }
.merchant-section .form-message:empty { display: none; }
.station-next { margin: 18px 0; padding: 14px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; }
.station-next p { margin: 0 0 6px; }
.station-next ul { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; color: var(--muted); }

/* The staff sign (/merchant/<id>/sign): controls and an on-screen code, then the sheet to print.
   The sheet is four quarters with dashed fold lines; the top left is printed upside down, since
   folding turns it upright (plan "The staff sign"). */
.sign-page { max-width: 880px; }
.sign-screen h1 { margin: 0 0 6px; }
/* Under each preview: the size, then the button, at the right end (wrapping onto two rows if needed). */
.sign-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 12px 10px; margin: 16px 0 0; }
.sign-controls .watch-button { padding: 0 20px; }
.ios-note { margin: 10px 0 0; text-align: right; }
.paper-choice { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 600; font-size: 14px; }
.paper-choice select { padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; font-size: 15px; }
.sign-show { display: flex; flex-wrap: wrap; align-items: center; gap: 24px; margin: 20px 0 32px; padding: 20px; border: 1px solid var(--card-line); border-radius: 14px; background: var(--surface); }
.sign-show-qr { width: 200px; padding: 12px; border-radius: 10px; background: #fff; line-height: 0; }
.sign-show-qr svg, .sheet-qr svg { width: 100%; height: auto; }
.sign-show-label { margin: 0; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.sign-pin { margin: 4px 0 8px; font-size: 40px; font-weight: 800; letter-spacing: 0.08em; font-variant-numeric: tabular-nums; }
.sign-preview-title { margin: 0 0 12px; font-size: 20px; }

/* Centered with auto margins, not justify-content, so nothing is ever cut off on the left. */
.sheet-frame, .label-frame { display: flex; }
.sheet, .label { margin-inline: auto; }
/* The sheet scales as one piece: everything in it is sized in cqw, hundredths of the sheet's
   width (100cqw = 8.5in on Letter, so 1in = 11.76cqw and 1pt = 0.163cqw), and its height follows
   from the paper's shape. On screen it fits the page (no zoom: iOS would enlarge its tiny text);
   printed, it's the paper's size, or smaller where Safari on iPhone and iPad adds margins. */
.sheet {
  --w: 8.5in;
  container: sheet / inline-size;
  position: relative; display: grid; grid-template: 1fr 1fr / 1fr 1fr; flex: none;
  width: min(100%, 540px); aspect-ratio: 8.5 / 11; box-sizing: border-box;
  color: #111; font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  box-shadow: var(--shadow-lg);
}
.sheet.is-a4 { --w: 210mm; aspect-ratio: 210 / 297; }
/* The fold lines, across the middle each way: dashed stripes in the sheet's background (borders on
   the quarters would turn with the rotated cover, and WebKit didn't paint a dashed border on a
   zero-width line). */
.sheet {
  --fold: #9a9a9a;
  background:
    linear-gradient(to bottom, var(--fold) 55%, transparent 0) 50% 0 / 1.5px 12px repeat-y,
    linear-gradient(to right, var(--fold) 55%, transparent 0) 0 50% / 12px 1.5px repeat-x,
    #fff;
}
.quad { display: flex; flex-direction: column; justify-content: center; gap: 1.41cqw; padding: 5.88cqw; box-sizing: border-box; min-width: 0; min-height: 0; }
.quad-cover { align-items: center; text-align: center; transform: rotate(180deg); }
.quad-back { color: #555; }
.quad-pin { align-items: center; text-align: center; }
.sheet p, .sheet ol { margin: 0; }
.sheet-brand { font-size: 1.8cqw; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: #555; }
.sheet-merchant { font-size: 3.27cqw; font-weight: 800; line-height: 1.15; }
.sheet-qr { width: 31.8cqw; margin: 0.94cqw 0; line-height: 0; }
.sheet-line { font-size: 1.96cqw; font-weight: 600; }
.sheet-heading { font-size: 2.29cqw; font-weight: 800; }
.sheet-steps { padding-left: 1.2em; font-size: 1.8cqw; line-height: 1.45; }
.sheet-steps li + li { margin-top: 0.71cqw; }
.sheet-small { font-size: 1.55cqw; line-height: 1.4; color: #444; }
.sheet-pin { font-size: 7.52cqw; font-weight: 800; letter-spacing: 0.08em; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Just the QR, on a (square) label for a label printer. What's inside scales with the label
   (cqmin); the label's own padding and gap can't use cqmin (it measures containers around it, not
   the label itself), so they're fractions of --label-w. The sides are kept narrow so the code is as
   big as it can be; top and bottom keep a quiet zone of white around it, which a QR needs to scan. */
.label-screen { margin-top: 48px; }
.label-frame { padding: 8px 0 0; }
.label {
  --label-w: 2in; --label-h: 2in;
  container: label / size;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: calc(var(--label-w) * 0.02);
  width: var(--label-w); height: var(--label-h); box-sizing: border-box;
  padding: calc(var(--label-w) * 0.05) calc(var(--label-w) * 0.02);
  background: #fff; color: #111; font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  text-align: center; line-height: 1.2; box-shadow: var(--shadow-lg);
}
.label p { margin: 0; }
.label-qr { width: 68cqmin; line-height: 0; }
.label.is-long .label-qr { width: 60cqmin; } /* a name on two lines: keep the quiet zone */
.label-qr svg { width: 100%; height: auto; }
.label-brand { font-size: 4.5cqmin; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: #555; }
.label-merchant { font-size: 8.5cqmin; font-weight: 800; line-height: 1.1; }
.label-line { margin-top: 1cqmin !important; font-size: 6cqmin; font-weight: 600; white-space: nowrap; }
.label-small { font-size: 4cqmin; color: #555; }

@media print {
  html, body { background: #fff !important; }
  .topbar, .site-footer, .sign-screen, .sign-controls { display: none !important; }
  .sign-page { max-width: none; margin: 0; padding: 0; }
  .sheet-frame, .label-frame { padding: 0; }
  .sheet { width: calc(var(--w) * var(--print-scale, 1)); box-shadow: none; break-inside: avoid; }
  /* Safari on iPhone and iPad ignores @page margin: 0 and adds wide margins, a header and a
     footer. At 76% the sheet fits inside them on one page (station-sign.js sets .is-ios). */
  .is-ios { --print-scale: 0.76; }
  .label { box-shadow: none; break-inside: avoid; }
  [data-print="sheet"] .label-frame, [data-print="label"] .sheet-frame { display: none !important; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
