:root {
  --bg: #08070b;
  --panel: rgba(18, 16, 22, 0.65);
  --panel-strong: rgba(12, 10, 15, 0.95);
  --gold: #f3c64f;
  --gold-glow: rgba(243, 198, 79, 0.35);
  --gold-deep: #b38600;
  --red: #ff334b;
  --red-glow: rgba(255, 51, 75, 0.25);
  --red-dark: #800e1b;
  --green: #00e676;
  --cream: #fff5d6;
  --text: #ffffff;
  --muted: #9c96a6;
  --line: rgba(255, 255, 255, 0.06);
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.8);
  --font-display: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  --page-max: 1200px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: 
    radial-gradient(circle at 50% 0%, rgba(243, 198, 79, 0.12) 0%, transparent 50%),
    radial-gradient(circle at 10% 40%, rgba(255, 51, 75, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 90% 70%, rgba(243, 198, 79, 0.05) 0%, transparent 40%),
    #08070b;
  overflow-x: hidden;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: 
    radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    radial-gradient(rgba(255, 255, 255, 0.05) 1.5px, transparent 1.5px);
  background-size: 40px 40px;
  background-position: 0 0, 20px 20px;
  opacity: 0.15;
  z-index: 0;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

.page {
  position: relative;
  width: min(100%, var(--page-max));
  margin: 0 auto;
  padding: 16px 16px 36px;
  z-index: 2;
}

.topbar {
  display: grid;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 0 16px;
}

.logo {
  width: min(180px, 46vw);
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.6));
  justify-self: center;
}

.hud-row {
  display: grid;
  grid-template-columns: repeat(3, max-content);
  justify-content: center;
  gap: 8px;
}

.hud-chip {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 14px;
  border: 1px solid rgba(243, 198, 79, 0.25);
  border-radius: 99px;
  background: linear-gradient(180deg, rgba(255, 51, 75, 0.12), rgba(18, 16, 22, 0.8));
  color: var(--gold);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.05);
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  backdrop-filter: blur(4px);
}

.hero {
  display: grid;
  gap: 16px;
  align-items: center;
  min-width: 0;
  max-width: 780px;
  margin: 0 auto;
  padding: 4px 0 16px;
}

.hero-copy {
  display: grid;
  gap: 8px;
  min-width: 0;
  width: 100%;
  text-align: center;
}

.main-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 7.5vw, 3.2rem);
  font-weight: 900;
  text-transform: uppercase;
  margin: 0 0 2px;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 0%, #ffe066 50%, #f3c64f 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 12px rgba(243, 198, 79, 0.15));
  line-height: 1.1;
}

.subhead {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  color: var(--muted);
  font-size: clamp(0.96rem, 4.2vw, 1.2rem);
  line-height: 1.4;
  overflow-wrap: break-word;
}

.countdown-block {
  width: min(100%, 520px);
  margin: 12px auto 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  backdrop-filter: blur(16px);
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.6), 
    inset 0 1px 1px rgba(255, 255, 255, 0.05);
}

