/*
 * Colour roles. --brand (from the logo), --accent (when chosen in setup) and
 * --ground are set at runtime; everything else is derived from them.
 */
:root {
  --font: "Archivo", ui-sans-serif, system-ui, sans-serif;

  --brand: #ff2e55;
  --ground: #1c1c1f; /* Glassdraw charcoal */
  --auto-accent: #ff2e55; /* Glassdraw cherry, until a logo gives a colour */
  --accent: var(--auto-accent);

  --accent-ink: oklch(0.2 0.03 70);
  --accent-text: var(--accent);
  --ground-safe: var(--ground);
  --sheet-bg: oklch(0.21 0.012 65);

  --paper: oklch(0.97 0.003 286);
  --paper-2: oklch(0.97 0.003 286 / 0.72);
  --paper-3: oklch(0.97 0.003 286 / 0.5);
  --danger: oklch(0.72 0.17 28);

  --row: clamp(44px, 9.5vmin, 120px);
  --gutter: clamp(16px, 3.2vmin, 44px);

  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  /* A damped spring (stiffness 170, damping 18) sampled over 0.9s; overshoots ~5%. */
  --spring: linear(
    0,
    0.043,
    0.144,
    0.265,
    0.406,
    0.533,
    0.658,
    0.759,
    0.842,
    0.914,
    0.963,
    1.002,
    1.025,
    1.04,
    1.047,
    1.048,
    1.045,
    1.04,
    1.034,
    1.027,
    1.021,
    1.015,
    1.01,
    1.007,
    1.003,
    1.001,
    1,
    0.999,
    0.998,
    1
  );
}

@supports (color: oklch(from red l c h)) {
  /* A colour taken from a logo is lifted so it reads on the dark stage. */
  :root[data-brand] {
    --auto-accent: oklch(from var(--brand) 0.84 clamp(0.08, c, 0.17) h);
  }

  :root {
    /* Near-white ink on dark accents, near-black on light ones. */
    --accent-ink: oklch(from var(--accent) clamp(0.2, (0.68 - l) * 1000, 0.99) 0.03 h);
    /* The accent, lifted when needed so it stays readable as text on dark. */
    --accent-text: oklch(from var(--accent) max(l, 0.78) c h);
    /* The stage stays dark whatever is picked, so white type always reads. */
    --ground-safe: oklch(from var(--ground) min(l, 0.3) c h);
    --sheet-bg: oklch(from var(--ground-safe) clamp(0.19, l + 0.05, 0.27) min(c, 0.04) h);
  }

  .sheet {
    --surface: oklch(from var(--sheet-bg) calc(l + 0.045) c h);
    --surface-hover: oklch(from var(--sheet-bg) calc(l + 0.08) c h);
  }
}

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

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--ground-safe);
  color: var(--paper);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  /* biome-ignore lint/complexity/noImportantStyles: `hidden` must win over any display rule */
  display: none !important;
}

:focus-visible {
  outline: 3px solid var(--accent-text);
  outline-offset: 3px;
}

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

/* ───────── Stage ───────── */

.stage {
  position: relative;
  isolation: isolate;
  height: 100dvh;
  display: grid;
  /* minmax(0, 1fr): a long winner name can't widen the column and nudge the controls. */
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  padding: max(var(--gutter), env(safe-area-inset-top)) max(var(--gutter), env(safe-area-inset-right))
    max(var(--gutter), env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
  overflow: hidden;
}

/* With a mouse, the cursor and toolbar fade out when it rests, keeping the projected screen clean. */
@media (hover: hover) {
  .stage[data-idle="true"]:not([data-state="empty"]) {
    cursor: none;
  }

  .stage[data-idle="true"]:not([data-state="empty"]) .toolbar {
    opacity: 0;
    pointer-events: none;
  }
}

.backdrop {
  --glow: radial-gradient(90% 70% at 50% 0%, color-mix(in oklch, var(--accent) 26%, transparent), transparent 70%);

  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--ground-safe) center / cover no-repeat;
  background-image: var(--bg-landscape, var(--bg-portrait, var(--glow)));
  transition: scale 1.4s var(--ease-out);
}

