:root {
  color-scheme: light;
  --ink: #17141f;
  --ink-2: #474355;
  --ink-3: #5d596e;
  --paper: #fff;
  /* Translucent, not blurred: the dot canvas behind these changes every frame,
     and re-blurring it constantly is what cost phones their frame rate. */
  --glass: rgb(255 255 255 / 0.74);
  --glass-strong: rgb(255 255 255 / 0.9);
  --live: #ff3b30;
  --soon: #ff9500;
  --focus: #2152d9;
  --shadow-border:
    0 0 0 1px oklch(0 0 0 / 0.06),
    0 1px 2px -1px oklch(0 0 0 / 0.06),
    0 2px 4px 0 oklch(0 0 0 / 0.04);
  --shadow-border-hover:
    0 0 0 1px oklch(0 0 0 / 0.08),
    0 1px 2px -1px oklch(0 0 0 / 0.08),
    0 2px 4px 0 oklch(0 0 0 / 0.06);
  --shadow-float:
    0 0 0 1px oklch(0 0 0 / 0.05),
    0 2px 6px -2px oklch(0 0 0 / 0.08),
    0 24px 48px -16px oklch(0.3 0.08 270 / 0.3);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --font-display: "Fredoka", ui-rounded, system-ui, sans-serif;
  --font-text: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: clamp(16px, 3vw, 32px);
  --topbar: 72px;

  /* Dot tones, shared with the canvas palette in js/art.js */
  --purple-hi: #d4b0ff; --purple: #9d5ff7; --purple-lo: #6d31dc;
  --green-hi: #c8f5a0; --green: #76cd47; --green-lo: #48a028;
  --blue-hi: #a6c6ff; --blue: #3f78f7; --blue-lo: #2152d9;
  --orange-hi: #ffd4a0; --orange: #f88d2e; --orange-lo: #da641b;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100dvh;
  font: 400 16px/1.5 var(--font-text);
  color: var(--ink);
  background: #cfe8ff;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Daylight sky over a pale plaza, like the banner. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(70% 45% at 12% -5%, rgb(255 255 255 / 0.5), transparent 70%),
    radial-gradient(38% 9% at 10% 67%, rgb(255 255 255 / 0.95), transparent 70%),
    radial-gradient(30% 8% at 88% 66%, rgb(255 255 255 / 0.9), transparent 70%),
    radial-gradient(24% 6% at 52% 68%, rgb(255 255 255 / 0.7), transparent 70%),
    linear-gradient(180deg, #6fb6ff 0%, #98cdff 28%, #c9e6ff 52%, #e9f5ff 66%, #f4f6f8 69%, #f1eee8 100%);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

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

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Crowd canvas ---------- */

.crowd {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.crowd[data-cursor="grab"] {
  cursor: grab;
}

.crowd[data-cursor="grabbing"] {
  cursor: grabbing;
}

/* ---------- Top bar ---------- */

.topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: calc(var(--topbar) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left));
  pointer-events: none;
}

.topbar > * {
  pointer-events: auto;
}

.brand {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
  font: 600 28px/1 var(--font-display);
  letter-spacing: -0.02em;
  border-radius: 999px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  filter: drop-shadow(0 2px 3px oklch(0.3 0.08 270 / 0.25));
}

.topbar-actions {
  display: flex;
  gap: 8px;
  min-width: 0;
}

.chip {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--glass);
  box-shadow: var(--shadow-border);
  color: var(--ink);
  font: 600 14px/1 var(--font-text);
  text-decoration: none;
  white-space: nowrap;
  transition-property: scale, background-color, box-shadow;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
  -webkit-tap-highlight-color: transparent;
}

.chip .icon {
  width: 16px;
  height: 16px;
}

.chip:active {
  scale: 0.96;
}

/* The contract address gives way first when the bar runs out of room,
   truncating in the middle so the familiar ends stay readable. */
.chip-ca {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  padding-inline-end: 14px;
  cursor: pointer;
}