.countdown-title {
  margin: 0 0 10px;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.countdown {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.time-box {
  min-height: 60px;
  padding: 8px 4px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  background: rgba(10, 8, 12, 0.7);
  text-align: center;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
  transition: border-color 0.3s ease;
}

.time-box:hover {
  border-color: rgba(243, 198, 79, 0.25);
}

.time-value {
  display: block;
  color: var(--gold);
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  font-size: clamp(1.3rem, 5.8vw, 2.1rem);
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 0 10px var(--gold-glow);
}

.time-label {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.game-area {
  display: grid;
  gap: 16px;
  justify-items: center;
  align-content: start;
  position: relative;
  min-height: 0;
  margin-top: 8px;
  padding: 0;
}

.lucas-guide {
  display: none;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 20px 30px rgba(0, 0, 0, 0.7));
  transition: transform 0.4s ease;
}

.wheel-stage {
  display: grid;
  justify-items: center;
  gap: 16px;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

.wheel-composition {
  position: relative;
  width: min(96vw, 50svh, 520px);
  display: grid;
  place-items: center;
  padding: 0;
}

.wheel-wrap {
  position: relative;
  width: min(94vw, 48svh, 500px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 10px;
  border-radius: 50%;
  background:
    conic-gradient(from 0deg, #f3c64f, #800e1b, #f3c64f, #07853f, #f3c64f, #800e1b, #f3c64f),
    radial-gradient(circle, rgba(255, 255, 255, 0.16), rgba(0, 0, 0, 0.16) 62%);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(243, 198, 79, 0.3) inset,
    0 0 40px rgba(243, 198, 79, 0.12);
  z-index: 2;
}

.wheel-pointer {
  position: absolute;
  top: -8px;
  left: 50%;
  width: 0;
  height: 0;
  border-left: 20px solid transparent;
  border-right: 20px solid transparent;
  border-top: 40px solid var(--gold);
  filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.6));
  transform: translateX(-50%);
  z-index: 4;
}

.wheel-pointer::after {
  content: "";
  position: absolute;
  top: -38px;
  left: -10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 10px var(--gold-glow), 0 0 0 3px #121016;
}

.wheel-canvas {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #121015;
  transition: transform 5.4s cubic-bezier(0.11, 0.78, 0.14, 1);
  will-change: transform;
}

.wheel-center {
  position: absolute;
  width: 22%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 5px solid #121015;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff 0%, #f3c64f 50%, #b38600 100%);
  color: #0b0a0d;
  font-family: var(--font-display);
  font-size: clamp(0.7rem, 3.2vw, 1.1rem);
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
  z-index: 3;
  letter-spacing: -0.02em;
}

.spin-button,
.cta-button {
  min-height: 72px;
  width: min(100%, 390px);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  background: linear-gradient(135deg, #ffe066 0%, #f3c64f 50%, #b38600 100%);
  color: #0b0a0d;
  box-shadow: 0 8px 25px rgba(243, 198, 79, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.4);
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 5.2vw, 1.38rem);
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  touch-action: manipulation;
  position: relative;
  overflow: hidden;
}

.spin-button::after,
.cta-button::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -60%;
  width: 30%;
  height: 200%;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.4) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: rotate(30deg);
  transition: all 0.6s ease;
  pointer-events: none;
}

.spin-button:hover::after,
.cta-button:hover::after {
  left: 130%;
}

.spin-button:hover,
.cta-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(243, 198, 79, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.5);
}

.spin-button:focus-visible,
.cta-button:focus-visible,
.close-button:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.85);
  outline-offset: 4px;
}

.spin-button:active,
.cta-button:active {
  transform: translateY(1px);
  box-shadow: 0 4px 10px rgba(243, 198, 79, 0.2), inset 0 1px 1px rgba(255, 255, 255, 0.2);
}