@media (orientation: portrait) {
  .backdrop {
    background-image: var(--bg-portrait, var(--bg-landscape, var(--glow)));
  }
}

/* Film grain, then a scrim tinted with the background colour so type reads on any photo. */
.backdrop::before,
.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
}

.backdrop::before {
  z-index: 1;
  background: url("grain.png");
}

.backdrop::after {
  background:
    radial-gradient(
      ellipse 80% 70% at 50% 50%,
      color-mix(in oklch, var(--ground-safe) 35%, transparent),
      color-mix(in oklch, var(--ground-safe) 85%, transparent)
    ),
    linear-gradient(to bottom, oklch(0 0 0 / 0.3), transparent 30%, transparent 65%, oklch(0 0 0 / 0.55));
  opacity: 0.85;
  transition: opacity 0.8s var(--ease-out);
}

.stage[data-state="revealed"] .backdrop {
  scale: 1.05;
}
.stage[data-state="revealed"] .backdrop::after {
  opacity: 1;
}

/* ───────── Top bar: brand centred, tools pinned to the corner ───────── */

.topbar {
  position: relative;
  display: grid;
  justify-items: center;
  min-height: 44px;
}

.brand {
  display: grid;
  justify-items: center;
  gap: clamp(8px, 1.6vmin, 18px);
  max-width: min(100%, 70vw);
  text-align: center;
}

.brand-logo {
  height: clamp(40px, 9vmin, 104px);
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.brand-name {
  margin: 0;
  font-size: clamp(1.125rem, 3.6vmin, 2.75rem);
  font-weight: 700;
  font-stretch: 112%;
  letter-spacing: -0.02em;
  line-height: 1.05;
  text-wrap: balance;
}

.toolbar {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  transition: opacity 0.4s var(--ease-out);
}

@media (max-width: 640px) {
  .topbar {
    padding-top: 48px;
  }
  .brand {
    max-width: 100%;
  }
}

.stage:is([data-state="spinning"], [data-state="stopping"]) .toolbar {
  opacity: 0;
  pointer-events: none;
}

.tool {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--paper-2);
  transition:
    color 0.15s,
    background-color 0.15s,
    scale 0.2s var(--ease-out);
}

.tool:hover {
  color: var(--paper);
  background: oklch(1 0 0 / 0.08);
}
.tool:active {
  scale: 0.9;
}

.tool svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 6px oklch(0 0 0 / 0.4));
}

.tool[aria-pressed="true"] .sound-off,
.tool[aria-pressed="false"] .sound-on {
  display: none;
}

/* ───────── Arena: reel, reveal and empty state share one cell ───────── */

.arena {
  position: relative;
  display: grid;
  /* Fixed to the space available, so the winner's name is fitted to the screen rather than stretching the grid. */
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  min-height: 0;
}

.arena > * {
  grid-area: 1 / 1;
}

/* ───────── Reel (structure in reel.css) ───────── */

.stage[data-state="revealed"] .reel {
  opacity: 0;
  scale: 0.9;
}
.stage[data-state="empty"] .reel {
  visibility: hidden;
}

/* ───────── Winner reveal ───────── */

.reveal {
  position: relative;
  display: grid;
  justify-items: center;
  gap: clamp(8px, 1.8vmin, 24px);
  width: 100%;
  max-width: 1600px;
  text-align: center;
  opacity: 0;
  scale: 0.96;
  visibility: hidden;
  /* Leaving: fade and shrink back as the reel returns. */
  transition:
    opacity 0.3s var(--ease-out),
    scale 0.3s var(--ease-out),
    visibility 0s 0.3s;
}

