@font-face {
  font-family: "Work Sans";
  src: url("work-sans.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

/* Tokens shared with the MDC26 check-in form */
:root {
  --night: #07062a;
  --night-2: #14104f;
  --ink: #f5f2ff;
  --muted: #b9b2de;
  --violet: #b79bff;
  --blue: #2f7bff;
  --amber: #ffcf8a;
  --danger: #ffb4a8;
  --line: rgb(183 155 255 / .34);
  --field: rgb(12 10 58 / .72);
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--night); }
html, body { overflow-x: clip; }
::selection { color: var(--night); background: var(--violet); }

body {
  margin: 0;
  min-height: 100svh;
  font: 400 1rem/1.5 "Work Sans", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(120% 60% at 80% 0%, rgb(122 77 255 / .28), transparent 60%),
    linear-gradient(var(--night), var(--night-2) 140%);
  -webkit-font-smoothing: antialiased;
}

/* Hero: the event backdrop itself */
.hero { position: relative; overflow: hidden; }
.hero img {
  display: block;
  width: 100%;
  height: min(60vw, 30svh);
  object-fit: cover;
  object-position: 50% 42%;
  mask-image: linear-gradient(#000 62%, transparent);
  @media (prefers-reduced-motion: no-preference) {
    animation: settle 1.8s var(--ease) both;
  }
}
@keyframes settle { from { opacity: 0; scale: 1.08; } }

main {
  position: relative;
  margin-top: -1.5rem;
  padding: 0 max(1.25rem, env(safe-area-inset-right, 0px)) calc(2.5rem + env(safe-area-inset-bottom, 0px)) max(1.25rem, env(safe-area-inset-left, 0px));
}

.panel { max-width: 30rem; margin-inline: auto; }

.eyebrow {
  margin: 0 0 .375rem;
  font-size: .9375rem;
  font-weight: 500;
  color: var(--amber);
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 8.5vw, 2.375rem);
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -.02em;
  text-wrap: balance;
}
h1 em { font-style: normal; font-weight: 600; color: var(--violet); }

.lede { margin: .75rem 0 0; color: var(--muted); }

/* Names form */
form { margin-top: 1.75rem; }

.field label {
  display: block;
  margin-bottom: .375rem;
  font-size: .875rem;
  font-weight: 500;
  color: var(--muted);
}
.field textarea {
  display: block;
  width: 100%;
  min-height: 12rem;
  padding: .75rem 1rem;
  font: inherit;
  line-height: 1.6;
  color: var(--ink);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: .875rem;
  caret-color: var(--violet);
  resize: vertical;
  transition: border-color .2s;
}
.field textarea:hover { border-color: rgb(183 155 255 / .6); }
.field textarea:focus-visible {
  outline: none;
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgb(183 155 255 / .4);
}

.count { margin: .5rem 0 0; font-size: .875rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.cta {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 3.5rem;
  margin-top: 1.5rem;
  padding: .75rem 1.5rem;
  font: inherit;
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--night);
  background: var(--violet);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgb(4 2 30 / .5), inset 0 1px 0 rgb(255 255 255 / .5);
  cursor: pointer;
  transition: scale .15s var(--ease), filter .2s, opacity .2s;
}
.cta:hover { filter: brightness(1.08); }
.cta:active { scale: .98; }
.cta:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.cta[disabled] { cursor: default; filter: saturate(.5); opacity: .6; }
.cta.danger { background: var(--danger); }

.status { min-height: 1.5rem; margin: .875rem 0 0; font-size: .9375rem; color: var(--danger); text-align: center; }
.notice { margin: .5rem 0 0; font-size: .8125rem; color: var(--muted); text-align: center; }

.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: .5rem 1.25rem;
  font: inherit;
  font-size: .9375rem;
  white-space: nowrap;
  color: var(--muted);
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: color .2s, border-color .2s, opacity .2s;
}
.ghost:hover { color: var(--ink); border-color: var(--violet); }
.ghost:focus-visible { outline: 3px solid var(--violet); outline-offset: 3px; }
.ghost[disabled], .ghost.danger[disabled] { opacity: .45; border-color: transparent; cursor: default; pointer-events: none; }
.ghost.danger { color: var(--danger); border-color: rgb(255 180 168 / .4); }
.ghost.danger:hover { border-color: var(--danger); }
#back { display: flex; margin: 1rem auto 0; }

