/* SPIN ZONE — arcade decision cabinet */

@font-face { font-family: "Press Start 2P"; font-style: normal; font-weight: 400; font-display: swap; src: url("/press-start-2p.woff2") format("woff2"); }
@font-face { font-family: "Press Start 2P Fallback"; src: local("Courier New"); size-adjust: 166.64%; ascent-override: 60%; descent-override: 0%; line-gap-override: 0%; }

:root {
  --bg: #0a0a12;
  --surface: #12121d;
  --surface-2: #1a1a2a;
  --line: #28283c;
  --text: #e9e9f2;
  --dim: #9aa0b5;
  --cyan: #45f0ff;
  --magenta: #ff3d8b;
  --gold: #ffc857;
  --green: #41ff8b;
  --red: #ff5560;
  --pixel: "Press Start 2P", "Press Start 2P Fallback", "Courier New", monospace;
  --body: -apple-system, "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --space-gutter: 16px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --glow-cyan: 0 0 14px rgba(69, 240, 255, 0.35);
}

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(900px 360px at 50% -10%, rgba(255, 61, 139, 0.08), transparent 70%),
    radial-gradient(800px 420px at 80% 0%, rgba(69, 240, 255, 0.06), transparent 65%),
    var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(69, 240, 255, 0.3); }
[hidden] { display: none !important; }
a { color: var(--cyan); }

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

.skip-link {
  position: absolute;
  left: 12px; top: -48px;
  z-index: 200;
  background: var(--cyan);
  color: #05050d;
  padding: 10px 16px;
  border-radius: 6px;
  font-family: var(--mono);
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.2s var(--ease-out);
}
.skip-link:focus-visible { transform: translateY(60px); }

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px rgba(69, 240, 255, 0.15);
}

.site-header {
  padding: 26px var(--space-gutter) 10px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.lab-link {
  align-self: flex-start;
  font-family: var(--pixel);
  font-size: 10px;
  color: var(--dim);
  text-decoration: none;
  padding: 6px 2px;
  transition: color 0.15s, text-shadow 0.15s;
}
.lab-link:hover { color: var(--cyan); text-shadow: var(--glow-cyan); }
.level {
  margin: 0;
  font-family: var(--pixel);
  font-size: 9px;
  letter-spacing: 3px;
  color: var(--gold);
}
.wordmark {
  margin: 6px 0 4px;
  font-family: var(--pixel);
  font-size: 22px;
  letter-spacing: 2px;
  color: var(--text);
  text-shadow: 0 0 16px rgba(69, 240, 255, 0.55), 3px 3px 0 var(--magenta);
}
.tagline {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--dim);
}
.cursor { color: var(--cyan); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

main {
  flex: 1;
  width: 100%;
  max-width: 1220px;
  margin: 0 auto;
  padding: 20px var(--space-gutter) 72px;
}

.cabinet-shell {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface), rgba(18, 18, 29, 0.45));
  border-radius: 12px;
  overflow: hidden;
}
.cabinet-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.cabinet-tab {
  min-height: 48px;
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--dim);
  font-family: var(--pixel);
  font-size: 10px;
  cursor: pointer;
}
.cabinet-tab:last-child { border-right: 0; }
.cabinet-tab[aria-selected="true"] {
  color: #05050d;
  background: var(--gold);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.24);
}

.cabinet-panel {
  display: grid;
  gap: 18px;
  padding: 16px;
}
.wheel-stage, .coin-stage, .dice-stage {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}
.wheel-wrap {
  position: relative;
  width: min(100%, 74vh, 640px);
  max-width: 640px;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 50%;
  background:
    repeating-conic-gradient(from 0deg, rgba(255,255,255,0.025) 0deg 6deg, transparent 6deg 12deg),
    var(--surface-2);
  box-shadow: inset 0 0 0 10px rgba(10, 10, 18, 0.65), 0 0 30px rgba(69, 240, 255, 0.08);
}
.wheel-canvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}
.wheel-pointer {
  position: absolute;
  top: -1px;
  left: 50%;
  width: 0; height: 0;
  transform: translateX(-50%);
  border-left: 18px solid transparent;
  border-right: 18px solid transparent;
  border-top: 34px solid var(--gold);
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.35));
}
.confetti-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  border-radius: 50%;
}
.confetti-bit {
  position: absolute;
  width: 8px; height: 12px;
  animation: confetti 850ms var(--ease-out) forwards;
}
@keyframes confetti {
  to { transform: translate(var(--tx), var(--ty)) rotate(520deg); opacity: 0; }
}