.stage[data-state="revealed"] .reveal {
  opacity: 1;
  scale: 1;
  visibility: visible;
  transition:
    opacity 0.2s,
    scale 0.2s,
    visibility 0s;
}

/* Sunburst: slow-turning rays in the accent colour, faded at the edges. */
.rays {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: -1;
  width: 150vmax;
  aspect-ratio: 1;
  translate: -50% -50%;
  background: repeating-conic-gradient(
    color-mix(in oklch, var(--accent) 20%, transparent) 0deg 5deg,
    transparent 5deg 15deg
  );
  mask-image: radial-gradient(closest-side, #000 8%, transparent 50%);
  opacity: 0;
  scale: 0.6;
  pointer-events: none;
  will-change: rotate;
  transition:
    opacity 0.4s var(--ease-out),
    scale 0.6s var(--ease-out);
}

.stage[data-state="revealed"] .rays {
  opacity: 1;
  scale: 1;
  transition:
    opacity 1.2s var(--ease-out),
    scale 1.6s var(--ease-out);
  animation: rays-turn 80s linear infinite;
}

@keyframes rays-turn {
  to {
    rotate: 1turn;
  }
}

.reveal-number {
  margin: 0;
  color: var(--accent-text);
  font-size: clamp(1.125rem, 3.4vmin, 2.5rem);
  font-weight: 650;
  font-stretch: 125%;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 16px oklch(0 0 0 / 0.4);
}

.stage[data-state="revealed"] .reveal-number {
  animation: rise 0.7s var(--spring) both;
}

.reveal-name {
  width: min(100%, 94vw);
  margin: 0;
  padding-block: 0.08em;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

/* Each word rises in on its own beat; set by app.js as --word. */
.reveal-name .word {
  display: inline-block;
}

.stage[data-state="revealed"] .reveal-name .word {
  animation:
    rise 0.9s var(--spring) both,
    bloom 2.4s var(--ease-out) both;
  animation-delay: calc(0.12s + var(--word) * 0.09s);
}

@keyframes rise {
  from {
    opacity: 0;
    translate: 0 0.45em;
    scale: 0.92;
  }
}

@keyframes bloom {
  0% {
    text-shadow: 0 0 0 transparent;
  }
  35% {
    text-shadow: 0 0 0.35em color-mix(in oklch, var(--accent) 80%, transparent);
  }
  100% {
    text-shadow: 0 2px 0.5em oklch(0 0 0 / 0.35);
  }
}

/* ───────── Empty state ───────── */

.empty {
  display: none;
  max-width: 34ch;
  text-align: center;
}

.stage[data-state="empty"] .empty {
  display: block;
}

.empty-title {
  margin: 0 0 0.4em;
  font-size: clamp(1.75rem, 5vmin, 3.25rem);
  font-weight: 750;
  font-stretch: 112%;
  letter-spacing: -0.03em;
  line-height: 1.05;
  text-wrap: balance;
}

.empty-body {
  margin: 0;
  color: var(--paper-2);
  font-size: clamp(1rem, 2.2vmin, 1.25rem);
  text-wrap: pretty;
}

/* ───────── Controls ───────── */

.controls {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding-top: 12px;
}

/*
 * The primary button always sits dead centre at a fixed width, and the
 * redraw link has a reserved slot below it, so nothing shifts as labels
 * change or the link appears.
 */
.actions {
  display: grid;
  justify-items: center;
  row-gap: 4px;
}

.primary-button {
  width: 11.5em;
  height: clamp(58px, 8.5vmin, 80px);
  padding-inline: 0;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: clamp(1.0625rem, 2.4vmin, 1.4rem);
  font-weight: 700;
  font-stretch: 115%;
  letter-spacing: -0.01em;
  box-shadow: 0 14px 34px -14px oklch(0 0 0 / 0.6);
  transition:
    scale 0.2s var(--ease-out),
    background-color 0.3s,
    color 0.3s,
    box-shadow 0.3s;
}

/* Each new label slides up into place; app.js swaps in a fresh span to replay it. */
.primary-button .label {
  display: inline-block;
  animation: label-in 0.32s var(--ease-out);
}

@keyframes label-in {
  from {
    opacity: 0;
    translate: 0 60%;
  }
}

.primary-button:active:not(:disabled) {
  scale: 0.96;
  transition-duration: 0.1s;
}

.stage[data-state="spinning"] .primary-button {
  background: var(--paper);
  color: var(--ground-safe);
  box-shadow: 0 16px 40px -14px oklch(0 0 0 / 0.6);
}

.primary-button:disabled {
  cursor: progress;
  background: oklch(1 0 0 / 0.12);
  color: var(--paper-2);
  box-shadow: none;
}

/* Secondary actions carry no colour, so the primary one is unmistakable. */
.secondary-button {
  padding: 12px 8px;
  border: 0;
  background: none;
  color: var(--paper-2);
  font-size: clamp(0.9375rem, 1.9vmin, 1.125rem);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: oklch(1 0 0 / 0.3);
  text-underline-offset: 5px;
  opacity: 0;
  visibility: hidden;
  translate: 0 -8px;
  transition:
    color 0.15s,
    opacity 0.2s,
    translate 0.2s var(--ease-out),
    visibility 0s 0.2s;
}

.secondary-button:hover {
  color: var(--paper);
}

/* Fades in a beat after the winner, once the name has landed. */
.stage[data-state="revealed"] .secondary-button {
  opacity: 1;
  visibility: visible;
  translate: 0 0;
  transition:
    color 0.15s,
    opacity 0.4s 0.6s,
    translate 0.5s 0.6s var(--ease-out),
    visibility 0s 0.6s;
}

.meta {
  margin: 0;
  color: var(--paper-3);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 8px oklch(0 0 0 / 0.5);
  transition: opacity 0.4s;
}

.stage:is([data-state="spinning"], [data-state="stopping"]) .meta {
  opacity: 0;
}
.stage[data-state="empty"] .meta {
  visibility: hidden;
}

kbd {
  font: inherit;
  font-weight: 650;
  color: var(--paper-2);
}

@media (hover: none) {
  .key-hint {
    display: none;
  }
}

.confetti {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ───────── Setup sheet ───────── */

.sheet {
  --surface: oklch(1 0 0 / 0.07);
  --surface-hover: oklch(1 0 0 / 0.11);

  width: min(500px, 100vw);
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
  background: var(--sheet-bg);
  color: var(--paper);
  color-scheme: dark;
  translate: 100% 0;
  transition:
    translate 0.45s var(--ease-out),
    display 0.45s allow-discrete,
    overlay 0.45s allow-discrete;
}

.sheet[open] {
  translate: 0 0;
}

@starting-style {
  .sheet[open] {
    translate: 100% 0;
  }
}

.sheet::backdrop {
  background: oklch(0 0 0 / 0);
  transition:
    background-color 0.45s,
    display 0.45s allow-discrete,
    overlay 0.45s allow-discrete;
}

.sheet[open]::backdrop {
  background: oklch(0 0 0 / 0.45);
}

@starting-style {
  .sheet[open]::backdrop {
    background: oklch(0 0 0 / 0);
  }
}

.sheet-form {
  display: flex;
  flex-direction: column;
  gap: 44px;
  min-height: 100%;
  padding: 0 28px max(32px, env(safe-area-inset-bottom));
}

.sheet-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-inline: -28px;
  padding: max(20px, env(safe-area-inset-top)) 28px 16px;
  background: var(--sheet-bg);
}

.sheet-header h2 {
  margin: 0;
  font-size: 2rem;
  font-weight: 800;
  font-stretch: 118%;
  letter-spacing: -0.035em;
}

.sheet-header h2:focus {
  outline: none;
}

.done-button {
  height: 42px;
  padding-inline: 22px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-stretch: 110%;
  transition: scale 0.2s var(--ease-out);
}

.done-button:active {
  scale: 0.94;
}

.sheet-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.section-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0;
  font-size: 1.25rem;
  font-weight: 750;
  font-stretch: 112%;
  letter-spacing: -0.02em;
}

.section-count {
  color: var(--accent-text);
  font-size: 0.9375rem;
  font-weight: 600;
  font-stretch: 100%;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.note {
  margin: 0;
  color: var(--paper-2);
  font-size: 0.875rem;
  line-height: 1.5;
  text-wrap: pretty;
}

.text-input {
  width: 100%;
  height: 52px;
  padding-inline: 16px;
  border: 0;
  border-radius: 6px;
  background: var(--surface);
  font-size: 1.0625rem;
  font-weight: 550;
  transition: background-color 0.15s;
}

.text-input::placeholder {
  color: var(--paper-3);
}
.text-input:hover {
  background: var(--surface-hover);
}
.text-input:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 0;
}

/* Entries: a list you can type in, plus a file upload that replaces it. */

.entries-text {
  display: block;
  width: 100%;
  min-height: 15rem;
  padding: 14px 16px;
  border: 0;
  border-radius: 6px;
  background: var(--surface);
  color: inherit;
  font: inherit;
  font-size: 1rem;
  line-height: 1.6;
  resize: vertical;
  transition:
    background-color 0.15s,
    box-shadow 0.15s;
}

.entries-text::placeholder {
  color: var(--paper-3);
}
.entries-text:hover {
  background: var(--surface-hover);
}
.entries-text:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 0;
}
.entries[data-dragging] .entries-text {
  box-shadow: inset 0 0 0 3px var(--accent-text);
  background: var(--surface-hover);
}

