/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0a0f;
  --surface: #13131a;
  --surface2: #1c1c28;
  --border: rgba(255,255,255,0.08);
  --gold: #f59e0b;
  --gold-light: #fbbf24;
  --pink: #ec4899;
  --violet: #8b5cf6;
  --text: #f8f8ff;
  --text-muted: rgba(248,248,255,0.5);
  --radius: 20px;
  --radius-sm: 12px;
  --font: 'Inter', sans-serif;
}

html, body {
  height: 100%;
  width: 100%;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

/* ── Background Orbs ── */
.bg-orbs {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0;
  overflow: hidden;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.18;
  animation: drift 14s ease-in-out infinite alternate;
}
.orb-1 {
  width: 380px; height: 380px;
  background: radial-gradient(circle, var(--gold), transparent);
  top: -100px; left: -80px;
}
.orb-2 {
  width: 350px; height: 350px;
  background: radial-gradient(circle, var(--pink), transparent);
  bottom: -100px; right: -80px;
  animation-delay: -6s;
}
.orb-3 {
  width: 280px; height: 280px;
  background: radial-gradient(circle, var(--violet), transparent);
  top: 45%; left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.1;
  animation-delay: -10s;
}
@keyframes drift {
  0% { transform: translate(0,0) scale(1); }
  100% { transform: translate(40px,30px) scale(1.1); }
}

/* ── Layout ── */
.app {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 20px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Header ── */
.header { text-align: center; padding-top: 8px; }

.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(245,158,11,0.12);
  border: 1px solid rgba(245,158,11,0.25);
  color: var(--gold);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 100px;
  margin-bottom: 14px;
}
.badge-dot {
  width: 6px; height: 6px;
  background: var(--gold);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { opacity:1; transform:scale(1); }
  50% { opacity:.5; transform:scale(0.7); }
}

.header-title {
  font-size: 36px;
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}
.gradient-text {
  background: linear-gradient(135deg, var(--gold-light), var(--pink));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.gold-text {
  background: linear-gradient(160deg, #fef9c3 0%, #fde047 25%, #f59e0b 50%, #d97706 75%, #fbbf24 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: drop-shadow(0 2px 8px rgba(245,158,11,0.45));
}

/* ── Rules ── */
.rules {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(245,158,11,0.15);
  border-radius: 16px;
  width: 100%;
}
.rules li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}
.rules li strong {
  color: var(--gold-light);
  font-weight: 700;
}
.rules-icon {
  font-size: 15px;
  flex-shrink: 0;
  margin-top: 1px;
}
.header-sub {
  font-size: 14px;
  color: var(--text-muted);
}

/* ── Wheel ── */
.wheel-area {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.wheel-pointer-pos {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  pointer-events: none;
  width: 44px;
  height: 62px;
}

.wheel-pointer {
  width: 100%;
  height: 100%;
  transform-origin: 50% 20%;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.55));
}

.wheel-pointer.tick {
  animation: pointer-tick 0.16s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes pointer-tick {
  0%   { transform: rotate(0deg); }
  40%  { transform: rotate(-22deg); }
  100% { transform: rotate(0deg); }
}

.wheel-wrap {
  position: relative;
  width: 100%;
  max-width: 380px;
  aspect-ratio: 1;
}

#wheel {
  width: 100%;
  height: 100%;
  display: block;
  transform-origin: 50% 50%;
  transition: transform 5.2s cubic-bezier(0.17, 0.67, 0.12, 0.99);
  filter: drop-shadow(0 12px 40px rgba(0,0,0,0.5));
}


/* ── Spin button ── */
.spin-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 24px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: 17px;
  font-weight: 800;
  color: #1a0e06;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  box-shadow:
    0 8px 32px rgba(245,158,11,0.4),
    0 2px 8px rgba(245,158,11,0.25),
    inset 0 1px 0 rgba(255,255,255,0.3);
  letter-spacing: -0.01em;
  animation: spin-btn-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes spin-btn-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow:
      0 8px 32px rgba(245,158,11,0.4),
      0 2px 8px rgba(245,158,11,0.25),
      inset 0 1px 0 rgba(255,255,255,0.3);
  }
  50% {
    transform: scale(1.04);
    box-shadow:
      0 12px 40px rgba(245,158,11,0.55),
      0 4px 12px rgba(245,158,11,0.35),
      inset 0 1px 0 rgba(255,255,255,0.4);
  }
}

