:root {
  color-scheme: dark;
  font-family: Arial, Helvetica, sans-serif;
  color: #f9f7ff;
  background: #12102a;
  --gold: #ffd550;
  --muted: #c4bde4;
  --line: #4b447a;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 50% 3%, #312273 0%, transparent 58%),
    linear-gradient(#171333, #12102a 78%);
}
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible {
  outline: 3px solid #b8f4f3;
  outline-offset: 4px;
}
button:disabled { cursor: wait; opacity: .7; }

.topbar {
  width: min(1120px, calc(100% - 48px));
  margin: auto;
  min-height: 74px;
  border-bottom: 1px solid #ffffff25;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.brand-icon {
  width: 33px;
  height: 33px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: #1b142b;
  background: var(--gold);
  font-size: 22px;
  transform: rotate(-10deg);
}
.top-actions { display: flex; gap: 8px; }
.quiet-button, .text-button {
  min-height: 44px;
  color: #f5f0ff;
  background: transparent;
}
.quiet-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  font-size: .875rem;
  font-weight: 700;
}
.quiet-button:hover, .share-button:hover { background: #ffffff1c; }
.text-button { border: 0; padding: 0; text-decoration: underline; text-underline-offset: 4px; }

.shell { width: min(1032px, calc(100% - 48px)); margin: auto; }
.intro { padding: clamp(24px, 4.5vw, 58px) 0 clamp(20px, 3vw, 34px); text-align: center; }
.mode {
  color: #e2cffa;
  margin: 0;
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}
h1 {
  margin: 7px 0 2px;
  font-size: clamp(3.1rem, 9.5vw, 7.4rem);
  font-weight: 900;
  letter-spacing: -.08em;
  line-height: .95;
  text-transform: uppercase;
  text-wrap: balance;
  text-shadow: 0 .06em #25174f;
}
h1 em { color: var(--gold); font-style: normal; white-space: nowrap; }
.subtitle { margin: 14px 0 0; color: var(--muted); font-size: clamp(1rem, 2vw, 1.25rem); }

.cabinet {
  position: relative;
  overflow: hidden;
  padding: clamp(16px, 3vw, 30px);
  border: 1px solid #6b5faf;
  border-radius: clamp(18px, 3vw, 28px);
  background: radial-gradient(ellipse at 50% 0%, #403087 0%, #241d53 59%, #1e1945 100%);
  box-shadow: 0 14px 0 -7px #0e0a22, 0 25px 70px #09061899, inset 0 2px #ffffff18;
}
.cabinet::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(#ffffff18 1px, transparent 1px);
  background-size: 18px 18px;
  mask-image: linear-gradient(black, transparent 75%);
}
.scorebar, .wheels, .playback { position: relative; }
.scorebar {
  min-height: 36px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 6px 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid #ffffff21;
  font-size: .94rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.scorebar strong { color: var(--gold); font-weight: 800; }

.wheels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(7px, 3vw, 36px);
  width: min(100%, 800px);
  margin: clamp(23px, 3.4vw, 40px) auto clamp(14px, 2vw, 24px);
}
.wheel-slot {
  --accent: #b6a8ff;
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 12px;
}
.wheel-slot:nth-child(2) { --accent: #7edee9; }
.wheel-slot:nth-child(3) { --accent: #ff9cba; }
.dial {
  position: relative;
  width: min(100%, 212px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: #100e2c;
  border: max(2px, .3vw) solid #6659a7;
  box-shadow: 0 5px 0 #110d30, inset 0 0 24px #07071e;
}
.is-active .dial {
  border-color: var(--accent);
  box-shadow: 0 5px 0 #110d30, 0 0 25px color-mix(in srgb, var(--accent) 35%, transparent);
}
.is-hit .dial { border-color: var(--gold); }
.track {
  position: absolute;
  inset: 5%;
  border-radius: 50%;
  background: conic-gradient(from var(--target-start), var(--gold) 0deg var(--target-size), transparent var(--target-size) 360deg),
    repeating-conic-gradient(#b3a5f8 0deg 1.5deg, #33265f 1.5deg 10deg);
  mask-image: radial-gradient(transparent 61%, #000 62%);
}
.track::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: rotate(var(--target-center));
  background: linear-gradient(#35204b, #35204b) top center / clamp(2px, .32vw, 4px) 12% no-repeat;
}
.hand {
  position: absolute;
  inset: 0;
  transform: rotate(var(--angle, 0deg));
}
.hand::before {
  content: "";
  position: absolute;
  width: max(3px, 3%);
  height: 46%;
  border-radius: 999px;
  top: 6%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 50%, transparent);
}
.hub {
  position: absolute;
  inset: 37%;
  display: grid;
  place-items: center;
  border: 1px solid #ffffff50;
  border-radius: 50%;
  background: #211840;
  color: #f7f2ff;
  font-size: clamp(.8rem, 2.6vw, 1.65rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.wheel-label { color: var(--muted); font-size: .9rem; font-weight: 700; line-height: 1.3; }
.is-active .wheel-label { color: var(--accent); }

.playback { text-align: center; }
.status { min-height: 42px; display: grid; align-content: center; gap: 4px; }
.status p { margin: 0; color: #e1d9ff; }
#result { font-size: clamp(1.7rem, 4vw, 2.6rem); line-height: 1; color: var(--gold); }
.actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.play-button, .share-button {
  min-height: 50px;
  padding: 0 24px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 800;
}
.play-button {
  min-width: 162px;
  border: 1px solid #f8a34c;
  background: var(--gold);
  color: #231523;
  box-shadow: 0 4px 0 #ba7133;
}
.play-button:hover { background: #ffe285; }
.play-button:active { transform: translateY(2px); box-shadow: 0 2px 0 #ba7133; }
.share-button { border: 1px solid #b4a4ff; background: #2d245f; color: #fff; }
.keyboard { color: var(--muted); font-size: .875rem; margin: 12px 0 0; }
kbd { font: inherit; font-weight: 700; border: 1px solid #736994; border-radius: 4px; padding: 1px 4px; }

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 6px 14px;
  min-height: 68px;
  color: var(--muted);
  font-size: .9rem;
}
dialog {
  width: min(440px, calc(100% - 36px));
  border: 1px solid #8170ba;
  border-radius: 20px;
  padding: 26px;
  color: #f9f7ff;
  background: #282050;
  box-shadow: 0 20px 60px #09051d;
}
dialog::backdrop { background: #090617c9; }
dialog h2 { margin: 8px 0 14px; font-size: 1.8rem; letter-spacing: -.035em; }
dialog li { margin-bottom: 9px; line-height: 1.5; }
dialog ol { padding-left: 20px; }
dialog form { margin-top: 22px; }
dialog input { width: 100%; padding: 10px; border: 1px solid #8170ba; border-radius: 8px; margin-top: 8px; color: white; background: #180f34; }

@media (max-width: 500px) {
  .shell, .topbar { width: calc(100% - 24px); }
  .topbar { min-height: 62px; }
  .quiet-button { padding: 0 10px; }
  .scorebar { font-size: .875rem; }
  .wheel-slot { gap: 9px; }
  .actions button { flex: 1 1 138px; min-width: 0; padding: 0 12px; }
  .intro { padding-top: 30px; }
}
@media (pointer: coarse) { .keyboard { display: none; } }
