@font-face {
  font-family: 'Poppins';
  src: url('/assets/fonts/Poppins-Bold.ttf') format('truetype');
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  /* taken from the AutoScrollerz logo */
  --plum: #0e1430;      /* page: deep cave blue */
  --grape: #18203f;     /* panels */
  --grape-hi: #26315e;  /* raised controls */
  --lilac: #a9b6dc;     /* quiet text */
  --text: #f2f6ff;
  --cream: #fff3cf;     /* regular glow */
  --gold: #ffc22e;      /* logo gold: primary action */
  --gold-hi: #ffd65a;
  --orange: #ff8a1c;    /* logo orange */
  --sky: #3fd0ff;       /* logo cyan: links */
  --danger: #ff7a8a;
  --display: 'Poppins', 'Segoe UI', system-ui, sans-serif;
  --body: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: dark;
}
/* Seasons follow the stream (assets/theme.js sets data-theme) */
[data-theme="halloween"] {
  --plum: #140d22; --grape: #221636; --grape-hi: #33224f; --lilac: #b9a8d8; --text: #f6f0ff;
  --cream: #ffe6c4; --gold: #ff9a1f; --gold-hi: #ffc04d; --orange: #ff6a00; --sky: #a6ff5c;
}
[data-theme="autumn"] {
  --plum: #1b120c; --grape: #2a1c12; --grape-hi: #3d2a1b; --lilac: #d1b896; --text: #fff6ea;
  --cream: #fff0d6; --gold: #ffb43a; --gold-hi: #ffd27a; --orange: #e2611c; --sky: #a8dc6e;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--plum);
  color: var(--text);
  font: 400 1.0625rem/1.55 var(--body);
}
main { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 var(--gutter); }

h1, h2 { font-family: var(--display); font-weight: 700; line-height: 1.12; margin: 0 0 .5em; }
h1 { font-size: clamp(2.2rem, 6.4vw, 3.9rem); letter-spacing: -.02em; }
h2 { font-size: 1.45rem; }
p { margin: 0 0 1em; }
a { color: var(--sky); text-underline-offset: .18em; }
code { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: .95em; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--gold); color: var(--plum); padding: 8px 14px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }

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