.entries-upload {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}

.upload-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  height: 42px;
  padding-inline: 18px;
  border-radius: 999px;
  background: var(--surface-hover);
  font-weight: 650;
  cursor: pointer;
  transition: background-color 0.15s;
}

.upload-button:hover {
  background: oklch(1 0 0 / 0.16);
}
.upload-button:focus-within {
  outline: 2px solid var(--accent-text);
  outline-offset: 2px;
}

.upload-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.note--error {
  color: var(--danger);
  font-weight: 600;
}

/* Upload tiles: filled surfaces, no outlines. One remove control per tile. */

.tile {
  position: relative;
}

.drop {
  position: relative;
  display: grid;
  place-items: center;
  height: 9.5rem;
  overflow: hidden;
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
  transition:
    background-color 0.15s,
    box-shadow 0.15s;
}

.tile--logo .drop {
  height: 7rem;
}
.tile--portrait .drop {
  aspect-ratio: 9 / 16;
}

.drop:hover {
  background: var(--surface-hover);
}
.drop:focus-within {
  outline: 2px solid var(--accent-text);
  outline-offset: 2px;
}
.tile[data-dragging] .drop {
  box-shadow: inset 0 0 0 3px var(--accent-text);
  background: var(--surface-hover);
}

.drop input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.drop img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Logos keep their shape and breathe inside the tile. */
.tile--logo .drop img {
  padding: 16px;
  object-fit: contain;
}

