/* Lucky Draw — big-screen celebratory theme. No external assets. */
:root {
  --navy-0: #070d1f;
  --navy-1: #0b1633;
  --navy-2: #12224d;
  --navy-3: #1b3268;
  --gold: #f5c542;
  --gold-dim: #c9a227;
  --red: #e5484d;
  --ink: #f4f1e8;
  --muted: #a8b0c4;
  --card-border: rgba(245, 197, 66, 0.28);
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(1100px 500px at 85% -10%, rgba(229, 72, 77, 0.22), transparent 60%),
    radial-gradient(900px 480px at 8% 0%, rgba(245, 197, 66, 0.14), transparent 55%),
    linear-gradient(180deg, var(--navy-1), var(--navy-0) 70%);
  background-attachment: fixed;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  line-height: 1.5;
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.4rem;
  border-bottom: 1px solid rgba(245, 197, 66, 0.25);
}
.brand { display: flex; align-items: center; gap: 0.55rem; font-size: 1.35rem; font-weight: 800; letter-spacing: 0.02em; }
.brand-mark { color: var(--gold); font-size: 1.6rem; line-height: 1; }
.brand-name { color: var(--ink); }
.topbar-right { display: flex; align-items: center; gap: 0.7rem; }
.demo-banner {
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: #1a1206; background: var(--gold);
  padding: 0.3rem 0.7rem; border-radius: 999px;
}