/* ---------- header / footer ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px var(--gutter); max-width: 1120px; width: 100%; margin: 0 auto;
}
.brand { display: block; line-height: 0; }
.brand-logo {
  display: block; width: clamp(150px, 30vw, 220px); aspect-ratio: 3 / 1;
  background: url('/assets/img/logo-text.webp') left center / contain no-repeat;
  filter: drop-shadow(0 3px 0 rgba(0,0,0,.35));
}
[data-theme="halloween"] .brand-logo { background-image: url('/assets/img/logo-halloween.webp'); }
[data-theme="autumn"] .brand-logo { background-image: url('/assets/img/logo-autumn.webp'); }
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.who-email { color: var(--lilac); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; }
.who .btn { white-space: nowrap; }
@media (max-width: 480px) { .who-email { display: none; } }
.foot {
  display: flex; flex-wrap: wrap; gap: 8px 22px; justify-content: center;
  padding: 32px var(--gutter) 40px; color: var(--lilac); font-size: .9rem;
}
.foot a { color: var(--lilac); }

/* ---------- buttons & inputs ---------- */
.btn {
  appearance: none; border: 0; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
  font: 700 1rem/1 var(--display); letter-spacing: 0;
  min-height: 48px; padding: 0 22px; border-radius: 999px;
  transition: transform .12s ease, background-color .12s ease;
}
.btn:active { transform: translateY(1px) scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: linear-gradient(180deg, var(--gold-hi), var(--gold) 55%, var(--orange)); color: #2b1400; box-shadow: inset 0 -3px 0 rgba(150,60,0,.45); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.06); }
.btn-secondary { background: var(--grape-hi); color: var(--text); }
.btn-secondary:hover:not(:disabled) { filter: brightness(1.15); }
.btn-quiet { background: transparent; color: var(--lilac); min-height: 40px; padding: 0 12px; }
.btn-quiet:hover { color: var(--text); }
.btn-danger { background: var(--danger); color: #2a0008; }
.btn-danger-quiet { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 2px rgba(255,122,138,.5); }

input[type=email], input[type=text] {
  font: inherit; color: var(--text); background: var(--plum);
  border: 2px solid var(--grape-hi); border-radius: 14px; min-height: 48px; padding: 0 14px; width: 100%; min-width: 0;
}
input[type=email]:focus, input[type=text]:focus { border-color: var(--sky); outline: none; }
.row { display: flex; flex-wrap: wrap; gap: 10px; }
.row input { flex: 1 1 12rem; width: auto; }
.row .btn { white-space: nowrap; flex: 0 0 auto; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 10px; }

.msg { margin: 6px 0 0; color: var(--cream); }
.msg:empty { margin: 0; }
.msg.bad { color: var(--danger); }
.muted { color: var(--lilac); font-size: .95rem; }
.warn { color: var(--lilac); font-size: .92rem; border-left: 3px solid var(--gold); padding-left: 12px; margin-top: 14px; }

.loading { padding: 120px 0; text-align: center; color: var(--lilac); }

/* ---------- signed out: the marble is the hero ---------- */
.hero {
  display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center;
  padding: 4px 0 24px;
}
.hero-marble { width: min(70vw, 340px); aspect-ratio: 1; margin: 0 0 -12px; }
.hero-copy { max-width: 34rem; }
.hero-plain { padding-top: 96px; }
.lede { font-size: 1.15rem; color: var(--lilac); max-width: 30rem; margin-inline: auto; }
.signin { display: grid; gap: 18px; margin: 28px auto 20px; max-width: 26rem; text-align: left; }
.signin > .btn { width: 100%; }
.gbtn { min-height: 44px; display: flex; justify-content: center; }
.gbtn:empty { display: none; }
@media (min-width: 900px) { .gbtn { justify-content: flex-start; } }
.email-form label { display: block; color: var(--lilac); font-size: .95rem; margin-bottom: 8px; }
.fine { color: var(--lilac); font-size: .9rem; max-width: 26rem; margin-inline: auto; }

@media (min-width: 900px) {
  .hero { grid-template-columns: 1fr 1fr; align-items: center; justify-items: start; text-align: left; padding-top: 32px; column-gap: 40px; }
  .hero-marble { width: 100%; max-width: 420px; justify-self: center; }
  .lede, .signin, .fine { margin-inline: 0; }
  .hero-plain { grid-template-columns: 1fr; }
}

/* ---------- signed in: marble on a stage, panels beside it ---------- */
.studio { display: grid; gap: 22px; padding-bottom: 24px; }
.stage { text-align: center; }
.studio-marble { width: min(84vw, 340px); aspect-ratio: 1; margin: -11% 0 -13%; }
.caption { color: var(--lilac); margin: 0; font-size: .92rem; }
.caption strong { color: var(--text); font-weight: 700; }

@media (min-width: 900px) {
  .studio { grid-template-columns: 380px 1fr; align-items: start; gap: 40px; }
  .stage { position: sticky; top: 24px; }
  .studio-marble { width: 100%; }
}

.panels { display: grid; gap: 16px; min-width: 0; }
.panel { background: var(--grape); border-radius: 28px; padding: 24px clamp(18px, 3vw, 30px); }
.panel > :last-child { margin-bottom: 0; }
.panel-alert { background: var(--grape-hi); box-shadow: inset 0 0 0 2px var(--gold); }
.panel-quiet { background: transparent; box-shadow: inset 0 0 0 2px var(--grape); }

.steps { padding-left: 1.4em; margin: 0 0 18px; }
.steps li { margin-bottom: 4px; }
.steps li::marker { font-family: var(--display); font-weight: 700; color: var(--gold); }
.code-box { margin-top: 18px; }
.code-label { color: var(--lilac); margin-bottom: 4px; }
.code { margin: 0 0 12px; }
.code code {
  display: inline-block; font-size: clamp(1.8rem, 7vw, 2.6rem); font-weight: 700; letter-spacing: .06em;
  color: var(--cream); background: var(--plum); padding: 10px 18px; border-radius: 16px; word-break: break-all;
}

/* pickers */
fieldset { border: 0; padding: 0; margin: 0 0 20px; min-width: 0; }
legend { font-family: var(--display); font-weight: 700; font-size: 1.05rem; padding: 0; margin-bottom: 10px; }
.pickers { display: grid; gap: 4px 28px; }
@media (min-width: 560px) { .pickers { grid-template-columns: 1fr 1fr; } }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.swatch {
  width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer; padding: 0;
  box-shadow: inset 0 -6px 10px rgba(0,0,0,.28), inset 0 4px 8px rgba(255,255,255,.35);
}
.swatch[aria-pressed=true] { outline: 3px solid var(--text); outline-offset: 3px; }
.custom { display: inline-flex; align-items: center; gap: 10px; color: var(--lilac); font-size: .95rem; cursor: pointer; }
.custom input { width: 44px; height: 32px; border: 0; padding: 0; background: none; cursor: pointer; }

.costumes { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.costume {
  appearance: none; border: 0; cursor: pointer; background: var(--plum); color: var(--text);
  border-radius: 18px; padding: 8px 6px 10px; display: grid; justify-items: center; gap: 2px; font: inherit; font-size: .88rem; line-height: 1.25;
}
.costume canvas { width: 64px; height: 64px; display: block; }
.costume-pic { position: relative; display: block; }
.costume-q { position: absolute; inset: 0; display: grid; place-items: center; font: 700 1.6rem/1 var(--display); color: #fff; text-shadow: 0 2px 6px rgba(0,0,0,.8); }
.costume[aria-pressed=true] { box-shadow: inset 0 0 0 3px var(--gold); }

/* glow */
.glow-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.glow-chip { width: 18px; height: 18px; border-radius: 50%; flex: none; }
.glow-name { font-family: var(--display); font-weight: 700; font-size: 1.2rem; }
.dots { display: flex; gap: 10px; margin: 6px 0 12px; }
.dot { width: 26px; height: 26px; border-radius: 50%; background: var(--plum); box-shadow: inset 0 0 0 2px var(--grape-hi); }
.dot.on { background: var(--cream); box-shadow: 0 0 12px rgba(255,243,207,.7); }
.tiers { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 10px 0 0; padding: 0; list-style: none; color: var(--lilac); font-size: .92rem; }
.tiers li { display: flex; align-items: center; gap: 8px; }
.tiers .glow-chip { width: 12px; height: 12px; }
.tiers .here { color: var(--text); }
#glow-pick h3 { margin: 18px 0 8px; font-family: var(--display); font-size: 1.05rem; }
.glow-options { display: flex; flex-wrap: wrap; gap: 8px; }
.glow-option {
  appearance: none; border: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border-radius: 999px; background: var(--plum); color: var(--lilac); font: 700 .95rem/1 var(--display);
}
.glow-option[aria-pressed=true] { background: var(--grape-hi); color: var(--text); box-shadow: inset 0 0 0 2px var(--gold); }
.glow-option:disabled { opacity: .5; cursor: wait; }
.glow-option .glow-chip { width: 14px; height: 14px; }
.glow-chip.off { background: transparent; box-shadow: inset 0 0 0 2px var(--grape-hi); }
.how { margin-top: 14px; color: var(--lilac); }
.how summary { cursor: pointer; color: var(--text); font-weight: 700; }
.how ul { padding-left: 1.2em; margin: 10px 0 0; }
.how li { margin-bottom: 6px; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
@media (min-width: 560px) { .stats { grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); } }
.stats div { background: var(--plum); border-radius: 18px; padding: 14px 16px; }
.stats dt { color: var(--lilac); font-size: .9rem; }
.stats dd { margin: 0; font-family: var(--display); font-weight: 700; font-size: 1.9rem; font-variant-numeric: tabular-nums; }

.confirm { margin-top: 14px; padding-top: 14px; border-top: 2px solid var(--grape); }
.confirm label { display: block; margin-bottom: 8px; color: var(--lilac); }

/* ---------- policy pages ---------- */
.doc { max-width: 42rem; padding: 12px 0 24px; }
.doc h1 { font-size: clamp(2rem, 6vw, 3rem); }
.doc h2 { margin-top: 1.6em; font-size: 1.3rem; }
.doc ul { padding-left: 1.2em; }
.doc li { margin-bottom: 6px; }
.doc .updated { color: var(--lilac); }

@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
}

/* marble controls */
.pickers .picker { margin-bottom: 18px; }
.segmented { display: inline-flex; background: var(--plum); border-radius: 999px; padding: 4px; gap: 4px; }
.segmented button {
  appearance: none; border: 0; cursor: pointer; min-width: 52px; min-height: 40px; border-radius: 999px;
  background: transparent; color: var(--lilac); font: 700 1rem/1 var(--display);
}
.segmented button[aria-pressed=true] { background: var(--grape-hi); color: var(--text); box-shadow: inset 0 0 0 2px var(--gold); }
.twist { display: flex; align-items: center; gap: 10px; color: var(--lilac); font-size: .92rem; }
.twist input { flex: 1; min-width: 0; accent-color: var(--gold); }
.note { color: var(--cream); font-size: .92rem; margin: 10px 0 0; border-left: 3px solid var(--orange); padding-left: 10px; }

/* header: stream status */
.top-right { display: flex; align-items: center; gap: 14px; min-width: 0; }
.stream-chip {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; text-decoration: none;
  font: 700 .88rem/1 var(--display); color: var(--lilac); background: var(--grape); padding: 9px 14px; border-radius: 999px;
}
.stream-chip .dot { width: 9px; height: 9px; border-radius: 50%; background: #6b7390; }
.stream-chip.live { color: var(--text); background: #3a1418; box-shadow: inset 0 0 0 2px #ff3b4e; }
.stream-chip.live .dot { background: #ff3b4e; box-shadow: 0 0 0 0 rgba(255,59,78,.7); animation: pulse 1.8s ease-out infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(255,59,78,0); } 100% { box-shadow: 0 0 0 0 rgba(255,59,78,0); } }
@media (prefers-reduced-motion: reduce) { .stream-chip.live .dot { animation: none; } }
@media (max-width: 560px) { .top { flex-wrap: wrap; } .stream-chip { padding: 8px 12px; font-size: .82rem; } }

/* your account: small and quiet */
.panel-quiet { padding: 16px clamp(18px, 3vw, 30px); }
.small-h { font-size: 1rem; color: var(--lilac); margin-bottom: 6px; }
.small-actions { gap: 4px 18px; margin: 0; }
.btn-link { appearance: none; background: none; border: 0; padding: 6px 0; cursor: pointer; font: inherit; font-size: .9rem; color: var(--lilac); text-decoration: underline; text-underline-offset: .2em; }
.btn-link:hover { color: var(--text); }
.btn-link-danger { color: #e58a95; }

/* glow: when the next play counts as a play day */
.next-day {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap;
  margin: 6px 0 14px; padding: 14px 16px; border-radius: 18px; background: var(--plum);
}
.next-label { color: var(--lilac); font-size: .95rem; }
.next-value { font-family: var(--display); font-weight: 700; font-size: 1.6rem; line-height: 1; color: var(--text); font-variant-numeric: tabular-nums; }
.next-day.ready { box-shadow: inset 0 0 0 2px var(--gold); }
.next-day.ready .next-label { color: var(--cream); }
.next-day.ready .next-value { color: var(--gold); }
