/* 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);
  --dark-bg: #171c2b; /* the dark theme's page, in either theme (the showcase's stage) */
  --cover-line: color-mix(in srgb, var(--primary) 14%, transparent); /* frames pictures against the light page */
  --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 */
  --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: var(--dark-bg);
  --cover-line: transparent; /* the dark page frames pictures already */
  --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);
  --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), 132px); top: 50%; transform: translateY(-50%); }
}
@media (max-width: 759px) {
  .site-nav { gap: 18px; margin-left: 8px; }
  .nav-label { display: none; } /* phones: icons only */
  .top-link .nav-label { display: inline; } /* but Sign In and Discover (signed out) are words */
  .site-session a { white-space: nowrap; }
}
@media (max-width: 400px) {
  .topbar { padding-inline: 16px; gap: 12px; }
  .site-right, .site-session { gap: 12px; }
}

/* 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 {
  display: inline-flex; align-items: center; gap: 0.4em;
  color: var(--ink); font-weight: 700; letter-spacing: 0.02em; text-decoration: none; font-size: 20px;
}
.brand-mark { height: 1.15em; width: auto; flex: none; }
/* The header's pieces only the sidebar shows (below): the theme toggle's and timer's names, and
   the signed-out links' icons. */
.rail-only, .top-link svg { display: none; }

/* --- Desktop: the header is a sidebar ---------------------------------------------------
   A narrow rail down the left edge, the height of the screen: the logo (no name), the links'
   icons, and at the bottom the session timer (minutes over seconds) and the theme toggle. On
   hover (or when a keyboard focuses something in it) it grows wider over the page and shows
   the links' names. Phones (and narrow windows) keep the header across the top. */
@media (min-width: 821px) {
  :root { --rail: 68px; --rail-open: 212px; }
  body { padding-left: var(--rail); }
  .topbar {
    position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; width: var(--rail);
    flex-direction: column; align-items: stretch; gap: 0; padding: 18px 12px;
    background: var(--bg); border-right: 1px solid var(--line);
    transition: width 220ms var(--ease-out), box-shadow 220ms ease;
  }
  .topbar:hover, .topbar:has(:focus-visible) { width: var(--rail-open); box-shadow: 4px 0 14px rgb(0 0 0 / 0.35), 28px 0 56px -8px rgb(0 0 0 / 0.55); }

  /* Every row: a 44px square for the icon, then its name, faded in as the rail opens. */
  .brand, .topbar .nav-link, .topbar .top-link, .session-timer, .topbar .theme-toggle {
    display: flex; align-items: center; gap: 14px; height: 44px; padding: 0 12px; flex: none;
    border-radius: 12px; white-space: nowrap; overflow: hidden;
  }
  .topbar .nav-label, .topbar .rail-only, .topbar .top-link svg { display: block; }
  .topbar .nav-label { opacity: 0; transition: opacity 160ms ease; }
  .topbar:hover .nav-label, .topbar:has(:focus-visible) .nav-label { opacity: 1; }
  .topbar svg { flex: none; }
  @media (hover: hover) and (pointer: fine) {
    .topbar .nav-link:hover, .topbar .top-link:hover, .session-timer:hover, .topbar .theme-toggle:hover { background: var(--tint-strong); }
  }
  .topbar .nav-link[aria-current="page"], .topbar .top-link[aria-current="page"] { background: var(--tint); }

  .brand { padding: 0 10px; margin-bottom: 18px; }
  .brand-mark { height: 22px; }
  .brand-name { display: none; }

  .site-nav, .is-signed-in .site-nav { position: static; transform: none; flex-direction: column; align-items: stretch; gap: 4px; margin: 0; }
  .site-right { margin: auto 0 0; flex-direction: column; align-items: stretch; gap: 4px; }
  .site-session { flex-direction: column; align-items: stretch; gap: 4px; }
  .topbar .top-link, .topbar .nav-link { font-size: 15px; }

  /* The timer: minutes over seconds, in the icons' column. */
  .session-timer { width: 100%; padding: 0 12px; text-align: left; }
  .timer-time { display: flex; flex-direction: column; align-items: center; width: 20px; flex: none; font-size: 13px; line-height: 1.15; }
  .timer-sep { display: none; }
  .session-popover { top: auto; bottom: 0; right: auto; left: calc(100% + 14px); }

  .topbar .theme-toggle { width: 100%; padding: 0 13px; border: 0; color: var(--muted); font: inherit; font-size: 15px; font-weight: 600; }
  .topbar .theme-toggle:active { transform: none; }
}

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);
}
.site-footer p { max-width: 560px; margin: 0 auto 6px; line-height: 1.5; text-wrap: pretty; }
.site-footer .footer-title { font-weight: 600; color: var(--ink); }
.footer-honored { list-style: none; margin: 0; padding: 0; }
.footer-honored a { color: inherit; font-weight: 600; }
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; padding-bottom: calc(var(--drawer-h, 120px) + 24px); }
.raffle-head { margin-bottom: 16px; }
/* "Live": red, with a dot that pulses while the drawing is on. */
.badge-live {
  --live: #e5383b;
  display: inline-flex; align-items: center; gap: 6px;
  border-color: color-mix(in srgb, var(--live) 45%, transparent);
  background: color-mix(in srgb, var(--live) 10%, transparent);
  color: var(--live);
}
.meta .badge-live { margin-left: 0; vertical-align: 1px; }
:root[data-theme="dark"] .badge-live { --live: #ff6b6b; }
.badge-live::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--live);
  animation: live-pulse 1.6s ease-out infinite;
}
@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 60%, transparent); }
  70%, 100% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--live) 0%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .badge-live::before { animation: live-blink 2s ease-in-out infinite; }
  @keyframes live-blink { 50% { opacity: 0.35; } }
}

/* 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 { position: relative; font-size: 26px; font-weight: 700; margin: 0; font-variant-numeric: tabular-nums; }
.message-line { display: block; }
.message-line.is-leaving { position: absolute; inset: 0 0 auto; } /* rolling out (watch.js), over the new line */
/* A die face in the message ("⚃ was rolled!"): a small die in the die's colors. */
.message-line:has(.message-die) { display: flex; justify-content: center; align-items: center; gap: 0.32em; }
.message-die {
  display: grid; place-items: center; flex: none; width: 1.1em; height: 1.1em;
  border-radius: 0.24em; background: var(--die); color: var(--die-pip);
}
.message-die .pips { width: 76%; height: 76%; }
/* The countdown to a roll (drawings/dice.js): each second's number comes at the viewer over
   the dice tray, in the raffle's color. */
.roll-countdown {
  position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; pointer-events: none;
}
.roll-countdown span {
  grid-area: 1 / 1;
  color: var(--accent, var(--button)); font-size: 96px; font-weight: 800; line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 0 rgb(0 0 0 / 0.12), 0 6px 24px rgb(0 0 0 / 0.25);
  opacity: 0;
}
.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; }
  /* The Live/Replay pill gets its own row, above the title. */
  .raffle-head h1 { display: flex; flex-direction: column-reverse; align-items: center; gap: 6px; }
  .raffle-head h1 .badge { margin-left: 0; }
  .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; }
  .roll-countdown span { font-size: 68px; }
  .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 drawer, fixed to the bottom of the screen on every drawing: a "?" slot per
   winner, with a crown and the place under it. --ws (the slot size) steps down as the number of
   winners grows; past a few rows it scrolls. The handle closes it to one line. The page leaves
   room for it (--drawer-h, measured by watch.js). */
