/* ==========================================================
   Midnight Gold — New Year design system
   ========================================================== */
:root {
  --bg-0: #05060f;
  --bg-1: #0b0e24;
  --bg-2: #141a3d;
  --ink: #f5f1e6;
  --ink-dim: #b9b3a3;
  --ink-mute: #7d7a86;
  --gold-1: #fff3c4;
  --gold-2: #f5d27a;
  --gold-3: #d9a441;
  --gold-4: #a8741e;
  --rose: #ff6b8b;
  --mint: #4fe3b0;
  --sky: #6cb8ff;
  --glass: rgba(255, 255, 255, 0.055);
  --glass-2: rgba(255, 255, 255, 0.09);
  --line: rgba(255, 236, 190, 0.14);
  --line-2: rgba(255, 236, 190, 0.28);
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.7), 0 0 0 1px var(--line) inset;
  --gold-grad: linear-gradient(135deg, var(--gold-1) 0%, var(--gold-2) 30%, var(--gold-3) 60%, var(--gold-4) 100%);
  --font-head: 'Kanit', 'Prompt', system-ui, sans-serif;
  --font-body: 'Prompt', 'Kanit', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-body);
  font-weight: 300;
  color: var(--ink);
  background:
    radial-gradient(1200px 700px at 15% -10%, rgba(80, 70, 200, 0.35), transparent 60%),
    radial-gradient(900px 600px at 110% 10%, rgba(217, 164, 65, 0.22), transparent 60%),
    radial-gradient(800px 800px at 50% 120%, rgba(255, 107, 139, 0.16), transparent 60%),
    linear-gradient(180deg, var(--bg-1), var(--bg-0));
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--gold-2); text-decoration: none; }
a:hover { color: var(--gold-1); }
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 500; margin: 0; letter-spacing: 0.01em; }

#sky { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
#fx  { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.page { position: relative; z-index: 1; }

