/*
 * Optletics pages.
 *
 * Every colour, font and corner radius here comes from the brand kit's
 * tokens (tokens/tokens.css, copied from the kit unchanged). This file only
 * gives the tokens jobs, and derives the dark mode from them.
 *
 * Rules from the kit that this file keeps:
 * - Cone orange is the accent and the primary button. Its label is ink, never white.
 * - Field green is for links and confirmed states.
 * - Confirmed, flagged and pending are never told apart by colour alone:
 *   each tag has its own mark in front of its words.
 *
 * How it is organised
 *  1. Fonts
 *  2. Colours for light, dark and the ink band
 *  3. Base elements
 *  4. The top bar, the Reduce motion button, the section rail
 *  5. Cards, bands, tiles, chips, tags, gates, steps
 *  6. Forms and buttons
 *  7. Lists, messages, loaders
 *  8. Page pieces (sign in, join, home screens)
 *  9. Phones
 * 10. Motion. Every rule that moves anything sits under
 *     html[data-motion="full"]. boot.js sets that only when the device has
 *     not asked for reduced motion and the Reduce motion button is off.
 *     Everything above section 10 describes the finished, still page.
 */

/* ---------- 1. Fonts ---------- */

/*
 * The kit's fonts, from our own server only. Nothing is loaded from another
 * host. Until the font files are put in web/fonts/, the token font stacks
 * fall back to the system font.
 */
@font-face {
  font-family: "Bricolage Grotesque";
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url("fonts/bricolage-grotesque-700.woff2") format("woff2");
}

@font-face {
  font-family: "Bricolage Grotesque";
  font-weight: 800;
  font-style: normal;
  font-display: swap;
  src: url("fonts/bricolage-grotesque-800.woff2") format("woff2");
}

@font-face {
  font-family: "Figtree";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("fonts/figtree-400.woff2") format("woff2");
}

@font-face {
  font-family: "Figtree";
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: url("fonts/figtree-500.woff2") format("woff2");
}

@font-face {
  font-family: "Figtree";
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  src: url("fonts/figtree-600.woff2") format("woff2");
}

@font-face {
  font-family: "Figtree";
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url("fonts/figtree-700.woff2") format("woff2");
}

/* ---------- 2. Colours ---------- */

/* Light: mist page, chalk cards, ink text, and ink bands for the big moments. */
:root {
  color-scheme: light dark;
  --bg: var(--opt-mist);
  --surface: var(--opt-chalk);
  --surface-2: color-mix(in srgb, var(--opt-mist) 92%, var(--opt-slate));
  --text: var(--opt-ink);
  --muted: var(--opt-slate);
  --link: var(--opt-field);
  --confirm: var(--opt-field);
  --accent: var(--opt-cone);
  --on-accent: var(--opt-ink);
  --accent-edge: color-mix(in srgb, var(--opt-cone) 80%, var(--opt-ink));
  --line: color-mix(in srgb, var(--opt-slate) 25%, var(--opt-chalk));
  --control-edge: var(--opt-slate);
  --focus: var(--opt-ink);
  --note-bg: color-mix(in srgb, var(--opt-field) 10%, var(--opt-chalk));
  --flag-bg: color-mix(in srgb, var(--opt-cone) 14%, var(--opt-chalk));
  --band: var(--opt-ink);
}

/* Dark, derived from the same tokens: ink page, chalk text, the reversed logo. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--opt-ink);
    --surface: color-mix(in srgb, var(--opt-ink) 80%, var(--opt-slate));
    --surface-2: color-mix(in srgb, var(--opt-ink) 55%, var(--opt-slate));
    --text: var(--opt-chalk);
    --muted: color-mix(in srgb, var(--opt-chalk) 75%, var(--opt-ink));
    --link: color-mix(in srgb, var(--opt-field) 40%, var(--opt-chalk));
    --confirm: color-mix(in srgb, var(--opt-field) 40%, var(--opt-chalk));
    --accent: var(--opt-cone);
    --on-accent: var(--opt-ink);
    --accent-edge: var(--opt-cone);
    --line: color-mix(in srgb, var(--opt-slate) 85%, var(--opt-chalk));
    --control-edge: color-mix(in srgb, var(--opt-chalk) 60%, var(--opt-ink));
    --focus: var(--opt-chalk);
    --note-bg: color-mix(in srgb, var(--opt-field) 30%, var(--opt-ink));
    --flag-bg: color-mix(in srgb, var(--opt-cone) 22%, var(--opt-ink));
    --band: color-mix(in srgb, var(--opt-ink) 80%, var(--opt-slate));
  }
}

/*
 * The ink band: a dark panel inside the page, in both modes. Inside it the
 * names above take their dark-mode values (a test checks they are the same
 * values), so everything placed in a band keeps its contrast.
 */
