:root {
  --bg: #020617;
  --card: rgba(15, 23, 42, 0.92);
  --muted: #94a3b8;
  --line: rgba(255, 255, 255, 0.08);
  --primary: #facc15;
  --primary-dark: #111827;
  --white: #fff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: Inter, Arial, sans-serif;
  background: radial-gradient(circle at top, #0f172a 0%, #020617 60%);
  color: var(--white);
  min-height: 100%;
}

button { font: inherit; }

.page-shell {
  min-height: 100vh;
  padding: 18px;
  display: flex;
  justify-content: center;
}

.app-card {
  width: 100%;
  max-width: 460px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
  padding: 18px;
  backdrop-filter: blur(10px);
}

.topbar {
  display: flex;
  justify-content: flex-start;
  gap: 12px;
  align-items: flex-start;
}

.pill {
  display: inline-block;
  background: rgba(250, 204, 21, 0.12);
  color: #fde68a;
  border: 1px solid rgba(250, 204, 21, 0.2);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
}

h1 {
  margin: 10px 0 6px;
  font-size: 28px;
  line-height: 1.1;
}

.ghost-btn, .secondary-btn, .icon-btn {
  background: rgba(255,255,255,0.05);
  color: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 11px 14px;
  cursor: pointer;
}

.stats-grid,
.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

.stat-box {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 14px;
}

.label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.value {
  font-size: 28px;
  font-weight: 700;
}

.value-small {
  font-size: 16px;
  line-height: 1.35;
}

.wheel-stage {
  position: relative;
  width: 290px;
  height: 290px;
  margin: 24px auto 10px;
}

.pointer {
  position: absolute;
  left: 50%;
  top: -6px;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
  border-top: 28px solid var(--primary);
  z-index: 5;
}

.wheel {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 10px solid rgba(255,255,255,0.95);
  position: relative;
  overflow: hidden;
  transition: transform 4.2s cubic-bezier(0.17, 0.67, 0.14, 1.03);
  background: conic-gradient(
    #ef4444 0deg 27.69deg,
    #f59e0b 27.69deg 55.38deg,
    #10b981 55.38deg 83.07deg,
    #3b82f6 83.07deg 110.76deg,
    #8b5cf6 110.76deg 138.45deg,
    #ec4899 138.45deg 166.14deg,
    #06b6d4 166.14deg 193.83deg,
    #22c55e 193.83deg 221.52deg,
    #eab308 221.52deg 249.21deg,
    #f97316 249.21deg 276.9deg,
    #14b8a6 276.9deg 304.59deg,
    #a855f7 304.59deg 332.28deg,
    #7c3aed 332.28deg 360deg
  );
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.wheel-label {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 74px;
  text-align: center;
  color: #fff;
  font-weight: 800;
  line-height: 1.05;
  z-index: 2;
  pointer-events: none;
  text-shadow:
    0 1px 2px rgba(0,0,0,0.7),
    0 0 5px rgba(0,0,0,0.35);
}

.wheel-label-line {
  font-size: 9px;
  white-space: nowrap;
}

.wheel-label-line + .wheel-label-line {
  margin-top: 2px;
}

.wheel-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 10px rgba(255,255,255,0.15);
  font-size: 28px;
  z-index: 4;
}

.cta-wrap { margin-top: 14px; }

.spin-btn {
  width: 100%;
  padding: 15px 18px;
  border: 0;
  border-radius: 20px;
  background: var(--primary);
  color: var(--primary-dark);
  font-weight: 800;
  cursor: pointer;
}

.spin-btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2,6,23,0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.hidden { display: none; }

.modal-card {
  width: 100%;
  max-width: 420px;
  background: #0f172a;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 16px;
  box-shadow: 0 18px 60px rgba(0,0,0,0.5);
}

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

.modal-head h3 { margin: 0; }

.icon-btn {
  width: 40px;
  height: 40px;
  padding: 0;
}

.modal-body {
  margin: 14px 0 10px;
  color: #e2e8f0;
  max-height: 60vh;
  overflow: auto;
}

.modal-action { margin-top: 8px; }

.history-item,
.rule-item {
  padding: 12px;
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  margin-bottom: 8px;
}

.history-time,
.rule-desc {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

@media (max-width: 420px) {
  .wheel-stage {
    width: 260px;
    height: 260px;
  }

  .wheel-label {
    width: 66px;
  }

  .wheel-label-line {
    font-size: 8px;
  }

  .wheel-center {
    width: 66px;
    height: 66px;
    font-size: 24px;
  }

  h1 {
    font-size: 24px;
  }
}