/* King of the Hill
   A dusk sky, one hill, and everything underneath it is the people who lost. */

:root {
  --night: #0d0720;
  --indigo: #1d0f3d;
  --plum: #4a1647;
  --rose: #a02c49;
  --ember: #f0643a;
  --gold: #ffc94a;
  --gold-deep: #e8a21c;
  --cream: #fff1d6;
  --cream-dim: rgba(255, 241, 214, 0.66);
  --earth: #150c10;
  --earth-deep: #0b0608;
  --ink: #1b0f14;

  --display: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --mono: 'DM Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --ridge: max(30svh, 16.7vw, 210px);
  --gutter: clamp(16px, 4vw, 48px);
}

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

html {
  background: var(--earth-deep);
  color: var(--cream);
  font-family: var(--display);
  font-optical-sizing: auto;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100svh;
  overflow-x: hidden;
  background: var(--earth-deep);
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

h1,
h2,
p,
ol,
blockquote {
  margin: 0;
  padding: 0;
}

ol {
  list-style: none;
}

[hidden] {
  display: none !important;
}

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

/* ---------- demo banner ---------- */

.demo-banner {
  position: relative;
  z-index: 5;
  padding: 8px var(--gutter);
  background: var(--gold);
  color: var(--ink);
  font: 500 0.8rem/1.3 var(--mono);
  text-align: center;
  letter-spacing: 0.04em;
}

/* ---------- the sky ---------- */

.sky {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100svh;
  overflow: hidden;
  background: linear-gradient(
    180deg,
    var(--night) 0%,
    var(--indigo) 30%,
    var(--plum) 56%,
    var(--rose) 76%,
    var(--ember) 90%,
    #ffb057 100%
  );
}

.stars {
  position: absolute;
  inset: 0 0 35% 0;
  z-index: -3;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 27% 62%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 41% 9%, #ffe9b8 50%, transparent 51%),
    radial-gradient(1px 1px at 58% 44%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 71% 23%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 83% 71%, #ffe9b8 50%, transparent 51%),
    radial-gradient(2px 2px at 93% 12%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 6% 83%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 49% 78%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 35% 36%, #fff 50%, transparent 51%);
  background-size: 520px 420px;
  -webkit-mask-image: linear-gradient(#000 30%, transparent);
  mask-image: linear-gradient(#000 30%, transparent);
  animation: twinkle 5s ease-in-out infinite alternate;
}

@keyframes twinkle {
  from { opacity: 0.55; }
  to { opacity: 1; }
}

/* A poster sunburst turning slowly behind the hill. */
.rays {
  position: absolute;
  z-index: -3;
  left: 50%;
  bottom: calc(var(--ridge) * 0.62);
  width: 240vmax;
  aspect-ratio: 1;
  translate: -50% 50%;
  background: repeating-conic-gradient(rgba(255, 196, 120, 0.085) 0 5deg, transparent 5deg 10deg);
  -webkit-mask-image: radial-gradient(closest-side, #000 0%, rgba(0, 0, 0, 0.5) 22%, transparent 60%);
  mask-image: radial-gradient(closest-side, #000 0%, rgba(0, 0, 0, 0.5) 22%, transparent 60%);
  animation: turn 240s linear infinite;
}

@keyframes turn {
  to { rotate: 360deg; }
}

.sun {
  position: absolute;
  z-index: -2;
  left: 50%;
  bottom: calc(var(--ridge) * 0.62);
  width: min(42vmin, 380px);
  aspect-ratio: 1;
  translate: -50% 50%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #fff3c4 0%, var(--gold) 38%, var(--ember) 100%);
  box-shadow:
    0 0 60px 20px rgba(255, 176, 87, 0.45),
    0 0 180px 80px rgba(240, 100, 58, 0.35);
}

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: clamp(14px, 2.4vw, 26px) var(--gutter);
}

.wordmark {
  color: var(--cream);
  font-size: clamp(1.05rem, 1.6vw, 1.35rem);
  font-weight: 800;
  font-variation-settings: 'SOFT' 100, 'WONK' 1;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.wordmark em {
  color: var(--gold);
  font-weight: 400;
}

.watchers {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid rgba(255, 241, 214, 0.22);
  border-radius: 999px;
  color: var(--cream-dim);
  font: 400 0.75rem/1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.watchers span {
  color: var(--cream);
  font-variant-numeric: tabular-nums;
}

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6dff9c;
  box-shadow: 0 0 0 0 rgba(109, 255, 156, 0.7);
  animation: pulse 2s ease-out infinite;
}

@keyframes pulse {
  to { box-shadow: 0 0 0 10px rgba(109, 255, 156, 0); }
}

/* ---------- the throne ---------- */

.throne {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: clamp(10px, 1.8vh, 20px);
  padding: clamp(8px, 2vh, 24px) var(--gutter) clamp(20px, 5vh, 56px);
  text-align: center;
}

.reign-clock {
  color: var(--cream-dim);
  font: 400 clamp(0.7rem, 1.1vw, 0.85rem) / 1 var(--mono);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.reign-clock time {
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.crown {
  width: clamp(44px, 6vw, 72px);
  fill: var(--gold);
  filter: drop-shadow(0 4px 18px rgba(255, 201, 74, 0.55));
  transform-origin: 50% 100%;
  animation: bob 6s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { rotate: -3deg; translate: 0 0; }
  50% { rotate: 3deg; translate: 0 -5px; }
}

.proclamation {
  max-width: min(22ch, 100%);
  font-size: clamp(2.3rem, 7.2vw, 6.2rem);
  font-weight: 700;
  font-variation-settings: 'SOFT' 60, 'WONK' 1;
  line-height: 0.98;
  letter-spacing: -0.025em;
  text-wrap: balance;
  overflow-wrap: anywhere;
  text-shadow: 0 2px 30px rgba(13, 7, 32, 0.55);
}

.proclamation.medium {
  max-width: min(26ch, 100%);
  font-size: clamp(1.9rem, 5.2vw, 4.4rem);
  line-height: 1.02;
}

.proclamation.long {
  max-width: min(32ch, 100%);
  font-size: clamp(1.55rem, 3.9vw, 3.3rem);
  line-height: 1.06;
  letter-spacing: -0.018em;
}

.proclamation.vacant {
  font-style: italic;
  font-weight: 400;
  color: var(--cream-dim);
}

.proclamation::before {
  content: '“';
  color: var(--gold);
}

.proclamation::after {
  content: '”';
  color: var(--gold);
}

.proclamation.vacant::before,
.proclamation.vacant::after {
  content: none;
}

.byline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 4px 14px;
  font: 500 clamp(0.8rem, 1.3vw, 1rem) / 1.3 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.byline .paid {
  color: var(--gold);
}

.byline .paid:empty {
  display: none;
}

/* Dethroning: the old words fall off the hill, the new ones land. */
.throne.toppled .proclamation,
.throne.toppled .byline,
.throne.toppled .crown {
  animation: topple 0.55s cubic-bezier(0.6, 0, 0.9, 0.4) forwards;
}

.throne.landed .proclamation,
.throne.landed .byline {
  animation: land 0.7s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.throne.landed .crown {
  animation: land 0.7s 0.12s cubic-bezier(0.2, 1.8, 0.4, 1) both, bob 6s 0.9s ease-in-out infinite;
}

@keyframes topple {
  to { opacity: 0; translate: 0 45vh; rotate: 9deg; }
}

@keyframes land {
  from { opacity: 0; translate: 0 -40px; scale: 1.08; }
}

.quake {
  animation: quake 0.5s linear;
}

@keyframes quake {
  20% { translate: -6px 3px; }
  40% { translate: 5px -4px; }
  60% { translate: -4px 2px; }
  80% { translate: 3px -1px; }
}

/* ---------- the gate (call to action, standing on the hill) ---------- */

.gate {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 12px;
  height: calc(var(--ridge) * 0.74);
  padding: 0 var(--gutter);
  text-align: center;
}

.cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 10px 10px 10px 26px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffe08a, var(--gold) 45%, var(--gold-deep));
  box-shadow:
    0 2px 0 #fff3c4 inset,
    0 6px 0 #9a6208,
    0 14px 30px rgba(0, 0, 0, 0.5);
  color: var(--ink);
  cursor: pointer;
  overflow: hidden;
  transition: translate 0.12s ease, box-shadow 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.cta::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, 0.65) 50%, transparent 65%);
  translate: -120% 0;
  animation: sheen 4.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes sheen {
  0%, 60% { translate: -120% 0; }
  100% { translate: 120% 0; }
}

.cta:hover {
  translate: 0 -2px;
  box-shadow:
    0 2px 0 #fff3c4 inset,
    0 8px 0 #9a6208,
    0 20px 36px rgba(0, 0, 0, 0.55);
}

.cta:active {
  translate: 0 4px;
  box-shadow:
    0 2px 0 #fff3c4 inset,
    0 2px 0 #9a6208,
    0 6px 14px rgba(0, 0, 0, 0.5);
}

.cta:disabled {
  cursor: progress;
  filter: saturate(0.5);
}

.cta-label {
  font-size: clamp(1.15rem, 2vw, 1.5rem);
  font-weight: 800;
  font-variation-settings: 'SOFT' 100, 'WONK' 1;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.cta-price {
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--gold);
  font: 500 clamp(1rem, 1.7vw, 1.25rem) / 1 var(--mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cta-price:empty {
  display: none;
}

.cta-price.bumped {
  animation: bump 0.5s cubic-bezier(0.2, 1.8, 0.4, 1);
}

@keyframes bump {
  from { scale: 1.35; background: var(--ember); color: #fff; }
}

.cta-note {
  color: var(--cream-dim);
  font: 400 0.78rem/1.4 var(--mono);
  letter-spacing: 0.03em;
}

/* ---------- the ridge ---------- */

.ridge {
  position: absolute;
  z-index: -1;
  left: 0;
  bottom: -1px;
  width: 100%;
  height: var(--ridge);
  pointer-events: none;
}

.ridge-far {
  fill: #3a1140;
  opacity: 0.75;
}

.ridge-mid {
  fill: #270d24;
}

.ridge-near {
  fill: var(--earth);
}

.flag rect {
  fill: var(--earth);
}

.pennant {
  fill: #b3203f;
  transform-box: fill-box;
  transform-origin: 0 50%;
  animation: flutter 2.6s ease-in-out infinite;
}

@keyframes flutter {
  0%, 100% { transform: skewY(-5deg) scaleX(1); }
  50% { transform: skewY(6deg) scaleX(0.88); }
}

/* ---------- underground ---------- */

.earth {
  position: relative;
  background:
    radial-gradient(rgba(255, 241, 214, 0.035) 1px, transparent 1.5px) 0 0 / 9px 9px,
    linear-gradient(var(--earth), var(--earth-deep) 900px);
}

.ledger,
.section-head,
.rules,
.colophon,
.bedrock {
  width: min(100% - 2 * var(--gutter), 980px);
  margin-inline: auto;
}

.ledger {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(12px, 3vw, 40px);
  padding: clamp(28px, 6vw, 64px) 0 clamp(36px, 7vw, 80px);
  text-align: center;
}

.figure {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.figure b {
  color: var(--gold);
  font-size: clamp(1.7rem, 5.4vw, 4rem);
  font-weight: 800;
  font-variation-settings: 'SOFT' 100, 'WONK' 1;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.figure span {
  color: var(--cream-dim);
  font: 400 clamp(0.62rem, 1.1vw, 0.8rem) / 1.3 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.section-head {
  display: grid;
  gap: 8px;
  padding-bottom: clamp(18px, 3vw, 30px);
}

.section-head h2 {
  font-size: clamp(2rem, 5vw, 3.6rem);
  font-weight: 800;
  font-variation-settings: 'SOFT' 100, 'WONK' 1;
  line-height: 1;
  letter-spacing: -0.02em;
}

.section-head p {
  color: var(--cream-dim);
  font: 400 0.85rem/1.5 var(--mono);
}

/* Each fallen king is a layer of rock. */
.strata li {
  --tone: #2b1a17;
  position: relative;
  margin-top: -7px;
  padding: calc(clamp(16px, 2.6vw, 26px) + 7px) var(--gutter) clamp(16px, 2.6vw, 26px);
  background: var(--tone);
  clip-path: polygon(0 7px, 9% 1px, 23% 6px, 38% 0, 54% 5px, 69% 1px, 84% 7px, 100% 2px, 100% 100%, 0 100%);
}

.strata li:nth-child(4n + 2) {
  --tone: #331a24;
  clip-path: polygon(0 2px, 12% 7px, 29% 1px, 47% 6px, 61% 0, 77% 6px, 91% 1px, 100% 6px, 100% 100%, 0 100%);
}

.strata li:nth-child(4n + 3) {
  --tone: #2a2118;
  clip-path: polygon(0 5px, 15% 0, 33% 7px, 50% 2px, 66% 7px, 81% 0, 100% 5px, 100% 100%, 0 100%);
}

.strata li:nth-child(4n + 4) {
  --tone: #221820;
}

.stratum {
  display: grid;
  grid-template-columns: 4.5ch minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 6px clamp(12px, 3vw, 32px);
  width: min(100%, 980px);
  margin-inline: auto;
}

.stratum .rank {
  color: rgba(255, 241, 214, 0.38);
  font: 400 0.8rem/1.4 var(--mono);
  font-variant-numeric: tabular-nums;
}

.stratum .words {
  font-size: clamp(1.05rem, 2.2vw, 1.45rem);
  font-style: italic;
  font-weight: 400;
  line-height: 1.25;
  color: rgba(255, 241, 214, 0.9);
  overflow-wrap: anywhere;
}

.stratum .who {
  display: block;
  margin-top: 6px;
  color: var(--cream-dim);
  font: 400 0.72rem/1.4 var(--mono);
  font-style: normal;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.stratum .tally {
  display: grid;
  justify-items: end;
  gap: 4px;
  font: 400 0.78rem/1.3 var(--mono);
  color: var(--cream-dim);
  white-space: nowrap;
}

.stratum .tally b {
  color: var(--gold);
  font-weight: 500;
  font-size: 0.95rem;
}

.strata li.fresh {
  animation: settle 0.9s cubic-bezier(0.2, 1, 0.3, 1) both;
}

@keyframes settle {
  from { max-height: 0; padding-block: 0; opacity: 0; }
  to { max-height: 400px; }
}

.bedrock {
  padding: clamp(28px, 5vw, 48px) 0;
  color: rgba(255, 241, 214, 0.34);
  font: 400 0.75rem/1.5 var(--mono);
  letter-spacing: 0.22em;
  text-align: center;
  text-transform: uppercase;
}

.strata:not(:empty) + .bedrock {
  border-top: 1px dashed rgba(255, 241, 214, 0.14);
}

/* ---------- rules ---------- */

.rules {
  padding: clamp(40px, 8vw, 96px) 0 clamp(24px, 5vw, 48px);
}

.rules .section-head {
  width: auto;
}

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: clamp(14px, 2.4vw, 24px);
  counter-reset: step;
}

.steps li {
  counter-increment: step;
  padding: clamp(18px, 2.6vw, 28px);
  border: 1px solid rgba(255, 241, 214, 0.14);
  border-radius: 18px;
  background: rgba(255, 241, 214, 0.035);
  color: var(--cream-dim);
  font-size: 1.05rem;
  line-height: 1.45;
}

.steps li::before {
  content: counter(step);
  display: block;
  margin-bottom: 14px;
  color: var(--gold);
  font-size: 3rem;
  font-weight: 800;
  font-variation-settings: 'SOFT' 100, 'WONK' 1;
  line-height: 0.9;
}

.steps b {
  display: block;
  margin-bottom: 4px;
  color: var(--cream);
  font-size: 1.3rem;
  font-weight: 700;
}

.fine {
  margin-top: clamp(20px, 3vw, 32px);
  max-width: 76ch;
  color: rgba(255, 241, 214, 0.5);
  font: 400 0.78rem/1.7 var(--mono);
}

.fine a {
  color: var(--gold);
}

.colophon {
  padding: clamp(32px, 6vw, 72px) 0 calc(clamp(32px, 6vw, 72px) + env(safe-area-inset-bottom));
  color: rgba(255, 241, 214, 0.4);
  font-size: clamp(1.1rem, 2.4vw, 1.6rem);
  font-style: italic;
  text-align: center;
}

/* ---------- the decree (claim dialog) ---------- */

.decree {
  width: min(100% - 24px, 520px);
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: var(--cream);
  color: var(--ink);
  box-shadow:
    0 0 0 6px rgba(255, 201, 74, 0.35),
    0 40px 120px rgba(0, 0, 0, 0.7);
  overflow: auto;
}

.decree::backdrop {
  background: rgba(13, 7, 32, 0.78);
  backdrop-filter: blur(6px);
}

.decree[open] {
  animation: unroll 0.35s cubic-bezier(0.2, 1.3, 0.4, 1);
}

@keyframes unroll {
  from { opacity: 0; translate: 0 24px; scale: 0.96; }
}

.decree form {
  position: relative;
  display: grid;
  gap: 16px;
  padding: clamp(22px, 5vw, 36px);
}

.close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(27, 15, 20, 0.08);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.close:hover {
  background: rgba(27, 15, 20, 0.16);
}

.decree-eyebrow {
  color: var(--rose);
  font: 500 0.72rem/1 var(--mono);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.decree h2 {
  margin-top: -8px;
  font-size: clamp(1.9rem, 6vw, 2.6rem);
  font-weight: 800;
  font-variation-settings: 'SOFT' 100, 'WONK' 1;
  line-height: 1;
  letter-spacing: -0.02em;
}

.field {
  display: grid;
  gap: 6px;
}

.field-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font: 500 0.72rem/1.3 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(27, 15, 20, 0.7);
}

.field-label output {
  font-variant-numeric: tabular-nums;
}

.field-label output.over {
  color: #c2182b;
}

.field textarea,
.field input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid rgba(27, 15, 20, 0.2);
  border-radius: 12px;
  background: #fffaf0;
  font-size: 1.05rem;
}

.field textarea {
  min-height: 5.2em;
  resize: vertical;
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.2;
}

.field textarea::placeholder,
.field input::placeholder {
  color: rgba(27, 15, 20, 0.35);
  font-style: italic;
  font-weight: 400;
}

.field textarea:focus,
.field input:focus {
  border-color: var(--ink);
  outline: none;
  box-shadow: 0 0 0 4px rgba(255, 201, 74, 0.6);
}

.error {
  padding: 10px 14px;
  border-radius: 10px;
  background: #fbdcd6;
  color: #7c1020;
  font: 500 0.82rem/1.4 var(--mono);
}

.cta-pay {
  justify-content: space-between;
  width: 100%;
  margin-top: 4px;
  box-shadow:
    0 2px 0 #fff3c4 inset,
    0 6px 0 #9a6208,
    0 10px 20px rgba(27, 15, 20, 0.25);
}

.decree-note {
  color: rgba(27, 15, 20, 0.6);
  font: 400 0.72rem/1.5 var(--mono);
  text-align: center;
}

/* ---------- the verdict (after paying) ---------- */

.verdict {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(13, 7, 32, 0.82);
  backdrop-filter: blur(8px);
  animation: fade 0.3s ease;
}

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

.verdict-card {
  display: grid;
  justify-items: center;
  gap: 16px;
  width: min(100%, 520px);
  padding: clamp(26px, 6vw, 44px);
  border-radius: 24px;
  background: linear-gradient(170deg, var(--indigo), var(--plum));
  box-shadow:
    0 0 0 1px rgba(255, 241, 214, 0.18),
    0 40px 120px rgba(0, 0, 0, 0.7);
  text-align: center;
}

.verdict-card h2 {
  font-size: clamp(2rem, 7vw, 3.2rem);
  font-weight: 800;
  font-variation-settings: 'SOFT' 100, 'WONK' 1;
  line-height: 1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.verdict-card p {
  color: var(--cream-dim);
  font-size: 1.1rem;
  line-height: 1.45;
  text-wrap: pretty;
}

.verdict[data-state='checking'] .crown {
  animation: spin 1.4s cubic-bezier(0.6, 0, 0.4, 1) infinite;
}

.verdict[data-state='outbid'] .crown,
.verdict[data-state='failed'] .crown {
  fill: var(--cream-dim);
  filter: none;
  transform-origin: 50% 50%;
  rotate: 168deg;
  animation: none;
}

@keyframes spin {
  to { rotate: 360deg; }
}

.verdict-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 16px;
  margin-top: 6px;
}

.verdict-actions .cta {
  padding: 14px 26px;
  font-size: 1.15rem;
  font-weight: 800;
}

.ghost {
  padding: 12px 20px;
  border: 1px solid rgba(255, 241, 214, 0.3);
  border-radius: 999px;
  background: transparent;
  color: var(--cream);
  font: 500 0.82rem/1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

.ghost:hover {
  background: rgba(255, 241, 214, 0.1);
}

.verdict-actions button:empty {
  display: none;
}

/* ---------- toasts and confetti ---------- */

.toasts {
  position: fixed;
  z-index: 30;
  left: 50%;
  top: calc(14px + env(safe-area-inset-top));
  display: grid;
  justify-items: center;
  gap: 8px;
  width: min(100% - 24px, 560px);
  translate: -50% 0;
  pointer-events: none;
}

.toast {
  padding: 12px 18px;
  border-radius: 14px;
  background: var(--cream);
  color: var(--ink);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  overflow-wrap: anywhere;
  animation: toast-in 0.4s cubic-bezier(0.2, 1.4, 0.4, 1), toast-out 0.4s 4.6s ease forwards;
}

@keyframes toast-in {
  from { opacity: 0; translate: 0 -20px; }
}

@keyframes toast-out {
  to { opacity: 0; translate: 0 -12px; }
}

.confetti {
  position: fixed;
  inset: 0;
  z-index: 40;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ---------- demo checkout page ---------- */

.demo-checkout {
  display: grid;
  place-items: center;
  min-height: 100svh;
  padding: 24px;
  background: linear-gradient(170deg, var(--night), var(--plum));
  text-align: center;
}

.demo-checkout main {
  display: grid;
  justify-items: center;
  gap: 20px;
  max-width: 520px;
}

.demo-checkout h1 {
  color: var(--gold);
  font-size: clamp(3rem, 12vw, 5rem);
  font-weight: 800;
}

.demo-checkout p {
  font-size: 1.2rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.demo-checkout .demo-tag {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--gold);
  color: var(--ink);
  font: 500 0.75rem/1.2 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.demo-checkout .cta {
  padding: 16px 28px;
  font-size: 1.2rem;
  font-weight: 800;
}

.demo-checkout a {
  color: var(--cream-dim);
  font: 400 0.85rem/1 var(--mono);
}

/* ---------- small screens ---------- */

@media (max-width: 560px) {
  .ledger {
    gap: 10px;
  }

  .stratum {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .stratum .rank {
    display: none;
  }

  .cta-note {
    font-size: 0.68rem;
  }
}

@media (max-height: 560px) {
  .sky {
    --ridge: max(16.7vw, 190px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