.winners-drawer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 8;
  width: min(100%, 880px); margin: 0 auto;
  background: linear-gradient(var(--surface), var(--surface)), var(--bg); /* solid: the page passes under it */
  border: 1px solid var(--line); border-bottom: 0;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -10px 30px -18px color-mix(in srgb, var(--primary) 55%, transparent);
  padding: 0 16px calc(10px + env(safe-area-inset-bottom));
  text-align: center;
}
.winners-drawer[data-size="l"] { --ws: 46px; }
.winners-drawer[data-size="m"] { --ws: 38px; }
.winners-drawer[data-size="s"] { --ws: 32px; }
.winners-drawer[data-size="xs"] { --ws: 26px; }
.winners-drawer[data-size="xxs"] { --ws: 20px; }
.drawer-handle {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  padding: 10px 0 8px; border: 0; background: none; color: var(--muted); font: inherit; cursor: pointer;
}
.drawer-handle::before { /* the grip */
  content: ""; position: absolute; top: 6px; left: 50%; width: 36px; height: 4px; margin-left: -18px;
  border-radius: 2px; background: var(--line);
}
.winners-label { color: var(--ink); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.winners-count { font-size: 13px; font-variant-numeric: tabular-nums; }
.drawer-chevron { transition: transform 250ms cubic-bezier(0.32, 0.72, 0, 1); }
.winners-drawer.is-closed .drawer-chevron { transform: rotate(180deg); }
.winners-drawer.is-closed .winner-slots { display: none; }
.winner-slots {
  list-style: none; margin: 0 auto; padding: 2px 0 4px; max-width: 760px;
  max-height: min(34vh, calc(var(--ws) * 4.4)); overflow-y: auto; overscroll-behavior: contain;
  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-drawer[data-size="xxs"] .winner-place span { display: none; } /* too small for "#n": the crown alone */

/* Tracked numbers: lines floating just above the drawer, like comments over a live video. No
   background; a soft halo in the page's color keeps them readable over whatever passes under. */
.tracker {
  position: fixed; z-index: 7;
  left: max(12px, calc(50% - 440px + 16px)); /* in line with the drawer's left edge */
  bottom: calc(var(--drawer-h, 120px) + 10px);
  max-width: min(calc(100% - 24px), 440px);
  text-align: left; pointer-events: none;
  /* stacked, so the halo is near-solid right around the letters and fades out past them */
  --halo: 0 0 1px var(--bg), 0 0 2px var(--bg), 0 0 3px var(--bg), 0 0 4px var(--bg), 0 0 7px var(--bg), 0 0 12px var(--bg), 0 0 18px var(--bg);
}
/* A soft fade of the page's color behind the lines: no edge, no box. */
.tracker::before {
  content: ""; position: absolute; z-index: -1; inset: -28px -60px -14px -40px;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--bg) 78%, transparent), transparent);
  pointer-events: none;
}
.tracker:not(:has(.tracked-line)):not(:has(.track-form.is-open))::before { display: none; }
.tracked {
  list-style: none; margin: 0; padding: 0; width: fit-content; max-width: 100%;
  display: flex; flex-direction: column; gap: 1px;
  max-height: min(30vh, 236px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none;
  pointer-events: auto;
}
.tracked:empty { display: none; }
.tracked-line {
  display: flex; align-items: center; gap: 6px; min-height: 26px;
  color: var(--ink); font-size: 15px; font-weight: 600; line-height: 1.25;
  text-shadow: var(--halo);
}
.tracked-num { font-weight: 800; font-variant-numeric: tabular-nums; }
.tracked-you {
  padding: 1px 6px; border-radius: 999px; background: var(--button); color: var(--on-button);
  font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; text-shadow: none;
}
.tracked-sep { color: var(--muted); }
.tracked-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tracked-line[data-state="waiting"] .tracked-text { color: var(--muted); }
/* The die face a tracked number needs, in its group's color, like the board's group labels. */
.tracked-die {
  flex: none; width: 22px; height: 22px; border-radius: 6px;
  display: grid; place-items: center;
  background: var(--g); color: var(--on-group);
  box-shadow: 0 0 0 2px var(--bg), 0 0 10px var(--bg);
}
.tracked-die[data-face="1"] { --g: var(--p1); } .tracked-die[data-face="2"] { --g: var(--p2); }
.tracked-die[data-face="3"] { --g: var(--p3); } .tracked-die[data-face="4"] { --g: var(--p4); }
.tracked-die[data-face="5"] { --g: var(--p5); } .tracked-die[data-face="6"] { --g: var(--p6); }
.tracked-line[data-state="out"] { color: var(--muted); }
.tracked-line[data-state="out"] .tracked-num { text-decoration: line-through; text-decoration-thickness: 1.5px; }
.tracked-line[data-state="won"] .tracked-num {
  padding: 1px 8px; border-radius: 999px; background: var(--button); color: var(--on-button); text-shadow: none;
}
.tracked-line[data-state="won"] .tracked-text { font-weight: 800; }
.tracked-line.is-new-win .tracked-num { animation: tracked-win 900ms cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes tracked-win { 0% { transform: scale(0.6); } 60% { transform: scale(1.18); } 100% { transform: none; } }
.tracked-remove {
  display: grid; place-items: center; width: 24px; height: 24px; margin-left: -2px; padding: 0;
  border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer;
  filter: drop-shadow(0 0 3px var(--bg));
}
@media (hover: hover) and (pointer: fine) { .tracked-remove:hover { color: var(--ink); } }
.track-form { display: flex; align-items: center; gap: 8px; width: fit-content; margin-top: 6px; pointer-events: auto; }
.track-add {
  display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 0 12px 0 9px;
  border: 1px dashed color-mix(in srgb, var(--ink) 35%, transparent); border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 55%, transparent); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  color: var(--ink); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
  transition: transform 150ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.track-add::before { content: "+"; font-size: 17px; line-height: 1; font-weight: 600; }
.track-add:active { transform: scale(0.97); }
/* The input, with a round arrow inside it on the right (once something's typed) to send it. */
.track-field { position: relative; display: inline-flex; }
.track-input {
  width: 156px; min-height: 34px; padding: 0 40px 0 14px;
  -moz-appearance: textfield; appearance: textfield; /* no spinner */
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink);
  font: inherit; font-size: 16px; font-variant-numeric: tabular-nums; box-shadow: var(--shadow-sm);
}
.track-input:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.track-input::-webkit-inner-spin-button, .track-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.track-go {
  position: absolute; top: 50%; right: 4px; translate: 0 -50%;
  display: grid; place-items: center; width: 28px; height: 28px; padding: 0;
  border: 0; border-radius: 50%; background: var(--button); color: var(--on-button); cursor: pointer;
  animation: track-go-in 180ms var(--ease-out);
  transition: transform 150ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.track-go:active { transform: scale(0.92); }
@keyframes track-go-in { from { opacity: 0; scale: 0.6; } }
@media (prefers-reduced-motion: reduce) { .track-go { animation: none; } }
.track-hint { color: var(--muted); font-size: 13px; font-weight: 600; text-shadow: var(--halo); }
@media (max-width: 600px) {
  .tracked-line { font-size: 14px; min-height: 24px; }
  .tracked { max-height: min(24vh, 170px); }
}
@media (prefers-reduced-motion: reduce) { .tracked-line.is-new-win .tracked-num { animation: none; } }

/* A tracked number, wherever it shows: ringed. */
.slot.is-tracked { box-shadow: 0 0 0 2px var(--ink); font-weight: 800; }
.winner-ball.is-tracked { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ink); }
.reveal-ball.is-tracked { box-shadow: 0 0 0 6px var(--bg), 0 0 0 11px var(--ink), var(--shadow-lg); }

.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;
}
/* The drum's winning number, big in the middle of the screen before it goes down to the drawer. */
.reveal-ball {
  background: linear-gradient(var(--button), var(--button)), var(--bg); /* solid over the drum */
  font-weight: 800; font-variant-numeric: tabular-nums; box-shadow: var(--shadow-lg); letter-spacing: -0.02em;
}
/* Behind it, the page dims, so the number is all you see. */
.reveal-scrim { position: fixed; inset: 0; background: color-mix(in srgb, var(--bg) 72%, transparent); }