.chip-ca-label {
  color: var(--ink-3);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.chip-ca-value {
  display: flex;
  min-width: 0;
  font: 500 13px/1 ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: -0.01em;
}

.chip-ca-head {
  min-width: 2ch;
  overflow: hidden;
  text-overflow: ellipsis;
}

.copy-icon {
  display: grid;
  flex: none;
}

.copy-icon .icon {
  grid-area: 1 / 1;
  transition-property: opacity, scale, filter;
  transition-duration: 300ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

.icon-check {
  color: #1f9d55;
}

.chip-ca:not([data-copied]) .icon-check,
.chip-ca[data-copied] .icon-copy {
  opacity: 0;
  scale: 0.25;
  filter: blur(4px);
}

/* ---------- Stage ---------- */

.stage {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 100dvh;
  padding: calc(var(--topbar) + env(safe-area-inset-top) + clamp(4px, 4.5vh, 56px)) var(--gutter) 0;
  /* The crowd sits behind the copy; only real controls take the pointer. */
  pointer-events: none;
}

.stage :is(a, button, [data-player]) {
  pointer-events: auto;
}

.waiting {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 960px;
  text-align: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  margin: 0;
  padding: 0 14px 0 12px;
  border-radius: 999px;
  background: var(--glass);
  box-shadow: var(--shadow-border);
  color: var(--ink-2);
  font: 600 13px/1 var(--font-text);
  white-space: nowrap;
}

.pill-dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--purple);
}

[data-phase="soon"] .pill-dot {
  background: var(--soon);
}

[data-phase="live"] .pill-dot {
  background: var(--live);
}

[data-phase="replay"] .pill-dot {
  background: var(--ink-3);
}

[data-phase="live"] .pill-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--live);
  animation: ping 1.6s var(--ease-out) infinite;
}

@keyframes ping {
  from {
    opacity: 0.6;
    scale: 1;
  }
  to {
    opacity: 0;
    scale: 2.6;
  }
}

.title {
  margin: 18px 0 0;
  font: 600 clamp(38px, min(5.6vw, 8.4vh), 78px)/1 var(--font-display);
  letter-spacing: -0.028em;
  text-wrap: balance;
}

.lede {
  max-width: 32em;
  margin: 14px 0 0;
  color: var(--ink-2);
  font-size: clamp(16px, 1.4vw, 19px);
  line-height: 1.5;
  text-wrap: pretty;
}

.lede strong {
  color: var(--ink);
  font-weight: 600;
}

/* ---------- Countdown ---------- */

.countdown {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  margin-top: clamp(16px, 3.4vh, 36px);
  font: 600 clamp(52px, min(8.4vw, 12.5vh), 124px)/1 var(--font-display);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.unit {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.unit-digits {
  display: flex;
}

.digit {
  display: grid;
  width: 0.6em;
  justify-items: center;
  overflow: hidden;
}

.glyph {
  grid-area: 1 / 1;
}

.unit-label {
  margin-top: 6px;
  color: var(--ink-3);
  font: 600 12px/1 var(--font-text);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.colon {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.15em;
  height: 1em;
  padding: 0 0.1em;
}

.colon i {
  width: 0.13em;
  height: 0.13em;
  border-radius: 50%;
  box-shadow: 0 0.02em 0.04em oklch(0.3 0.08 270 / 0.3);
}

.tone-purple { background: radial-gradient(circle at 34% 30%, var(--purple-hi), var(--purple) 50%, var(--purple-lo)); }
.tone-green { background: radial-gradient(circle at 34% 30%, var(--green-hi), var(--green) 50%, var(--green-lo)); }
.tone-blue { background: radial-gradient(circle at 34% 30%, var(--blue-hi), var(--blue) 50%, var(--blue-lo)); }
.tone-orange { background: radial-gradient(circle at 34% 30%, var(--orange-hi), var(--orange) 50%, var(--orange-lo)); }

.localtime {
  margin: 14px 0 0;
  color: var(--ink-2);
  font-size: 15px;
}

.localtime b {
  color: var(--ink);
  font-weight: 600;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: clamp(16px, 3.2vh, 32px);
}

/* ---------- Buttons ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  font: 600 16px/1 var(--font-text);
  letter-spacing: -0.005em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition-property: scale, background-color, box-shadow;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
  -webkit-tap-highlight-color: transparent;
}

.button:active {
  scale: 0.96;
}

/* Icon side gets 2px less padding so the label reads as centered. */
.button-lead {
  padding-inline-start: 20px;
}

.button-trail {
  padding-inline-end: 20px;
}

.button-primary {
  background: var(--ink);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.14),
    0 8px 20px -8px oklch(0.25 0.08 280 / 0.6);
}

.button-secondary {
  background: var(--glass-strong);
  color: var(--ink);
  box-shadow: var(--shadow-border);
}

@media (hover: hover) and (pointer: fine) {
  .chip:hover {
    background: var(--glass-strong);
    box-shadow: var(--shadow-border-hover);
  }

  .button-primary:hover {
    background: #2b2735;
  }

  .button-secondary:hover {
    background: var(--paper);
    box-shadow: var(--shadow-border-hover);
  }
}

/* ---------- Live view ---------- */

.live {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.player {
  position: relative;
  width: min(100%, 1120px, max(300px, calc((100dvh - var(--topbar) - 270px) * 16 / 9)));
  aspect-ratio: 16 / 9;
  margin-top: 14px;
  border-radius: 20px;
  overflow: hidden;
  background: #100e16;
  box-shadow: var(--shadow-float);
}

.player::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  outline: 1px solid oklch(0 0 0 / 0.1);
  outline-offset: -1px;
  pointer-events: none;
}

.player iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.player-note {
  display: grid;
  place-items: center;
  height: 100%;
  margin: 0;
  padding: 24px;
  color: rgb(255 255 255 / 0.62);
  font-size: 15px;
  text-align: center;
  text-wrap: balance;
}

.player-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 14px;
  margin: 12px 0 0;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--glass-strong);
  box-shadow: var(--shadow-border);
  color: var(--ink-2);
  font-size: 14px;
  line-height: 20px;
}

