:root {
  --bg: #0f1220;
  --surface: #1a1f35;
  --surface-2: #232a47;
  --text: #f5f6fa;
  --text-muted: #9aa0c0;
  --border: #2e3658;
  --accent: #ffb020;
  --accent-2: #ff7a00;
  --danger: #ff5470;
  --success: #34d399;
  --radius: 16px;
  --radius-sm: 10px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 48px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: radial-gradient(ellipse at top, #1a1f35 0%, #0f1220 60%);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Navigation ---------- */
.nav {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  flex-wrap: wrap;
}

.nav__brand {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.nav__links {
  display: flex;
  gap: var(--space-1);
  margin-left: auto;
}

.nav__link {
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: background 0.15s ease, color 0.15s ease;
}

.nav__link:hover { background: var(--surface-2); color: var(--text); }
.nav__link--active { color: var(--accent); background: rgba(255,176,32,0.12); }

.nav__right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}

.nav__balance {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: var(--space-1) var(--space-2);
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--accent);
}

.nav__logout {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.nav__logout:hover { color: var(--danger); border-color: var(--danger); }

/* ---------- View container ---------- */
#view {
  flex: 1;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: var(--space-4) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--bg);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 4px 16px rgba(255, 176, 32, 0.3);
  transition: transform 0.1s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  width: 100%;
}
.btn:hover:not(:disabled) { box-shadow: 0 6px 22px rgba(255,176,32,0.45); }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--ghost {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: none;
  border: 1px solid var(--border);
}
.btn--ghost:hover:not(:disabled) { background: var(--border); }
.btn--danger {
  background: var(--surface-2);
  color: var(--danger);
  border: 1px solid var(--border);
  box-shadow: none;
}
.btn--danger:hover:not(:disabled) { background: rgba(255,84,112,0.12); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: var(--space-1); }
.field__label { font-size: 0.8125rem; font-weight: 600; color: var(--text-muted); }
.field__input {
  width: 100%;
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255,176,32,0.18);
}
.field__hint { font-size: 0.75rem; color: var(--text-muted); }
.field__error { font-size: 0.75rem; color: var(--danger); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
}
.card__title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: var(--space-2);
}
.card__muted { font-size: 0.8125rem; color: var(--text-muted); }

/* ---------- Landing ---------- */
.landing {
  min-height: calc(100vh - 0px);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding: var(--space-5) var(--space-3);
  max-width: 520px;
  margin: 0 auto;
}
.landing__hero { text-align: center; display: flex; flex-direction: column; gap: var(--space-3); padding-top: var(--space-4); }
.landing__emoji { font-size: 3.5rem; }
.landing__title { font-size: 2.25rem; font-weight: 800; line-height: 1.1; letter-spacing: -0.03em; }
.landing__title span { color: var(--accent); }
.landing__sub { font-size: 1rem; color: var(--text-muted); max-width: 420px; margin: 0 auto; }
.landing__badge {
  display: inline-flex; align-items: center; gap: var(--space-1);
  align-self: center;
  background: rgba(255,176,32,0.14);
  border: 1px solid rgba(255,176,32,0.35);
  color: var(--accent);
  font-size: 0.8125rem; font-weight: 700;
  padding: var(--space-1) var(--space-3);
  border-radius: 999px;
}
.landing__steps { display: flex; flex-direction: column; gap: var(--space-2); }
.step {
  display: flex; gap: var(--space-3); align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--space-3);
}
.step__num {
  flex: 0 0 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--bg); font-weight: 800; font-size: 0.875rem;
  display: grid; place-items: center;
}
.step__body h3 { font-size: 0.9375rem; font-weight: 700; }
.step__body p { font-size: 0.8125rem; color: var(--text-muted); }

.landing__cta { display: flex; flex-direction: column; gap: var(--space-2); }

/* ---------- Auth ---------- */
.auth { display: flex; flex-direction: column; gap: var(--space-3); }
.auth__title { font-size: 1.5rem; font-weight: 800; text-align: center; }
.auth__sub { font-size: 0.875rem; color: var(--text-muted); text-align: center; margin-top: calc(var(--space-1) * -1); }
.auth__switch { text-align: center; font-size: 0.875rem; color: var(--text-muted); }
.auth__switch a { color: var(--accent); font-weight: 600; }
.auth__form { display: flex; flex-direction: column; gap: var(--space-3); }
.auth__error {
  background: rgba(255,84,112,0.12); border: 1px solid var(--danger);
  color: var(--danger); font-size: 0.8125rem; padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
}

/* ---------- Dashboard / Wheel ---------- */
.dash-head { text-align: center; display: flex; flex-direction: column; gap: var(--space-1); }
.dash-head__welcome { font-size: 1.25rem; font-weight: 800; }
.dash-head__balance-big { font-size: 2.5rem; font-weight: 800; color: var(--accent); letter-spacing: -0.02em; }
.dash-head__balance-label { font-size: 0.875rem; color: var(--text-muted); }
.dash-head__rupee { font-size: 0.8125rem; color: var(--text-muted); }
.dash-head__rupee b { color: var(--success); }

.wheel-section { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); padding: var(--space-3) 0; }