/* The drum drawing: no board, the drum in the middle of what's left of the screen, bigger. */
.watch.is-drum .stage-dock { position: static; display: flex; flex-direction: column; justify-content: center; }
.watch.is-drum .stage-top { height: auto; padding: 24px 0; }
.watch.is-drum .drum { --r: 84px; width: 340px; }
.watch.is-drum .drum-face { font-size: 17px; }
.watch.is-drum .board-area { display: none; }
.watch.is-drum .sound-button { top: 8px; bottom: auto; } /* clear of the tracked numbers, low on the left */
@media (max-width: 600px) {
  .watch.is-drum .drum { --r: 60px; width: 250px; }
  .watch.is-drum .drum-face { font-size: 13px; }
}

.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; }
/* "How would you like to enter?" over the ways to enter: the question the form asks. */
.method-choice { display: grid; gap: 8px; }
.method-question { margin: 0; font-weight: 600; }
.method-aside { color: var(--muted); font-weight: 400; }
.form-terms { margin: -4px 0 0; color: var(--muted); font-size: 13px; text-align: center; }
.form-terms a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.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 Prizes) ------------------------------------------- */

.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; }
.prize-actions button.action-button { background: transparent; font: inherit; font-size: 16px; font-weight: 600; cursor: pointer; }

/* "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 ---- */

/* Desktop: two panes, the whole width and height of the screen (the header is a sidebar there).
   On the left, on a dark panel from the top of the screen to the bottom, the showcase, centered,
   staying put (sticky); on the right, on the page's own color, the details, scrolling with the
   page. The sidebar takes the panel's color, so the panel reaches the screen's left edge.
   The panel is the theme's dark page color; in dark mode, where that's the page itself, darker. */