/* ---------- text utilities ---------- */
.gold-text {
  background: var(--gold-grad);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: sheen 6s ease-in-out infinite;
}
@keyframes sheen { 0%,100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.eyebrow {
  font-family: var(--font-head);
  text-transform: uppercase;
  letter-spacing: 0.45em;
  font-size: 0.72rem;
  color: var(--gold-2);
  opacity: 0.9;
}
.muted { color: var(--ink-dim); }
.mute  { color: var(--ink-mute); }
.center { text-align: center; }

/* ---------- glass card ---------- */
.card {
  position: relative;
  background: linear-gradient(160deg, rgba(255,255,255,0.08), rgba(255,255,255,0.025));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  padding: 28px;
}
.card.glow::before {
  content: '';
  position: absolute; inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, rgba(255,243,196,0.7), rgba(217,164,65,0.1) 35%, rgba(255,255,255,0.0) 60%, rgba(245,210,122,0.55));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* ---------- buttons ---------- */
.btn {
  --b: var(--glass-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-head);
  font-weight: 400;
  font-size: 0.95rem;
  padding: 11px 20px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--b);
  color: var(--ink);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .25s ease, background .25s ease, border-color .25s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); border-color: var(--gold-2); color: var(--ink); box-shadow: 0 10px 30px -10px rgba(245,210,122,0.45); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-gold {
  background: var(--gold-grad);
  background-size: 160% 160%;
  color: #2a1a00;
  border-color: transparent;
  font-weight: 500;
  box-shadow: 0 12px 40px -12px rgba(245, 210, 122, 0.8), inset 0 1px 0 rgba(255,255,255,0.6);
}
.btn-gold:hover { color: #1a0f00; background-position: 100% 0; box-shadow: 0 18px 50px -12px rgba(245, 210, 122, 0.95), inset 0 1px 0 rgba(255,255,255,0.6); }
.btn-danger { border-color: rgba(255,107,139,0.4); color: #ffc2cf; }
.btn-danger:hover { border-color: var(--rose); box-shadow: 0 10px 30px -10px rgba(255,107,139,0.6); color: #fff; }
.btn-sm { padding: 6px 13px; font-size: 0.82rem; }
.btn-lg { padding: 18px 34px; font-size: 1.15rem; }
.btn-block { width: 100%; }
.btn-icon { padding: 7px; width: 34px; height: 34px; }

/* ---------- forms ---------- */
label { display: block; font-size: 0.82rem; color: var(--ink-dim); margin: 0 0 6px; }
.input, select.input, textarea.input {
  width: 100%;
  font: inherit;
  font-weight: 400;
  color: var(--ink);
  background: rgba(0,0,0,0.28);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.input:focus { border-color: var(--gold-2); box-shadow: 0 0 0 4px rgba(245,210,122,0.15); background: rgba(0,0,0,0.38); }
.input::placeholder { color: var(--ink-mute); }
select.input option { background: var(--bg-2); color: var(--ink); }
.field { margin-bottom: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1 1 auto; }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; color: var(--ink); font-size: 0.95rem; }
.check input { width: 18px; height: 18px; accent-color: var(--gold-3); }

/* ==========================================================
   Check-in page (mobile first)
   ========================================================== */
.checkin-wrap {
  min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 32px 20px 40px;
}
.hero { text-align: center; margin-bottom: 28px; }
.hero .year {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: clamp(4.5rem, 24vw, 8rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  filter: drop-shadow(0 10px 40px rgba(245,210,122,0.35));
}
.hero .title { font-size: clamp(1.3rem, 5.5vw, 1.8rem); font-weight: 300; margin-top: 6px; letter-spacing: 0.06em; }
.hero .company { margin-top: 10px; }
.checkin-card { width: 100%; max-width: 420px; }
.code-input {
  text-align: center;
  font-family: var(--font-head);
  font-size: 1.9rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  padding: 18px 14px;
  border-radius: 18px;
  text-transform: uppercase;
}
.code-input::placeholder { letter-spacing: 0.06em; font-size: 1.1rem; font-weight: 300; }
.hint { font-size: 0.82rem; color: var(--ink-mute); text-align: center; margin-top: 14px; }

.state { display: none; text-align: center; }
.state.show { display: block; animation: rise .6s cubic-bezier(.2,.9,.3,1.2); }
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }
.badge-ok {
  width: 92px; height: 92px; margin: 0 auto 18px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--gold-grad);
  box-shadow: 0 0 0 10px rgba(245,210,122,0.12), 0 0 60px rgba(245,210,122,0.6);
  animation: pop .7s cubic-bezier(.2,1.6,.4,1) both;
}
.badge-ok svg { width: 46px; height: 46px; stroke: #2a1a00; stroke-width: 3.2; fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw .6s .35s ease forwards; }
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
.welcome-name { font-family: var(--font-head); font-size: clamp(1.7rem, 8vw, 2.3rem); font-weight: 500; margin: 6px 0 4px; line-height: 1.2; }
.welcome-dept { color: var(--ink-dim); }
.ticket {
  margin: 22px auto 0;
  padding: 14px 18px;
  border: 1px dashed var(--line-2);
  border-radius: 14px;
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 0.85rem; color: var(--ink-dim);
  max-width: 320px;
}
.ticket b { color: var(--gold-2); font-weight: 500; font-family: var(--font-head); }
.err-box {
  margin-top: 14px; padding: 12px 14px; border-radius: 12px;
  background: rgba(255,107,139,0.1); border: 1px solid rgba(255,107,139,0.35); color: #ffd0da;
  text-align: center; font-size: 0.92rem; display: none;
}
.err-box.show { display: block; animation: shake .45s; }
@keyframes shake { 20%,60% { transform: translateX(-7px); } 40%,80% { transform: translateX(7px); } }
.spinner { width: 20px; height: 20px; border: 2.5px solid rgba(42,26,0,0.3); border-top-color: #2a1a00; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.footer-note { margin-top: 28px; font-size: 0.75rem; color: var(--ink-mute); letter-spacing: 0.2em; text-transform: uppercase; }

/* ==========================================================
   Big screen display
   ========================================================== */
.stage { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; gap: 4vw; padding: 5vh 5vw; align-items: center; }
.stage-left .year { font-family: var(--font-head); font-weight: 600; font-size: 13vw; line-height: .9; letter-spacing: -0.03em; filter: drop-shadow(0 20px 60px rgba(245,210,122,0.35)); }
.stage-left .title { font-size: 2.6vw; font-weight: 300; letter-spacing: .08em; margin-top: 1vh; }
.counter { margin-top: 5vh; display: flex; align-items: flex-end; gap: 1.2vw; }
.counter .num { font-family: var(--font-head); font-size: 8vw; font-weight: 500; line-height: .9; font-variant-numeric: tabular-nums; }
.counter .of { font-size: 1.6vw; color: var(--ink-dim); padding-bottom: 1.2vw; }
.progress { margin-top: 2.4vh; height: 10px; border-radius: 99px; background: rgba(255,255,255,0.07); overflow: hidden; max-width: 36vw; }
.progress > i { display: block; height: 100%; width: 0; background: var(--gold-grad); border-radius: inherit; box-shadow: 0 0 20px rgba(245,210,122,0.7); transition: width 1.2s cubic-bezier(.2,.8,.2,1); }
.scan-box { margin-top: 5vh; display: flex; gap: 1.6vw; align-items: center; }
.scan-box .qr { background: #fff; padding: 10px; border-radius: 16px; box-shadow: 0 0 50px rgba(245,210,122,0.25); }
.scan-box .qr img, .scan-box .qr canvas { display: block; width: 10vw; height: 10vw; min-width: 120px; min-height: 120px; }
.scan-box .txt { font-size: 1.3vw; color: var(--ink-dim); line-height: 1.6; }
.scan-box .txt b { color: var(--ink); font-family: var(--font-head); font-weight: 500; font-size: 1.7vw; display: block; }

.feed-card { height: 86vh; display: flex; flex-direction: column; padding: 3vh 2vw; }
.feed-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2vh; }
.feed-head h3 { font-size: 1.6vw; }
.live { display: inline-flex; align-items: center; gap: 8px; font-size: .95vw; color: var(--mint); letter-spacing: .2em; font-family: var(--font-head); }
.live::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 0 rgba(79,227,176,.7); animation: ping 1.6s infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(79,227,176,.7); } 100% { box-shadow: 0 0 0 14px rgba(79,227,176,0); } }
.feed { list-style: none; margin: 0; padding: 0; overflow: hidden; flex: 1; display: flex; flex-direction: column; gap: 1.2vh; }
.feed li { display: flex; align-items: center; gap: 1.2vw; padding: 1.5vh 1.2vw; border-radius: 16px; background: rgba(255,255,255,0.04); border: 1px solid var(--line); }
.feed li.new { animation: slideIn .8s cubic-bezier(.2,.9,.3,1.1); background: linear-gradient(90deg, rgba(245,210,122,0.22), rgba(255,255,255,0.04)); border-color: var(--line-2); }
@keyframes slideIn { from { opacity: 0; transform: translateX(40px) scale(.96); } to { opacity: 1; transform: none; } }
.avatar { flex: none; width: 3.4vw; height: 3.4vw; min-width: 42px; min-height: 42px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-head); font-weight: 500; font-size: 1.3vw; color: #2a1a00; background: var(--gold-grad); }
.avatar.guest { background: linear-gradient(135deg, #ffd1dc, var(--rose)); }
.feed .nm { font-family: var(--font-head); font-size: 1.45vw; font-weight: 400; line-height: 1.25; }
.feed .dp { font-size: .95vw; color: var(--ink-dim); }
.feed .tm { margin-left: auto; font-size: .95vw; color: var(--ink-mute); font-variant-numeric: tabular-nums; }

.welcome-toast {
  position: fixed; left: 50%; top: 50%; z-index: 40;
  transform: translate(-50%, -50%) scale(.8);
  opacity: 0; pointer-events: none;
  text-align: center;
  padding: 5vh 6vw;
  border-radius: 36px;
  background: radial-gradient(circle at 50% 0%, rgba(245,210,122,0.25), rgba(11,14,36,0.92) 70%);
  box-shadow: 0 40px 120px rgba(0,0,0,0.7), 0 0 0 1px var(--line-2) inset;
  backdrop-filter: blur(16px);
  transition: all .5s cubic-bezier(.2,1.3,.4,1);
}
.welcome-toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.welcome-toast .eyebrow { font-size: 1vw; }
.welcome-toast .nm { font-family: var(--font-head); font-size: 4.6vw; font-weight: 500; margin-top: 1vh; line-height: 1.15; }
.welcome-toast .dp { font-size: 1.6vw; color: var(--ink-dim); margin-top: 1vh; }

/* ==========================================================
   Lucky draw stage
   ========================================================== */
.draw-stage { min-height: 100vh; display: grid; grid-template-columns: 22vw 1fr; }
.draw-side { padding: 3vh 1.6vw; border-right: 1px solid var(--line); background: rgba(0,0,0,0.25); backdrop-filter: blur(10px); overflow-y: auto; max-height: 100vh; }
.draw-side h4 { font-size: 1rem; margin-bottom: 14px; color: var(--ink-dim); font-weight: 400; }
.prize-item { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; padding: 12px; margin-bottom: 8px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,0.03); color: var(--ink); cursor: pointer; font: inherit; transition: all .2s; }
.prize-item:hover { border-color: var(--line-2); background: rgba(255,255,255,0.06); }
.prize-item.active { border-color: var(--gold-2); background: linear-gradient(90deg, rgba(245,210,122,0.18), rgba(255,255,255,0.03)); box-shadow: 0 0 30px -8px rgba(245,210,122,0.5); }
.prize-item.done { opacity: .45; }
.prize-thumb { flex: none; width: 46px; height: 46px; border-radius: 12px; object-fit: cover; background: rgba(255,255,255,0.06); display: grid; place-items: center; font-size: 22px; }
.prize-item .pn { font-family: var(--font-head); font-size: .95rem; line-height: 1.25; }
.prize-item .pq { font-size: .78rem; color: var(--ink-dim); }

.draw-main { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4vh 4vw; text-align: center; overflow: hidden; }
.spotlight { position: absolute; top: -20vh; left: 50%; width: 70vw; height: 120vh; transform: translateX(-50%); background: radial-gradient(ellipse at top, rgba(255,243,196,0.18), transparent 60%); pointer-events: none; opacity: .6; transition: opacity .6s; }
.drawing .spotlight { opacity: 1; animation: sway 3s ease-in-out infinite; }
@keyframes sway { 0%,100% { transform: translateX(-52%); } 50% { transform: translateX(-48%); } }
.prize-hero { position: relative; }
.prize-hero img { max-height: 22vh; max-width: 30vw; border-radius: 20px; box-shadow: 0 20px 60px rgba(0,0,0,0.6); margin-bottom: 2vh; }
.prize-hero .pname { font-family: var(--font-head); font-size: 3.6vw; font-weight: 500; line-height: 1.1; }
.prize-hero .pdesc { color: var(--ink-dim); font-size: 1.3vw; margin-top: .8vh; }
.prize-hero .pleft { margin-top: 1.4vh; display: inline-flex; gap: 8px; padding: 6px 16px; border-radius: 99px; border: 1px solid var(--line-2); font-size: 1vw; color: var(--gold-2); }

.slot {
  position: relative;
  margin: 4.5vh 0 4vh;
  width: min(70vw, 1100px);
  height: 22vh;
  border-radius: 32px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(0,0,0,0.55), rgba(20,26,61,0.6) 50%, rgba(0,0,0,0.55));
  box-shadow: 0 0 0 2px rgba(245,210,122,0.35) inset, 0 30px 100px -20px rgba(0,0,0,0.9), 0 0 80px -20px rgba(245,210,122,0.35);
}
.slot::before, .slot::after { content: ''; position: absolute; left: 0; right: 0; height: 32%; z-index: 2; pointer-events: none; }
.slot::before { top: 0; background: linear-gradient(180deg, rgba(5,6,15,0.95), transparent); }
.slot::after { bottom: 0; background: linear-gradient(0deg, rgba(5,6,15,0.95), transparent); }
.slot .line { position: absolute; left: 3%; right: 3%; top: 50%; height: 1px; background: linear-gradient(90deg, transparent, rgba(245,210,122,0.5), transparent); z-index: 3; }
.slot .reel { position: absolute; left: 0; right: 0; top: 0; will-change: transform; }
.slot .reel div { height: 22vh; display: flex; flex-direction: column; align-items: center; justify-content: center; font-family: var(--font-head); font-size: 4.4vw; font-weight: 500; line-height: 1.1; white-space: nowrap; }
.slot .reel div small { font-family: var(--font-body); font-size: 1.2vw; font-weight: 300; color: var(--ink-dim); margin-top: .6vh; letter-spacing: .1em; }
.slot.win { animation: winPulse 1.6s ease-in-out infinite; }
.slot.win .reel div.target { color: transparent; background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; }
.slot.win .reel div.target small { -webkit-text-fill-color: var(--ink); }
@keyframes winPulse { 0%,100% { box-shadow: 0 0 0 2px rgba(245,210,122,0.6) inset, 0 0 80px -10px rgba(245,210,122,0.6); } 50% { box-shadow: 0 0 0 3px rgba(255,243,196,0.95) inset, 0 0 160px 0 rgba(245,210,122,0.8); } }
.slot-idle { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-head); font-size: 2vw; color: var(--ink-mute); letter-spacing: .3em; z-index: 1; }
.draw-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.draw-actions .btn-lg { font-size: 1.4vw; padding: 2vh 3.4vw; min-width: 16vw; }
.winners-strip { margin-top: 3.5vh; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 70vw; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 99px; background: rgba(255,255,255,0.06); border: 1px solid var(--line); font-size: .95vw; }
.chip b { color: var(--gold-2); font-weight: 500; font-family: var(--font-head); }
/* --- draw modes --- */
.eyebrow.th { letter-spacing: 0.12em; }
.mode-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode-pick button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,0.03); color: var(--ink-dim); font: inherit; font-size: .85rem; cursor: pointer; transition: all .2s; }
.mode-pick button span { font-size: 1.4rem; line-height: 1; }
.mode-pick button:hover { border-color: var(--line-2); color: var(--ink); }
.mode-pick button.on { border-color: var(--gold-2); color: var(--gold-1); background: rgba(245,210,122,0.12); box-shadow: 0 0 24px -8px rgba(245,210,122,0.6); }
.test-toggle { display: flex; gap: 12px; align-items: center; margin-top: 20px; padding: 12px; border-radius: 14px; border: 1px dashed var(--line-2); cursor: pointer; color: var(--ink); font-size: .9rem; line-height: 1.35; }
.test-toggle small { color: var(--ink-mute); font-size: .75rem; }
.test-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.test-toggle .sw { flex: none; position: relative; width: 44px; height: 24px; border-radius: 99px; background: rgba(255,255,255,0.15); transition: background .2s; }
.test-toggle .sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 2px 4px rgba(0,0,0,0.3); }
.test-toggle input:checked + .sw { background: #ff9f43; }
.test-toggle input:checked + .sw::after { transform: translateX(20px); }
.test-toggle input:focus-visible + .sw { outline: 2px solid var(--gold-2); outline-offset: 2px; }
.test-toggle:has(input:checked) { border-color: #ff9f43; background: rgba(255,159,67,0.1); }
.test-banner { position: absolute; top: 2.6vh; left: 50%; transform: translate(-50%, -20px); z-index: 6; padding: 8px 22px; border-radius: 99px; background: #ff9f43; color: #2a1600; font-family: var(--font-head); font-weight: 500; font-size: 1rem; box-shadow: 0 8px 30px rgba(255,159,67,0.45); opacity: 0; pointer-events: none; transition: all .3s; }
.test-banner.show { opacity: 1; transform: translate(-50%, 0); }
.draw-main.testing .slot, .draw-main.testing .scramble { outline: 3px dashed rgba(255,159,67,0.7); outline-offset: 6px; }
.range { width: 100%; accent-color: var(--gold-2); cursor: pointer; }

.arena { position: relative; width: min(70vw, 1100px); margin: 4vh 0 3.5vh; display: flex; justify-content: center; }
.arena .slot { margin: 0; }
.mode-el { display: none !important; }
.arena[data-mode="slot"] [data-for="slot"],
.arena[data-mode="wheel"] [data-for="wheel"],
.arena[data-mode="grid"] [data-for="grid"],
.arena[data-mode="scramble"] [data-for="scramble"] { display: flex !important; }
.arena[data-mode="slot"] [data-for="slot"] { display: block !important; }
.draw-main[data-mode="wheel"] #heroImg, .draw-main[data-mode="grid"] #heroImg { display: none; }
.draw-main[data-mode="wheel"] .arena, .draw-main[data-mode="grid"] .arena { margin: 2.4vh 0 2.4vh; }
.draw-main[data-mode="wheel"] .prize-hero .pname { font-size: 2.6vw; }

.wheel-wrap { position: relative; width: min(52vh, 44vw); aspect-ratio: 1; align-items: center; justify-content: center; filter: drop-shadow(0 24px 50px rgba(0,0,0,0.55)); }
.wheel-wrap canvas { width: 100%; height: 100%; display: block; }
.wheel-pointer { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); z-index: 2; width: 0; height: 0; border-left: 20px solid transparent; border-right: 20px solid transparent; border-top: 40px solid var(--gold-2); filter: drop-shadow(0 4px 6px rgba(0,0,0,0.5)); }
.wheel-hub { position: absolute; left: 50%; top: 50%; width: 15%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; background: var(--gold-grad); display: grid; place-items: center; color: #2a1a00; font-size: 1.8vw; box-shadow: 0 0 0 5px rgba(255,255,255,0.85), 0 6px 20px rgba(0,0,0,0.5); }

.name-grid { flex-wrap: wrap; gap: 10px; justify-content: center; align-content: center; min-height: 30vh; max-height: 46vh; overflow: hidden; }
.name-grid .tile { padding: 1.1vh 1.2vw; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,0.05); font-family: var(--font-head); font-size: 1.15vw; white-space: nowrap; transition: transform .12s, background .12s, opacity .4s; }
.name-grid .tile.on { background: var(--gold-grad); color: #2a1a00; border-color: transparent; transform: scale(1.12); box-shadow: 0 0 30px rgba(245,210,122,0.7); }
.name-grid .tile.dim { opacity: .25; }
.name-grid .tile.win { transform: scale(1.35); z-index: 1; animation: tileWin 1s ease-in-out infinite; }
@keyframes tileWin { 50% { box-shadow: 0 0 60px 6px rgba(245,210,122,0.9); } }

.scramble { flex-direction: column; align-items: center; justify-content: center; width: 100%; min-height: 22vh; padding: 3vh 3vw; border-radius: 32px; background: linear-gradient(180deg, rgba(0,0,0,0.5), rgba(20,26,61,0.55)); box-shadow: 0 0 0 2px rgba(245,210,122,0.35) inset, 0 30px 100px -20px rgba(0,0,0,0.9); }
.scramble .sc-name { font-family: var(--font-head); font-size: 4.4vw; font-weight: 500; line-height: 1.15; letter-spacing: .02em; font-variant-numeric: tabular-nums; text-align: center; }
.scramble .sc-dept { font-size: 1.3vw; color: var(--ink-dim); margin-top: 1vh; min-height: 1.5em; }
.scramble.win .sc-name { color: transparent; background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; }
.scramble.win { animation: winPulse 1.6s ease-in-out infinite; }

.result-pop { position: absolute; left: 50%; top: 50%; z-index: 5; width: max-content; min-width: 40%; max-width: 96%; text-align: center; padding: 3.5vh 4vw; border-radius: 28px; cursor: pointer;
  background: radial-gradient(circle at 50% 0%, rgba(245,210,122,0.28), transparent 70%), #0d1130; box-shadow: 0 30px 90px rgba(0,0,0,0.7), 0 0 0 1px var(--line-2) inset;
  opacity: 0; pointer-events: none; transform: translate(-50%, -50%) scale(.6); transition: all .5s cubic-bezier(.2,1.4,.4,1); }
.result-pop.show { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.result-pop .nm { white-space: nowrap; font-family: var(--font-head); font-size: 3.8vw; font-weight: 500; line-height: 1.15; margin-top: .8vh; }
.result-pop .dp { font-size: 1.3vw; color: var(--ink-dim); margin-top: .8vh; }

.pool-info {position: absolute; top: 3vh; right: 3vw; font-size: .95rem; color: var(--ink-dim); }
.fs-btn { position: absolute; top: 3vh; left: 2vw; }

/* ==========================================================
   Admin
   ========================================================== */
.admin { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 18px; border-right: 1px solid var(--line); background: rgba(5,6,15,0.55); backdrop-filter: blur(14px); display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 26px; }
.brand .logo { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: var(--gold-grad); color: #2a1a00; font-family: var(--font-head); font-weight: 600; font-size: 1.05rem; box-shadow: 0 8px 30px -8px rgba(245,210,122,0.8); }
.brand .bt { font-family: var(--font-head); font-weight: 500; line-height: 1.15; }
.brand .bs { font-size: .72rem; color: var(--ink-mute); letter-spacing: .18em; text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; color: var(--ink-dim); font-weight: 400; transition: all .2s; }
.nav a svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav a:hover { background: rgba(255,255,255,0.05); color: var(--ink); }
.nav a.active { background: linear-gradient(90deg, rgba(245,210,122,0.16), rgba(245,210,122,0.02)); color: var(--gold-1); box-shadow: inset 2px 0 0 var(--gold-2); }
.nav .sep { height: 1px; background: var(--line); margin: 14px 8px; }
.sidebar .bottom { margin-top: auto; }
.theme-switch { padding: 0 6px 12px; }
.theme-switch label { font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-mute); }
.theme-switch .input { padding: 8px 12px; font-size: .88rem; border-radius: 10px; cursor: pointer; }
.main { padding: 34px 40px 60px; min-width: 0; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.topbar h1 { font-size: 2rem; font-weight: 500; }
.topbar p { margin: 6px 0 0; color: var(--ink-dim); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 18px; margin-bottom: 26px; }
.stat { padding: 22px 24px; }
.stat .k { font-size: .8rem; color: var(--ink-dim); letter-spacing: .08em; }
.stat .v { font-family: var(--font-head); font-size: 2.4rem; font-weight: 500; margin-top: 6px; line-height: 1; font-variant-numeric: tabular-nums; }
.stat .s { font-size: .8rem; color: var(--ink-mute); margin-top: 8px; }
.ring { --p: 0; width: 64px; height: 64px; border-radius: 50%; background: conic-gradient(var(--gold-2) calc(var(--p) * 1%), rgba(255,255,255,0.08) 0); display: grid; place-items: center; position: absolute; right: 22px; top: 22px; }
.ring::after { content: ''; width: 50px; height: 50px; border-radius: 50%; background: var(--bg-1); position: absolute; }
.ring span { position: relative; z-index: 1; font-size: .78rem; font-family: var(--font-head); }

.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 22px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.section-title h3 { font-size: 1.15rem; }

.table-wrap { overflow-x: auto; margin: 0 -8px; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0 6px; font-size: .92rem; }
.tbl th { text-align: left; font-weight: 400; font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-mute); padding: 6px 14px; }
.tbl td { padding: 12px 14px; background: rgba(255,255,255,0.03); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl td:first-child { border-left: 1px solid var(--line); border-radius: 12px 0 0 12px; }
.tbl td:last-child { border-right: 1px solid var(--line); border-radius: 0 12px 12px 0; }
.tbl tr:hover td { background: rgba(255,255,255,0.06); }
.tbl .code { font-family: var(--font-head); color: var(--gold-2); letter-spacing: .05em; }
.tbl .actions { display: flex; gap: 6px; justify-content: flex-end; }

.tag { display: inline-flex; align-items: center; gap: 6px; font-size: .75rem; padding: 4px 10px; border-radius: 99px; border: 1px solid var(--line); color: var(--ink-dim); white-space: nowrap; }
.tag.ok { color: var(--mint); border-color: rgba(79,227,176,0.35); background: rgba(79,227,176,0.08); }
.tag.ok::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--mint); }
.tag.guest { color: #ffc2cf; border-color: rgba(255,107,139,0.35); background: rgba(255,107,139,0.08); }
.tag.sub { color: #bfe0ff; border-color: rgba(108,184,255,0.4); background: rgba(108,184,255,0.1); }
.tag.emp { color: var(--ink-dim); }
.avatar.subcontract { background: linear-gradient(135deg, #d6ecff, var(--sky)); }
.type-pick { display: flex; width: 100%; }
.type-pick label { flex: 1; margin: 0; cursor: pointer; }
.type-pick input { position: absolute; opacity: 0; pointer-events: none; }
.type-pick span { display: block; text-align: center; padding: 9px 10px; border-radius: 99px; font-size: .88rem; color: var(--ink-dim); transition: all .2s; }
.type-pick input:checked + span { background: var(--glass-2); color: var(--gold-1); box-shadow: inset 0 0 0 1px var(--line-2); }
.type-pick input:focus-visible + span { outline: 2px solid var(--gold-2); }
.tag.gold {color: var(--gold-1); border-color: rgba(245,210,122,0.4); background: rgba(245,210,122,0.1); }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters .input { width: auto; }
.filters .search { flex: 1 1 260px; }
.seg { display: inline-flex; padding: 4px; border-radius: 99px; background: rgba(0,0,0,0.3); border: 1px solid var(--line); }
.seg a { padding: 7px 14px; border-radius: 99px; font-size: .85rem; color: var(--ink-dim); }
.seg a.on { background: var(--glass-2); color: var(--gold-1); box-shadow: inset 0 0 0 1px var(--line-2); }

.flash { padding: 14px 18px; border-radius: 14px; margin-bottom: 20px; border: 1px solid; animation: rise .5s; }
.flash.success { background: rgba(79,227,176,0.08); border-color: rgba(79,227,176,0.35); color: #c6f7e6; }
.flash.error { background: rgba(255,107,139,0.08); border-color: rgba(255,107,139,0.35); color: #ffd0da; }

.empty { text-align: center; padding: 50px 20px; color: var(--ink-mute); }
.empty .ic { font-size: 2.6rem; margin-bottom: 10px; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 100; display: none; place-items: center; padding: 20px; background: rgba(3,4,10,0.7); backdrop-filter: blur(6px); }
.modal.open { display: grid; animation: fade .2s; }
.modal .card { width: 100%; max-width: 480px; animation: rise .35s cubic-bezier(.2,.9,.3,1.2); background: linear-gradient(160deg, rgba(30,36,80,0.96), rgba(14,17,40,0.98)); }
.modal h3 { margin-bottom: 18px; font-size: 1.3rem; }
.modal .foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.prize-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.prize-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.prize-card .img { height: 170px; flex: none; overflow: hidden; background: linear-gradient(135deg, rgba(245,210,122,0.15), rgba(108,184,255,0.08)); display: grid; place-items: center; font-size: 3.4rem; position: relative; }
.prize-card .img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; }
.prize-card .handle { position: absolute; top: 10px; left: 10px; z-index: 1; padding: 4px 10px; border-radius: 99px; font-size: .75rem; background: rgba(0,0,0,0.55); color: #fff; cursor: grab; user-select: none; }
.prize-card[draggable="true"] { cursor: grab; }
.prize-card.dragging { opacity: .4; transform: scale(.97); }
.prize-cards.sorting .prize-card:not(.dragging) { transition: transform .15s; }
.save-note { font-size: .85rem; color: var(--mint); opacity: 0; transition: opacity .3s; }
.save-note.show { opacity: 1; }
.prize-card .body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.prize-card .name { font-family: var(--font-head); font-size: 1.2rem; font-weight: 500; }
.prize-card .bar { height: 6px; border-radius: 99px; background: rgba(255,255,255,0.08); overflow: hidden; }
.prize-card .bar i { display: block; height: 100%; background: var(--gold-grad); }
.winner-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.winner-list li { display: flex; align-items: center; gap: 10px; font-size: .88rem; padding: 7px 10px; border-radius: 10px; background: rgba(255,255,255,0.035); }
.winner-list li .x { margin-left: auto; }
.winner-list .code { color: var(--gold-2); font-family: var(--font-head); font-size: .8rem; }

.ac { position: relative; }
.ac-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 10; max-height: 240px; overflow-y: auto; border-radius: 12px; background: #161c44; border: 1px solid var(--line-2); box-shadow: 0 20px 50px rgba(0,0,0,0.6); display: none; }
.ac-list.open { display: block; }
.ac-list button { display: flex; width: 100%; gap: 10px; align-items: center; padding: 10px 12px; background: none; border: 0; border-bottom: 1px solid var(--line); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.ac-list button:hover, .ac-list button.hi { background: rgba(245,210,122,0.12); }
.ac-list button:disabled { opacity: .45; cursor: not-allowed; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 400px; text-align: center; }

.qr-print { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.qr-poster { background: radial-gradient(circle at 50% 0%, #1d2459, #070915 70%); border-radius: 28px; padding: 44px 30px; text-align: center; box-shadow: var(--shadow); }
.qr-poster .qrbox { display: inline-block; background: #fff; padding: 16px; border-radius: 20px; margin: 22px 0; box-shadow: 0 0 60px rgba(245,210,122,0.35); }
.qr-poster .qrbox img, .qr-poster .qrbox canvas { display: block; width: 260px; height: 260px; }

@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-2, .qr-print { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .admin { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; overflow-x: auto; padding: 14px; gap: 10px; }
  .brand { padding: 0 8px 0 0; }
  .brand .bt, .brand .bs { display: none; }
  .nav { flex-direction: row; }
  .nav a span, .nav .sep { display: none; }
  .sidebar .bottom { margin: 0 0 0 auto; }
  .main { padding: 22px 16px 50px; }
  .stats { gap: 12px; }
  .stage { grid-template-columns: 1fr; }
}

@media print {
  body { background: #fff; }
  .sidebar, .no-print, #sky { display: none !important; }
  .admin { display: block; }
  .main { padding: 0; }
  .qr-print { display: block; }
  .qr-poster { -webkit-print-color-adjust: exact; print-color-adjust: exact; page-break-inside: avoid; margin: 0 auto; max-width: 560px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
