:root {
  --bg: #0f172a;
  --bg-2: #111c34;
  --card: #1b2543;
  --card-2: #243056;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --primary: #6366f1;
  --primary-2: #818cf8;
  --success: #10b981;
  --danger: #ef4444;
  --border: rgba(255, 255, 255, 0.08);
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: linear-gradient(180deg, var(--bg), var(--bg-2));
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100%;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
}

.topbar {
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
  position: sticky;
  top: 0;
  backdrop-filter: blur(8px);
  z-index: 5;
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; }
.brand { color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.15rem; }
.user-area { display: flex; gap: 12px; align-items: center; }
.user-chip {
  background: var(--card-2);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.9rem;
  border: 1px solid var(--border);
}
.link-muted { color: var(--muted); text-decoration: none; font-size: 0.9rem; }
.link-muted:hover { color: var(--text); }

main { padding: 28px 0 60px; min-height: calc(100vh - 130px); }

.footer {
  border-top: 1px solid var(--border);
  padding: 16px 0;
  text-align: center;
  color: var(--muted);
}

.muted { color: var(--muted); }

.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  padding: 12px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 1rem;
  transition: transform 0.05s ease, opacity 0.15s ease, background 0.15s ease;
  color: white;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn-success { background: var(--success); }
.btn-success:hover:not(:disabled) { filter: brightness(1.08); }

input[type="text"] {
  width: 100%;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s ease;
}
input[type="text"]:focus { border-color: var(--primary-2); }

.msglist { list-style: none; padding: 0; margin: 0 0 18px 0; display: flex; flex-direction: column; gap: 8px; }
.msg { padding: 10px 14px; border-radius: 10px; }
.msg-error { background: rgba(239, 68, 68, 0.15); color: #fecaca; border: 1px solid rgba(239, 68, 68, 0.4); }
.msg-success { background: rgba(16, 185, 129, 0.15); color: #a7f3d0; border: 1px solid rgba(16, 185, 129, 0.4); }
.msg-info, .msg- { background: rgba(99, 102, 241, 0.12); color: #c7d2fe; border: 1px solid rgba(99, 102, 241, 0.3); }

.msg-area { min-height: 1.2em; margin: 8px 0 0; }

/* Auth */
.auth-card {
  max-width: 420px;
  margin: 60px auto;
  background: var(--card);
  border: 1px solid var(--border);
  padding: 28px;
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}
.auth-card h1 { margin: 0 0 6px 0; }
.auth-form { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.auth-form label { font-size: 0.9rem; color: var(--muted); }

/* Wheel layout */
.wheel-page {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 28px;
  align-items: start;
}
@media (max-width: 1024px) {
  .wheel-page { grid-template-columns: 1fr; }
  .balance-card { position: static; }
}

.wheel-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.wheel-stage {
  position: relative;
  width: min(420px, 90vw);
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wheel {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 6px solid #fff;
  box-shadow: 0 0 0 6px var(--card-2), 0 14px 50px rgba(0, 0, 0, 0.5);
  transform: rotate(0deg);
  will-change: transform;
}
.wheel-label {
  position: absolute;
  transform: translate(-50%, -50%);
  font-weight: 800;
  color: #1f2937;
  font-size: 0.95rem;
  pointer-events: none;
  text-shadow: 0 1px 0 rgba(255,255,255,0.5);
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.55);
  padding: 2px 8px;
  border-radius: 999px;
}
.wheel-pointer {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-top: 24px solid #ef4444;
  z-index: 3;
  filter: drop-shadow(0 4px 4px rgba(0,0,0,0.5));
}
.wheel-hub {
  position: absolute;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
  z-index: 2;
}

.spin-form { width: 100%; max-width: 480px; display: flex; flex-direction: column; gap: 8px; }
.spin-form label { color: var(--muted); font-size: 0.9rem; }
.spin-form .row { display: flex; gap: 8px; }
.spin-form .row input { flex: 1; }

.balance-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 80px;
}
.balance-card h2 { margin: 0; font-size: 1.05rem; color: var(--muted); font-weight: 600; }
.balance-amount {
  font-size: 2.4rem;
  font-weight: 800;
  background: linear-gradient(135deg, #fcd34d, #f472b6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.tier-help {
  border-top: 1px solid var(--border);
  margin-top: 8px;
  padding-top: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}
.tier-help h3 { margin: 0 0 8px; font-size: 0.95rem; color: var(--text); }
.tier-help ul { margin: 0; padding-left: 18px; }

/* New wheel page styles */
.wheel-header { text-align: center; }
.wheel-header h1 {
  font-size: 1.6rem;
  margin: 0 0 6px 0;
  font-weight: 700;
}
.wheel-header h2 {
  font-size: 1.6rem;
  margin: 0 0 8px 0;
  font-weight: 800;
}
.wheel-header p { margin: 0; }
.accent {
  background: linear-gradient(135deg, #c4b5fd, #f472b6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.btn-wide { width: 100%; padding: 14px 18px; font-size: 1.05rem; }

.card-input {
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card-input-head { display: flex; gap: 12px; align-items: center; }
.card-title { font-weight: 700; }
.card-sub { font-size: 0.85rem; }
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}

.info-card {
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  width: 100%;
}
.info-card .info-icon {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(99,102,241,0.18);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.info-card p { margin: 4px 0 0; font-size: 0.9rem; }

.user-line { display: flex; }
.balance-card .user-chip { margin-bottom: 4px; }

/* Responsive tweaks */
@media (max-width: 768px) {
  .container { padding: 0 12px; }
  main { padding: 20px 0 40px; }

  .topbar { padding: 10px 0; }
  .brand { font-size: 1rem; }
  .user-area { gap: 8px; }
  .user-chip { padding: 4px 10px; font-size: 0.8rem; }
  .link-muted { font-size: 0.85rem; }

  .wheel-page { gap: 18px; }
  .wheel-section { padding: 18px; gap: 18px; }

  .wheel-header h1 { font-size: 1.3rem; }
  .wheel-header h2 { font-size: 1.3rem; }
  .wheel-header p { font-size: 0.9rem; }

  .wheel-label { font-size: 0.7rem; padding: 1px 5px; }
  .wheel-hub { width: 52px; height: 52px; font-size: 0.7rem; text-align: center; line-height: 1.1; padding: 0 6px; }

  .balance-amount { font-size: 1.9rem; }
  .balance-card { padding: 18px; }
  .balance-card h2 { font-size: 0.95rem; }

  .btn { padding: 11px 16px; font-size: 0.95rem; }
  .btn-wide { padding: 13px 16px; font-size: 1rem; }

  .auth-card { margin: 30px auto; padding: 22px; }

  .card-input { padding: 12px; }
  .info-card { padding: 12px; }
  .card-title { font-size: 0.95rem; }
}

@media (max-width: 420px) {
  .topbar-inner { gap: 8px; }
  .brand { font-size: 0.95rem; }
  .user-chip { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .wheel-stage { width: min(320px, 88vw); }
  .wheel { border-width: 4px; box-shadow: 0 0 0 4px var(--card-2), 0 10px 30px rgba(0, 0, 0, 0.5); }
  .wheel-label { font-size: 0.62rem; padding: 1px 4px; }
  .wheel-hub { width: 44px; height: 44px; font-size: 0.6rem; }
  .wheel-pointer { border-left-width: 10px; border-right-width: 10px; border-top-width: 18px; top: -6px; }

  .wheel-header h1, .wheel-header h2 { font-size: 1.15rem; }

  .balance-amount { font-size: 1.6rem; }

  input[type="text"] { padding: 10px 12px; font-size: 0.95rem; }
}
