/* ========================================
   RESET & BASE
   ======================================== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

[hidden] { display: none !important; }

:root {
  --bg: #0f0f1a;
  --bg-card: #1a1a2e;
  --text: #f0f0f0;
  --text-muted: #8888aa;
  --accent: #e94560;
  --accent-glow: rgba(233, 69, 96, 0.4);
  --success: #00d26a;
  --input-bg: #16213e;
  --input-border: #2a2a4a;
  --radius: 10px;
}

html, body { height: 100%; background: #000; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ========================================
   BACKGROUND LAYOUT — always visible
   ======================================== */
#app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.bg-layout {
  display: flex;
  height: 100%;
  overflow: hidden;
}

/* Left: header + wheel */
.bg-wheel {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  gap: 16px;
}

/* Right: leaderboard */
.bg-leaders {
  width: 240px;
  border-left: 1px solid var(--input-border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  overflow: hidden;
}

/* Collapse sidebar on mobile — single column */
@media (max-width: 600px) {
  .bg-layout { flex-direction: column; }
  .bg-leaders {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--input-border);
    padding: 12px 16px;
    flex: 1;
    min-height: 0;
  }
}

/* ========================================
   HEADER
   ======================================== */
.header {
  text-align: center;
  flex-shrink: 0;
}

.header__title {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #e94560, #f5a623, #e94560);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 3s ease infinite;
}

@keyframes shimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.header__subtitle {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* ========================================
   WHEEL SECTION
   ======================================== */
.wheel-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.wheel-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wheel-pointer {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.6rem;
  color: var(--accent);
  z-index: 10;
  filter: drop-shadow(0 2px 6px var(--accent-glow));
  line-height: 1;
  transition: transform 0.08s;
}

.wheel-pointer.tick {
  transform: translateX(-50%) scaleY(0.85);
}

#wheel-canvas {
  width: 260px;
  height: 260px;
  border-radius: 50%;
  box-shadow:
    0 0 0 5px var(--bg-card),
    0 0 0 8px var(--accent),
    0 0 30px var(--accent-glow);
}

/* ========================================
   SPIN BUTTON
   ======================================== */
.spin-btn {
  width: 150px;
  height: 44px;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 2px;
  border: none;
  border-radius: 22px;
  background: linear-gradient(135deg, #e94560, #c81e45);
  color: white;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.spin-btn:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 6px 30px var(--accent-glow);
}

.spin-btn:active:not(:disabled) { transform: scale(0.97); }

.spin-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.spin-btn--ready {
  animation: pulse 1.8s ease infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 4px 20px var(--accent-glow); }
  50% { box-shadow: 0 4px 40px var(--accent-glow), 0 0 60px var(--accent-glow); }
}

/* ========================================
   COUPON CODE MODAL
   ======================================== */
.code-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 24px;
  animation: fadeIn 0.3s ease;
}

.code-modal {
  background: var(--bg-card);
  border: 1px solid var(--input-border);
  border-radius: 20px;
  padding: 36px 28px 28px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
}

.code-modal__icon {
  font-size: 2.8rem;
  margin-bottom: 12px;
  line-height: 1;
}

.code-modal__title {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.code-modal__sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.4;
}

.code-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.code-form__input {
  width: 100%;
  padding: 14px 16px;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-align: center;
  text-transform: uppercase;
  border: 2px solid var(--input-border);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.code-form__input::placeholder {
  letter-spacing: normal;
  font-weight: 400;
  text-transform: none;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.code-form__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.code-form__btn {
  padding: 13px 24px;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: white;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.code-form__btn:hover { transform: translateY(-1px); box-shadow: 0 4px 16px var(--accent-glow); }
.code-form__btn:active { transform: translateY(0); }
.code-form__btn:disabled { opacity: 0.6; cursor: not-allowed; }

.code-form__error {
  margin-top: 8px;
  color: var(--accent);
  font-size: 0.8rem;
}

/* ========================================
   RESULT MODAL
   ======================================== */
.result-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.3s ease;
  padding: 16px;
}

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

@keyframes popIn {
  from { opacity: 0; transform: scale(0.7); }
  to   { opacity: 1; transform: scale(1); }
}

.result-modal {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 32px 28px;
  text-align: center;
  max-width: 340px;
  width: 100%;
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid rgba(233, 69, 96, 0.3);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.result-modal__emoji { font-size: 3rem; margin-bottom: 8px; }
.result-modal__title { font-size: 1.4rem; font-weight: 800; margin-bottom: 6px; color: var(--success); }
.result-modal__prize { font-size: 1.2rem; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.result-modal__desc  { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 20px; }

.result-modal__btn {
  padding: 12px 36px;
  font-size: 0.95rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius);
  background: var(--success);
  color: white;
  cursor: pointer;
  transition: transform 0.15s;
}

.result-modal__btn:hover { transform: translateY(-1px); }

/* ========================================
   WINNERS LIST
   ======================================== */
.winners-section {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.winners-section__title {
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
  flex-shrink: 0;
}

.winners-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.winners-list::-webkit-scrollbar { display: none; }

.winners-list__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-card);
  border-radius: 8px;
  border: 1px solid var(--input-border);
  flex-shrink: 0;
}

.winners-list__dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.winners-list__info { flex: 1; min-width: 0; }
.winners-list__name { font-size: 0.78rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.winners-list__prize { font-size: 0.7rem; color: var(--text-muted); margin-top: 1px; }
.winners-list__time { font-size: 0.66rem; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.winners-list__empty { text-align: center; padding: 14px; color: var(--text-muted); font-size: 0.8rem; }

/* ========================================
   CONFETTI
   ======================================== */
#confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 200;
}