.drop-empty {
  display: grid;
  gap: 4px;
  padding: 16px;
  text-align: center;
  color: var(--paper-2);
  font-size: 0.875rem;
  line-height: 1.4;
}

.drop-empty strong {
  color: var(--paper);
  font-size: 1rem;
  font-weight: 650;
}

.tile[data-filled] .drop-empty {
  display: none;
}

.tile-pair {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.tile-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: oklch(0 0 0 / 0.55);
  color: var(--paper);
  transition:
    background-color 0.15s,
    scale 0.2s var(--ease-out);
}

.tile-remove:hover {
  background: oklch(0 0 0 / 0.8);
}
.tile-remove:active {
  scale: 0.88;
}

.tile-remove svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

/* Switch */

.switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-top: 6px;
  cursor: pointer;
}

.switch-text {
  display: grid;
  gap: 2px;
}
.switch-label {
  font-weight: 600;
}

.switch input {
  appearance: none;
  position: relative;
  flex: none;
  width: 50px;
  height: 30px;
  margin: 0;
  border-radius: 999px;
  background: var(--surface-hover);
  cursor: pointer;
  transition: background-color 0.2s;
}

.switch input::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--paper);
  transition:
    translate 0.25s var(--ease-out),
    background-color 0.2s;
}

.switch input:checked {
  background: var(--accent);
}
.switch input:checked::before {
  translate: 20px 0;
  background: var(--accent-ink);
}