.winner-banner {
  width: 100%;
  min-height: 52px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 14px;
  text-align: center;
  font-family: var(--pixel);
  font-size: 11px;
  line-height: 1.65;
  overflow-wrap: anywhere;
  text-shadow: 0 0 12px rgba(65, 255, 139, 0.35);
}
.controls-stack { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.panel-head, .action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.panel-title {
  margin: 0;
  font-family: var(--pixel);
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(69, 240, 255, 0.4);
}
.counter {
  color: var(--gold);
  font-family: var(--mono);
  font-size: 12px;
}
.field-label, .two-fields label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1px;
}
textarea, input[type="text"], select {
  width: 100%;
  min-width: 0;
  background: var(--bg);
  border: 1px solid #5e5e80;
  color: var(--text);
  border-radius: 6px;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 14px;
}
textarea { min-height: 220px; resize: vertical; line-height: 1.45; }
select { min-height: 44px; }
.note, .hint {
  margin: 0;
  color: var(--dim);
  font-size: 12px;
}
.mono { font-family: var(--mono); color: var(--gold); }
.toggle-line {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
}
.toggle-line input { width: 18px; height: 18px; accent-color: var(--cyan); }

.btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 6px;
  padding: 10px 14px;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s var(--ease-out), border-color 0.12s, box-shadow 0.12s, color 0.12s;
}
.btn:hover:not(:disabled) {
  border-color: var(--cyan);
  box-shadow: 0 0 12px rgba(69, 240, 255, 0.22);
  transform: translateY(-1px);
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.48; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary { background: var(--cyan); border-color: var(--cyan); color: #05050d; }
.btn-primary:hover:not(:disabled) { box-shadow: 0 0 18px rgba(69, 240, 255, 0.5); }
.btn-ghost { background: transparent; }
.btn-big { font-family: var(--pixel); font-size: 11px; padding: 14px 18px; }

.split-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.mini-list {
  min-height: 52px;
  margin: 10px 0 0;
  padding-left: 22px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
}
.mini-list li { margin-bottom: 6px; overflow-wrap: anywhere; }
.muted-row { color: var(--dim); list-style: none; margin-left: -22px; }

.coin-stage, .dice-stage {
  justify-content: center;
  min-height: 320px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(0deg, rgba(255,255,255,0.03) 1px, transparent 1px) 0 0 / 24px 24px,
    rgba(10, 10, 18, 0.45);
  padding: 18px;
}
.coin {
  width: 168px;
  height: 168px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 35% 28%, #fff1a8, var(--gold) 44%, #b06d16 100%);
  border: 10px solid #7d5218;
  box-shadow: inset -16px -18px 0 rgba(0, 0, 0, 0.16), 0 18px 40px rgba(0, 0, 0, 0.36);
  color: #18100a;
  font-family: var(--pixel);
  font-size: 36px;
  transform-style: preserve-3d;
}
.coin.is-flipping { animation: coin-flip 900ms cubic-bezier(0.2, 0.7, 0.18, 1) both; }
@keyframes coin-flip {
  25% { transform: rotateY(540deg) translateY(-26px); }
  55% { transform: rotateY(1180deg) translateY(-54px); }
  100% { transform: rotateY(1800deg); }
}
.two-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.stat-grid p {
  margin: 0;
  min-height: 86px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
}
.stat-grid span {
  color: var(--gold);
  font-family: var(--pixel);
  font-size: 18px;
}
.stat-grid small { color: var(--dim); font-family: var(--mono); margin-top: 8px; }

.dice-tray {
  min-height: 132px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
}
.die {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 2px solid var(--cyan);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--pixel);
  font-size: 16px;
  box-shadow: inset 0 0 0 4px var(--bg), 0 0 18px rgba(69, 240, 255, 0.16);
}
.die.is-rolling { animation: dice-tumble 700ms cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes dice-tumble {
  35% { transform: translateY(-18px) rotate(18deg); }
  70% { transform: translateY(5px) rotate(-12deg); }
}
.result-note { text-align: center; min-height: 20px; }

.privacy-note {
  margin: 18px auto 0;
  max-width: 520px;
  text-align: center;
  font-size: 12.5px;
  color: var(--dim);
}
.site-footer {
  border-top: 1px solid var(--line);
  padding: 22px var(--space-gutter);
  text-align: center;
  color: var(--dim);
  font-size: 13px;
}
.site-footer a { color: var(--cyan); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; text-shadow: var(--glow-cyan); }

.toasts {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(440px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  animation: toast-in 0.22s var(--ease-out) both;
}
.toast-info { border-left-color: var(--cyan); }
.toast-success { border-left-color: var(--green); }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity 0.25s, transform 0.25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

@media (min-width: 560px) {
  :root { --space-gutter: 28px; }
  .wordmark { font-size: 30px; letter-spacing: 3px; }
  .two-fields, .split-panel { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 920px) {
  :root { --space-gutter: 48px; }
  .cabinet-panel {
    grid-template-columns: minmax(0, 1fr) 380px;
    align-items: start;
    padding: 22px;
  }
}
@media (max-width: 380px) {
  .wordmark { font-size: 19px; letter-spacing: 1px; }
  .cabinet-tab { font-size: 9px; }
  .stat-grid { grid-template-columns: 1fr; }
  .btn { width: 100%; }
}

@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;
  }
  .cursor, .coin.is-flipping, .die.is-rolling, .confetti-bit { animation: none !important; }
}