.wheel-wrap {
  position: relative;
  width: 300px; height: 300px;
  display: flex; align-items: center; justify-content: center;
}
.wheel {
  width: 300px; height: 300px; display: block; border-radius: 50%;
  box-shadow: 0 12px 40px rgba(0,0,0,0.45), 0 0 0 6px var(--accent), 0 0 0 10px var(--bg);
  transition: transform 4s cubic-bezier(0.17,0.67,0.12,0.99);
}
.wheel-pointer {
  position: absolute; top: -6px; left: 50%; transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 14px solid transparent; border-right: 14px solid transparent;
  border-top: 24px solid var(--accent);
  z-index: 3; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}
.wheel__spin-btn {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 76px; height: 76px; border-radius: 50%;
  font-size: 1rem; font-weight: 800; letter-spacing: 0.05em;
  color: var(--bg);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: 4px solid var(--bg); z-index: 2;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  transition: transform 0.1s ease;
}
.wheel__spin-btn:active:not(:disabled) { transform: translate(-50%,-50%) scale(0.94); }
.wheel__spin-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.spin-cost {
  display: flex; align-items: center; gap: var(--space-2);
  font-size: 0.8125rem; color: var(--text-muted);
  background: var(--surface); border: 1px solid var(--border);
  padding: var(--space-2) var(--space-3); border-radius: 999px;
}
.spin-cost b { color: var(--accent); }

.wheel__hint { font-size: 0.8125rem; color: var(--text-muted); text-align: center; }

.result {
  min-height: 52px; display: flex; align-items: center; justify-content: center;
  text-align: center; font-size: 1.0625rem; font-weight: 700;
  border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3);
  transition: all 0.2s ease;
}
.result--win { color: var(--accent); background: rgba(255,176,32,0.12); border: 1px solid rgba(255,176,32,0.3); }
.result--jackpot { color: var(--bg); background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.result--miss { color: var(--text-muted); background: var(--surface); border: 1px solid var(--border); }
.result--error { color: var(--danger); background: rgba(255,84,112,0.12); border: 1px solid var(--danger); }

@keyframes pop { 0% { transform: scale(0.8); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.result--win, .result--jackpot, .result--miss, .result--error { animation: pop 0.25s ease; }
@media (prefers-reduced-motion: reduce) { .result--win, .result--jackpot, .result--miss, .result--error { animation: none; } }

/* daily bonus */
.bonus-card { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.bonus-card__info h3 { font-size: 0.9375rem; font-weight: 700; }
.bonus-card__info p { font-size: 0.8125rem; color: var(--text-muted); }
.bonus-card__btn {
  flex: 0 0 auto; padding: var(--space-2) var(--space-4);
  border: none; border-radius: var(--radius-sm);
  font-weight: 700; font-size: 0.875rem;
  background: linear-gradient(135deg, var(--success), #10b981); color: var(--bg);
}
.bonus-card__btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- History ---------- */
.list { list-style: none; display: flex; flex-direction: column; gap: var(--space-2); }
.list__item {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.list__item--win { border-left: 3px solid var(--accent); }
.list__item--miss { border-left: 3px solid var(--border); }
.list__item--bonus { border-left: 3px solid var(--success); }
.list__item--withdraw { border-left: 3px solid var(--danger); }
.list__icon { font-size: 1.1rem; }
.list__desc { font-size: 0.875rem; font-weight: 500; }
.list__time { font-size: 0.75rem; color: var(--text-muted); }
.list__amt { font-weight: 700; font-size: 0.9375rem; }
.list__amt--pos { color: var(--success); }
.list__amt--neg { color: var(--danger); }

.empty { text-align: center; color: var(--text-muted); font-size: 0.875rem; padding: var(--space-5) 0; }

/* ---------- Withdraw ---------- */
.withdraw-rate {
  text-align: center; font-size: 0.8125rem; color: var(--text-muted);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: var(--space-2);
}
.withdraw-rate b { color: var(--accent); font-size: 1rem; }

.presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); }
.preset {
  padding: var(--space-2); border: 1px solid var(--border);
  background: var(--surface); border-radius: var(--radius-sm);
  color: var(--text); font-size: 0.8125rem; font-weight: 600;
  text-align: center; transition: all 0.15s ease;
}
.preset b { display: block; font-size: 1rem; color: var(--accent); }
.preset:disabled { opacity: 0.4; cursor: not-allowed; }

.summary {
  display: flex; justify-content: space-between;
  font-size: 0.875rem; color: var(--text-muted);
  padding: var(--space-2) 0; border-top: 1px solid var(--border);
}
.summary b { color: var(--text); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: var(--space-4); left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); font-size: 0.875rem; font-weight: 500;
  padding: var(--space-2) var(--space-4); border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4); z-index: 100;
  opacity: 0; transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none; max-width: 90vw; text-align: center;
}
.toast--show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast--success { border-color: var(--success); }
.toast--error { border-color: var(--danger); }

@media (prefers-reduced-motion: reduce) {
  .wheel { transition-duration: 0.01s; }
  .toast { transition: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 360px) {
  .nav__brand { font-size: 1rem; }
  .nav__link { font-size: 0.8125rem; padding: var(--space-1); }
  .wheel-wrap, .wheel { width: 260px; height: 260px; }
  .landing__title { font-size: 1.75rem; }
  .dash-head__balance-big { font-size: 2rem; }
}

@media (min-width: 768px) {
  #view, .landing { max-width: 720px; }
  .landing__hero { padding-top: var(--space-6); }
  .landing__title { font-size: 3rem; }
  .presets { grid-template-columns: repeat(5, 1fr); }
}
