:root {
  --bg: #0a0612;
  --bg2: #150a1f;
  --gold: #f5c842;
  --gold2: #ff9f1a;
  --red: #e63946;
  --purple: #7b2cbf;
  --text: #f5f0ff;
  --muted: #9a8fb0;
  --card: rgba(255, 255, 255, 0.06);
  --border: rgba(245, 200, 66, 0.25);
  --radius: 16px;
}

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

body {
  font-family: 'Noto Sans SC', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

.bg-glow {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 40% at 50% 0%, rgba(123, 44, 191, 0.35), transparent),
    radial-gradient(ellipse 40% 30% at 80% 80%, rgba(245, 200, 66, 0.12), transparent);
  pointer-events: none;
  z-index: 0;
}

.header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 6, 18, 0.85);
  backdrop-filter: blur(12px);
}

.logo { display: flex; align-items: center; gap: 14px; }
.logo-icon { font-size: 2.4rem; filter: drop-shadow(0 0 12px rgba(245,200,66,.6)); }
.logo h1 { font-size: 1.4rem; font-weight: 900; color: var(--gold); }
.tagline { font-size: 0.82rem; color: var(--muted); margin-top: 2px; }

.header-actions { display: flex; align-items: center; gap: 16px; }
.link-game {
  color: var(--gold2);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
}
.link-game:hover { text-decoration: underline; }

.main {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.info-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

.info-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.info-card.highlight {
  border-color: var(--gold);
  background: rgba(245, 200, 66, 0.08);
}
.info-label { font-size: 0.78rem; color: var(--muted); margin-bottom: 6px; }
.info-value { font-size: 1.35rem; font-weight: 700; color: var(--gold); }
.info-hint { font-size: 0.75rem; color: var(--muted); margin-top: 4px; }

.lottery-section {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 28px;
  align-items: start;
}

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

.wheel-pointer {
  font-size: 2rem;
  color: var(--gold);
  filter: drop-shadow(0 2px 8px rgba(245,200,66,.8));
  line-height: 1;
  margin-bottom: -8px;
  z-index: 2;
}

#wheel-canvas {
  width: 520px;
  height: 520px;
  max-width: 100%;
  border-radius: 50%;
  box-shadow: 0 0 40px rgba(123,44,191,.4), inset 0 0 20px rgba(0,0,0,.5);
}

.draw-btn {
  width: 200px;
  padding: 16px 32px;
  font-size: 1.15rem;
  font-weight: 900;
  font-family: inherit;
  color: #1a0a00;
  background: linear-gradient(135deg, var(--gold), var(--gold2));
  border: none;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(245,200,66,.45);
  transition: transform .15s, box-shadow .15s, opacity .15s;
}
.draw-btn:not(:disabled):hover { transform: scale(1.04); box-shadow: 0 6px 32px rgba(245,200,66,.6); }
.draw-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.side-panel { display: flex; flex-direction: column; gap: 16px; }
.panel-block {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.panel-block h3 {
  font-size: 0.9rem;
  color: var(--gold);
  margin-bottom: 12px;
  font-weight: 700;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.panel-head h3 { margin-bottom: 0; }
.panel-head-extra {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}
.panel-head-extra strong {
  color: var(--gold2);
  font-weight: 700;
}

.prize-list, .winners-list { list-style: none; }
.winners-list-wrap {
  height: calc(32px * 3);
  max-height: calc(32px * 3);
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(245, 200, 66, 0.45) rgba(255, 255, 255, 0.06);
}
.winners-list-wrap::-webkit-scrollbar { width: 6px; }
.winners-list-wrap::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
}
.winners-list-wrap::-webkit-scrollbar-thumb {
  background: rgba(245, 200, 66, 0.45);
  border-radius: 3px;
}
.prize-list li, .winners-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2px;
  height: 32px;
  box-sizing: border-box;
  border-bottom: 1px solid rgba(255,255,255,.06);
  font-size: 0.85rem;
}
.prize-list li:last-child, .winners-list li:last-child { border-bottom: none; }
.prize-prob { color: var(--muted); font-size: 0.78rem; }
.prize-super { color: var(--gold2); font-weight: 700; }

.pool-info { font-size: 0.85rem; line-height: 1.7; color: var(--muted); }
.pool-info strong { color: var(--gold); }

.history-section {
  margin-top: 32px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.history-section h3 { color: var(--gold); margin-bottom: 14px; font-size: 0.95rem; }
.history-table-wrap {
  height: calc(38px * 4);
  max-height: calc(38px * 4);
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(245, 200, 66, 0.45) rgba(255, 255, 255, 0.06);
}
.history-table-wrap::-webkit-scrollbar { width: 6px; }
.history-table-wrap::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
}
.history-table-wrap::-webkit-scrollbar-thumb {
  background: rgba(245, 200, 66, 0.45);
  border-radius: 3px;
}
.history-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.history-table th, .history-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,.06);
  height: 38px;
  line-height: 18px;
  box-sizing: border-box;
}
.history-table th {
  color: var(--muted);
  font-weight: 600;
  position: sticky;
  top: 0;
  background: #150a1f;
  z-index: 1;
}
.history-table tbody tr:last-child td { border-bottom: none; }

