:root {
  /* Trang quản trị */
  --bg: #fff8f4;
  --panel: #ffffff;
  --panel-2: #fff9f5;
  --line: #f1e2d8;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #8391a7;
  --accent: #f37321;
  --accent-ink: #ffffff;
  --accent-soft: #fff0e6;
  --accent-text: #b04a07;
  --ok: #16a34a;
  --ok-soft: #e5f7ec;
  --warn: #b45309;
  --warn-soft: #fff4e0;
  --danger: #e11d48;
  --danger-soft: #ffe8ee;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 4px 16px rgba(15, 23, 42, .05);
  --shadow-lg: 0 20px 60px rgba(15, 23, 42, .25);
  --radius: 12px;
  --font: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  /* Màn hình quay: trắng + cam */
  --p: #f37321;
  --p-light: #fbc7a4;
  --p-soft: #fff0e6;
  --p-deep: #d85f10;
  --p-ink: #b04a07;
  --s-bg-1: #ffffff;
  --s-bg-2: #fff6f0;
  --s-bg-3: #ffe6d6;
  --s-text: #3b2216;
  --s-text-2: #8a6a5a;
  --s-line: rgba(243, 115, 33, .35);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); line-height: 1.45; }
body.on-stage { background: var(--s-bg-2); overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
a { color: var(--accent-text); }

/* =============================================================
   MÀN HÌNH QUAY (tông sáng: trắng + cam #f37321)
   ============================================================= */
.stage {
  position: fixed; inset: 0; color: var(--s-text); display: flex; flex-direction: column;
  background:
    radial-gradient(900px 520px at 50% 42%, #ffffff 0%, rgba(255, 255, 255, 0) 70%),
    linear-gradient(180deg, var(--s-bg-1) 0%, var(--s-bg-2) 60%, var(--s-bg-3) 100%);
  overflow: hidden;
}
.stage-bg { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.stage-bg i {
  position: absolute; bottom: -40px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--p-light); opacity: 0; box-shadow: 0 0 0 4px rgba(243, 115, 33, .12);
  animation: rise 11s linear infinite;
}
.stage-bg i:nth-child(1) { left: 6%; animation-delay: 0s; }
.stage-bg i:nth-child(2) { left: 18%; animation-delay: 3.5s; animation-duration: 13s; }
.stage-bg i:nth-child(3) { left: 31%; animation-delay: 7s; }
.stage-bg i:nth-child(4) { left: 47%; animation-delay: 1.5s; animation-duration: 14s; }
.stage-bg i:nth-child(5) { left: 62%; animation-delay: 5s; }
.stage-bg i:nth-child(6) { left: 75%; animation-delay: 9s; animation-duration: 12s; }
.stage-bg i:nth-child(7) { left: 88%; animation-delay: 2.5s; }
.stage-bg i:nth-child(8) { left: 95%; animation-delay: 6.5s; animation-duration: 15s; }
@keyframes rise {
  0% { transform: translateY(0) scale(.6); opacity: 0; }
  10% { opacity: .9; }
  90% { opacity: .5; }
  100% { transform: translateY(-110vh) scale(1.1); opacity: 0; }
}

.stage-head { position: relative; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 14px 24px 6px; gap: 16px; }
.stage-logo { justify-self: start; background: #fff; border-radius: 12px; padding: 8px 14px; box-shadow: 0 4px 16px rgba(216, 95, 16, .18); border: 1px solid var(--s-line); }
.stage-logo img { height: 32px; display: block; }
.stage-title { text-align: center; }
.stage-title h1 {
  margin: 0; font-size: clamp(26px, 3.6vw, 54px); font-weight: 900; letter-spacing: .02em; line-height: 1.1;
  background: linear-gradient(180deg, var(--p) 0%, var(--p-deep) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 rgba(255, 255, 255, .9)) drop-shadow(0 6px 14px rgba(216, 95, 16, .25));
}
.stage-title p { margin: 4px 0 0; color: var(--s-text-2); font-size: clamp(13px, 1.25vw, 18px); letter-spacing: .18em; text-transform: uppercase; font-weight: 600; }
.stage-tools { justify-self: end; display: flex; gap: 8px; }
.tool {
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--s-line); background: #fff;
  color: var(--p-ink); cursor: pointer; font-size: 18px; display: grid; place-items: center; transition: background .2s, transform .2s;
  box-shadow: 0 2px 8px rgba(216, 95, 16, .12);
}
.tool:hover { background: var(--p-soft); transform: translateY(-1px); }
.tool:focus-visible, .spin-btn:focus-visible, .prize-card:focus-visible { outline: 3px solid var(--p-deep); outline-offset: 3px; }

.stage-main {
  position: relative; flex: 1; min-height: 0; display: grid; gap: 20px; padding: 10px 24px 22px;
  grid-template-columns: minmax(240px, 300px) 1fr minmax(260px, 340px);
}
.panel {
  background: rgba(255, 255, 255, .88);
  border: 1px solid var(--s-line); border-radius: 18px; padding: 14px; display: flex; flex-direction: column; min-height: 0;
  backdrop-filter: blur(6px); box-shadow: 0 8px 28px rgba(216, 95, 16, .12);
}
.panel h2 { margin: 2px 4px 12px; font-size: 13px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--p-ink); display: flex; justify-content: space-between; align-items: center; }
.panel h2 b { color: var(--s-text); font-weight: 700; letter-spacing: 0; font-size: 13px; }

.prize-list { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; padding: 2px; margin: -2px; }
.prize-card {
  --c: var(--p);
  text-align: left; border: 1px solid #f3e3da; background: #fff; color: var(--s-text);
  border-radius: 14px; padding: 12px 14px; cursor: pointer; position: relative; overflow: hidden; transition: transform .15s, border-color .2s, background .2s;
}
.prize-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--c); }
.prize-card:hover { transform: translateX(2px); border-color: var(--p-light); }
.prize-card.active { background: linear-gradient(90deg, color-mix(in srgb, var(--c) 22%, #fff), #fff 85%); border-color: var(--p); box-shadow: 0 0 0 1px var(--p), 0 8px 22px rgba(216, 95, 16, .22); }
.prize-card.done { opacity: .6; }
.prize-card .pc-name { font-weight: 800; font-size: 16px; display: flex; justify-content: space-between; gap: 8px; }
.prize-card .pc-count { font-variant-numeric: tabular-nums; color: var(--p-ink); font-weight: 800; white-space: nowrap; }
.prize-card .pc-gift { font-size: 12.5px; color: var(--s-text-2); margin-top: 2px; }
.prize-card .pc-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chip { font-size: 11.5px; padding: 2px 8px; border-radius: 99px; background: #f5ede8; color: var(--s-text-2); white-space: nowrap; font-weight: 500; }
.chip.gold { background: var(--p-soft); color: var(--p-ink); }
.chip.done { background: #e5f7ec; color: #15803d; }
.prize-card .pc-bar { height: 5px; border-radius: 4px; background: #f5ede8; margin-top: 9px; overflow: hidden; }
.prize-card .pc-bar i { display: block; height: 100%; background: var(--c); border-radius: 4px; transition: width .6s; }

.center { display: flex; flex-direction: column; align-items: center; min-height: 0; min-width: 0; gap: 14px; }
.prize-hero { text-align: center; min-height: 64px; }
.prize-hero .ph-name { font-size: clamp(26px, 3vw, 46px); font-weight: 900; color: var(--p-deep); line-height: 1.1; text-shadow: 0 2px 0 #fff; }
.prize-hero .ph-gift { font-size: clamp(14px, 1.4vw, 20px); color: var(--s-text); margin-top: 4px; font-weight: 600; }
.prize-hero .ph-meta { font-size: 13px; color: var(--s-text-2); margin-top: 6px; }

/* ---------- Trang trí theo nhận diện Hanwha ---------- */
.stage-deco { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
/* Mảng cam cắt chéo như banner trên hanwha.vn */
.slash { position: absolute; background: linear-gradient(135deg, var(--p), var(--p-light)); }
.slash-a { right: -6vw; bottom: -12vh; width: 34vw; height: 46vh; clip-path: polygon(38% 0, 100% 0, 100% 100%, 0 100%); opacity: .35; }
.slash-b { left: -4vw; top: -10vh; width: 22vw; height: 30vh; clip-path: polygon(0 0, 100% 0, 62% 100%, 0 100%); opacity: .25; }
/* Biểu tượng ba vòng tròn Hanwha, mờ và xoay chậm */
.ring { position: absolute; opacity: .08; animation: ringSpin 80s linear infinite; }
.ring-a { width: 62vmin; right: -14vmin; top: 8vh; }
.ring-b { width: 40vmin; left: -12vmin; bottom: -8vmin; animation-direction: reverse; animation-duration: 110s; opacity: .06; }
@keyframes ringSpin { to { rotate: 360deg; } }

/* ---------- Ống quay ---------- */
.reels { flex: 1; min-height: 0; width: 100%; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 16px; align-content: center; overflow-y: auto; padding: 8px; scrollbar-width: thin; scrollbar-color: rgba(243, 115, 33, .5) transparent; }
.reel {
  --item-h: 76px; --rows: 5;
  position: relative; width: min(100%, 680px); height: calc(var(--item-h) * var(--rows));
  border-radius: 22px; overflow: hidden;
  background: #fff;
  box-shadow: 0 0 0 3px var(--p), 0 0 0 8px rgba(243, 115, 33, .18), 0 20px 50px rgba(216, 95, 16, .22);
}
.reels.multi .reel { --item-h: 54px; --rows: 3; width: min(100%, 256px); border-radius: 16px; }
.reels.multi.many .reel { --item-h: 50px; --rows: 1; width: min(100%, 230px); border-radius: 12px; }
.reels.multi.many .reel-band { left: 4px; right: 4px; border-radius: 10px; }
.reels.multi.many .reel-band::before, .reels.multi.many .reel-band::after { display: none; }
.reel-strip { position: absolute; left: 0; right: 0; top: 0; will-change: transform; }
.reel-item {
  height: var(--item-h); display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 0 18px; text-align: center; color: #b9a296;
}
.reel-item .n { font-weight: 800; font-size: calc(var(--item-h) * .4); line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.reel-item .d { font-size: calc(var(--item-h) * .19); opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.reels.multi .reel-item .d { display: none; }
.reel::before, .reel::after { content: ''; position: absolute; left: 0; right: 0; height: calc(var(--item-h) * (var(--rows) - 1) / 2); z-index: 2; pointer-events: none; }
.reel::before { top: 0; background: linear-gradient(180deg, rgba(255, 255, 255, .97), rgba(255, 255, 255, .45)); }
.reel::after { bottom: 0; background: linear-gradient(0deg, rgba(255, 255, 255, .97), rgba(255, 255, 255, .45)); }
.reel-band {
  position: absolute; left: 10px; right: 10px; top: 50%; height: var(--item-h); transform: translateY(-50%); z-index: 1;
  border-radius: 14px; border: 2px solid var(--p);
  background: linear-gradient(90deg, rgba(243, 115, 33, .08), rgba(243, 115, 33, .22), rgba(243, 115, 33, .08));
  box-shadow: 0 0 20px rgba(243, 115, 33, .3);
}
.reel-band::before, .reel-band::after { content: ''; position: absolute; top: 50%; transform: translateY(-50%); border: 10px solid transparent; }
.reel-band::before { left: -12px; border-left-color: var(--p); }
.reel-band::after { right: -12px; border-right-color: var(--p); }
.reel.won .reel-band { animation: bandPulse .9s ease-in-out 3; }
.reel-item.hit { color: var(--s-text-2); }
.reel-item.hit .n { color: var(--p-deep); }
@keyframes bandPulse { 50% { box-shadow: 0 0 44px rgba(243, 115, 33, .8); background: rgba(243, 115, 33, .3); } }
.reel-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--s-text-2); z-index: 3; font-size: 16px; }

/* ---------- Nút quay ---------- */
.controls { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.per-spin { display: flex; align-items: center; gap: 6px; color: var(--s-text-2); font-size: 13px; font-weight: 500; }
.per-spin span { margin-right: 4px; }
.per-spin input { width: 56px; text-align: center; border-radius: 10px; border: 1px solid var(--s-line); background: #fff; color: var(--s-text); padding: 5px 4px; font-weight: 700; }
.per-spin .step { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--s-line); background: #fff; color: var(--p-ink); cursor: pointer; font-size: 16px; }
.per-spin .step:hover { background: var(--p-soft); }
.spin-btn {
  position: relative; border: 0; cursor: pointer; padding: 0; border-radius: 999px;
  width: 260px; height: 76px; font-size: 30px; font-weight: 900; letter-spacing: .3em; color: #fff;
  background: linear-gradient(180deg, #f8955a 0%, var(--p) 45%, var(--p-deep) 100%);
  box-shadow: 0 6px 0 #b04a07, 0 14px 30px rgba(216, 95, 16, .35), inset 0 2px 0 rgba(255, 255, 255, .5);
  transition: transform .1s, box-shadow .1s, filter .2s;
}
.spin-btn span { padding-left: .3em; text-shadow: 0 2px 2px rgba(120, 45, 0, .45); }
.spin-btn:not(:disabled) { animation: breathe 2.2s ease-in-out infinite; }
.spin-btn:hover:not(:disabled) { filter: brightness(1.04); }
.spin-btn:active:not(:disabled) { transform: translateY(5px); box-shadow: 0 1px 0 #b04a07, 0 6px 14px rgba(216, 95, 16, .3), inset 0 2px 0 rgba(255, 255, 255, .5); }
.spin-btn:disabled { cursor: not-allowed; filter: grayscale(.6) opacity(.6); animation: none; }
@keyframes breathe { 50% { box-shadow: 0 6px 0 #b04a07, 0 14px 30px rgba(216, 95, 16, .35), 0 0 0 10px rgba(243, 115, 33, .18), inset 0 2px 0 rgba(255, 255, 255, .5); } }
.stage-msg { min-height: 20px; color: var(--s-text-2); font-size: 13.5px; text-align: center; }
.stage-msg a { color: var(--p-ink); }

/* ---------- Danh sách trúng ---------- */
.win-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; gap: 8px; }
.win-list li {
  display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center;
  padding: 9px 10px; border-radius: 12px; background: #fff; border: 1px solid #f3e3da;
}
.win-list li.win-empty::before { display: none; }
.win-list li::before { content: attr(data-n); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; background: var(--p); color: #fff; }
.win-list li.fresh { animation: fresh 1.8s ease-out; }
@keyframes fresh { 0% { background: var(--p-light); } 100% { background: #fff; transform: none; } }
.win-list .wn { font-weight: 700; line-height: 1.25; }
.win-list .wd { font-size: 12px; color: var(--s-text-2); }
.win-list .void-btn { border: 1px solid #ead9cf; background: #fff; color: var(--s-text-2); border-radius: 8px; font-size: 11.5px; padding: 3px 7px; cursor: pointer; }
.win-list .void-btn:hover { color: #be123c; border-color: #fda4af; background: #ffe8ee; }
.win-empty { color: var(--s-text-2); text-align: center; padding: 30px 10px; font-size: 13.5px; }

/* ---------- Công bố ---------- */
.reveal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(255, 241, 233, .82); backdrop-filter: blur(4px); animation: fadeIn .35s ease-out; padding: 16px; }
.reveal-rays {
  position: absolute; width: 160vmax; height: 160vmax; left: 50%; top: 50%; translate: -50% -50%; pointer-events: none;
  background: repeating-conic-gradient(from 0deg, rgba(243, 115, 33, .22) 0 8deg, transparent 8deg 20deg);
  mask-image: radial-gradient(circle, #000 0, transparent 55%); -webkit-mask-image: radial-gradient(circle, #000 0, transparent 55%);
  animation: spinRays 30s linear infinite;
}
@keyframes spinRays { to { rotate: 360deg; } }
.reveal-card {
  position: relative; text-align: center; color: var(--s-text); max-width: min(1100px, 100%); max-height: 100%; overflow-y: auto;
  padding: 34px clamp(20px, 4vw, 56px) 28px; border-radius: 28px;
  background: linear-gradient(180deg, var(--p-soft) 0%, #fff 45%);
  box-shadow: 0 0 0 3px var(--p), 0 0 0 10px rgba(243, 115, 33, .2), 0 30px 80px rgba(216, 95, 16, .3);
  animation: pop .7s cubic-bezier(.2, 1.4, .4, 1);
}
.reveal-emblem { width: 74px; height: 74px; display: block; margin: -6px auto 6px; filter: drop-shadow(0 4px 12px rgba(243, 115, 33, .45)); animation: pop .8s cubic-bezier(.2, 1.4, .4, 1) .1s both; }
.reveal-kicker { font-size: clamp(22px, 3vw, 40px); font-weight: 900; letter-spacing: .12em; color: var(--p-deep); }
.reveal-prize { font-size: clamp(16px, 1.7vw, 24px); margin-top: 6px; color: var(--s-text); }
.reveal-prize b { color: var(--p-ink); }
.reveal-people { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin: 24px 0 26px; }
.person {
  min-width: 240px; padding: 18px 22px; border-radius: 18px; background: #fff; border: 2px solid var(--p-light);
  box-shadow: 0 8px 22px rgba(216, 95, 16, .14);
  animation: pop .6s cubic-bezier(.2, 1.4, .4, 1) both;
}
.person .pn { font-size: clamp(30px, 4.4vw, 64px); font-weight: 900; line-height: 1.1; color: var(--s-text); }
.reveal-people.multi .person .pn { font-size: clamp(20px, 2.2vw, 30px); }
.person .pc { margin-top: 6px; font-size: clamp(14px, 1.4vw, 20px); color: var(--p-ink); font-weight: 700; }
.person .pd { font-size: clamp(13px, 1.2vw, 17px); color: var(--s-text-2); margin-top: 2px; }
.person .pv { margin-top: 10px; }
.person.voided { opacity: .45; text-decoration: line-through; }
.reveal-actions { display: flex; justify-content: center; gap: 10px; }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } }

#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 70; }

/* ---------- Màn hình hẹp ---------- */
@media (max-width: 1100px) {
  body.on-stage { overflow: auto; }
  .stage { position: relative; min-height: 100vh; overflow: visible; }
  .stage-main { grid-template-columns: minmax(0, 1fr); }
  .panel { min-width: 0; }
  .reels { flex: none; overflow: visible; }
  .center { order: -1; }
  .prize-list { flex-direction: row; overflow-x: auto; }
  .prize-card { min-width: 220px; }
  .win-list { max-height: 360px; }
  .reel { --item-h: 60px; }
}
@media (max-width: 640px) {
  .stage-head { grid-template-columns: 1fr auto; padding: 12px 16px 4px; }
  .stage-logo { display: none; }
  .stage-title { text-align: left; }
  .stage-main { padding: 8px 16px 16px; }
  .reel { --item-h: 52px; }
  .spin-btn { width: 200px; height: 64px; font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .stage-bg, .reveal-rays { display: none; }
  .ring { animation: none; }
  .spin-btn:not(:disabled) { animation: none; }
}

/* =============================================================
   NÚT / BIỂU MẪU CHUNG
   ============================================================= */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center; white-space: nowrap;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); background: var(--panel); color: var(--accent-text); border-radius: 9px; padding: 7px 13px;
  cursor: pointer; font-weight: 500; text-decoration: none; transition: background .15s, border-color .15s;
}
.btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { background: var(--p-deep); border-color: var(--p-deep); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 4px 9px; font-size: 12.5px; border-radius: 7px; }
.btn.gold { border: 0; background: linear-gradient(180deg, #f8955a, var(--p) 45%, var(--p-deep)); color: #fff; font-weight: 800; padding: 11px 28px; text-shadow: 0 1px 2px rgba(120, 45, 0, .45); font-size: 16px; border-radius: 99px; box-shadow: 0 4px 0 #b04a07; }
.btn.gold-ghost { background: #fff; border: 1px solid #ead9cf; color: var(--s-text-2); font-size: 12.5px; padding: 4px 10px; border-radius: 8px; }
.btn.gold-ghost:hover { color: #be123c; border-color: #fda4af; background: #ffe8ee; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

label.field { display: flex; flex-direction: column; gap: 5px; font-weight: 500; font-size: 13px; color: var(--text-2); }
input.in, select.in, textarea.in {
  border: 1px solid var(--line); background: var(--panel); border-radius: 9px; padding: 8px 11px; color: var(--text); font-size: 14px; width: 100%;
}
input.in:focus, select.in:focus, textarea.in:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); border-color: var(--accent); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent); }
.check small { display: block; color: var(--text-3); font-size: 12.5px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.err { color: var(--danger); font-size: 13px; margin-top: 10px; }
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }

/* ---------- Hộp thoại ---------- */
.modal { position: fixed; inset: 0; z-index: 100; background: rgba(2, 6, 23, .55); display: grid; place-items: center; padding: 16px; animation: fadeIn .15s; }
.modal-box { background: var(--panel); color: var(--text); width: min(560px, 100%); max-height: calc(100vh - 32px); border-radius: 16px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; }
.modal-box.wide { width: min(980px, 100%); }
.modal-box header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 10px; }
.modal-box h3 { margin: 0; font-size: 17px; }
.modal-box .x { border: 0; background: none; font-size: 24px; cursor: pointer; color: var(--text-3); line-height: 1; }
.modal-body { padding: 4px 20px 20px; overflow-y: auto; }
.login-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.login-head img { height: 34px; }
input.access-in { font-size: 24px; font-weight: 700; letter-spacing: .25em; text-align: center; padding: 12px; }

.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: #0f172a; color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 13.5px; animation: fadeIn .2s; }
.toast.error { background: #be123c; }
.toast.ok { background: #15803d; }

/* =============================================================
   TRANG QUẢN TRỊ
   ============================================================= */
.admin { min-height: 100vh; display: flex; flex-direction: column; }
.admin-top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line); box-shadow: var(--shadow);
}
.admin-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.admin-brand img { height: 28px; background: #fff; border-radius: 6px; padding: 2px 4px; }
.admin-nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.admin-nav a { padding: 7px 12px; border-radius: 8px; text-decoration: none; color: var(--text-2); font-weight: 500; }
.admin-nav a:hover { background: var(--panel-2); color: var(--text); }
.admin-nav a.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.admin-user { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.admin-user span { color: var(--text-2); font-size: 13px; }
.admin-main { padding: 22px 20px 60px; max-width: 1280px; width: 100%; margin: 0 auto; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h2 { margin: 0; font-size: 21px; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; }
.card h3 { margin: 0 0 12px; font-size: 15px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--text-2); font-size: 13px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th, table.t td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.t th { background: var(--panel-2); font-weight: 600; color: var(--text-2); font-size: 12.5px; white-space: nowrap; position: sticky; top: 0; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr:hover td { background: color-mix(in srgb, var(--panel-2) 70%, transparent); }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.t td.act, table.t td.nowrap { text-align: right; white-space: nowrap; }
table.t td.nowrap { text-align: left; }
table.t tr.off td { color: var(--text-3); }
table.t tr.void td { color: var(--text-3); text-decoration: line-through; }
table.t tr.void td.act, table.t tr.void td.keep { text-decoration: none; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--panel-2); color: var(--text-2); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--danger-soft); color: var(--danger); }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 8px; }
.drag { cursor: grab; color: var(--text-3); user-select: none; padding: 0 4px; }
tr.dragging td { opacity: .4; }
tr.drop-target td { box-shadow: inset 0 2px 0 var(--accent); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar .in { width: auto; min-width: 200px; }
.toolbar .grow { flex: 1; }

.dropzone {
  display: block; border: 2px dashed var(--line); border-radius: var(--radius); padding: 26px; text-align: center; cursor: pointer;
  background: var(--panel-2); transition: border-color .2s, background .2s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone b { color: var(--accent-text); }
.import-modes { display: flex; gap: 22px; flex-wrap: wrap; margin: 14px 0 4px; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 12px 0; }
.summary-grid div { background: var(--panel-2); border-radius: 10px; padding: 10px 12px; }
.summary-grid b { display: block; font-size: 20px; }
.summary-grid span { font-size: 12.5px; color: var(--text-2); }
.pw-box { font-family: ui-monospace, Consolas, monospace; font-size: 20px; letter-spacing: .05em; background: var(--panel-2); border: 1px dashed var(--line); border-radius: 10px; padding: 12px; text-align: center; margin: 10px 0; user-select: all; }
.group-title { display: flex; align-items: center; gap: 8px; margin: 20px 0 8px; font-size: 15px; }
.group-title:first-child { margin-top: 0; }

@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
  .admin-top { padding: 10px 16px; }
  .admin-main { padding: 16px 16px 50px; }
}

/* =============================================================
   GIẢI ĐẶC BIỆT – hiệu ứng bùng nổ
   ============================================================= */
/* Lúc quay: tối viền như đèn sân khấu, ống quay viền vàng rực */
.stage.grand-spin::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(55% 60% at 50% 52%, transparent 0 45%, rgba(70, 25, 0, .5) 100%);
  animation: fadeIn .6s ease-out;
}
.stage.grand-spin .reel { animation: grandGlow .7s ease-in-out infinite alternate; }
.stage.grand-spin .reel-band { border-color: #ffb000; background: linear-gradient(90deg, rgba(255, 215, 0, .12), rgba(255, 190, 0, .32), rgba(255, 215, 0, .12)); }
.stage.grand-spin .reel-band::before { border-left-color: #ffb000; }
.stage.grand-spin .reel-band::after { border-right-color: #ffb000; }
.stage.grand-spin .prize-hero .ph-name { animation: shimmerText 1.6s linear infinite; background: linear-gradient(90deg, var(--p-deep), #ffb000, #ffe066, #ffb000, var(--p-deep)); background-size: 200% auto; -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: none; }
@keyframes grandGlow {
  from { box-shadow: 0 0 0 3px #ffb000, 0 0 24px 4px rgba(255, 190, 0, .45), 0 20px 50px rgba(216, 95, 16, .25); }
  to { box-shadow: 0 0 0 5px #ffd700, 0 0 50px 16px rgba(255, 200, 0, .65), 0 0 110px 36px rgba(243, 115, 33, .4); }
}

/* Chữ tên giải phóng to trước khi quay */
.grand-intro { position: fixed; inset: 0; z-index: 65; display: grid; place-items: center; pointer-events: none; padding: 16px; text-align: center; }
.grand-intro span {
  font-size: clamp(44px, 9vw, 150px); font-weight: 900; letter-spacing: .04em; line-height: 1.05; text-transform: uppercase;
  background: linear-gradient(180deg, #fff6c2 0%, #ffd700 35%, #f37321 75%, #b04a07 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 #fff) drop-shadow(0 14px 30px rgba(150, 50, 0, .55));
  animation: introZoom 1.6s cubic-bezier(.2, 1.2, .3, 1) forwards;
}
@keyframes introZoom {
  0% { transform: scale(3.2); opacity: 0; }
  22% { transform: scale(1); opacity: 1; }
  78% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(.5); opacity: 0; }
}

/* Chớp sáng + rung khi trúng */
.fx-flash { position: fixed; inset: 0; z-index: 75; pointer-events: none; background: radial-gradient(circle at 50% 45%, #fff 0%, #fff7d1 45%, rgba(255, 215, 0, .25) 100%); animation: flashOut 1.1s ease-out forwards; }
@keyframes flashOut { 0% { opacity: 0; } 8% { opacity: 1; } 100% { opacity: 0; } }
.shake { animation: shake .8s cubic-bezier(.36, .07, .19, .97) both; }
@keyframes shake {
  10%, 90% { transform: translate(-2px, 1px); }
  20%, 80% { transform: translate(5px, -3px); }
  30%, 50%, 70% { transform: translate(-9px, 4px); }
  40%, 60% { transform: translate(9px, -4px); }
}

/* Thẻ công bố giải đặc biệt */
.reveal.grand { background: radial-gradient(circle at 50% 45%, rgba(255, 244, 214, .92) 0%, rgba(255, 200, 140, .85) 45%, rgba(110, 35, 0, .78) 100%); }
.reveal.grand .reveal-rays {
  background: repeating-conic-gradient(from 0deg, rgba(255, 215, 0, .5) 0 6deg, transparent 6deg 15deg);
  mask-image: radial-gradient(circle, #000 0, transparent 68%); -webkit-mask-image: radial-gradient(circle, #000 0, transparent 68%);
  animation-duration: 14s;
}
.reveal.grand .reveal-card {
  background: linear-gradient(180deg, #fff3cc 0%, #fff 55%);
  animation: pop .9s cubic-bezier(.2, 1.5, .4, 1), grandCard 1.4s ease-in-out .9s infinite alternate;
  box-shadow: 0 0 0 4px #ffd700, 0 0 0 12px rgba(255, 215, 0, .35), 0 0 70px 16px rgba(255, 190, 0, .5), 0 30px 80px rgba(110, 35, 0, .45);
}
@keyframes grandCard {
  to { box-shadow: 0 0 0 4px #ffd700, 0 0 0 16px rgba(255, 215, 0, .45), 0 0 120px 36px rgba(255, 200, 0, .7), 0 30px 80px rgba(110, 35, 0, .45); }
}
.reveal.grand .reveal-emblem { width: 100px; height: 100px; animation: pop .8s cubic-bezier(.2, 1.4, .4, 1) .1s both, ringSpin 8s linear .9s infinite; filter: drop-shadow(0 0 18px rgba(255, 200, 0, .8)); }
.reveal.grand .reveal-kicker {
  font-size: clamp(30px, 4.6vw, 68px);
  background: linear-gradient(90deg, var(--p-deep), #ffb000, #ffe680, #ffb000, var(--p-deep)); background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmerText 2s linear infinite;
}
.reveal.grand .reveal-prize { font-size: clamp(18px, 2vw, 30px); font-weight: 700; }
.reveal.grand .person { border-color: #ffd700; box-shadow: 0 0 0 2px #ffd700, 0 12px 40px rgba(255, 170, 0, .45); background: linear-gradient(180deg, #fffaf0, #fff); }
.reveal.grand .reveal-people:not(.multi) .person { padding: 24px 40px; }
.reveal.grand .reveal-people:not(.multi) .person .pn { font-size: clamp(42px, 6.4vw, 96px); color: var(--p-deep); }
@keyframes shimmerText { to { background-position: -200% center; } }

@media (prefers-reduced-motion: reduce) {
  .grand-intro { display: none; }
  .stage.grand-spin .reel, .reveal.grand .reveal-card, .reveal.grand .reveal-emblem, .reveal.grand .reveal-kicker, .stage.grand-spin .prize-hero .ph-name { animation: none; }
  .fx-flash { animation-duration: .4s; }
}

/* Mã truy cập theo giải */
.scope-note { margin-top: 4px; padding: 10px 12px; border-radius: 12px; background: var(--p-soft); color: var(--p-ink); font-size: 13px; line-height: 1.4; }
.code-chip { font-family: ui-monospace, Consolas, monospace; font-size: 13px; background: var(--accent-soft); color: var(--accent-text); padding: 2px 8px; border-radius: 6px; letter-spacing: .05em; }