@media (prefers-reduced-motion: no-preference) {
  #setup > *, #setup .field, #setup .cta { animation: rise .7s var(--ease) both; }
  #setup .field { animation-delay: .1s; }
  #setup .cta { animation-delay: .25s; }
}
@keyframes rise { from { opacity: 0; translate: 0 14px; } }

/* Board: the two arcs of light from the backdrop become the sky the wheel hangs in */
/* z-index 0, not -1: below zero it would paint under the body's own opaque background */
body[data-view="wheel"] .hero { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
body[data-view="wheel"] .hero img {
  height: 100%;
  object-position: 50% 0;
  opacity: .7;
  mask-image: linear-gradient(#000 8%, transparent 32%); /* the arcs only; the logo below them stays hidden */
}
body[data-view="wheel"] main { z-index: 1; margin-top: 0; padding-top: max(1.25rem, env(safe-area-inset-top, 0px)); }

.board { display: grid; gap: 1.5rem; max-width: 78rem; margin-inline: auto; }

.bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1.5rem; }
.mark { display: flex; align-items: baseline; gap: .75rem; font-size: 1.5rem; }
.mark strong { font-weight: 700; letter-spacing: -.01em; }
.mark span { font-size: .75rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--amber); }
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
/* the destructive action stands apart from the harmless ones */
.tools .danger { margin-left: 1rem; }

/* Phone: the three tools share one row under the mark */
@media (max-width: 47.99rem) {
  .bar { gap: .75rem; }
  .tools { display: grid; grid-template-columns: repeat(3, auto); justify-content: stretch; width: 100%; }
  .tools .ghost { min-height: 2.75rem; padding-inline: .5rem; font-size: .875rem; }
  .tools .danger { margin-left: 0; }
}

.stage { display: grid; justify-items: center; min-width: 0; }
.stage .cta { width: min(100%, 18rem); }

.wheel {
  position: relative;
  width: min(100%, 34rem, max(16rem, 100svh - 17rem));
  aspect-ratio: 1;
  border-radius: 50%;
  box-shadow: 0 30px 80px rgb(4 2 30 / .8), 0 0 0 1px rgb(205 184 255 / .55);
}
.wheel canvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  will-change: transform;
  transition: opacity .25s var(--ease), scale .25s var(--ease);
}
.wheel canvas.swap { opacity: 0; scale: .97; }

