:root {
  --bg-1: #22071b;
  --bg-2: #501836;
  --bg-3: #ff8f5c;
  --card: rgba(31, 11, 29, 0.68);
  --card-border: rgba(255, 239, 211, 0.2);
  --text-main: #fff6ec;
  --text-muted: #ffd9bf;
  --gold: #ffd48a;
  --accent: #ff7a6a;
  --shadow: rgba(8, 1, 8, 0.4);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  position: relative;
  overflow-x: hidden;
  color: var(--text-main);
  font-family: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
  background: radial-gradient(circle at 20% 15%, #763356 0%, var(--bg-1) 34%, #16030f 100%);
}

.ambient {
  position: fixed;
  width: 52vw;
  height: 52vw;
  border-radius: 50%;
  filter: blur(58px);
  opacity: 0.5;
  z-index: 0;
  pointer-events: none;
  animation: drift 16s ease-in-out infinite alternate;
}

.ambient-a {
  top: -16vw;
  right: -8vw;
  background: radial-gradient(circle, #ffc884 0%, rgba(255, 154, 89, 0.2) 68%, transparent 80%);
}

.ambient-b {
  bottom: -20vw;
  left: -16vw;
  background: radial-gradient(circle, #ff7792 0%, rgba(255, 91, 147, 0.2) 68%, transparent 80%);
  animation-duration: 20s;
}

.page-wrap {
  position: relative;
  z-index: 1;
  width: min(100%, 940px);
  margin: 0 auto;
  padding: 18px 14px 34px;
  display: grid;
  gap: 14px;
}

.hero-card,
.main-card,
.result-card,
.history-card {
  background: linear-gradient(155deg, rgba(58, 18, 46, 0.86), rgba(27, 8, 24, 0.76));
  border: 1px solid var(--card-border);
  border-radius: 24px;
  box-shadow: 0 22px 45px -22px var(--shadow);
  backdrop-filter: blur(7px);
}

.hero-card {
  padding: 18px;
  text-align: center;
}

.hero-kicker {
  margin: 0;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--text-muted);
}

h1 {
  margin: 8px 0 6px;
  font-family: "Cormorant Garamond", "Times New Roman", serif;
  font-size: clamp(32px, 7vw, 58px);
  line-height: 0.96;
}

#subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: clamp(14px, 2.7vw, 18px);
}

.main-card {
  padding: 14px;
  display: grid;
  gap: 14px;
}

.balance-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.muted {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.balance-value {
  margin: 5px 0 8px;
  font-size: clamp(20px, 3.8vw, 30px);
  font-weight: 800;
}

.heart-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.heart {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, #fff6ec, #ff8aa0 65%, #df2f5f 100%);
  box-shadow: 0 0 8px rgba(255, 131, 164, 0.7);
}

.ghost-button {
  border: 1px solid rgba(255, 223, 182, 0.32);
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
}

.wheel-zone {
  position: relative;
  display: grid;
  place-items: center;
  padding-top: 8px;
}

.pointer {
  width: 0;
  height: 0;
  border-left: 18px solid transparent;
  border-right: 18px solid transparent;
  border-top: 34px solid var(--gold);
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.45));
  transform: translateY(10px);
  z-index: 5;
}

.wheel {
  position: relative;
  width: min(78vw, 450px);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 10px solid rgba(255, 219, 153, 0.95);
  box-shadow:
    inset 0 0 24px rgba(0, 0, 0, 0.33),
    0 12px 30px rgba(0, 0, 0, 0.33);
  overflow: hidden;
  transition: transform 5600ms cubic-bezier(0.12, 0.86, 0.16, 1);
}

.wheel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.45) 0%, transparent 30%, rgba(255, 255, 255, 0.08) 100%);
  pointer-events: none;
  z-index: 1;
}

.wheel::after {
  content: "";
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  border: 2px dashed rgba(255, 235, 198, 0.32);
  pointer-events: none;
  z-index: 2;
}

.wheel-labels {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.wheel-label {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 42%;
  text-align: center;
  font-weight: 800;
  letter-spacing: 0.02em;
  font-size: clamp(11px, 1.9vw, 15px);
  line-height: 1.1;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  transform-origin: center center;
  transition: filter 320ms ease;
}

.wheel-label.win {
  filter: drop-shadow(0 0 8px rgba(255, 245, 222, 0.86)) drop-shadow(0 0 16px rgba(255, 215, 145, 0.62));
  animation: winnerPulse 0.9s ease-in-out infinite alternate;
}

.wheel-center {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 106px;
  height: 106px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: "Cormorant Garamond", "Times New Roman", serif;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #2a0c22;
  background: radial-gradient(circle at 28% 22%, #fff7dd 0%, #ffc768 80%);
  border: 5px solid rgba(255, 233, 198, 0.95);
  z-index: 4;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
}

.spin-button {
  border: none;
  border-radius: 15px;
  padding: 14px 22px;
  background: linear-gradient(120deg, #ff9c68, #ff5e7f);
  color: #fff8f0;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 26px -14px rgba(255, 100, 109, 0.9);
  transition: transform 190ms ease, filter 190ms ease, opacity 190ms ease;
}

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

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

.hint-text {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

.result-card,
.history-card {
  padding: 14px;
}

.result-card h2 {
  margin: 8px 0 6px;
  font-size: clamp(24px, 5vw, 38px);
  line-height: 1;
}

.result-card p {
  margin: 0;
}

.history-card h3 {
  margin: 0 0 12px;
  font-size: 15px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.history-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 242, 220, 0.12);
  border-radius: 12px;
  padding: 10px;
  font-size: 13px;
}

.hidden {
  display: none;
}

.confetti-layer {
  pointer-events: none;
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 20;
}

.confetti {
  position: absolute;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  opacity: 0.95;
  animation: fall linear forwards;
}

@keyframes drift {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  100% {
    transform: translate3d(-2vw, 2vw, 0) scale(1.08);
  }
}

@keyframes fall {
  from {
    transform: translate3d(var(--x-start), -18vh, 0) rotate(0deg);
  }
  to {
    transform: translate3d(var(--x-end), 110vh, 0) rotate(720deg);
    opacity: 0.8;
  }
}

@keyframes winnerPulse {
  from {
    transform: translate(-50%, -50%) rotate(var(--angle)) translateY(calc(var(--radius) * -1));
  }
  to {
    transform: translate(-50%, -50%) rotate(var(--angle)) translateY(calc(var(--radius) * -1)) scale(1.07);
  }
}

@media (max-width: 680px) {
  .page-wrap {
    padding: 12px 10px 26px;
    gap: 11px;
  }

  .hero-card,
  .main-card,
  .result-card,
  .history-card {
    border-radius: 20px;
  }

  .wheel {
    width: min(92vw, 430px);
    border-width: 8px;
  }

  .wheel-center {
    width: 90px;
    height: 90px;
    font-size: 28px;
  }

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