:root {
  --bg: #0d0710;
  --panel: rgba(31, 14, 32, .92);
  --gold: #e9c46a;
  --gold-light: #fff1c7;
  --magenta: #ee4d9b;
  --lilac: #bd8be2;
  --ink: #fffaf3;
  --muted: #c7a9bc;
  --wheel-size: min(78vw, 43vh, 410px);
  --heading: 'Cinzel', Georgia, serif;
  --body: 'Outfit', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ink);
  font-family: var(--body);
  background:
    radial-gradient(circle at 86% 8%, rgba(189, 139, 226, .22), transparent 31%),
    radial-gradient(circle at 8% 78%, rgba(238, 77, 155, .17), transparent 35%),
    linear-gradient(150deg, #09050b, var(--bg) 48%, #1a0917);
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.app {
  width: min(100%, 640px);
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 12px max(22px, env(safe-area-inset-bottom));
}
.hero { text-align: center; }
.brand, .stage-kicker, .result-eyebrow {
  margin: 0;
  color: var(--magenta);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .36em;
  text-transform: uppercase;
}
h1, h2 { font-family: var(--heading); }
h1 {
  margin: 5px 0;
  font-size: clamp(25px, 6vw, 41px);
  line-height: 1.02;
  letter-spacing: .02em;
  color: var(--gold-light);
}
h1 em {
  color: transparent;
  font-style: normal;
  background: linear-gradient(90deg, var(--gold), #fff2c9, #c99035);
  -webkit-background-clip: text;
  background-clip: text;
}
.rule { display: flex; align-items: center; gap: 12px; color: var(--gold); }
.rule::before, .rule::after { content: ''; height: 1px; flex: 1; background: linear-gradient(90deg, transparent, var(--gold)); }
.rule::after { transform: scaleX(-1); }
.game-card {
  overflow: hidden;
  position: relative;
  padding: clamp(14px, 3.5vw, 24px);
  text-align: center;
  border: 1px solid rgba(233, 196, 106, .22);
  border-radius: 28px;
  background: linear-gradient(160deg, rgba(48, 21, 42, .93), rgba(17, 9, 17, .96));
  box-shadow: 0 24px 80px rgba(0, 0, 0, .5), inset 0 1px rgba(255, 255, 255, .04);
}
.game-card::before { content: ''; position: absolute; inset: 0 15% auto; height: 1px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.stage-copy h2 { margin: 5px auto 3px; font-size: clamp(17px, 4vw, 24px); color: var(--gold-light); }
.stage-copy > p:last-child { margin: 0 auto 7px; color: var(--muted); font-size: 12px; }

.wheel-shell { position: relative; width: var(--wheel-size); aspect-ratio: 1; margin: 25px auto 12px; }
canvas { display: block; width: 100%; height: 100%; filter: drop-shadow(0 17px 26px rgba(0, 0, 0, .58)); }
.pointer {
  position: absolute;
  z-index: 5;
  top: -7%;
  left: 50%;
  width: 11%;
  height: 14%;
  transform: translateX(-50%);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  background: linear-gradient(#fff9e7, var(--gold) 68%, #a87529);
  filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .65));
}
.hub {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  display: grid;
  place-content: center;
  width: 30%;
  aspect-ratio: 1;
  border: clamp(3px, .7vw, 5px) solid var(--gold);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 28%, #3a1530, #100810 76%);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, .4), 0 5px 20px #000;
  text-transform: uppercase;
}
.hub span { color: #ef9bc6; font-size: clamp(8px, 2vw, 13px); letter-spacing: .22em; }
.hub strong { color: var(--gold-light); font: 700 clamp(12px, 3vw, 20px) var(--heading); }

.spin-button, .reset-button {
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--body);
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.spin-button { padding: 12px clamp(26px, 8vw, 58px); color: #2c1a08; border: 0; background: linear-gradient(#fff1c7, #dfb556); box-shadow: 0 10px 26px rgba(0, 0, 0, .42), inset 0 1px #fff; font-size: 11px; }
.spin-button:disabled { opacity: .45; cursor: wait; }
.spin-button:not(:disabled):active, .reset-button:active { transform: scale(.97); }
.status { min-height: 18px; margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.status.is-warning { color: #f3a2ca; }

.saved-result { margin-top: 24px; padding-top: 23px; border-top: 1px solid rgba(233, 196, 106, .2); animation: reveal .55s cubic-bezier(.2, .8, .2, 1); }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 12px; text-align: left; }
.result-grid div { padding: 13px; border: 1px solid rgba(233, 196, 106, .16); border-radius: 14px; background: rgba(5, 3, 6, .35); }
.result-grid span { display: block; margin-bottom: 5px; color: var(--magenta); font-size: 9px; letter-spacing: .16em; text-transform: uppercase; }
.result-grid strong { color: var(--gold-light); font-size: clamp(14px, 3.5vw, 18px); line-height: 1.25; }
.final-order { margin: 18px auto 15px; max-width: 500px; color: var(--ink); font: 700 clamp(18px, 4.5vw, 27px)/1.35 var(--heading); text-wrap: balance; }
.reset-button { padding: 10px 23px; color: #f2a2c9; border: 1px solid rgba(238, 77, 155, .45); background: transparent; font-size: 10px; }
[hidden] { display: none !important; }
@keyframes reveal { from { opacity: 0; transform: translateY(12px); } }

@media (max-width: 520px) {
  :root { --wheel-size: min(78vw, 39vh, 335px); }
  .app { padding-inline: 8px; }
  .game-card { padding-inline: 11px; border-radius: 20px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; } }