:root { --pane-dark: var(--dark-bg); }
:root[data-theme="dark"] { --pane-dark: color-mix(in srgb, var(--dark-bg) 45%, #000); }
.raffle-page {
  max-width: none; margin: 0; padding: 0; min-height: 100svh;
  display: grid; grid-template-columns: minmax(0, 43fr) minmax(0, 57fr); grid-template-rows: auto 1fr;
}
.raffle-panes { display: contents; }
.showcase-pane {
  grid-column: 1; grid-row: 1 / span 2; align-self: start; position: sticky; top: 0; height: 100svh;
  display: grid; place-items: center; padding: 48px; background: var(--pane-dark);
  container-type: size; /* the showcase sizes itself to the room the panel has (cq units) */
}
.showcase-pane .showcase { box-shadow: 0 34px 70px -24px rgb(0 0 0 / 0.8); }
.detail-pane { grid-column: 2; grid-row: 1; justify-self: center; width: min(100%, 880px); min-width: 0; padding: 48px 48px 0; }
.raffle-page > .site-footer { grid-column: 2; grid-row: 2; align-self: end; margin: 48px 48px 0; }
/* The sidebar, on the panel's color, with the dark theme's colors for its text and icons. */
@media (min-width: 821px) {
  body:has(.raffle-panes) .topbar {
    --bg: var(--pane-dark); --line: transparent; color-scheme: dark;
    --ink: rgb(246 245 241 / 0.8); --muted: rgb(246 245 241 / 0.5); --user: rgb(246 245 241 / 0.88);
    --icon-ink: var(--off-white); --icon-ink-alpha: 0.8; --icon-muted: var(--off-white); --icon-muted-alpha: 0.5;
    --surface: rgb(246 245 241 / 0.06); --card-line: rgb(246 245 241 / 0.1); --link: rgb(246 245 241 / 0.88);
    --tint: rgb(246 245 241 / 0.06); --tint-strong: rgb(246 245 241 / 0.1); --shadow-lg: 0 22px 44px -18px rgb(0 0 0 / 0.55);
  }
}
/* The details: one column at every width (the side's provider and count are the first of the
   facts; its links go last). */
.raffle-layout { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "main" "side"; }
.raffle-side .side-section { display: none; }
.raffle-side { border-top: 1px solid var(--line); padding-top: 16px; }
/* --- The prize showcase (templates/_showcase.html) ------------------------------------
   The full width of the screen, under the header: two scrolling banners with a little stage
   between them, and the prize in front of all three, a few pixels taller than the stage so it
   overlaps both banners.
   The stage swings left and right (2.5D): every layer has its own animation, all on the same
   clock, moving by its own amount: the wall a little, the floor's near edge more than its far
   one, the prize turns. Only transforms are animated, so the browser runs them off the main
   thread. */
body:has(.showcase) { overflow-x: clip; } /* phones: 100vw counts the scrollbar */
/* Desktop: the left pane, square (or as tall as the screen allows), rounded. Phones (below):
   the full width of the screen, square. */
.showcase {
  --banner-h: 58px;
  --show-w: min(100cqw, 100cqh, 720px); /* square, as big as the panel allows */
  --show-h: var(--show-w);
  --pop: 4px; /* how far the prize reaches over each banner */
  --prize: min(var(--show-w), calc(var(--show-h) - 2 * var(--banner-h) + 2 * var(--pop)));
  --swing: 9s ease-in-out -2.25s infinite; /* every layer's clock; starts straight on, turning left */
  position: relative; isolation: isolate; overflow: hidden;
  width: var(--show-w); height: var(--show-h); border-radius: 20px;
  box-shadow: var(--shadow-lg);
  display: grid; grid-template-rows: var(--banner-h) 1fr var(--banner-h);
}

.showcase-banner { position: relative; z-index: 2; display: flex; align-items: center; overflow: hidden; }
.showcase-banner-top { background: var(--button); color: var(--on-button); }
.showcase-banner-bottom { background: var(--ink); color: var(--bg); }
.marquee {
  display: flex; width: max-content;
  font-size: calc(var(--banner-h) * 0.46); font-weight: 900; letter-spacing: 0.03em; line-height: 1;
  text-transform: uppercase; white-space: nowrap;
  animation: marquee var(--marquee-s, 30s) linear infinite;
  will-change: transform;
}
.showcase-banner-bottom .marquee { animation-direction: reverse; }
@keyframes marquee { to { transform: translateX(-50%); } }
.marquee-copy { display: flex; }
.marquee-item { display: flex; align-items: center; }
.marquee-item::after { content: "✦"; margin: 0 0.7em; font-size: 0.6em; opacity: 0.8; }

/* The stage: a spotlit back wall, and a strip of wooden floor along the bottom. The camera is
   low, so the floor is seen nearly edge on. */
.showcase-stage {
  --stage-dark: var(--dark-bg); /* the dark theme's page: the raffle's color, in the dark */
  position: relative; z-index: 1; overflow: hidden; background: var(--stage-dark);
  perspective: 600px; perspective-origin: 50% 62%;
}
.stage-wall {
  position: absolute; inset: 0 -4%;
  /* A soft, warm spotlight from the top center, into the theme's color in the dark. */
  background: radial-gradient(ellipse 72% 135% at 50% -6%, /* wide: the light shows around a square photo */
    #fff1c2 0%, color-mix(in srgb, #e8cf86 72%, var(--stage-dark)) 16%,
    color-mix(in srgb, #b39a5c 42%, var(--stage-dark)) 40%, var(--stage-dark) 80%); /* srgb: no green between yellow and blue */
  animation: wall-swing var(--swing);
  will-change: transform;
}
@keyframes wall-swing { 0%, 100% { transform: translateX(6px); } 50% { transform: translateX(-6px); } }
/* A photo of planks laid flat (rotateX) from the bottom edge back toward the wall. Wider than the
   stage, so its far edge (narrower, laid flat) still reaches both sides. */
.stage-floor {
  position: absolute; left: -150%; right: -150%; bottom: -14%; height: 65%; /* past the bottom: turned, its corners stay out of sight */
  transform-origin: 50% 100%;
  background:
    linear-gradient(to top, transparent 30%, rgb(0 0 0 / 0.7)), /* darker toward the back */
    url("/images/stage-floor.jpg") 50% 100% / 520px 100% repeat-x; /* one copy front to back */
  /* its far edge fades out into the wall, rather than ending on a line */
  -webkit-mask-image: linear-gradient(to top, #000 55%, transparent);
  mask-image: linear-gradient(to top, #000 55%, transparent);
  animation: floor-swing var(--swing);
  will-change: transform;
}
/* translateX before the rotation moves the floor sideways in 3D: its near edge moves more than
   its far one, so the planks swing. rotateZ, before it's laid flat, turns it about the vertical:
   the planks angle off left, then right. */
@keyframes floor-swing {
  0%, 100% { transform: translateX(-26px) rotateX(68deg) rotateZ(-1.2deg); }
  50% { transform: translateX(26px) rotateX(68deg) rotateZ(1.2deg); }
}
/* The prize's shadow on the floor, moving with it. */
.showcase-stage::after {
  content: ""; position: absolute; left: 50%; bottom: 3%; width: calc(var(--prize) * 0.6); height: 26px; margin-left: calc(var(--prize) * -0.3);
  border-radius: 50%; background: radial-gradient(closest-side, rgb(0 0 0 / 0.55), transparent);
  animation: shadow-swing var(--swing);
  will-change: transform;
}
@keyframes shadow-swing { 0%, 100% { transform: translateX(-14px); } 50% { transform: translateX(14px); } }
.showcase-prize {
  position: absolute; z-index: 3; left: 50%; top: calc(var(--banner-h) - var(--pop));
  width: var(--prize); height: var(--prize); margin-left: calc(var(--prize) / -2);
  animation: prize-swing var(--swing);
  will-change: transform;
}
@keyframes prize-swing {
  0%, 100% { transform: perspective(900px) translateX(-12px) rotateY(15deg); }
  50% { transform: perspective(900px) translateX(12px) rotateY(-15deg); }
}
/* The full width, in the middle: a tall picture fills the square and loses its top and bottom
   (showcase.js marks it), a wide one is shown whole. Sized to the picture itself, so the rounded
   corners are its own (a transparent PNG's corners are see-through anyway). */
.showcase-prize { display: grid; place-items: center; }
.showcase-prize img {
  display: block; width: 100%; height: auto; max-height: 100%; border-radius: 18px;
  filter: drop-shadow(0 18px 22px rgb(0 0 0 / 0.5));
}
/* A tall picture: a square from its middle, its whole width shown. (aspect-ratio, not height:
   100%: the grid row is sized by its content, so a percentage height falls back to auto.) */
.showcase-prize img.is-tall { aspect-ratio: 1; height: auto; object-fit: cover; object-position: 50% 50%; }

@media (max-width: 820px) {
  .showcase {
    --banner-h: 46px; --show-w: 100vw; --show-h: 100vw;
    width: 100vw; margin: -16px calc(50% - 50vw) 20px; /* from the header's edge, across the whole screen */
    border-radius: 0; box-shadow: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .stage-wall, .stage-floor, .showcase-stage::after, .showcase-prize, .marquee { animation: none; }
}

.draft-banner {
  margin: 0 0 20px; padding: 10px 14px; border-radius: 12px; background: var(--tint); color: var(--ink); font-size: 14px;
}
.draft-banner strong { margin-right: 6px; text-transform: uppercase; letter-spacing: 0.06em; font-size: 12px; }
.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; justify-items: start; gap: 6px; font-size: 14px; }  /* each link only as wide as its text */
.side-links a { color: var(--muted); text-decoration: none; }
@media (hover: hover) and (pointer: fine) {
  .side-links a:hover { color: var(--ink); }
}

/* The raffle's name: Emblema One (Google Fonts, SIL Open Font License; served from /fonts, and
   only fetched by the raffle pages, the one place it's used). */
@font-face {
  font-family: "Emblema One"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/fonts/emblema-one-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Emblema One"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/fonts/emblema-one-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
.raffle-title {
  margin: 0 0 10px; text-align: center; text-wrap: balance;
  font-family: "Emblema One", system-ui, sans-serif; font-weight: 400; font-size: 48px; line-height: 1.15; letter-spacing: 0.01em;
}
@media (min-width: 821px) { .raffle-title { margin-bottom: 22px; } }
/* The poster (the raffle's own picture) and the facts. Desktop has three widths, by the room
   the right column has (a container query, so it's the column's width, not the screen's):
     super wide (660px+)    the poster with the facts beside it, one column;
     wide (520-659px)       the facts under the poster, in two columns (reading order: left to
                            right, then the next row);
     narrow (under 520px)   as on phones: the facts under the poster, one column.
   Without a poster the facts are two columns when super wide or wide, one when narrow. Phones:
   always under the poster, one column. Under it, the poster is a little bigger, and centered. */
.raffle-intro { container-type: inline-size; margin: 0 0 24px; }
.raffle-intro .facts { margin: 0; }
.has-poster .intro-body { display: flex; flex-direction: column; align-items: center; gap: 24px; }
.has-poster .facts { align-self: stretch; }
.has-poster .raffle-poster { max-width: 400px; }
@media (min-width: 821px) {
  @container (min-width: 660px) {
    .has-poster .intro-body { flex-direction: row; align-items: flex-start; gap: 28px; }
    .has-poster .raffle-poster { flex: none; width: 342px; }
    .has-poster .facts { flex: 1; min-width: 0; align-self: center; }
  }
  @container (min-width: 520px) and (max-width: 659.98px) {
    .has-poster .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 20px; }
  }
  @container (min-width: 520px) {
    .raffle-intro:not(.has-poster) .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 20px; }
  }
}
.fact-host { display: grid; place-items: center; background: var(--button); color: var(--on-button); border-color: transparent; font-size: 17px; font-weight: 800; }
.raffle-poster {
  display: block; width: 100%; height: auto; margin: 0;
  border: 1px solid var(--cover-line); border-radius: 12px; background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.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-warning .fact-sub, .fact-warning .fact-icon { color: var(--bad); }
.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; }

/* The call to action (templates/_raffle_layout.html): on desktop a card above the title; on
   phones a drawer fixed to the bottom of the screen (below). Its title says where the raffle is
   at, in capitals: ENTER NOW in the raffle's color, the rest quieter. */
.cta {
  margin-bottom: 28px; overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--card-line); border-radius: 16px;
  box-shadow: var(--shadow-lg);
}
.cta-head {
  display: flex; align-items: center; gap: 10px; padding: 14px 18px;
  background: var(--tint); border-bottom: 1px solid var(--card-line);
}
.cta-title {
  display: flex; align-items: center; gap: 9px; flex: 1; margin: 0;
  color: var(--ink); font-size: 20px; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase;
}
.cta[data-state="enter"] .cta-head { background: var(--button); border-color: transparent; }
.cta-free { margin-left: -3px; font-weight: 600; opacity: 0.8; } /* "(Free)" by "Enter now": the title's gap is enough */
.cta[data-state="enter"] .cta-title, .cta[data-state="enter"] .cta-toggle { color: var(--on-button); }
.cta[data-state="closed"] .cta-icon, .cta[data-state="full"] .cta-icon { flex: none; color: var(--bad); }
.cta-alert { flex: none; }
/* Entered (enter.js): YOU ARE IN!, on the success color. */
.cta[data-state="in"] .cta-head { background: var(--good); border-color: transparent; }
.cta[data-state="in"] .cta-title, .cta[data-state="in"] .cta-toggle { color: var(--on-button); }
@media (min-width: 821px) { .cta-title { justify-content: center; text-align: center; } }

/* The enter link's card (.is-calling, until entered): a gold border, the logo's gold, with a
   wide lit band going round it slowly, forever. The ring is the card's edge, 2.5px wide (a mask
   cuts its middle out); behind it, a big square of conic gradient turns. Only the square's
   transform animates, so it runs off the main thread. */
.cta { position: relative; }
.cta-ring { display: none; }
.cta.is-calling {
  border-color: transparent;
  box-shadow: var(--shadow-lg), 0 0 34px -10px rgb(245 207 41 / 0.55);
}
.cta.is-calling .cta-ring {
  display: block; position: absolute; inset: 0; z-index: 3; pointer-events: none; overflow: hidden;
  border-radius: inherit; padding: 2.5px;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.cta-ring > span {
  position: absolute; left: 50%; top: 50%; width: max(150%, 900px); aspect-ratio: 1;
  translate: -50% -50%;
  background: conic-gradient(rgb(201 170 34 / 0.18) 0deg, rgb(201 170 34 / 0.18) 70deg,
    #9d851b 130deg, #c9aa22 180deg, #f5cf29 240deg, #fff3b3 275deg, #f5cf29 305deg,
    rgb(201 170 34 / 0.18) 360deg);
  animation: cta-ring-turn 7s linear infinite;
  will-change: transform;
}
@keyframes cta-ring-turn { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) { .cta-ring > span { animation: none; } }

/* The enter link's buttons ("Continue as …", then "Enter the raffle"): bigger, and a ring
   pulsing out of them every couple of seconds (once enabled), so they're the thing to press.
   The ring is a pseudo-element animated with transform and opacity only. */
.attention-button {
  position: relative; gap: 10px; min-height: 56px; font-size: 17px; border-radius: 12px;
  box-shadow: 0 10px 24px -10px color-mix(in srgb, var(--button) 80%, transparent);
}
.attention-button > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attention-button svg { flex: none; transition: transform 200ms var(--ease-out); }
.attention-button::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  border: 2px solid var(--button); opacity: 0;
  animation: attention-ring 2.2s var(--ease-out) 0.6s infinite;
}
.attention-button:disabled::after { animation: none; }
@keyframes attention-ring {
  0% { transform: scale(1); opacity: 0.7; }
  60%, 100% { transform: scale(1.03, 1.35); opacity: 0; }
}
@media (hover: hover) and (pointer: fine) { .attention-button:not(:disabled):hover svg { transform: translateX(3px); } }
@media (prefers-reduced-motion: reduce) { .attention-button::after { animation: none; } }
.cta-live { /* the drawing is on: a red dot, pulsing */
  --live: #e5383b; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--live);
  animation: live-pulse 1.6s ease-out infinite;
}
:root[data-theme="dark"] .cta-live { --live: #ff6b6b; }
.cta-toggle {
  display: none; place-items: center; width: 34px; height: 34px; padding: 0; flex: none;
  border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer;
}
.cta-toggle svg { transition: transform 250ms cubic-bezier(0.32, 0.72, 0, 1); }
.cta.is-closed .cta-toggle svg { transform: rotate(180deg); }
.cta-body { padding: 18px; }

.card-countdown { margin: 0 0 12px; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.card-countdown:empty { display: none; }
.card-countdown:has(+ .card-countdown-sub:not([hidden])) { margin-bottom: 4px; }
.card-countdown-sub { margin: 0 0 14px; color: var(--muted); font-size: 14px; }
.go-to-drawing { margin: 0 0 16px; }
.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); }
/* On the waitlist (raffle-page.js): in place of the form. */
.waitlist-done { display: grid; gap: 6px; justify-items: start; padding: 14px 16px; border-radius: 12px; background: var(--tint-strong); }
.waitlist-done p { margin: 0; }
.waitlist-done-title { font-weight: 700; color: var(--good); }
.waitlist-note { font-size: 14px; color: var(--muted); }
/* Unsubscribing from one raffle (templates/unsubscribe.html). */
.unsub-form { display: grid; gap: 14px; }
.unsub-choices { display: grid; gap: 10px; margin: 0; padding: 0; border: 0; }
.unsub-choices legend { margin-bottom: 4px; padding: 0; }
.unsub-choices small { color: var(--muted); }
.unsub-choices input { flex: none; }  /* a two-line label mustn't squeeze it */
.unsub-done { display: grid; gap: 6px; }
.unsub-done p { margin: 0; }
/* The optional "you can email me" checkbox, under the terms (enter.html). */
.check.is-optional span { color: var(--muted); font-size: 14px; }
.cta .link-form { justify-items: stretch; gap: 14px; }
.cta .link-form .card-lead { margin: 0; }
/* The entry link's question, before the page (enter.html): sign in as the link's address?
   A modal <dialog> over the page, which greys out behind it. */
.ask {
  width: min(calc(100% - 32px), 420px); padding: 28px 26px 22px; text-align: center;
  border: 1px solid var(--card-line); border-radius: 20px;
  background: linear-gradient(var(--surface), var(--surface)), var(--bg); color: var(--ink);
  box-shadow: var(--shadow-lg);
}
.ask[open] { animation: ask-in 300ms var(--ease-out); }
.ask::backdrop { background: rgb(8 10 18 / 0.55); backdrop-filter: grayscale(1) blur(5px); }
@keyframes ask-in { from { opacity: 0; transform: translateY(10px) scale(0.97); } }
@media (prefers-reduced-motion: reduce) { .ask[open] { animation: none; } }
.ask-logo { display: block; height: 40px; width: auto; margin: 0 auto; }
.ask-title { margin: 14px 0 8px; font-size: 22px; font-weight: 800; }
.ask-text { margin: 0; color: var(--muted); line-height: 1.55; text-wrap: pretty; }
.ask-email { color: var(--user); font-weight: 700; overflow-wrap: anywhere; }
.ask-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
.ask-button {
  display: grid; place-items: center; text-decoration: none;
  min-height: 46px; padding: 0 16px; border: 1px solid var(--card-line); border-radius: 10px;
  background: transparent; color: var(--ink); font: inherit; font-weight: 700; cursor: pointer;
  transition: transform 150ms cubic-bezier(0.25, 0.46, 0.45, 0.94), background-color 150ms ease;
}
.ask-button:active { transform: scale(0.97); }
.ask-button:disabled { opacity: 0.5; cursor: progress; }
.ask-button.is-primary { background: var(--button); color: var(--on-button); border-color: transparent; }
@media (hover: hover) and (pointer: fine) {
  .ask-button:not(.is-primary):not(:disabled):hover { background: var(--tint-strong); }
  .ask-button.is-primary:not(:disabled):hover { filter: brightness(1.08); }
}
.ask .form-message:empty { display: none; }

/* A link sent: the form greyed out, and a window in the middle of the screen saying to check
   your email (over the sidebar and the phone drawer too). */
.link-form { transition: opacity 200ms ease, filter 200ms ease; }
.link-form.is-sent { opacity: 0.3; filter: grayscale(1); }
.sent-panel {
  position: fixed; z-index: 45; left: 50%; top: 50%; width: min(calc(100% - 32px), 400px);
  translate: -50% -50%;
  display: grid; justify-items: center; gap: 8px; padding: 24px 22px 18px; text-align: center;
  background: linear-gradient(var(--surface), var(--surface)), var(--bg);
  border: 1px solid var(--card-line); border-radius: 16px;
  box-shadow: var(--shadow-lg), 0 30px 80px -20px rgb(0 0 0 / 0.45);
  animation: sent-in 260ms var(--ease-out);
}
/* Desktop: across the middle of the right pane (the form's), still halfway down the screen.
   The panes split the room right of the rail 43:57, so the pane's middle is 71.5% across it. */
@media (min-width: 821px) { .sent-panel { left: calc(var(--rail) + (100% - var(--rail)) * 0.715); } }
@keyframes sent-in { from { opacity: 0; transform: scale(0.96) translateY(6px); } }
.sent-icon {
  display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%;
  background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good);
}
.sent-title { margin: 4px 0 0; font-size: 20px; font-weight: 800; color: var(--ink); }
.sent-message { margin: 0; color: var(--good); font-weight: 600; text-wrap: pretty; }
.sent-note { margin: 2px 0 0; color: var(--ink); font-size: 14px; font-weight: 600; text-wrap: pretty; }
.sent-panel .hint { margin: 0; }
.sent-again {
  margin-top: 8px; padding: 4px 2px; border: 0; background: none; cursor: pointer;
  color: var(--link); font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px;
}
@media (prefers-reduced-motion: reduce) { .sent-panel { animation: none; } }
.cta .methods { justify-content: flex-start; }
.cta .field { max-width: none; }
.cta .hint { margin-top: 10px; }
.cta .check { margin-bottom: 14px; }
.cta .actions { justify-content: flex-start; }
.cta .entered-as { margin: 0; }
/* The terms step: who's entering, before anything else. */
.entering-as { margin: 0 0 14px; color: var(--muted); font-size: 14px; }
.entering-as strong { display: block; margin-top: 2px; font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.cta .your-number { margin: 2px 0 12px; }
#my-entry + .primary-button { margin-top: 20px; } /* entries closed: Watch, under your number */
.cta .method, .cta .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; }
/* The raffle's updates (raff.updates): a timeline, newest first, a dot on a line for each. */
.updates { margin-top: 28px; padding-bottom: 32px; }
.update-list { list-style: none; margin: 8px 0 0; padding: 0; }
/* Arrived while the page was open (raffle-page.js). */
.updates-new {
  margin: 0 0 12px; padding: 8px 12px; border-radius: 10px;
  background: var(--tint-strong); color: var(--ink); font-size: 14px; font-weight: 600;
  animation: updates-new-in 320ms cubic-bezier(0.23, 1, 0.32, 1);
}
@keyframes updates-new-in { from { opacity: 0; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .updates-new { animation: none; } }
.update { position: relative; padding: 0 0 18px 22px; }
.update::before { /* the line, down to the next update */
  content: ""; position: absolute; left: 4px; top: 14px; bottom: -2px; width: 2px;
  background: var(--card-line);
}
.update:last-child::before { display: none; }
.update::after { /* the dot */
  content: ""; position: absolute; left: 0; top: 5px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--muted);
}
.update-result::after { background: var(--good); }
.update-result.is-cancelled::after { background: var(--bad, var(--muted)); }
.update-stretch::after { background: var(--accent, var(--primary)); }
.update-opened::after { background: var(--good); }
.update-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin: 0 0 2px; font-size: 13px; color: var(--muted); }
.update-label { font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; font-size: 12px; color: var(--ink); }
.update-text { margin: 0; white-space: pre-line; overflow-wrap: anywhere; line-height: 1.55; }
.update-links { margin: 4px 0 0; font-size: 14px; }
.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; }

/* Phones: one column, the showcase across the top, and the call to action a drawer fixed to
   the bottom of the screen (open to start; cta.js). The page leaves room for it (--cta-h). */
@media (max-width: 820px) {
  .raffle-page { padding: 16px 16px calc(var(--cta-h, 0px) + 32px); }
  .raffle-page { display: block; min-height: 0; }
  .raffle-panes { display: block; }
  .showcase-pane { position: static; height: auto; padding: 0; display: block; background: none; container-type: normal; }
  .showcase-pane .showcase { box-shadow: none; }
  .detail-pane { width: auto; padding: 0; }
  .raffle-page > .site-footer { margin: 48px 0 0; }
  .raffle-title { font-size: 38px; }
  .cta {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; margin: 0;
    background: linear-gradient(var(--surface), var(--surface)), var(--bg); /* solid: the page passes under it */
    display: flex; flex-direction: column; max-height: 78svh;
    border-width: 1px 0 0; border-radius: 20px 20px 0 0;
    /* Lifted off the page: a close shadow and a wide soft one above it, and a light top edge
       (on a dark page a shadow alone barely shows). */
    box-shadow: 0 -2px 8px rgb(0 0 0 / 0.12), 0 -16px 44px rgb(0 0 0 / 0.28), inset 0 1px 0 rgb(255 255 255 / 0.08);
  }
  :root[data-theme="dark"] .cta { /* in the dark, raised reads as lighter: a shade above the page */
    background: color-mix(in srgb, var(--dark-bg) 90%, #fff);
    box-shadow: 0 -2px 10px rgb(0 0 0 / 0.35), 0 -18px 50px rgb(0 0 0 / 0.6), inset 0 1px 0 rgb(255 255 255 / 0.1);
  }
  .cta-head { position: relative; padding: 16px 18px 12px; cursor: pointer; }
  .cta-head::before { /* the grip */
    content: ""; position: absolute; top: 6px; left: 50%; width: 36px; height: 4px; margin-left: -18px;
    border-radius: 2px; background: currentColor; opacity: 0.25;
  }
  .cta[data-state="enter"] .cta-head::before { color: var(--on-button); }
  .cta-toggle { display: grid; }
  .cta-body { overflow-y: auto; overscroll-behavior: contain; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .cta.is-closed .cta-body { display: none; }
  .cta.is-closed .cta-head { padding-bottom: calc(12px + env(safe-area-inset-bottom)); border-bottom: 0; }
}
.cta .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%; }
#link-continue { min-height: 52px; padding-block: 10px; overflow-wrap: anywhere; }
.signin-card .signin-link-note { margin: 16px 0 0; font-size: 14px; }
.code-form .code-or { margin: 0; color: var(--muted); font-size: 14px; text-align: center; }
/* 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 Prizes) ------------------------- */

.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 ------------------------------
   Wide: the date on the left, a dot on a dashed line, the cards on the right.
   Narrow (phones, and Discover's column beside its calendar): the date on its own line next to
   the dot, the cards under it. It goes by the timeline's own width (a container query), not the
   screen's. */

.timeline-box { container: timeline / inline-size; }
.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); }
/* Light mode: the cards lie right on the off-white page, no frame, until hovered. */
:root:not([data-theme="dark"]) .tl-card:not(.is-won) { background: transparent; border-color: transparent; box-shadow: none; }
@media (hover: hover) and (pointer: fine) {
  :root:not([data-theme="dark"]) .tl-card:not(.is-won):hover { border-color: var(--ink); }
}
.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; } }
@container timeline (max-width: 640px) {
  .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; }
}

