:root {
  --bg-top: #22104a;
  --bg-mid: #12255e;
  --bg-bottom: #0f3f47;
  --panel: rgba(11, 18, 32, 0.82);
  --panel-border: rgba(255, 255, 255, 0.12);
  --card: rgba(255, 255, 255, 0.9);
  --text: #f8fafc;
  --text-dark: #1e293b;
  --muted: #9fb0c7;
  --success: #15803d;
  --danger-bg: rgba(127, 29, 29, 0.92);
  --danger-text: #fecaca;
  --gold-1: #ffd465;
  --gold-2: #ef9f17;
  --button-1: #22c55e;
  --button-2: #15803d;
  --shadow: 0 24px 80px rgba(15, 23, 42, 0.38);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.12), transparent 22%),
    linear-gradient(135deg, var(--bg-top), var(--bg-mid), var(--bg-bottom));
  color: var(--text);
}

body {
  min-height: 100vh;
}

.page-shell {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
}

.background-overlay {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 212, 101, 0.18), transparent 25%),
    radial-gradient(circle at 80% 10%, rgba(93, 173, 226, 0.16), transparent 22%),
    rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(5px);
}

.roulette-page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 18px;
}

.roulette-panel {
  width: min(100%, 860px);
  padding: 32px 24px 28px;
  border: 1px solid var(--panel-border);
  border-radius: 32px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero {
  text-align: center;
  max-width: 680px;
  margin: 0 auto 28px;
}

.eyebrow {
  margin: 0 0 10px;
  color: #fbd38d;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1;
}

.hero-copy {
  margin: 14px auto 0;
  max-width: 560px;
  color: var(--muted);
  line-height: 1.6;
}

.roulette-stage {
  display: flex;
  justify-content: center;
  margin-top: 8px;
}

.wheel-frame {
  position: relative;
  width: min(92vw, 470px);
  aspect-ratio: 1;
  border-radius: 50%;
  padding: 22px;
  background: linear-gradient(135deg, var(--gold-1), var(--gold-2));
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.4),
    0 20px 40px rgba(0, 0, 0, 0.35);
}

.wheel-shadow {
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.15), rgba(0, 0, 0, 0.1));
}

.wheel {
  --rotation: 0deg;
  position: absolute;
  inset: 20px;
  border-radius: 50%;
  overflow: hidden;
  transform: rotate(var(--rotation));
  transition: transform 4000ms cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.22);
}

.wheel-segment {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 50%;
  height: 50%;
  transform-origin: 0 0;
}

.wheel-segment-label {
  position: absolute;
  top: 14px;
  left: 52%;
  width: 108px;
  padding: 7px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.35);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  transform: translateX(-50%) rotate(-78deg);
  transform-origin: center;
  backdrop-filter: blur(4px);
}

.wheel-pointer {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-top: 0;
  border-bottom: 28px solid #ef4444;
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.35));
  z-index: 3;
}

.wheel-center {
  position: absolute;
  inset: 50%;
  width: 94px;
  height: 94px;
  margin-left: -47px;
  margin-top: -47px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #facc15, #f97316);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.06em;
  border: 5px solid rgba(255, 255, 255, 0.88);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  z-index: 2;
}

.status-card,
.error-card,
.result-card {
  margin: 22px auto 0;
  max-width: 640px;
  border-radius: 20px;
  padding: 18px 20px;
}

.status-card {
  background: rgba(255, 255, 255, 0.88);
  color: var(--text-dark);
}

.status-label,
.result-label {
  margin: 0 0 8px;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #64748b;
}

.status-message {
  margin: 0;
  font-size: 1rem;
  line-height: 1.5;
}

.error-card {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.actions {
  display: flex;
  justify-content: center;
  margin-top: 24px;
}

.spin-button {
  border: 0;
  border-radius: 999px;
  padding: 18px 34px;
  min-width: 250px;
  background: linear-gradient(135deg, var(--button-1), var(--button-2));
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  cursor: pointer;
  box-shadow: 0 16px 30px rgba(21, 128, 61, 0.28);
  transition: transform 180ms ease, filter 180ms ease, opacity 180ms ease;
}

.spin-button:hover:not(:disabled) {
  transform: translateY(-1px) scale(1.02);
  filter: brightness(1.03);
}

.spin-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.result-card {
  background: var(--card);
  color: var(--text-dark);
  text-align: center;
}

.result-value {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 900;
  color: var(--success);
}

.result-segment,
.result-note,
.result-id {
  margin: 10px 0 0;
}

.result-note {
  color: #475569;
}

.result-id {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.84rem;
  color: #94a3b8;
}

.is-hidden {
  display: none;
}

@media (max-width: 640px) {
  .roulette-panel {
    padding: 24px 16px 22px;
    border-radius: 24px;
  }

  .wheel-frame {
    width: min(94vw, 390px);
    padding: 18px;
  }

  .wheel {
    inset: 16px;
  }

  .wheel-segment-label {
    top: 9px;
    width: 92px;
    font-size: 0.62rem;
    padding: 6px 6px;
  }

  .wheel-center {
    width: 82px;
    height: 82px;
    margin-left: -41px;
    margin-top: -41px;
    font-size: 0.8rem;
  }

  .spin-button {
    width: 100%;
    min-width: 0;
  }
}