.spin-button:disabled {
  cursor: not-allowed;
  transform: none;
  background: linear-gradient(135deg, #2c2738 0%, #1e1b27 100%);
  color: #5d5670;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: none;
}

.result-strip {
  display: none;
  width: min(100%, 430px);
  padding: 14px 18px;
  border: 1px solid rgba(0, 230, 118, 0.3);
  border-radius: 12px;
  background: rgba(0, 230, 118, 0.08);
  color: #ffffff;
  text-align: center;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(0, 230, 118, 0.05), inset 0 1px 1px rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(8px);
}

.result-strip.is-visible {
  display: block;
  animation: fadeIn 0.4s ease forwards;
}

.result-strip strong {
  color: var(--gold);
  text-shadow: 0 0 8px var(--gold-glow);
}

.deadline-note {
  width: min(100%, 390px);
  margin: 0;
  padding: 10px 14px;
  border: 1px solid rgba(255, 51, 75, 0.15);
  border-radius: 12px;
  background: rgba(255, 51, 75, 0.05);
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.64rem;
  line-height: 1.3;
  text-align: center;
}

.micro-footer {
  width: min(100%, 390px);
  margin: 16px auto 0;
  color: var(--muted);
  font-size: 0.62rem;
  line-height: 1.3;
  text-align: center;
  opacity: 0.8;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(5, 4, 8, 0.85);
  backdrop-filter: blur(12px);
  z-index: 20;
}

.modal.is-open {
  display: flex;
}

.celebration-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.confetti-piece {
  position: absolute;
  top: -28px;
  left: var(--x);
  width: var(--w);
  height: var(--h);
  border-radius: var(--r);
  background: var(--c);
  opacity: 0;
  transform: translate3d(0, 0, 0) rotate(0deg);
  animation: confettiDrop var(--d) cubic-bezier(0.16, 0.8, 0.28, 1) var(--delay) forwards;
  box-shadow: 0 0 10px rgba(255, 211, 77, 0.22);
}

.modal-card {
  position: relative;
  overflow: hidden;
  width: min(100%, 480px);
  padding: 36px 24px;
  border: 1px solid rgba(243, 198, 79, 0.3);
  border-radius: 20px;
  background: radial-gradient(circle at top, rgba(243, 198, 79, 0.12) 0%, rgba(15, 12, 18, 0.99) 70%);
  box-shadow: 
    0 30px 90px rgba(0, 0, 0, 0.8),
    0 0 40px rgba(243, 198, 79, 0.08),
    inset 0 1px 1px rgba(255, 255, 255, 0.05);
  text-align: center;
}

.modal.is-open .modal-card {
  animation: victoryPop 0.58s cubic-bezier(0.18, 1.3, 0.32, 1) both;
}

.modal-card::before {
  content: "";
  position: absolute;
  inset: -40%;
  background:
    conic-gradient(from 0deg, transparent 0 12deg, rgba(243, 198, 79, 0.1) 13deg 18deg, transparent 19deg 32deg),
    radial-gradient(circle, rgba(243, 198, 79, 0.15), transparent 45%);
  opacity: 0;
  transform: scale(0.75) rotate(0deg);
  pointer-events: none;
}

.modal.is-open .modal-card::before {
  animation: victoryRays 1.25s ease-out both;
}

.modal-badge {
  position: relative;
  z-index: 1;
  display: inline-grid;
  place-items: center;
  width: 80px;
  height: 80px;
  margin-bottom: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffffff 0%, #f3c64f 50%, #b38600 100%);
  color: #0b0a0d;
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 900;
  box-shadow: 
    0 10px 25px rgba(243, 198, 79, 0.25),
    0 0 0 8px rgba(243, 198, 79, 0.08);
}

.modal.is-open .modal-badge {
  animation: badgePulse 1.2s ease-out 0.16s both;
}

.modal h2 {
  position: relative;
  z-index: 1;
  margin: 0 0 12px;
  color: #ffffff;
  font-family: var(--font-display);
  font-size: clamp(2rem, 10vw, 2.6rem);
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: -0.02em;
}

.modal.is-open h2 {
  animation: titleFlash 0.9s ease-out 0.12s both;
}

.modal p {
  position: relative;
  z-index: 1;
  margin: 0 auto 24px;
  max-width: 360px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}

.close-button {
  position: relative;
  z-index: 1;
  min-height: 48px;
  padding: 0 24px;
  margin-top: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all 0.2s ease;
}

.close-button:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.15);
}

@keyframes victoryPop {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.86);
  }
  58% {
    opacity: 1;
    transform: translateY(-4px) scale(1.035);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes victoryRays {
  0% {
    opacity: 0;
    transform: scale(0.55) rotate(0deg);
  }
  30% {
    opacity: 1;
  }
  100% {
    opacity: 0.28;
    transform: scale(1.12) rotate(26deg);
  }
}

@keyframes badgePulse {
  0% {
    transform: scale(0.65) rotate(-8deg);
    box-shadow: 0 0 0 0 rgba(243, 198, 79, 0.4);
  }
  45% {
    transform: scale(1.16) rotate(4deg);
    box-shadow: 0 0 0 18px rgba(243, 198, 79, 0);
  }
  100% {
    transform: scale(1) rotate(0deg);
    box-shadow: 0 0 0 8px rgba(243, 198, 79, 0.08);
  }
}

@keyframes titleFlash {
  0% {
    letter-spacing: 0;
    text-shadow: 0 0 0 rgba(243, 198, 79, 0);
    transform: scale(0.9);
  }
  40% {
    text-shadow: 0 0 24px rgba(243, 198, 79, 0.6);
    transform: scale(1.06);
  }
  100% {
    letter-spacing: -0.02em;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    transform: scale(1);
  }
}

@keyframes confettiDrop {
  0% {
    opacity: 0;
    transform: translate3d(0, -20px, 0) rotate(0deg);
  }
  12% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--dx), 104vh, 0) rotate(var(--rot));
  }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 760px) {
  .page {
    min-height: 100vh;
    min-height: 100svh;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    gap: 20px;
    padding: 24px 32px 36px;
  }

  .topbar {
    width: min(100%, 960px);
    margin: 0 auto;
    grid-template-columns: auto auto;
    justify-content: space-between;
    gap: 18px;
    padding: 0;
  }

  .logo {
    width: clamp(150px, 15vw, 210px);
    justify-self: start;
  }

  .hud-row {
    justify-content: end;
  }

  .hero {
    width: min(100%, 820px);
    max-width: none;
    padding: 0;
  }

  .hero-copy {
    gap: 10px;
    text-align: center;
  }

  .subhead {
    font-size: clamp(1rem, 1.2vw, 1.25rem);
  }

  .countdown-block {
    width: min(100%, 600px);
    margin: 4px auto 0;
    padding: 16px;
  }

  .game-area {
    width: min(100%, 1040px);
    margin: 0 auto;
    grid-template-columns: minmax(220px, 0.72fr) minmax(360px, 1fr);
    align-items: end;
    justify-items: stretch;
    align-content: center;
    gap: 24px;
  }

  .deadline-note {
    grid-column: 1 / -1;
    justify-self: center;
    width: min(100%, 720px);
    font-size: clamp(0.68rem, 0.74vw, 0.8rem);
  }

  .lucas-guide {
    display: block;
    position: relative;
    justify-self: end;
    align-self: end;
    height: clamp(285px, 46vh, 480px);
    max-width: 100%;
    z-index: 3;
    transform: translateX(20px);
  }

  .wheel-stage {
    grid-column: 2;
    width: 100%;
    justify-items: center;
    align-content: end;
    gap: 18px;
    overflow: visible;
  }

  .wheel-composition {
    width: clamp(340px, min(40vw, 48vh), 520px);
    margin: 0;
  }

  .wheel-wrap {
    width: clamp(330px, min(38vw, 46vh), 500px);
  }

  .spin-button {
    width: min(100%, clamp(360px, 38vw, 500px));
    min-height: clamp(64px, 8vh, 80px);
    font-size: clamp(1.2rem, 1.8vw, 1.55rem);
  }

  .result-strip {
    width: min(100%, clamp(360px, 38vw, 500px));
  }

  .micro-footer {
    width: min(100%, 760px);
    font-size: clamp(0.58rem, 0.7vw, 0.74rem);
  }
}