/* --- Discover: the timeline, and a calendar beside it on the right ------------------- */

.discover-layout { display: grid; grid-template-columns: minmax(0, 1fr) 216px; gap: 40px; align-items: start; }
.discover-side { position: sticky; top: 24px; }
.cal { padding: 14px 12px 12px; border: 1px solid var(--card-line); border-radius: 14px; background: var(--surface); }
:root:not([data-theme="dark"]) .cal { background: transparent; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin: 0 2px 8px 4px; }
.cal-title { margin: 0; font-size: 15px; font-weight: 700; }
.cal-steps { display: flex; gap: 2px; }
.cal-step {
  display: grid; place-items: center; width: 28px; height: 28px; padding: 0;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer;
}
@media (hover: hover) and (pointer: fine) { .cal-step:hover { background: var(--tint-strong); color: var(--ink); } }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.cal-weekday { padding: 2px 0 4px; color: var(--muted); font-size: 11px; font-weight: 700; }
.cal-day {
  position: relative; display: grid; place-items: center; aspect-ratio: 1;
  border: 0; border-radius: 50%; background: none; padding: 0;
  color: var(--muted); font: inherit; font-size: 13px; font-variant-numeric: tabular-nums;
}
.cal-day.is-other { opacity: 0.4; }
.cal-day.is-today { box-shadow: inset 0 0 0 1.5px var(--line); color: var(--ink); }
.cal-day.has-raffles { color: var(--ink); font-weight: 700; cursor: pointer; }
.cal-day.has-raffles::after { /* a dot under the date */
  content: ""; position: absolute; bottom: 3px; left: 50%; width: 4px; height: 4px; margin-left: -2px;
  border-radius: 50%; background: var(--primary);
}
@media (hover: hover) and (pointer: fine) { .cal-day.has-raffles:hover { background: var(--tint-strong); } }
.cal-note { margin: 10px 4px 0; color: var(--muted); font-size: 13px; }
/* A day jumped to from the calendar: its date flashes. */
.tl-day.is-flashed .tl-date { animation: tl-flash 1.2s ease-out; }
@keyframes tl-flash { from { color: var(--primary); } }
.tl-day { scroll-margin-top: 16px; }
@media (max-width: 760px) {
  .discover-layout { grid-template-columns: minmax(0, 1fr); }
  .discover-side { display: none; } /* phones: the timeline alone */
}