/* Auth */
.user-bar { display: flex; align-items: center; gap: 10px; font-size: 0.88rem; }
.user-name { color: var(--gold); font-weight: 600; }
.btn-sm {
  padding: 6px 14px;
  font-size: 0.82rem;
  font-family: inherit;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
}
.btn-sm.primary {
  background: linear-gradient(135deg, var(--gold), var(--gold2));
  color: #1a0a00;
  border: none;
  font-weight: 700;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}
.modal.hidden { display: none; }
.modal-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  text-align: center;
  max-width: 380px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.result-icon { font-size: 4rem; margin-bottom: 12px; }
.modal-box h2 { font-size: 1.4rem; color: var(--gold); margin-bottom: 10px; }
.modal-box p { color: var(--muted); margin-bottom: 20px; line-height: 1.6; }
.btn-primary {
  padding: 12px 32px;
  font-family: inherit;
  font-weight: 700;
  font-size: 1rem;
  background: linear-gradient(135deg, var(--gold), var(--gold2));
  color: #1a0a00;
  border: none;
  border-radius: 999px;
  cursor: pointer;
}

.auth-box { text-align: left; position: relative; }
.modal-close {
  position: absolute;
  top: 12px; right: 16px;
  background: none; border: none;
  color: var(--muted); font-size: 1.5rem; cursor: pointer;
}
.auth-box h2 { text-align: center; margin-bottom: 20px; }
.auth-box label { display: block; margin-bottom: 14px; font-size: 0.85rem; color: var(--muted); }
.auth-box input {
  display: block; width: 100%; margin-top: 6px;
  padding: 10px 14px;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit; font-size: 1rem;
}
.error-msg { color: var(--red); font-size: 0.82rem; min-height: 1.2em; margin-bottom: 8px; }
.auth-switch { text-align: center; margin-top: 14px; font-size: 0.85rem; color: var(--muted); }
.link-btn { background: none; border: none; color: var(--gold2); cursor: pointer; font-family: inherit; font-size: inherit; }
.auth-note { margin-top: 14px; font-size: 0.78rem; color: var(--muted); line-height: 1.5; text-align: center; }

.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: rgba(30,20,50,.95);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 0.88rem;
  z-index: 200;
  transition: transform .3s;
  pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.err { border-color: var(--red); color: #ffb3b3; }

@media (max-width: 900px) {
  .info-cards { grid-template-columns: repeat(2, 1fr); }
  .lottery-section { grid-template-columns: 1fr; }
  #wheel-canvas { width: 340px; height: 340px; }
  .header { flex-direction: column; gap: 14px; align-items: flex-start; }
  .withdraw-cards { grid-template-columns: repeat(2, 1fr); }
}

/* Withdraw */
.withdraw-section {
  margin-top: 32px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.withdraw-head h3 { color: var(--gold); font-size: 1rem; margin-bottom: 6px; }
.withdraw-sub { font-size: 0.8rem; color: var(--muted); margin-bottom: 16px; line-height: 1.5; }
.withdraw-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.wd-stat-card {
  background: rgba(245, 200, 66, 0.06);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.85rem;
  color: var(--muted);
}
.wd-stat-card strong { color: var(--gold); font-size: 1.2rem; margin-right: 4px; }
.withdraw-methods { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.withdraw-method-btn {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.withdraw-method-btn.active {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(245, 200, 66, 0.08);
}
.withdraw-method-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.withdraw-hint { font-size: 0.78rem; color: var(--muted); margin-bottom: 12px; }
.withdraw-form { max-width: 480px; }
.wd-field {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 12px;
}
.wd-field input[type="text"],
.wd-field input[type="number"],
.wd-field input[type="file"] {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
}
.withdraw-submit { margin-top: 8px; }
.withdraw-history-title {
  margin-top: 24px;
  margin-bottom: 12px;
  font-size: 0.9rem;
  color: var(--gold);
}
.withdraw-history-wrap { height: calc(38px * 4); max-height: calc(38px * 4); }
.wd-st-pending { color: var(--gold2); }
.wd-st-approved { color: #06d6a0; }
.wd-st-paid { color: #06d6a0; }
.wd-st-rejected { color: var(--red); }
#btn-withdraw-open {
  border: 1px solid var(--border);
  background: rgba(245, 200, 66, 0.1);
  color: var(--gold);
}