.hub {
  position: absolute;
  inset: 0;
  margin: auto;
  display: grid;
  place-items: center;
  width: 22%;
  height: 22%;
  font-size: clamp(.75rem, 2.6vw, 1.125rem);
  font-weight: 700;
  letter-spacing: -.01em;
  border-radius: 50%;
  border: 1px solid rgb(205 184 255 / .55);
  background:
    radial-gradient(120% 90% at 100% 0%, rgb(122 77 255 / .55), transparent 55%),
    linear-gradient(160deg, #1a1466, #0a0838 70%);
  box-shadow: 0 6px 24px rgb(4 2 30 / .7), inset 0 1px 0 rgb(255 255 255 / .25);
}

.pointer {
  position: absolute;
  top: -3.5%;
  left: 50%;
  width: 7%;
  aspect-ratio: 3 / 4;
  translate: -50% 0;
  transform-origin: 50% 0;
  background: var(--amber);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  /* a night edge keeps the amber tip clear on the light slices */
  filter: drop-shadow(0 1.5px 0 var(--night)) drop-shadow(0 4px 8px rgb(4 2 30 / .6));
}

/* Drawn names */
.drawn {
  min-width: 0;
  padding: 1.25rem 1.5rem;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 1.5rem;
}
.drawn h2 { margin: 0; font-size: 1.125rem; font-weight: 600; }
.drawn h2 span { margin-left: .375rem; font-size: .875rem; font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }
.empty { margin: .75rem 0 0; color: var(--muted); }
.drawn ol { margin: .75rem 0 0; padding: 0; list-style: none; }
.drawn li {
  display: grid;
  grid-template-columns: 2rem 1fr;
  align-items: baseline;
  gap: .5rem;
  padding: .625rem 0;
  font-size: 1.0625rem;
  font-weight: 500;
  overflow-wrap: anywhere;
  border-top: 1px solid rgb(205 184 255 / .18);
}
.drawn li:first-child { border-top: 0; }
.drawn li b { font-size: .8125rem; font-weight: 500; color: var(--amber); font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: no-preference) {
  .drawn li.new { animation: land .9s var(--ease) both; }
}
@keyframes land { from { opacity: 0; translate: -24px 0; color: var(--amber); } }

.board > .notice { margin: 0; }
#unsaved { max-width: 30rem; margin: 0 auto 1rem; padding: .625rem 1rem; border: 1px solid var(--danger); border-radius: .875rem; background: rgb(70 14 40 / .6); }
/* not saving: the "saved on this device" note would be false */
#unsaved:not([hidden]) ~ #board #offline-ready { display: none; }

/* Dialogs fill the screen so a click beside the sheet can close them; the sheet is the visible part */
.modal {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  padding: 1.25rem;
  color: var(--ink);
  background: none;
  border: 0;
  opacity: 0;
  transition-property: opacity, display, overlay;
  transition-duration: .3s;
  transition-timing-function: var(--ease);
  transition-behavior: allow-discrete;
}
.modal:modal { overscroll-behavior: contain; }
.modal[open] { display: grid; place-items: center; }
.modal::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background-color: rgb(4 2 30 / 0);
  transition-property: background-color, display, overlay;
  transition-duration: .3s;
  transition-behavior: allow-discrete;
}
.sheet { position: relative; width: min(100%, 34rem); }
@media (prefers-reduced-motion: no-preference) {
  .sheet { transform: translateY(28px) scale(.94); transition: transform .45s var(--ease); }
}
/* data-closing: exit animation where the browser cannot transition out of the top layer by itself */
.modal[open]:where(:not([data-closing])) {
  opacity: 1;
  @starting-style { opacity: 0; }

  &::backdrop {
    background-color: rgb(4 2 30 / .82);
    @starting-style { background-color: rgb(4 2 30 / 0); }
  }

  @media (prefers-reduced-motion: no-preference) {
    .sheet {
      transform: none;
      @starting-style { transform: translateY(28px) scale(.94); }
    }
  }
}
@media (prefers-reduced-motion: reduce) {
  .modal, .modal::backdrop { transition-duration: .1s; }
}

.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; margin-top: 1.75rem; }
.actions .cta { width: auto; min-height: 3rem; margin: 0; }

.ask {
  padding: 1.75rem;
  width: min(100%, 26rem);
  text-align: center;
  background: linear-gradient(160deg, #1a1466, #0a0838 70%);
  border: 1px solid var(--line);
  border-radius: 1.5rem;
  box-shadow: 0 30px 80px rgb(4 2 30 / .8);
}
.ask h1 { font-size: 1.5rem; font-weight: 600; }

/* Winner: the delegate pass from the check-in form, turned into a prize card */
#confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.arcs {
  position: absolute;
  inset: -18% -22%;
  width: 144%;
  height: 136%;
  overflow: visible;
  filter: drop-shadow(0 0 6px rgb(183 155 255 / .55));
  pointer-events: none;
}
.arcs path { fill: none; stroke-width: 5; stroke-linecap: round; stroke-dasharray: 1; }
@media (prefers-reduced-motion: no-preference) {
  .modal[open] .arcs path { animation: draw 1.4s .15s var(--ease) both; }
  .modal[open] .arcs path + path { animation-delay: .4s; }
}
@keyframes draw { from { stroke-dashoffset: 1; } }