.player-meta :is(a, .text-button) {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: 600 14px/20px var(--font-text);
  text-decoration: underline;
  text-decoration-color: oklch(0 0 0 / 0.2);
  text-underline-offset: 3px;
  cursor: pointer;
  transition: text-decoration-color 150ms ease-out;
}

@media (hover: hover) and (pointer: fine) {
  .player-meta :is(a, .text-button):hover {
    text-decoration-color: currentColor;
  }
}

/* ---------- Hint and fine print ---------- */

.hint,
.fineprint {
  position: fixed;
  left: 50%;
  z-index: 2;
  margin: 0;
  border-radius: 999px;
  background: var(--glass-strong);
  box-shadow: var(--shadow-border);
  white-space: nowrap;
  transform: translateX(-50%);
  pointer-events: none;
}

.fineprint {
  bottom: max(12px, env(safe-area-inset-bottom));
  padding: 6px 12px;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 16px;
}

.hint {
  bottom: calc(max(12px, env(safe-area-inset-bottom)) + 40px);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 10px;
  color: var(--ink);
  font: 600 13px/16px var(--font-text);
  animation: rise 400ms var(--ease-out) both;
}

.hint[hidden],
[data-phase]:not([data-phase="waiting"]) .hint {
  display: none;
}

.hint-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, var(--green-hi), var(--green) 50%, var(--green-lo));
}

/* ---------- Make-your-dot dialog ---------- */

.maker {
  width: min(400px, 100% - 32px);
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  overflow: visible;
  transition:
    opacity 200ms var(--ease-out),
    scale 200ms var(--ease-out),
    translate 200ms var(--ease-out),
    display 200ms allow-discrete,
    overlay 200ms allow-discrete;
}

.maker:not([open]) {
  opacity: 0;
  scale: 0.96;
}

@starting-style {
  .maker[open] {
    opacity: 0;
    scale: 0.96;
  }
}

.maker::backdrop {
  background: oklch(0.28 0.05 260 / 0.3);
  transition:
    opacity 200ms ease-out,
    display 200ms allow-discrete,
    overlay 200ms allow-discrete;
}

.maker:not([open])::backdrop {
  opacity: 0;
}

@starting-style {
  .maker[open]::backdrop {
    opacity: 0;
  }
}

/* 36px outer radius = 24px inner (the stage and pill buttons) + 12px padding. */
.maker-card {
  display: grid;
  gap: 16px;
  padding: 12px;
  border-radius: 36px;
  background: var(--paper);
  box-shadow: var(--shadow-float);
}

