:root {
  color-scheme: dark;
  --bg: #040b18;
  --card: #0b1b33;
  --card-hi: #142947;
  --line: #294c79;
  --text: #f4f7ff;
  --muted: #aebfdd;
  --blue: #3679ee;
  --blue-hi: #5b9bff;
}

* { box-sizing: border-box; }

html, body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 84% 4%, rgba(45, 105, 220, .22), transparent 28rem),
    radial-gradient(circle at 4% 98%, rgba(21, 64, 142, .19), transparent 30rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.roulette-app {
  width: min(960px, calc(100% - 28px));
  margin: 0 auto;
  padding: 20px 0 46px;
}

.roulette-header {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  min-height: 58px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(11, 27, 51, .87);
}

.back-link {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 11px;
  color: var(--text);
  font-size: 26px;
  text-decoration: none;
}

.back-link:hover { background: rgba(105, 159, 255, .14); }

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 19px;
}

.header-brand img {
  width: 31px;
  height: 31px;
  object-fit: contain;
}

.header-profile {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.roulette-hero {
  padding: 31px 4px 22px;
}

.eyebrow,
.card-label {
  color: #8db6f7;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.roulette-hero h1 {
  margin: 5px 0 8px;
  font-size: clamp(34px, 7vw, 48px);
  letter-spacing: -.045em;
  line-height: 1;
}

.roulette-hero p {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
}

.roulette-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(280px, .78fr);
  gap: 16px;
  align-items: start;
}

.roulette-card {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(145deg, var(--card-hi), var(--card));
  box-shadow: 0 16px 40px rgba(0, 0, 0, .24);
}

.wheel-card {
  display: flex;
  min-height: 535px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 22px 24px;
}

.wheel-wrap {
  position: relative;
  width: min(390px, 72vw);
  aspect-ratio: 1;
}

.wheel-ring {
  width: 100%;
  height: 100%;
  padding: 10px;
  border-radius: 50%;
  background: #23457b;
  box-shadow: 0 0 0 8px rgba(91, 155, 255, .13), 0 20px 42px rgba(0, 0, 0, .42);
}

.wheel {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 5px solid #78aaff;
  border-radius: 50%;
  background: conic-gradient(
    #3b78dc 0deg 30deg,
    #173967 30deg 60deg,
    #285cae 60deg 90deg,
    #112946 90deg 120deg,
    #4a84dc 120deg 150deg,
    #173967 150deg 180deg,
    #285cae 180deg 210deg,
    #112946 210deg 240deg,
    #3b78dc 240deg 270deg,
    #173967 270deg 300deg,
    #285cae 300deg 330deg,
    #112946 330deg 360deg
  );
  transition: transform 4.2s cubic-bezier(.12, .78, .08, 1);
}

.wheel::after {
  content: "";
  position: absolute;
  inset: 41%;
  z-index: 3;
  border: 4px solid #c3dcff;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #5e9fff, #1a4caa 68%);
  box-shadow: 0 4px 15px rgba(0, 0, 0, .5);
}

.wheel-pointer {
  position: absolute;
  z-index: 5;
  top: -5px;
  left: 50%;
  width: 0;
  height: 0;
  border-right: 16px solid transparent;
  border-bottom: 38px solid #b5d2ff;
  border-left: 16px solid transparent;
  filter: drop-shadow(0 5px 8px rgba(0, 0, 0, .45));
  transform: translateX(-50%);
}

.wheel-label {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  width: 75px;
  color: #f5f8ff;
  font-size: clamp(10px, 2.15vw, 12px);
  font-weight: 850;
  line-height: 1.05;
  text-align: center;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .72);
  transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-128px) rotate(calc(var(--angle) * -1));
}

.spin-button {
  min-width: min(286px, 100%);
  min-height: 52px;
  margin-top: 28px;
  padding: 0 24px;
  border: 0;
  border-radius: 15px;
  background: linear-gradient(135deg, var(--blue), var(--blue-hi));
  color: #fff;
  cursor: pointer;
  font-size: 17px;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(34, 96, 215, .28);
}

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

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

.roulette-message {
  width: min(380px, 100%);
  margin: 17px 0 0;
  padding: 13px 15px;
  border: 1px solid #4f86da;
  border-radius: 14px;
  background: rgba(34, 90, 184, .16);
  color: #dbe9ff;
  line-height: 1.4;
  text-align: center;
}

.roulette-message.error {
  border-color: #a64c68;
  background: rgba(145, 35, 64, .18);
  color: #ffd4df;
}

.roulette-side {
  display: grid;
  gap: 14px;
}

.info-card,
.history-card {
  padding: 21px;
}

.info-card strong {
  display: block;
  margin-top: 9px;
  color: var(--text);
  font-size: 23px;
  line-height: 1.15;
}

.info-card p {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

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

.history-card li {
  padding: 10px 12px;
  border: 1px solid rgba(110, 160, 240, .48);
  border-radius: 11px;
  color: #eaf1ff;
  font-size: 14px;
  font-weight: 700;
}

.history-card li.empty {
  color: var(--muted);
  font-weight: 500;
}

@media (max-width: 720px) {
  .roulette-app { width: min(100% - 22px, 600px); padding-top: 11px; }
  .header-profile { display: none; }
  .roulette-header { grid-template-columns: 44px 1fr; }
  .roulette-layout { grid-template-columns: 1fr; }
  .wheel-card { min-height: auto; }
  .wheel-label { transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-116px) rotate(calc(var(--angle) * -1)); }
}