.band {
  --surface: color-mix(in srgb, var(--opt-ink) 55%, var(--opt-slate));
  --surface-2: color-mix(in srgb, var(--opt-ink) 55%, var(--opt-slate));
  --text: var(--opt-chalk);
  --muted: color-mix(in srgb, var(--opt-chalk) 75%, var(--opt-ink));
  --link: color-mix(in srgb, var(--opt-field) 40%, var(--opt-chalk));
  --confirm: color-mix(in srgb, var(--opt-field) 40%, var(--opt-chalk));
  --accent-edge: var(--opt-cone);
  --line: color-mix(in srgb, var(--opt-slate) 85%, var(--opt-chalk));
  --control-edge: color-mix(in srgb, var(--opt-chalk) 60%, var(--opt-ink));
  --focus: var(--opt-chalk);
  --note-bg: color-mix(in srgb, var(--opt-field) 30%, var(--opt-ink));
  --flag-bg: color-mix(in srgb, var(--opt-cone) 22%, var(--opt-ink));
  background: var(--band);
  color: var(--text);
}

/* Sizes, shadows and timing. Kept off the two colour blocks above so the contrast test can read those. */
html {
  --gutter: clamp(16px, 4vw, 40px);
  --wide: 78rem;
  --shadow: 0 1px 2px color-mix(in srgb, var(--opt-ink) 8%, transparent),
    0 14px 36px -12px color-mix(in srgb, var(--opt-ink) 26%, transparent);
  --shadow-lift: 0 2px 4px color-mix(in srgb, var(--opt-ink) 10%, transparent),
    0 26px 54px -16px color-mix(in srgb, var(--opt-ink) 42%, transparent);
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-pop: cubic-bezier(0.3, 1.5, 0.5, 1);
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 1rem;
}

/* ---------- 3. Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--opt-font-body);
  font-size: 1.0625rem;
  font-weight: 400;
  line-height: 1.55;
  overflow-wrap: break-word;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: calc(var(--opt-radius-card) / 5);
}

main:focus-visible,
h1:focus-visible,
h2:focus-visible {
  outline-width: 0;
}

.skip {
  position: absolute;
  left: -999rem;
  top: 0;
  padding: 0.7rem 1.2rem;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  border-radius: var(--opt-radius-button);
}

.skip:focus {
  left: 0.6rem;
  top: 0.6rem;
  z-index: 100;
}

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

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

svg {
  display: block;
}

.icon {
  width: 1.25em;
  height: 1.25em;
  flex: none;
}

/* The aperture mark, drawn: an ink ring, six blade lines and a cone centre. The centre is always cone. */
.ap-hex {
  fill: var(--opt-cone);
}

h1,
h2,
h3 {
  font-family: var(--opt-font-display);
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2rem, 1.35rem + 3vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0;
}

h2 {
  font-size: clamp(1.4rem, 1.2rem + 0.9vw, 1.9rem);
  font-weight: 800;
  margin: 0 0 0.6rem;
}

h3 {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 1.2rem 0 0.4rem;
}

p {
  margin: 0 0 0.8rem;
  text-wrap: pretty;
}

a {
  color: var(--link);
  font-weight: 600;
  text-underline-offset: 0.15em;
}

.muted,
.hint {
  color: var(--muted);
  font-size: 0.95rem;
}

.hint {
  margin: 0.25rem 0 0;
}

.eyebrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5em;
  margin: 0 0 0.5rem;
  font-family: var(--opt-font-display);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.lede {
  font-size: 1.15rem;
  line-height: 1.45;
  color: var(--muted);
  max-width: 38em;
}

/* ---------- 4. Top bar, Reduce motion, rail ---------- */

/*
 * The logo. Always the kit's own file, never text.
 * Clear space: the kit asks for the height of the aperture "o" on every
 * side. The "o" is less than half the height of the wordmark, so half the
 * drawn height of the logo is kept clear all round, which is always enough.
 */
.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 1rem;
  width: 100%;
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.brand {
  display: block;
  padding: 22px 22px 22px 0;
  line-height: 0;
}

.brand img {
  display: block;
  height: 44px;
  width: auto;
}

.lockup {
  margin: 0;
  padding: 44px 44px 44px 0;
  line-height: 0;
}

.lockup img {
  display: block;
  height: 88px;
  width: auto;
  max-width: 100%;
}

.top-end {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem 1rem;
  padding: 0.5rem 0;
}

#who {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.8rem;
  font-size: 0.95rem;
}

.who-name {
  font-weight: 700;
}

.role {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.15rem 0.7rem;
  border: 2px solid var(--control-edge);
  border-radius: var(--opt-radius-button);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
}

/* The Reduce motion button. Shown only when scripts run, because without them nothing moves. */
button.motion-toggle {
  display: none;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.5rem;
  padding: 0.2rem 0.9rem 0.2rem 0.35rem;
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--control-edge);
  font-size: 0.88rem;
}

html.js button.motion-toggle {
  display: inline-flex;
}