/* --- My Prizes: compact rows (picture, prize, how it came to you); a tap opens the action sheet --- */

.win-list { display: grid; gap: 10px; }
.win-card {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; align-items: center; gap: 14px;
  width: 100%; padding: 12px 14px; text-align: left; font: inherit; color: var(--ink); cursor: pointer;
  border: 1px solid var(--card-line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, transform 0.1s;
}
@media (hover: hover) and (pointer: fine) { .win-card:hover { border-color: var(--ink); } }
.win-card:active { transform: scale(0.99); }
.win-card:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.win-card.is-highlighted { border-color: var(--ink); }
.win-thumb { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; }
.win-thumb.is-empty { background: var(--tint); }
.win-body { display: grid; gap: 2px; min-width: 0; }
.win-title, .win-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.win-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.win-title { font-size: 17px; font-weight: 700; }
.win-top .win-badge { flex: none; }
.win-meta { color: var(--muted); font-size: 14px; }
.win-badge {
  padding: 3px 8px; border-radius: 999px; background: var(--tint); color: var(--muted);
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap;
}
.win-badge.is-used, .win-badge.is-accepted { color: var(--good); }
.win-badge.is-sending { color: var(--ink); }
.win-badge.is-offer { background: var(--button); color: var(--on-button); }
.win-chevron { color: var(--muted); font-size: 22px; line-height: 1; }
.win-card.is-sent { box-shadow: none; }
.win-card.is-sent .win-thumb { opacity: 0.6; }
.win-section { margin: 18px 0 0; font-size: 18px; }
.win-section.is-first { margin-top: 0; }
@media (max-width: 420px) {
  .win-card { grid-template-columns: 48px minmax(0, 1fr) auto; gap: 12px; padding: 10px 12px; }
  .win-thumb { width: 48px; height: 48px; }
}

/* The action sheet (sheet.js): pages that slide, with Back. The viewport clips the pages and
   its height follows them. */
.action-sheet {
  width: min(440px, calc(100vw - 24px)); padding: 0;
  border: 1px solid var(--card-line); border-radius: 18px;
  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);
  opacity: 1; transform: none; transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}