.spin-btn:active {
  transform: scale(0.97);
  animation: none;
}

.spin-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  animation: none;
}

.admin-link {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.05em;
  padding: 4px;
  transition: color 0.2s;
}
.admin-link:hover { color: var(--text); }

/* ── Custom gages button ── */
.custom-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(139,92,246,0.4);
  background: linear-gradient(135deg, rgba(139,92,246,0.15), rgba(236,72,153,0.1));
  color: #c4b5fd;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: -0.01em;
  transition: all 0.2s ease;
}
.custom-btn:hover, .custom-btn:active {
  background: linear-gradient(135deg, rgba(139,92,246,0.25), rgba(236,72,153,0.18));
  border-color: rgba(139,92,246,0.6);
  transform: translateY(-1px);
}
.custom-btn[hidden] { display: none; }

/* ── Bonus button ── */
.bonus-btn {
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(135deg, rgba(234,179,8,0.12), rgba(245,158,11,0.08));
  border: 1px solid rgba(234,179,8,0.35);
  border-radius: 16px;
  color: #fde047;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: -0.01em;
  transition: all 0.2s ease;
}
.bonus-btn:hover, .bonus-btn:active {
  background: linear-gradient(135deg, rgba(234,179,8,0.22), rgba(245,158,11,0.15));
  border-color: rgba(234,179,8,0.7);
  transform: translateY(-1px);
  box-shadow: 0 0 16px rgba(234,179,8,0.25);
}
.bonus-btn[hidden] { display: none; }

/* ── Bonus error message ── */
.bonus-error {
  color: #f87171;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  margin: 4px 0;
  animation: fadeIn 0.2s ease;
}
.bonus-error[hidden] { display: none; }

/* ── Modal custom inputs ── */
.custom-title {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-top: 4px;
}
.custom-intro {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
}
.custom-intro strong {
  color: var(--gold-light);
  font-weight: 700;
}
.custom-inputs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin: 8px 0;
}
.custom-inputs .name-input {
  text-align: left;
  font-size: 14px;
  font-weight: 500;
  padding: 14px 16px;
}
.modal-btn-ghost {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-muted);
}
.modal-btn-ghost:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text);
}

/* ── Modal ── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeIn 0.3s ease both;
  padding: 0;
}
.modal[hidden] { display: none; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  width: 100%;
  max-width: 480px;
  background: linear-gradient(160deg, #1c1c28, #13131a);
  border-top: 1px solid rgba(245,158,11,0.3);
  border-radius: 24px 24px 0 0;
  padding: 28px 24px max(28px, env(safe-area-inset-bottom));
  box-shadow: 0 -20px 60px rgba(0,0,0,0.6);
  animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.modal-step[hidden] { display: none; }

.result-badge {
  background: rgba(245,158,11,0.18);
  border: 1px solid rgba(245,158,11,0.4);
  color: var(--gold-light);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 6px 16px;
  border-radius: 100px;
}

.result-gage {
  font-size: 22px;
  font-weight: 800;
  text-align: center;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 4px 0;
}

.result-deadline {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}
.result-deadline strong {
  color: var(--gold-light);
  font-weight: 700;
}

.name-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.04em;
  margin-top: 6px;
  text-transform: uppercase;
}

.name-input {
  width: 100%;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  font-weight: 600;
  text-align: center;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.name-input::placeholder {
  color: rgba(255,255,255,0.3);
  font-weight: 400;
}
.name-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(245,158,11,0.2);
}

.modal-btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.2s;
  margin-top: 4px;
}
.modal-btn:active { transform: scale(0.98); }
.modal-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.modal-btn-primary {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #1a0e06;
  box-shadow: 0 8px 24px rgba(245,158,11,0.3);
}

.confirm-icon {
  font-size: 56px;
  margin-bottom: 4px;
}
.confirm-title {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.02em;
}
.confirm-text {
  font-size: 15px;
  color: var(--text-muted);
  text-align: center;
}
.confirm-text strong { color: var(--text); font-weight: 700; }
.confirm-deadline {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}
.confirm-deadline strong { color: var(--gold-light); }

/* ── Safe areas ── */
@supports (padding: max(0px)) {
  .app {
    padding-bottom: max(32px, env(safe-area-inset-bottom));
  }
}

/* ── Larger ── */
@media (min-width: 480px) {
  .header-title { font-size: 44px; }
}