/* Colour swatches */

.swatches {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  border: 0;
}

.swatches-label {
  padding: 0;
  margin-bottom: 12px;
  font-weight: 600;
}

.swatches-name {
  margin-left: 8px;
  color: var(--paper-2);
  font-weight: 450;
}

.swatch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.swatch {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--swatch);
  cursor: pointer;
  transition:
    scale 0.2s var(--ease-out),
    box-shadow 0.2s;
}

.swatch:hover {
  scale: 1.08;
}

.swatch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.swatch:has(input:focus-visible) {
  outline: 2px solid var(--paper);
  outline-offset: 3px;
}

.swatch[data-selected] {
  box-shadow:
    0 0 0 3px var(--sheet-bg),
    0 0 0 5px var(--paper);
}

/* "From logo" shows the colour picked from the logo, with a small mark. */
.swatch--auto {
  background: var(--auto-accent);
}

.swatch--auto::after {
  content: "A";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: oklch(0.2 0.03 70);
  font-size: 0.875rem;
  font-weight: 800;
  font-stretch: 120%;
  pointer-events: none;
}

.swatch--custom {
  background: conic-gradient(
    oklch(0.75 0.15 0),
    oklch(0.75 0.15 90),
    oklch(0.75 0.15 180),
    oklch(0.75 0.15 270),
    oklch(0.75 0.15 360)
  );
}

.swatch--custom[data-selected] {
  background: var(--swatch);
}

/* Winners */

.winner-list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: winner;
  max-height: 20rem;
  overflow-y: auto;
}

.winner-list li {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 6px 0;
  font-size: 1.0625rem;
  font-weight: 550;
  counter-increment: winner;
}

.winner-list li::before {
  content: counter(winner);
  min-width: 1.6em;
  color: var(--accent-text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.winner-list li.is-no-show {
  counter-increment: none;
  color: var(--paper-3);
  text-decoration: line-through;
}

.winner-list li.is-no-show::before {
  content: "–";
  color: var(--paper-3);
}

.winner-list li.is-no-show::after {
  content: "absent";
  margin-left: auto;
  font-size: 0.8125rem;
}

.winner-actions {
  display: flex;
  gap: 24px;
}

.text-button {
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--paper);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: oklch(1 0 0 / 0.3);
  text-underline-offset: 4px;
}

.text-button:hover {
  text-decoration-color: currentColor;
}
.text-button--danger {
  color: var(--danger);
  text-decoration-color: color-mix(in oklch, var(--danger) 40%, transparent);
}

.fairness summary {
  font-weight: 600;
  cursor: pointer;
}

.fairness p {
  margin: 10px 0 0;
  color: var(--paper-2);
  font-size: 0.875rem;
  line-height: 1.6;
  text-wrap: pretty;
}

.sheet-footnote {
  color: var(--paper-3);
  line-height: 1.7;
}
.sheet-footnote a {
  color: var(--paper-2);
}

/* biome-ignore-start lint/complexity/noImportantStyles: reduced motion must override every animation */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    /* No transitions at all: a near-zero duration would still make every property
       (font size included) report its old value for a frame. */
    transition: none !important;
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
  }
}
/* biome-ignore-end lint/complexity/noImportantStyles: reduced motion block above */