.maker-stage {
  display: block;
  width: 100%;
  height: 176px;
  border-radius: 24px;
  background: linear-gradient(180deg, #8cc6ff 0%, #d7edff 62%, #f4f6f8 74%, #efece6 100%);
  cursor: pointer;
}

.maker-head {
  padding: 4px 12px 0;
}

.maker-head h2 {
  margin: 0;
  font: 600 26px/1.1 var(--font-display);
  letter-spacing: -0.015em;
}

.maker-head p {
  margin: 6px 0 0;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.45;
  text-wrap: pretty;
}

.maker fieldset {
  min-width: 0;
  margin: 0;
  padding: 0 12px;
  border: 0;
}

.maker legend {
  margin-bottom: 8px;
  padding: 0;
  color: var(--ink-3);
  font: 600 12px/1 var(--font-text);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.options {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.option {
  position: relative;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  transition: box-shadow 150ms ease-out, background-color 150ms ease-out;
}

.option input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.option :is(.swatch, canvas) {
  pointer-events: none;
  transition: scale 150ms ease-out;
}

.option:active :is(.swatch, canvas) {
  scale: 0.96;
}

.swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  box-shadow:
    inset 0 0 0 1px oklch(0 0 0 / 0.06),
    0 2px 4px -1px oklch(0.3 0.08 270 / 0.3);
}

.option-face canvas {
  width: 40px;
  height: 40px;
}

.option:has(:checked) {
  box-shadow: 0 0 0 2px var(--ink);
}

.option:has(:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

@media (hover: hover) and (pointer: fine) {
  .option:hover {
    background: oklch(0 0 0 / 0.05);
  }
}

.maker-actions {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 8px;
  margin-top: 4px;
}

.maker-actions .button-secondary {
  background: oklch(0 0 0 / 0.05);
  box-shadow: none;
}

@media (hover: hover) and (pointer: fine) {
  .maker-actions .button-secondary:hover {
    background: oklch(0 0 0 / 0.08);
    box-shadow: none;
  }
}

/* On phones the maker is a bottom sheet. */
@media (max-width: 560px) {
  .maker {
    width: 100%;
    margin: auto 0 0;
    transition-duration: 400ms;
    transition-timing-function: var(--ease-drawer);
  }

  .maker:not([open]) {
    opacity: 1;
    scale: 1;
    translate: 0 100%;
  }

  @starting-style {
    .maker[open] {
      opacity: 1;
      scale: 1;
      translate: 0 100%;
    }
  }

  .maker-card {
    border-radius: 36px 36px 0 0;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
}

/* ---------- Entrance ---------- */

.enter {
  animation: rise 400ms var(--ease-out) both;
}

.enter:nth-child(1) { animation-delay: 100ms; }
.enter:nth-child(2) { animation-delay: 200ms; }
.enter:nth-child(3) { animation-delay: 300ms; }
.enter:nth-child(4) { animation-delay: 400ms; }
.enter:nth-child(5) { animation-delay: 500ms; }
.enter:nth-child(6) { animation-delay: 600ms; }

@keyframes rise {
  from {
    opacity: 0;
    translate: 0 12px;
    filter: blur(4px);
  }
}

/* ---------- Small screens ---------- */

@media (max-width: 560px) {
  :root {
    --topbar: 64px;
  }

  .brand {
    font-size: 26px;
  }

  .chip {
    padding-inline: 12px;
  }

  .chip-collapse {
    width: 40px;
    padding: 0;
    justify-content: center;
  }

  .chip-label {
    display: none;
  }

  .chip-ca {
    gap: 6px;
  }

  .chip-ca-value {
    font-size: 12px;
  }

  .actions {
    width: 100%;
  }

  .actions .button {
    flex: 1 1 0;
    padding-inline: 14px;
  }

  .unit-label {
    font-size: 11px;
  }

  .player {
    border-radius: 16px;
  }

  .player-meta {
    border-radius: 20px;
  }
}

/* The smallest phones need the room for the contract address. */
@media (max-width: 374px) {
  .brand-word {
    display: none;
  }
}

/* ---------- Social card (?card) ---------- */

.card-only,
[data-card] :is(.topbar-actions, .lede:not(.card-only), .countdown, .localtime, .actions, .hint) {
  display: none;
}

[data-card] .card-only {
  display: block;
}

[data-card] .stage {
  padding-top: 118px;
}

[data-card] .title {
  font-size: 92px;
}

[data-card] .lede {
  font-size: 24px;
}

[data-card] .enter {
  animation: none;
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .enter,
  .hint {
    animation: fade 300ms ease-out both;
  }

  [data-phase="live"] .pill-dot::after {
    animation: none;
  }

  .maker,
  .maker:not([open]) {
    translate: none;
    scale: none;
  }
}

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