@starting-style { .action-sheet[open] { opacity: 0; transform: translateY(8px) scale(0.98); } }
.action-sheet::backdrop { background: color-mix(in srgb, var(--primary) 35%, transparent); }
.as-head {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  padding: 12px 12px 4px;
}
.as-title { grid-column: 2; margin: 0; font-size: 17px; text-align: center; outline: none; }
.as-back, .as-close {
  min-height: 36px; padding: 0 8px; border: 0; border-radius: 10px; background: none;
  color: var(--ink); font: inherit; font-weight: 600; cursor: pointer;
}
.as-back { grid-column: 1; justify-self: start; }
.as-back span { font-size: 22px; line-height: 0; vertical-align: -2px; }
.as-close { grid-column: 3; justify-self: end; font-size: 24px; line-height: 1; width: 36px; }
@media (hover: hover) and (pointer: fine) { .as-back:hover, .as-close:hover { background: var(--tint); } }
.as-viewport { position: relative; overflow: hidden; }
.as-page { padding: 8px 20px 20px; }
.as-page.is-leaving { position: absolute; top: 0; left: 0; pointer-events: none; }
.as-summary { display: flex; gap: 14px; align-items: center; }
.as-summary p { margin: 0; }
.as-thumb { flex: none; width: 72px; height: 72px; border-radius: 12px; object-fit: cover; }
.as-prize { font-size: 19px; font-weight: 700; line-height: 1.25; }
.as-note { margin: 14px 0 0; }
.as-note figcaption { color: var(--muted); font-size: 13px; }
.as-note blockquote {
  margin: 4px 0 0; padding: 8px 12px; border-left: 3px solid var(--line);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.as-status { margin: 14px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--tint); font-size: 15px; }