@media (max-width: 759px) {
  .page {
    height: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: max(8px, env(safe-area-inset-top)) 12px max(16px, env(safe-area-inset-bottom));
    overflow: visible;
  }

  .topbar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
  }

  .logo {
    width: min(140px, 40vw);
  }

  .hero {
    padding: 0;
    gap: 8px;
  }

  .hero-copy {
    gap: 4px;
  }

  .subhead {
    font-size: clamp(0.82rem, 3.6vw, 0.95rem);
  }

  .countdown-block {
    margin: 4px auto 0;
    padding: 8px 10px;
  }

  .time-box {
    min-height: 46px;
    padding: 2px 2px;
  }

  .time-value {
    font-size: 1.25rem;
  }

  .time-label {
    margin-top: 1px;
    font-size: 0.5rem;
  }

  .result-strip {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    width: min(100%, 290px);
    margin: 6px auto 0;
    z-index: 8;
  }

  .game-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
    width: 100%;
    position: relative;
  }

  .lucas-guide {
    display: block;
    position: absolute;
    z-index: 5;
    pointer-events: none;
    max-height: 125px;
    width: auto;
    left: 50%;
    transform: translateX(-155px);
    bottom: 64px;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.4));
    margin: 0;
  }

  .deadline-note {
    justify-self: center;
    position: relative;
    z-index: 5;
    padding: 6px 8px;
    border-radius: 10px;
    width: min(100%, 310px);
    font-size: 0.6rem;
  }

  .wheel-stage {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    position: relative;
    z-index: 4;
    overflow: visible;
  }

  .wheel-composition {
    width: min(78vw, 290px);
    margin: 0 auto;
  }

  .wheel-wrap {
    width: min(76vw, 275px);
  }

  .spin-button {
    position: relative;
    z-index: 6;
    justify-self: center;
    min-height: 52px;
    width: min(100%, 280px);
    border-radius: 12px;
    font-size: 1.08rem;
  }
}

@media (max-height: 720px) and (max-width: 759px) {
  .hud-row {
    display: none;
  }

  .countdown-block {
    padding: 10px;
    margin-top: 4px;
  }

  .time-box {
    min-height: 48px;
    padding: 4px 2px;
  }

  .lucas-guide {
    max-height: 115px;
    bottom: 70px;
  }
}

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

  .wheel-canvas {
    transition-duration: 1ms !important;
  }

  .modal.is-open .modal-card,
  .modal.is-open .modal-card::before,
  .modal.is-open .modal-badge,
  .modal.is-open h2,
  .confetti-piece {
    animation: none !important;
  }
}