.motion-toggle-track {
  position: relative;
  width: 2.5rem;
  height: 1.6rem;
  border: 2px solid var(--control-edge);
  border-radius: var(--opt-radius-button);
  background: var(--surface-2);
}

.motion-toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(1.6rem - 8px);
  height: calc(1.6rem - 8px);
  border-radius: var(--opt-radius-button);
  background: var(--text);
}

.motion-toggle[aria-pressed="true"] .motion-toggle-track {
  background: var(--accent);
  border-color: var(--accent-edge);
}

.motion-toggle[aria-pressed="true"] .motion-toggle-knob {
  left: calc(2.5rem - 1.6rem + 2px);
  background: var(--on-accent);
}

.motion-toggle-label::after {
  content: ": off";
  font-weight: 500;
}

.motion-toggle[aria-pressed="true"] .motion-toggle-label::after {
  content: ": on";
}

.shell {
  display: flex;
  align-items: flex-start;
  gap: clamp(1.25rem, 3vw, 2.5rem);
  width: 100%;
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0.5rem var(--gutter) 2.5rem;
  flex: 1 0 auto;
}

main {
  flex: 1 1 0;
  min-width: 0;
}

.page-head {
  margin: 0.5rem 0 1.5rem;
}

.page-head .lede {
  margin: 0.6rem 0 0;
}

/* The rail: sections of the page. A side rail on wide screens, a bottom bar on phones. */
.rail {
  flex: 0 0 15.5rem;
  position: sticky;
  top: 1rem;
  padding: 0.6rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--opt-radius-card);
}

.rail ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.15rem;
}

.rail a,
button.rail-more-button {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.45rem 0.9rem;
  border: 2px solid transparent;
  border-radius: var(--opt-radius-button);
  background: transparent;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  text-align: left;
}

.rail a:hover,
button.rail-more-button:hover {
  background: var(--surface-2);
  opacity: 1;
}

/* The section you are on: a filled cone pill with a heavier label, not colour alone. */
.rail a[aria-current="page"] {
  background: var(--accent);
  border-color: var(--accent-edge);
  color: var(--on-accent);
  font-weight: 800;
}

.rail-label {
  flex: 1 1 auto;
}

button.rail-more-button {
  display: none;
}

.badge {
  display: inline-grid;
  place-items: center;
  min-width: 1.6em;
  height: 1.6em;
  padding: 0 0.4em;
  border-radius: var(--opt-radius-button);
  background: var(--text);
  color: var(--bg);
  font-family: var(--opt-font-display);
  font-weight: 800;
  font-size: 0.82rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

footer {
  width: 100%;
  max-width: var(--wide);
  margin: 0 auto;
  padding: 1.25rem var(--gutter) 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
}

footer p {
  margin: 0 0 0.3rem;
}

/* ---------- 5. Cards, bands, tiles, chips, tags, gates, steps ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--opt-radius-card);
  padding: clamp(1.1rem, 2.2vw, 1.75rem);
  margin: 0 0 1.25rem;
  box-shadow: var(--shadow);
}

.card > :last-child,
.band > :last-child {
  margin-bottom: 0;
}

.band {
  position: relative;
  overflow: hidden;
  border-radius: var(--opt-radius-card);
  padding: clamp(1.25rem, 3vw, 2.25rem);
  margin: 0 0 1.25rem;
  box-shadow: var(--shadow);
}

.band h2,
.band h3,
.band p {
  position: relative;
}

/* The big faint aperture behind a band's words. Decoration only. */
.band-mark {
  position: absolute;
  right: -3.5rem;
  top: -3.5rem;
  width: 15rem;
  height: 15rem;
  color: var(--text);
  opacity: 0.1;
  pointer-events: none;
}

.grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
  align-items: start;
  margin: 0 0 1.25rem;
}

.grid > .card,
.grid > .band {
  margin: 0;
  height: 100%;
}

.grid.wide-first > :first-child {
  grid-column: 1 / -1;
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 1rem;
  margin: 0 0 0.6rem;
}

.card-head h2,
.card-head h3 {
  margin: 0;
}

/* Stat tiles: a large numeral over a quiet label. */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 8.5rem), 1fr));
  gap: 0.75rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.9rem 1rem;
  background: var(--surface-2);
  border-radius: calc(var(--opt-radius-card) * 0.7);
  color: var(--text);
  text-decoration: none;
  font-weight: 400;
}