.as-status.is-used { color: var(--good); font-weight: 600; }
.as-lead { margin: 0 0 4px; }
.as-actions { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.as-action {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 14px; text-align: left;
  border: 1px solid var(--card-line); border-radius: 12px; background: none; color: var(--ink);
  font: inherit; text-decoration: none; cursor: pointer;
}
@media (hover: hover) and (pointer: fine) { .as-action:hover { border-color: var(--ink); background: var(--tint); } }
.as-action:active { transform: scale(0.99); }
.as-action-text { display: grid; gap: 1px; flex: 1; min-width: 0; }
.as-action-text span { color: var(--muted); font-size: 14px; }
.as-action.is-bad strong { color: var(--bad); }
.as-chevron { color: var(--muted); font-size: 22px; line-height: 1; }
/* History: a line down the left, a dot per step. */
.as-history { list-style: none; margin: 14px 0 0; padding: 0; }
.as-step { position: relative; display: grid; grid-template-columns: 14px 1fr; gap: 12px; padding-bottom: 16px; }
.as-step:not(:last-child)::before {
  content: ""; position: absolute; left: 6px; top: 16px; bottom: 0; width: 2px; background: var(--line);
}
.as-step-dot { width: 14px; height: 14px; margin-top: 3px; border-radius: 50%; border: 2px solid var(--muted); background: var(--surface); }
.as-step.is-now .as-step-dot { border-color: var(--good); background: var(--good); }
.as-step.is-now { padding-bottom: 0; }
.as-step p { margin: 0; }
.as-step-what { font-weight: 600; }
.as-step-note {
  margin: 6px 0 0; padding: 6px 12px; border-left: 3px solid var(--line);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  font-size: 16px; white-space: pre-wrap; overflow-wrap: anywhere;
}
.as-center { display: grid; gap: 12px; justify-items: center; text-align: center; }
.as-center p { margin: 0; }
.as-center .redeem-warning { margin: 4px 0; }
.action-sheet .redeem-qr { margin: 4px auto 0; }
.action-sheet .send-form { margin: 4px 0 0; }
@media (prefers-reduced-motion: reduce) { .action-sheet, .win-card { transition: none; } }

/* 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; }
/* Read-only lists (prizes drawn, inventory): short rows. */
.merchant-table { width: 100%; margin: 8px 0 0; border-collapse: collapse; font-size: 14px; }
.merchant-table th {
  padding: 4px 12px 6px 0; text-align: left; color: var(--muted); white-space: nowrap;
  font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
}
.merchant-table td { padding: 7px 12px 7px 0; border-top: 1px solid var(--line); white-space: nowrap; }
.merchant-table td:first-child { width: 100%; white-space: normal; }
.merchant-table th:last-child, .merchant-table td:last-child { padding-right: 0; }
.merchant-table .is-num { text-align: right; font-variant-numeric: tabular-nums; }
.merchant-table .is-muted { color: var(--muted); }
.table-more { margin: 8px 0 0; }
.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; }
}

/* --- Sending prizes (/offer/<token>, and My Prizes) ------------------------------------ */

/* The sender's note: a card with a small label tucked in its top left, the note in a serif. */
.offer-note {
  margin: 16px auto 0; max-width: 420px; padding: 30px 18px 14px; text-align: left; position: relative;
  background: var(--surface); border: 1px solid var(--card-line); border-radius: 12px;
}
.offer-note figcaption {
  position: absolute; top: 10px; left: 18px;
  color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
}
.offer-note blockquote {
  margin: 0; white-space: pre-wrap; overflow-wrap: anywhere;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  font-size: 18px; line-height: 1.45;
}
.offer-terms { margin: 0 0 16px; }
.send-form { margin: 16px 0 4px; }
.send-form .field { max-width: none; }
.field textarea {
  width: 100%; min-width: 0; padding: 10px 14px; border-radius: 10px; resize: vertical;
  border: 1px solid var(--line); background: var(--bg); color: var(--user); font: inherit; font-size: 16px;
}
.field textarea:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.note-count { float: right; font-variant-numeric: tabular-nums; }

/* Desktop's sidebar header (top of this file): what's fixed to the bottom of the watch page
   centers in the room right of the rail. Here, after those pages' own rules. */
@media (min-width: 821px) {
  .winners-drawer { left: var(--rail); width: min(100% - var(--rail), 880px); }
  .tracker { left: max(calc(var(--rail) + 12px), calc(50% + var(--rail) / 2 - 440px + 16px)); }
}