.pass {
  position: relative;
  padding: 2.5rem 1.75rem 2rem;
  text-align: center;
  overflow: hidden;
  isolation: isolate;
  border-radius: 1.5rem;
  border: 1px solid rgb(205 184 255 / .55);
  background:
    radial-gradient(140% 90% at 100% 0%, rgb(122 77 255 / .55), transparent 55%),
    radial-gradient(120% 80% at 0% 100%, rgb(47 123 255 / .45), transparent 60%),
    linear-gradient(160deg, #1a1466, #0a0838 70%);
  box-shadow: 0 30px 80px rgb(4 2 30 / .8), inset 0 1px 0 rgb(255 255 255 / .25);
}
.pass .eyebrow { font-size: .75rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; }
.pass-name {
  margin: .75rem 0 0;
  font-size: clamp(2rem, 9vw, 3.5rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -.02em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.foil {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(115deg, transparent 25%, rgb(255 207 138 / .28) 42%, rgb(183 155 255 / .4) 50%, rgb(47 123 255 / .3) 58%, transparent 75%);
  background-size: 250% 100%;
  background-position: 50% 0;
  mix-blend-mode: screen;
  pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
  .modal[open] .foil { animation: sheen 1.8s .3s var(--ease) both; }
}
@keyframes sheen { from { background-position: 130% 0; } }

/* Tablet up */
@media (min-width: 48rem) {
  .hero img { height: 36svh; object-position: 50% 38%; }
  main { margin-top: -3rem; }
}

/* Desktop: setup has the backdrop left and the form right; the board has the wheel left and drawn names right */
@media (min-width: 64rem) {
  body[data-view="setup"] { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(26rem, 1fr); }
  body[data-view="setup"] .hero { position: sticky; top: 0; height: 100svh; }
  body[data-view="setup"] .hero img { height: 100%; object-position: 50% 50%; mask-image: linear-gradient(90deg, #000 70%, transparent); }
  body[data-view="setup"] main { margin: 0; padding: 2rem 2.5rem; display: grid; align-content: center; min-height: 100svh; }
  .panel { width: 100%; }

  /* the backdrop stands to the right, as on the form, fading in behind the drawn list */
  body[data-view="wheel"] .hero { inset: 0 0 0 auto; width: min(48rem, 50vw); }
  body[data-view="wheel"] .hero img {
    object-position: 50% 50%;
    opacity: .5;
    mask-image: linear-gradient(90deg, transparent, #000 45%), linear-gradient(transparent 10%, #000 55%);
    mask-composite: intersect;
  }
  body[data-view="wheel"] main { padding: 1.5rem 2.5rem; }
  .board { grid-template-columns: minmax(0, 1fr) 24rem; column-gap: 2.5rem; align-items: start; }
  .bar, .board > .notice { grid-column: 1 / -1; }
  .wheel { width: min(100%, max(20rem, 100svh - 19.5rem)); } /* bar, button and notes stay on one screen */
  /* denser panel: the names stay readable where the backdrop shows through */
  .drawn { background: color-mix(in srgb, var(--field), var(--night) 50%); max-height: calc(100svh - 12.75rem); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }

  /* read from the back of the room */
  .drawn h2 { font-size: 1.375rem; }
  .drawn h2 span { font-size: 1rem; }
  .drawn li { grid-template-columns: 2.25rem 1fr; padding: .75rem 0; font-size: 1.25rem; }
  .drawn li b { font-size: .9375rem; }

  /* the warning takes the note's place at the foot, so the board still fits one screen */
  body[data-view="wheel"] #unsaved { position: fixed; bottom: .75rem; left: 50%; z-index: 1; width: max-content; max-width: min(40rem, 100% - 2rem); margin: 0; translate: -50% 0; }

  /* the winner fills the projector without losing the card's proportions */
  .sheet.prize { width: min(100%, 46rem); }
  .pass { padding: 3.5rem 3rem 2.75rem; }
  .pass .eyebrow { font-size: .875rem; }
  .pass-name { font-size: clamp(3.5rem, 5.2vw, 4.75rem); }
  .pass .lede { font-size: 1.25rem; }
  .pass .actions .cta, .pass .actions .ghost { min-height: 3.5rem; padding-inline: 1.75rem; font-size: 1.0625rem; }
}