.tile-num {
  font-family: var(--opt-font-display);
  font-weight: 800;
  font-size: clamp(2rem, 1.6rem + 1.6vw, 3rem);
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.tile-label {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

/* A tile with nothing to count yet: a dashed outline and words, never a made-up number. */
.tile.is-empty {
  background: transparent;
  border: 2px dashed var(--control-edge);
}

.tile.is-empty .tile-num {
  font-size: 1.05rem;
  letter-spacing: 0;
  line-height: 1.3;
  min-height: 2rem;
}

/* The jersey chip: cone with an ink number. */
.jersey {
  display: inline-grid;
  place-items: center;
  min-width: 2.1em;
  height: 1.75em;
  padding: 0 0.35em;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: calc(var(--opt-radius-card) * 0.3);
  font-family: var(--opt-font-display);
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  flex: none;
}

.jersey-lg {
  font-size: 1.6rem;
  border-radius: calc(var(--opt-radius-card) * 0.5);
}

.player {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.player-name {
  font-weight: 700;
  min-width: 0;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  margin: 0.8rem 0 0;
  padding: 0;
  list-style: none;
}

/* Roster as player cards. */
.players {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr));
  gap: 0.75rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.players > li {
  padding: 0.85rem 1rem;
  background: var(--surface-2);
  border-radius: calc(var(--opt-radius-card) * 0.7);
}

/* State tags. Each state has its own mark as well as its own words. */
.tag {
  display: inline-block;
  padding: 0.15rem 0.7rem;
  border: 2px solid var(--control-edge);
  border-radius: calc(var(--opt-radius-card) * 0.7);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  margin: 0.2rem 0.3rem 0.2rem 0;
}

.tag.confirmed {
  border-color: var(--confirm);
  color: var(--confirm);
}

.tag.confirmed::before {
  content: "\2713\00a0";
}

.tag.flagged {
  border-color: var(--accent);
  background: var(--flag-bg);
  color: var(--text);
}

.tag.flagged::before {
  content: "!\00a0";
  font-weight: 800;
}

.tag.pending {
  border-style: dashed;
  color: var(--muted);
}

.tag.pending::before {
  content: "\2026\00a0";
}

/* Made-up content is always marked with these words, in a dashed frame. */
.tag.sample {
  border-style: dashed;
  border-color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  font-weight: 800;
}

.sample-frame {
  border: 2px dashed var(--control-edge);
  border-radius: var(--opt-radius-card);
  padding: clamp(0.9rem, 2vw, 1.4rem);
  margin: 0 0 1.25rem;
}

.sample-frame > :last-child {
  margin-bottom: 0;
}

/* The three gates: invitation, roster match, approval. An icon and words for each state. */
.gates {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  margin: 1rem 0;
  padding: 0;
  list-style: none;
}

.gate {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.2rem 0.9rem;
  align-items: start;
  align-content: start;
  padding: 1rem;
  background: var(--surface-2);
  border-radius: calc(var(--opt-radius-card) * 0.7);
}

.gate-icon {
  grid-row: 1 / span 3;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: var(--opt-radius-button);
  border: 3px dashed var(--control-edge);
  color: var(--text);
}

.gate.is-done .gate-icon {
  border: 3px solid var(--accent-edge);
  background: var(--accent);
  color: var(--on-accent);
}

.gate-step {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.gate-title {
  margin: 0;
  font-family: var(--opt-font-display);
  font-weight: 700;
  font-size: 1.1rem;
  line-height: 1.2;
}

.gate-state {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
}

.gate-text {
  grid-column: 2;
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

/* Steps with progress (join, setup). */
.steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.4rem;
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.step {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.3rem 0.9rem 0.3rem 0.3rem;
  border: 2px solid var(--line);
  border-radius: var(--opt-radius-button);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  counter-increment: step;
}

.step-dot {
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: var(--opt-radius-button);
  border: 2px dashed var(--control-edge);
  font-family: var(--opt-font-display);
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--text);
  flex: none;
}

.step-dot::before {
  content: counter(step);
}

.step[data-state="done"] {
  color: var(--text);
}

.step[data-state="done"] .step-dot {
  border: 2px solid var(--confirm);
  color: var(--confirm);
}

.step[data-state="done"] .step-dot::before {
  content: "\2713";
}

.step[data-state="now"] {
  border-color: var(--accent-edge);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 800;
}

.step[data-state="now"] .step-dot {
  border: 2px solid var(--on-accent);
  color: var(--on-accent);
}

.progress {
  height: 0.5rem;
  margin: 0 0 1rem;
  border-radius: var(--opt-radius-button);
  background: var(--surface-2);
  overflow: hidden;
}

.progress-bar {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: var(--opt-radius-button);
  background: var(--accent);
  transform-origin: 0 50%;
  scale: var(--done, 0) 1;
}

/* Designed empty states: the aperture, a plain heading, what will appear. */
.empty {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 0.4rem;
  padding: clamp(1.25rem, 4vw, 2.5rem) 1rem;
  border: 2px dashed var(--line);
  border-radius: var(--opt-radius-card);
}

.empty .aperture {
  width: 4rem;
  height: 4rem;
  color: var(--text);
  margin-bottom: 0.4rem;
}

.empty h3 {
  margin: 0;
  font-size: 1.3rem;
}

.empty p {
  margin: 0;
  max-width: 34em;
  color: var(--muted);
}

/* ---------- 6. Forms and buttons ---------- */

.field {
  margin: 0 0 0.9rem;
}

label {
  display: block;
  font-weight: 600;
  margin: 0 0 0.25rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea {
  display: block;
  width: 100%;
  max-width: 26rem;
  min-height: 3rem;
  padding: 0.65rem 0.9rem;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 2px solid var(--control-edge);
  border-radius: calc(var(--opt-radius-card) / 2);
}

textarea {
  min-height: 4.5rem;
}

.field.check {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.field.check input {
  width: 1.3rem;
  height: 1.3rem;
  margin: 0.2rem 0 0;
  accent-color: var(--confirm);
  flex: none;
}

.field.check label {
  font-weight: 400;
  margin: 0;
  flex: 1 1 12rem;
}

.field.check .hint {
  flex-basis: 100%;
}

/* The primary button: cone, with an ink label. */
button {
  font: inherit;
  font-weight: 700;
  min-height: 3rem;
  padding: 0.5rem 1.4rem;
  border-radius: var(--opt-radius-button);
  border: 2px solid var(--accent-edge);
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:hover {
  opacity: 0.9;
}

button:disabled {
  opacity: 0.55;
  cursor: default;
}

/* Second-rank and removing actions: an outline, so the one cone button on a card stands out. */
button.quiet,
button.danger {
  background: transparent;
  color: var(--text);
  border-color: var(--control-edge);
}

button.danger {
  border-style: dashed;
}

button.small {
  min-height: 2.5rem;
  padding: 0.25rem 1rem;
  font-size: 0.95rem;
}

/* A link that looks like a button, for moving to another section. */
a.button {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  min-height: 3rem;
  padding: 0.5rem 1.4rem;
  border-radius: var(--opt-radius-button);
  border: 2px solid var(--accent-edge);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  text-decoration: none;
}

a.button.quiet {
  background: transparent;
  color: var(--text);
  border-color: var(--control-edge);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0.8rem 0 0;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.6rem 0.8rem;
  margin: 0.8rem 0 0;
}

.inline-form .field {
  margin: 0;
  flex: 1 1 11rem;
}

.inline-form .field.narrow {
  flex: 0 1 9.5rem;
}

.inline-form input {
  max-width: none;
}

.inline-form {
  max-width: 44rem;
}

/* ---------- 7. Lists, messages, loaders ---------- */

ul.plain {
  list-style: none;
  margin: 0;
  padding: 0;
}

ul.plain > li {
  padding: 0.85rem 0;
  border-top: 1px solid var(--line);
}

ul.plain > li:first-child {
  border-top: 0;
}

.row-title {
  font-weight: 700;
}

/* A list of cards: requests, families, people. */
ul.cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

ul.cards > li {
  padding: 1rem 1.1rem;
  background: var(--surface-2);
  border-radius: calc(var(--opt-radius-card) * 0.7);
}

.row-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.8rem;
}

.note {
  background: var(--note-bg);
  border-left: 5px solid var(--confirm);
  border-radius: calc(var(--opt-radius-card) / 2);
  padding: 0.75rem 1rem;
  margin: 0 0 1rem;
}

/* Problems: a cone bar, an exclamation mark and bold words. Not colour alone. */
.alert {
  background: var(--flag-bg);
  color: var(--text);
  border: 1px solid var(--control-edge);
  border-left: 6px solid var(--accent);
  border-radius: calc(var(--opt-radius-card) / 2);
  padding: 0.75rem 1rem;
  margin: 0 0 1rem;
  font-weight: 700;
}

.alert::before {
  content: "!\00a0\00a0";
  font-family: var(--opt-font-display);
  font-weight: 800;
}

/*
 * Results arrive as a toast: a small panel at the bottom of the screen that
 * never covers a control you are using (it takes no clicks) and fades after
 * a few seconds. It is the page's role="status" area, so it is read out.
 */
.status {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  z-index: 40;
  translate: -50% 0;
  width: max-content;
  max-width: min(34rem, calc(100vw - 2rem));
  padding: 0.75rem 1.2rem;
  background: var(--text);
  color: var(--bg);
  border-radius: var(--opt-radius-card);
  box-shadow: var(--shadow-lift);
  font-weight: 600;
  pointer-events: none;
}

.status::before {
  content: "\2713\00a0\00a0";
  font-weight: 800;
}

.status.is-gone {
  visibility: hidden;
}

.alert:empty,
.status:empty {
  display: none;
}

.link-box {
  display: block;
  width: 100%;
  padding: 0.7rem 0.9rem;
  margin: 0.4rem 0;
  background: var(--note-bg);
  border: 2px dashed var(--control-edge);
  border-radius: calc(var(--opt-radius-card) / 2);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.log {
  font-size: 0.93rem;
}

.log time {
  color: var(--muted);
}

/* Skeleton loaders: the shape of what is coming, in place of a blank wait. */
.skeleton {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  margin: 0 0 1.25rem;
}

.sk {
  display: block;
  min-height: 7.5rem;
  border-radius: var(--opt-radius-card);
  background: var(--surface-2);
}

.sk.tall {
  min-height: 12rem;
  grid-column: 1 / -1;
}

/* The camera iris. Opens once after sign-in and on the first visit to a home screen. Decoration only. */
.iris {
  display: none;
}

.iris-blade {
  fill: var(--opt-ink);
  stroke: color-mix(in srgb, var(--opt-chalk) 22%, transparent);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.iris-lens {
  fill: var(--opt-cone);
}

/* ---------- 8. Page pieces ---------- */

/* Sign in and join: words on one side, the task on the other. */
.entry {
  display: grid;
  gap: clamp(1.25rem, 3vw, 2.5rem);
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

.entry > * {
  min-width: 0;
}

.hero {
  display: grid;
  gap: 1rem;
  align-content: center;
  padding: clamp(1.5rem, 4vw, 3.25rem);
  min-height: 16rem;
  margin: 0;
}

.hero .band-mark {
  width: clamp(14rem, 34vw, 26rem);
  height: clamp(14rem, 34vw, 26rem);
  right: -5rem;
  top: -5rem;
}

.tagline {
  position: relative;
  margin: 0;
  font-family: var(--opt-font-display);
  font-weight: 800;
  font-size: clamp(2rem, 1.2rem + 3.6vw, 4rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

/* "counted." arriving as running numbers. The word keeps its place: the digits sit on top of it. */
.tally {
  position: relative;
  display: inline-block;
  white-space: nowrap;
}

.tally-digits {
  display: none;
  position: absolute;
  left: 0;
  top: 0;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transform-origin: left center;
  scale: var(--squeeze, 1) 1;
}

.points {
  display: grid;
  gap: 0.6rem;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
}

.points li {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
}

.points .icon {
  margin-top: 0.15em;
  color: var(--opt-cone);
}

/* Places you can go, on the home page. Each is one big link. */
.places {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
}

a.place > .role {
  justify-self: start;
}

a.place {
  display: grid;
  gap: 0.5rem;
  height: 100%;
  padding: 1.25rem 1.35rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--opt-radius-card);
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
  font-weight: 400;
}

.place-title {
  font-family: var(--opt-font-display);
  font-weight: 800;
  font-size: 1.5rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.place-go {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  margin-top: 0.3rem;
  font-weight: 700;
  color: var(--link);
}

/* The team at the top of a home screen. */
.team-hero {
  display: grid;
  gap: 0.4rem;
}

.team-hero h2 {
  font-size: clamp(1.6rem, 1.2rem + 2vw, 2.6rem);
  margin: 0;
}

/* "Live now": only ever shown inside a marked sample. */
.live {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
}

.live-dot {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: var(--opt-radius-button);
  background: var(--opt-cone);
  flex: none;
}

.live-word {
  font-family: var(--opt-font-display);
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.scoreline {
  font-family: var(--opt-font-display);
  font-weight: 800;
  font-size: clamp(1.6rem, 1.3rem + 1.5vw, 2.4rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 0.3rem;
}

/* ---------- 9. Phones ---------- */

@media (max-width: 59.99rem) {
  .shell {
    display: block;
  }

  /* The rail becomes a bar along the bottom. */
  .rail {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 30;
    padding: 0.3rem 0.4rem calc(0.3rem + env(safe-area-inset-bottom, 0px));
    border-radius: calc(var(--opt-radius-card) * 0);
    border-width: 1px 0 0;
    box-shadow: var(--shadow-lift);
  }

  .rail > ul {
    display: flex;
    gap: 0.1rem;
  }

  .rail > ul > li {
    flex: 1 1 0;
    min-width: 0;
    position: relative;
  }

  .rail > ul > li.rail-more {
    position: static;
  }

  .rail a,
  button.rail-more-button {
    flex-direction: column;
    justify-content: center;
    gap: 0.1rem;
    min-height: 3.4rem;
    padding: 0.3rem 0.15rem;
    border-radius: calc(var(--opt-radius-card) / 2);
    font-size: 0.72rem;
    line-height: 1.15;
    text-align: center;
  }

  .rail-label {
    flex: none;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .rail .badge {
    position: absolute;
    top: 0.2rem;
    right: 12%;
  }

  button.rail-more-button {
    display: flex;
  }

  button.rail-more-button.has-current {
    border-color: var(--accent-edge);
    font-weight: 800;
  }

  /* The sections that do not fit on the bar open as a small menu above it. */
  .rail .rail-extra {
    display: none;
  }

  .rail.is-open .rail-extra {
    display: grid;
    gap: 0.15rem;
    position: absolute;
    right: 0.5rem;
    bottom: calc(100% + 0.5rem);
    width: min(16rem, calc(100vw - 1rem));
    padding: 0.5rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--opt-radius-card);
    box-shadow: var(--shadow-lift);
  }

  .rail-extra a {
    flex-direction: row;
    justify-content: flex-start;
    gap: 0.7rem;
    min-height: 2.9rem;
    padding: 0.4rem 0.9rem;
    font-size: 1rem;
    text-align: left;
  }

  body.with-rail footer {
    padding-bottom: 6rem;
  }

  body.with-rail .status {
    bottom: 5.25rem;
  }
}

@media (max-width: 40rem) {
  body {
    font-size: 1rem;
  }

  .brand {
    padding: 22px 12px 22px 0;
  }

  .lockup {
    padding: 36px 36px 36px 0;
  }

  .lockup img {
    height: 72px;
  }

  /* The logo and the Reduce motion button share the first row. The account sits under them. */
  .top-end {
    display: contents;
  }

  button.motion-toggle {
    order: 1;
    margin-left: auto;
    min-width: 0;
    flex: 0 1 auto;
    font-size: 0.8rem;
    padding-right: 0.7rem;
    gap: 0.45rem;
    text-align: left;
  }

  #who {
    order: 2;
    flex: 1 1 100%;
    padding-bottom: 0.5rem;
  }

  #who button {
    margin-left: auto;
  }

  .actions button,
  .actions a.button,
  .inline-form button {
    flex: 1 1 100%;
    justify-content: center;
  }

  .inline-form .field,
  .inline-form .field.narrow {
    flex: 1 1 100%;
  }

  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  textarea {
    max-width: none;
  }

  .step-label {
    display: none;
  }

  .step[data-state="now"] .step-label {
    display: inline;
  }

  .step {
    padding-right: 0.3rem;
  }

  .hero {
    min-height: 0;
    gap: 0.7rem;
  }

  .step[data-state="now"] {
    padding-right: 0.9rem;
  }
}

@media (min-width: 60rem) {
  .entry {
    grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
  }

  .entry .hero {
    position: sticky;
    top: 1rem;
    min-height: min(34rem, calc(100vh - 14rem));
  }

  .entry.task-first > :first-child {
    order: 2;
  }
}

/* ---------- 10. Motion ---------- */

/*
 * Moving from page to page: the browser cross-fades the two pages and
 * carries the logo and the page title across. Browsers that do not know
 * this rule ignore it and simply load the next page.
 */
@view-transition {
  navigation: auto;
}

html[data-motion="full"] .brand,
html[data-motion="full"] .lockup {
  view-transition-name: brand-logo;
}

html[data-motion="full"] #page-title {
  view-transition-name: page-title;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.22s;
}

::view-transition-group(brand-logo),
::view-transition-group(page-title) {
  animation-duration: 0.38s;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
}

::view-transition-old(page-title),
::view-transition-new(page-title) {
  height: 100%;
  width: auto;
}

/* Calm pages do not transition at all. */
html:not([data-motion="full"])::view-transition-group(*),
html:not([data-motion="full"])::view-transition-old(*),
html:not([data-motion="full"])::view-transition-new(*) {
  animation: none !important;
}

@keyframes pop-in {
  from {
    opacity: 0;
    translate: 0 14px;
  }

  to {
    opacity: 1;
    translate: 0 0;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    translate: 0 26px;
  }

  to {
    opacity: 1;
    translate: 0 0;
  }
}

@keyframes turn-in {
  from {
    rotate: -120deg;
  }

  to {
    rotate: 0deg;
  }
}

@keyframes shimmer {
  from {
    background-position: 140% 0;
  }

  to {
    background-position: -40% 0;
  }
}

@keyframes live-pulse {
  0%,
  100% {
    scale: 1;
    opacity: 1;
  }

  50% {
    scale: 1.5;
    opacity: 0.55;
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    translate: -50% 16px;
  }

  to {
    opacity: 1;
    translate: -50% 0;
  }
}

@keyframes thud {
  0% {
    scale: 1;
  }

  35% {
    scale: 1.14;
  }

  100% {
    scale: 1;
  }
}

@keyframes iris-cover {
  0% {
    opacity: 0;
  }

  14%,
  82% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

@keyframes iris-open {
  0%,
  16% {
    translate: 0 -34px;
  }

  100% {
    translate: 0 -1100px;
  }
}

@keyframes iris-turn {
  0%,
  16% {
    rotate: -70deg;
  }

  100% {
    rotate: 0deg;
  }
}

@keyframes iris-lens {
  0%,
  16% {
    opacity: 1;
  }

  45%,
  100% {
    opacity: 0;
  }
}

/* The iris. It never takes a click, so it is never in the way of a task. */
html[data-motion="full"] .iris.is-playing {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  overflow: hidden;
  animation: iris-cover 1.15s linear both;
}

.iris svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

html[data-motion="full"] .iris.is-playing .iris-rotor {
  animation: iris-turn 1.15s cubic-bezier(0.5, 0, 0.2, 1) both;
}

html[data-motion="full"] .iris.is-playing .iris-blade {
  animation: iris-open 1.15s cubic-bezier(0.5, 0, 0.2, 1) both;
}

html[data-motion="full"] .iris.is-playing .iris-lens {
  animation: iris-lens 1.15s linear both;
}

/* Buttons, links and cards you can press: a small lift on hover, a small give on press. */
html[data-motion="full"] button,
html[data-motion="full"] a.button {
  transition: scale 0.18s var(--ease-out), opacity 0.18s ease, background-color 0.18s ease;
}

html[data-motion="full"] button:not(:disabled):active,
html[data-motion="full"] a.button:active {
  scale: 0.96;
}

html[data-motion="full"] a.place,
html[data-motion="full"] a.tile {
  transition: translate 0.22s var(--ease-out), box-shadow 0.22s ease;
}

html[data-motion="full"] a.place:hover,
html[data-motion="full"] a.tile:hover {
  translate: 0 -3px;
  box-shadow: var(--shadow-lift);
}

html[data-motion="full"] a.place:active,
html[data-motion="full"] a.tile:active {
  translate: 0 0;
}

html[data-motion="full"] .rail a,
html[data-motion="full"] button.rail-more-button {
  transition: background-color 0.18s ease, scale 0.18s var(--ease-out);
}

html[data-motion="full"] .motion-toggle-knob {
  transition: left 0.2s ease;
}

html[data-motion="full"] input,
html[data-motion="full"] textarea {
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

html[data-motion="full"] input:focus-visible,
html[data-motion="full"] textarea:focus-visible {
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--opt-cone) 30%, transparent);
}

/* List items arrive one after another. common.js marks new items and numbers them with --i. */
html[data-motion="full"] .enter {
  animation: pop-in 0.42s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}

/* A section you have just switched to. */
html[data-motion="full"] section.is-arriving {
  animation: rise 0.36s var(--ease-out) both;
}

html[data-motion="full"] .status:not(:empty) {
  animation: toast-in 0.3s var(--ease-out) both;
}

html[data-motion="full"] .status {
  transition: opacity 0.3s ease, visibility 0.3s;
}

html[data-motion="full"] .status.is-gone {
  opacity: 0;
}

html[data-motion="full"] .sk {
  background-image: linear-gradient(100deg, transparent 30%, color-mix(in srgb, var(--text) 9%, transparent) 50%, transparent 70%);
  background-size: 220% 100%;
  background-repeat: no-repeat;
  animation: shimmer 1.3s linear infinite;
}

html[data-motion="full"] .hero .band-mark {
  animation: turn-in 1.6s cubic-bezier(0.3, 0, 0.1, 1) both;
}

html[data-motion="full"] .hero .tagline {
  animation: rise 0.8s var(--ease-out) 0.1s both;
}

html[data-motion="full"] .hero .eyebrow,
html[data-motion="full"] .hero .points {
  animation: fade-in 0.8s ease 0.45s both;
}

html[data-motion="full"] .tally.is-running .tally-word {
  opacity: 0;
}

html[data-motion="full"] .tally.is-running .tally-digits {
  display: block;
}

html[data-motion="full"] .gate.is-done.is-fresh .gate-icon,
html[data-motion="full"] .step[data-state="done"].is-fresh .step-dot {
  animation: thud 0.45s var(--ease-pop) both;
}

html[data-motion="full"] .progress-bar {
  transition: scale 0.6s var(--ease-out);
}

html[data-motion="full"] .live-dot {
  animation: live-pulse 1.6s ease-in-out infinite;
}

/*
 * The device's own setting, respected even if the scripts fail: nothing
 * moves without data-motion="full", and boot.js never sets that when the
 * device asks for reduced motion (unless the person turns motion back on
 * with the button).
 */
@media (prefers-reduced-motion: reduce) {
  html:not([data-motion="full"]) *,
  html:not([data-motion="full"]) *::before,
  html:not([data-motion="full"]) *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .motion-toggle,
  .rail,
  .iris,
  .skip,
  .status {
    display: none !important;
  }
}

/* A button that reads as a link, for small "instead" choices inside a sentence. */
button.link {
  background: none;
  border: 0;
  padding: 0;
  min-height: 0;
  font: inherit;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  cursor: pointer;
  box-shadow: none;
}
.nowrap {
  white-space: nowrap;
}

/* Watch page: the player and the games list fit any screen. */
.player-card video,
#player {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  background: var(--opt-ink);
  border-radius: calc(var(--opt-radius-card) / 2);
}
.game-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}
.game-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.game-row .game-name {
  font-weight: 600;
}
.game-row button {
  margin-left: auto;
  min-height: 44px;
  min-width: 72px;
}
.alert-inline {
  color: var(--text);
  border-left: 4px solid var(--accent);
  padding-left: 0.6rem;
  margin: 0 0 0.5rem;
}