/* ---------- Buttons / inputs ---------- */
.btn {
  appearance: none; border: 1px solid rgba(255, 255, 255, 0.22);
  background: var(--navy-2); color: var(--ink);
  font: inherit; font-weight: 700; cursor: pointer;
  padding: 0.6rem 1.1rem; border-radius: 10px;
  transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { background: var(--navy-3); border-color: rgba(255, 255, 255, 0.4); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-gold { background: linear-gradient(180deg, #ffd964, #e0a92e); color: #241a04; border-color: #8a6a12; }
.btn-gold:hover { background: linear-gradient(180deg, #ffe27e, #eab53c); border-color: #8a6a12; }
.btn-ghost { background: transparent; }
.btn-danger { color: #ffb3b5; border-color: rgba(229, 72, 77, 0.5); }
.btn-danger:hover { background: rgba(229, 72, 77, 0.15); }
.btn-big { font-size: 1.25rem; padding: 0.9rem 1.8rem; border-radius: 12px; }

input[type="text"], input[type="number"], textarea {
  width: 100%; font: inherit; color: var(--ink);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 10px; padding: 0.6rem 0.8rem;
}
input:focus-visible, textarea:focus-visible { outline: 3px solid var(--gold); outline-offset: 1px; }
textarea { resize: vertical; }
input[type="checkbox"] { width: 1.25rem; height: 1.25rem; accent-color: var(--gold); }

.field { display: flex; flex-direction: column; gap: 0.4rem; font-weight: 600; }
.field + .field { margin-top: 0.9rem; }
.inline-field { flex-direction: row; align-items: center; gap: 0.8rem; }
.inline-field input { width: 5.5rem; }
.check { display: flex; align-items: center; gap: 0.6rem; font-weight: 600; cursor: pointer; }
.check + .field { margin-top: 0.9rem; }

.row { display: flex; align-items: center; gap: 0.7rem; }
.row.wrap { flex-wrap: wrap; margin-top: 0.7rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.warning { color: #ffd964; font-weight: 700; margin: 0.6rem 0 0; }

/* ---------- Setup view ---------- */
.setup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.1rem;
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.4rem;
}
.card {
  background: rgba(11, 22, 51, 0.72);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
}
.card h2 { margin: 0 0 0.8rem; font-size: 1.15rem; letter-spacing: 0.02em; }
.count-pill {
  display: inline-block; min-width: 2rem; text-align: center;
  background: var(--gold); color: #241a04; font-size: 0.9rem; font-weight: 800;
  padding: 0.1rem 0.55rem; border-radius: 999px; vertical-align: middle;
}
.license-status { font-weight: 600; }
.license-status.ok { color: #7ee2a0; }
.license-status.bad { color: #ffb3b5; }

.prize-row { display: flex; gap: 0.6rem; align-items: center; margin-bottom: 0.55rem; }
.prize-row input[type="text"] { flex: 1 1 auto; }
.prize-row input[type="number"] { width: 5rem; flex: 0 0 auto; }
.prize-remove { padding: 0.45rem 0.7rem; }
.setup-actions { grid-column: 1 / -1; text-align: center; padding: 0.4rem 0 0.6rem; }
.setup-actions .btn + .btn { margin-left: 0.7rem; }

/* ---------- Draw view ---------- */
#drawView { max-width: 1500px; margin: 0 auto; padding: 1rem 1.4rem 2rem; text-align: center; }
.stage-head { margin: 0.4rem 0 0.6rem; }
.event-title { font-size: clamp(1.2rem, 2.4vw, 1.8rem); font-weight: 700; color: var(--muted); letter-spacing: 0.06em; }
.prize-banner {
  font-size: clamp(2rem, 5.5vw, 4.2rem); font-weight: 900; line-height: 1.15;
  color: var(--gold);
  text-shadow: 0 0 34px rgba(245, 197, 66, 0.35);
  margin-top: 0.2rem;
}
.prize-progress { font-size: 1.05rem; margin-top: 0.3rem; }

.stage {
  margin: 1rem auto; max-width: 1200px;
  border: 2px solid var(--card-border); border-radius: 20px;
  background: radial-gradient(700px 260px at 50% 0%, rgba(245, 197, 66, 0.12), transparent 70%),
    rgba(0, 0, 0, 0.3);
  padding: clamp(1.2rem, 4vh, 2.6rem) 1rem;
  min-height: clamp(180px, 30vh, 300px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.6rem;
}
.name-display {
  font-size: clamp(3rem, 9vw, 7.5rem); font-weight: 900; line-height: 1.1;
  letter-spacing: 0.02em; word-break: break-word;
}
.name-display.rolling { animation: pulse 0.35s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: 0.75; } to { opacity: 1; } }
.draw-message { min-height: 1.6rem; font-size: 1.1rem; color: var(--muted); font-weight: 600; }

.draw-controls { display: flex; gap: 0.9rem; justify-content: center; flex-wrap: wrap; margin: 0.4rem 0 1rem; }
.draw-controls .btn-big { min-width: 11rem; }

.stats { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-bottom: 1.1rem; }
.stat {
  min-width: 9.5rem; padding: 0.7rem 1.2rem;
  background: rgba(11, 22, 51, 0.72); border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
}
.stat-num { font-size: 2rem; font-weight: 900; color: var(--gold); line-height: 1.1; }
.stat-label { color: var(--muted); font-size: 0.95rem; font-weight: 600; }

.draw-footer { display: flex; gap: 0.7rem; justify-content: center; align-items: center; flex-wrap: wrap; margin-bottom: 1.4rem; }
.keys-hint { margin-left: 0.4rem; }

.winners-panel { text-align: left; max-width: 1100px; margin: 0 auto; }
.winners-panel h2 { font-size: 1.4rem; margin: 0 0 0.7rem; text-align: center; }
.winner-group { margin-bottom: 1rem; }
.winner-group h3 { margin: 0 0 0.4rem; color: var(--gold); font-size: 1.15rem; }
.winner-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; margin: 0; padding: 0; }
.winner-chips li {
  background: var(--navy-2); border: 1px solid rgba(245, 197, 66, 0.35);
  padding: 0.4rem 0.9rem; border-radius: 999px; font-weight: 700; font-size: 1.05rem;
}

/* ---------- Reveal overlay ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(4, 7, 17, 0.88);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.overlay[hidden] { display: none; }
.overlay-card {
  text-align: center; max-width: 1000px; width: 100%;
  background: linear-gradient(180deg, var(--navy-2), var(--navy-1));
  border: 2px solid var(--gold); border-radius: 22px;
  padding: clamp(1.5rem, 5vh, 3rem) 1.5rem;
  box-shadow: 0 0 80px rgba(245, 197, 66, 0.3);
  animation: pop 0.35s ease-out;
}
@keyframes pop { from { transform: scale(0.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.reveal-prize { font-size: clamp(1.4rem, 3.5vw, 2.4rem); font-weight: 800; color: var(--gold); letter-spacing: 0.05em; }
.reveal-names {
  font-size: clamp(2.6rem, 8vw, 6rem); font-weight: 900; line-height: 1.2;
  margin: 0.8rem 0 1.4rem; word-break: break-word;
}
.reveal-names .one-winner { display: block; }

.confetti { position: fixed; inset: 0; z-index: 40; pointer-events: none; }
.confetti[hidden] { display: none; }

.foot { text-align: center; padding: 1rem; border-top: 1px solid rgba(255, 255, 255, 0.1); }

[hidden] { display: none !important; }

@media (max-width: 640px) {
  .btn-big { font-size: 1.05rem; padding: 0.75rem 1.2rem; }
  .draw-controls .btn-big { min-width: 0; flex: 1 1 auto; }
  .setup-grid { padding: 1rem; }
}
