/* ĐẤU TRƯỜNG TRỰC TIẾP – giao diện người chơi & màn hình trình chiếu. Tông xanh trời đồng bộ trang Đấu trường. */
:root {
  --ink: #1f2a44; --ink2: #4b5878; --ink3: #8592ad; --line: #e3ebf7;
  --blue: #0284c7; --navy: #243b7a; --mint: #22c58b; --pink: #ff4f8b; --gold: #ffc23d; --violet: #8b5cf6;
  --c0: #e21b3c; --c1: #1368ce; --c2: #d89e00; --c3: #26890c;
  --shadow: 0 14px 30px -16px rgba(29, 78, 216, 0.4);
  --display: "Arial Rounded MT Bold", "Arial Black", system-ui, sans-serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { background: #eaf5ff; }
body { margin: 0; min-height: 100vh; font-family: var(--sans); color: var(--ink); background: linear-gradient(180deg, #dff0ff, #f5faff 50%, #eef6ff); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
[hidden] { display: none !important; }
a { color: inherit; }
button { font: inherit; }
.spin { width: 34px; height: 34px; border-radius: 50%; border: 4px solid #cfe5ff; border-top-color: var(--blue); animation: rot 0.9s linear infinite; display: inline-block; }
@keyframes rot { to { transform: rotate(360deg); } }
.lv-load { display: grid; place-items: center; min-height: 60vh; }

/* thanh trên */
.lv-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 14px; background: linear-gradient(90deg, #0369a1, #0284c7 55%, #0ea5e9); color: #fff; box-shadow: 0 6px 18px -10px rgba(3, 105, 161, 0.7); }
.lv-brand { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.lv-brand img { width: 34px; height: 34px; border-radius: 10px; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.7); }
.lv-brand b { font-family: "Arial Black", var(--display); letter-spacing: 0.04em; font-size: 1rem; background: linear-gradient(180deg, #fffbe6, #ffe27a 45%, #ffb703); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 2px 0 rgba(2, 62, 110, 0.55)); }
.lv-me { display: flex; align-items: center; gap: 8px; font-weight: 800; }
.lv-me .sc { padding: 5px 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.18); border: 1.5px solid rgba(255, 255, 255, 0.5); font-variant-numeric: tabular-nums; }
.lv-me .av { font-size: 1.4rem; }

main { max-width: 980px; margin: 0 auto; padding: 16px 14px 40px; }
.card { background: #fff; border: 2px solid var(--line); border-radius: 26px; padding: 22px; box-shadow: var(--shadow); }
.center { text-align: center; }
h1, h2 { font-family: var(--display); color: var(--navy); margin: 0 0 8px; line-height: 1.15; }
h1 { font-size: clamp(1.6rem, 5vw, 2.4rem); }
.muted { color: var(--ink2); } .faint { color: var(--ink3); } .small { font-size: 0.9rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 999px; padding: 14px 24px; font-weight: 900; font-size: 1.05rem; cursor: pointer; text-decoration: none; transition: transform 0.12s, filter 0.15s; }
.btn:active { transform: scale(0.96); }
.btn-go { background: linear-gradient(135deg, #ff8fb4, #ff3d7f 55%, #be123c); color: #fff; box-shadow: 0 12px 24px -12px rgba(190, 18, 60, 0.9); }
.btn-blue { background: linear-gradient(135deg, #38bdf8, #0284c7); color: #fff; box-shadow: 0 12px 24px -12px rgba(2, 132, 199, 0.9); }
.btn-white { background: #fff; color: var(--navy); border: 2px solid var(--line); }
.btn:disabled { opacity: 0.5; cursor: default; }

/* nhập mã & tên */
.pin-in { width: 100%; max-width: 360px; margin: 14px auto; display: block; text-align: center; font: 900 2.2rem/1 var(--display); letter-spacing: 0.18em; padding: 14px; border-radius: 20px; border: 3px solid #bfdbfe; color: var(--navy); background: #f8fbff; }
.pin-in:focus, .name-in:focus { outline: none; border-color: var(--blue); }
.name-in { width: 100%; max-width: 420px; margin: 12px auto; display: block; text-align: center; font: 800 1.3rem var(--sans); padding: 14px; border-radius: 18px; border: 3px solid #bfdbfe; color: var(--ink); }
.avs { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 12px auto; max-width: 520px; }
.avs button { width: 48px; height: 48px; border-radius: 14px; border: 2px solid var(--line); background: #f8fbff; font-size: 1.6rem; cursor: pointer; }
.avs button.on { border-color: var(--pink); background: #ffe4ee; transform: scale(1.1); }
.rooms { display: grid; gap: 10px; margin-top: 14px; }
.room-it { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 18px; background: #f8fbff; border: 2px solid var(--line); text-decoration: none; }
.room-it b { display: block; } .room-it small { color: var(--ink3); }
.room-it .go { margin-left: auto; padding: 8px 14px; border-radius: 999px; background: var(--blue); color: #fff; font-weight: 800; white-space: nowrap; }
.live-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #ef4444; margin-right: 6px; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: 0.25; } }

/* phòng chờ */
.lobby-head { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; }
.pinbox { text-align: center; padding: 10px 18px; border-radius: 18px; background: #eef7ff; border: 2px dashed #93c5fd; }
.pinbox small { display: block; color: var(--ink2); font-weight: 700; }
.pinbox b { font: 900 2rem/1.1 var(--display); letter-spacing: 0.12em; color: var(--navy); }
.players { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 16px; }
.pl { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; background: #fff; border: 2px solid var(--line); font-weight: 800; animation: pop 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.4) both; }
.pl.me { border-color: var(--pink); background: #fff0f5; }
.pl span { font-size: 1.3rem; }
@keyframes pop { from { opacity: 0; transform: scale(0.6); } }
.reactbar { display: flex; justify-content: center; gap: 8px; margin-top: 16px; }
.reactbar button { width: 48px; height: 48px; border-radius: 50%; border: 2px solid var(--line); background: #fff; font-size: 1.4rem; cursor: pointer; }
.react-layer { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
.fly { position: absolute; bottom: -40px; font-size: 2rem; animation: fly 3.2s ease-out forwards; }
.fly small { display: block; font-size: 0.65rem; font-weight: 800; color: var(--navy); text-align: center; background: rgba(255, 255, 255, 0.8); border-radius: 8px; padding: 0 4px; }
@keyframes fly { to { transform: translateY(-75vh); opacity: 0; } }

/* đếm ngược */
.count { display: grid; place-items: center; min-height: 60vh; text-align: center; }
.count b { font: 900 clamp(5rem, 22vw, 10rem)/1 var(--display); color: var(--blue); animation: zoom 1s ease-out infinite; }
@keyframes zoom { from { transform: scale(1.4); opacity: 0.3; } }

/* câu hỏi */
.qhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; font-weight: 800; color: var(--ink2); }
.ring { --p: 1; position: relative; width: 58px; height: 58px; border-radius: 50%; background: conic-gradient(var(--rc, var(--blue)) calc(var(--p) * 360deg), #e5edf8 0); display: grid; place-items: center; flex: none; }
.ring::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: #fff; }
.ring b { position: relative; font: 900 1.3rem var(--display); color: var(--navy); }
.qtext { background: #fff; border: 2px solid var(--line); border-radius: 22px; padding: 18px; font-size: clamp(1.15rem, 3.4vw, 1.6rem); font-weight: 800; text-align: center; box-shadow: var(--shadow); margin-bottom: 14px; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opt { position: relative; display: flex; align-items: center; gap: 12px; min-height: 84px; padding: 14px 16px; border: 0; border-radius: 18px; color: #fff; font-weight: 800; font-size: 1.08rem; text-align: left; cursor: pointer; box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.18); transition: transform 0.12s, opacity 0.2s; }
.opt:active { transform: scale(0.97); }
.opt i { font-style: normal; font-size: 1.5rem; flex: none; }
.opt.o0 { background: var(--c0); } .opt.o1 { background: var(--c1); } .opt.o2 { background: var(--c2); } .opt.o3 { background: var(--c3); }
.opt.dim { opacity: 0.25; }
.opt.gone { visibility: hidden; }
.opt.right { box-shadow: 0 0 0 5px #fff, 0 0 0 9px var(--mint); }
.opt .cnt { margin-left: auto; padding: 2px 10px; border-radius: 999px; background: rgba(0, 0, 0, 0.22); font-variant-numeric: tabular-nums; }
.powers { display: flex; justify-content: center; gap: 10px; margin-top: 12px; }
.powers button { padding: 10px 16px; border-radius: 999px; border: 2px solid #e9d5ff; background: #faf5ff; color: #6d28d9; font-weight: 900; cursor: pointer; }
.powers button.on { background: #7c3aed; color: #fff; }
.waiting { text-align: center; padding: 22px; }
.waiting b { display: block; font-size: 1.3rem; margin-bottom: 6px; }

/* kết quả câu */
.res { text-align: center; padding: 26px 16px; border-radius: 26px; color: #fff; box-shadow: var(--shadow); animation: pop 0.3s both; }
.res.ok { background: linear-gradient(135deg, #34d399, #059669); }
.res.no { background: linear-gradient(135deg, #fb7185, #e11d48); }
.res.miss { background: linear-gradient(135deg, #94a3b8, #475569); }
.res h2 { color: #fff; font-size: 2rem; }
.res .pts { font: 900 2.6rem var(--display); }
.res .sub { opacity: 0.95; font-weight: 700; }
.rankline { margin-top: 12px; display: inline-block; padding: 8px 16px; border-radius: 999px; background: rgba(255, 255, 255, 0.22); font-weight: 800; }
.expl { margin-top: 12px; padding: 12px 14px; border-radius: 16px; background: #fffaf0; border: 2px dashed #ffd98a; color: var(--ink2); }

/* bảng xếp hạng & cuộc đua */
.board { display: grid; gap: 8px; margin-top: 12px; }
.brow { position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 16px; background: #fff; border: 2px solid var(--line); overflow: hidden; animation: slide 0.4s both; }
.brow.me { border-color: var(--pink); background: #fff0f5; }
.brow .bar { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, rgba(56, 189, 248, 0.18), rgba(139, 92, 246, 0.14)); z-index: 0; transition: width 0.6s; }
.brow > * { position: relative; z-index: 1; }
.brow .rk { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #eef2f8; font-weight: 900; flex: none; }
.brow .nm { flex: 1; min-width: 0; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brow .nm small { color: var(--ink3); font-weight: 600; margin-left: 6px; }
.brow .sc { font: 900 1.05rem var(--display); color: var(--blue); font-variant-numeric: tabular-nums; }
@keyframes slide { from { opacity: 0; transform: translateX(-20px); } }
.race { background: #fff; border: 2px solid var(--line); border-radius: 18px; padding: 10px 12px; margin-bottom: 12px; }
.race h3 { margin: 0 0 6px; font-size: 0.9rem; color: var(--ink2); }
.lane { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; font-weight: 700; margin: 4px 0; }
.lane .nm { width: 84px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lane .track { flex: 1; height: 10px; border-radius: 10px; background: #eef2f8; position: relative; }
.lane .track i { position: absolute; top: 50%; transform: translate(-50%, -50%); font-style: normal; font-size: 1.2rem; transition: left 0.6s; }
.lane.me .nm { color: var(--pink); }

/* bục vinh danh */
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 10px; align-items: end; max-width: 640px; margin: 18px auto; }
.pd { text-align: center; animation: rise 0.8s cubic-bezier(0.2, 0.9, 0.3, 1.2) both; }
.pd.p1 { animation-delay: 0.6s; } .pd.p2 { animation-delay: 0.3s; }
@keyframes rise { from { opacity: 0; transform: translateY(60px); } }
.pd .av { font-size: 2.6rem; }
.pd b { display: block; } .pd small { color: var(--ink2); font-weight: 700; }
.pd .bar { margin-top: 6px; border-radius: 18px 18px 8px 8px; color: #fff; font: 900 1.6rem var(--display); padding-top: 10px; }
.pd.p1 .bar { height: 150px; background: linear-gradient(180deg, #ffd23d, #ff9f1c); }
.pd.p2 .bar { height: 110px; background: linear-gradient(180deg, #7dd3fc, #38bdf8); }
.pd.p3 .bar { height: 80px; background: linear-gradient(180deg, #fda4af, #ff4f8b); }
.confetti { position: fixed; top: -12px; width: 10px; height: 14px; border-radius: 3px; z-index: 60; pointer-events: none; animation: fall 2s ease-in forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); } }

/* màn hình trình chiếu (người tổ chức) */
body.host main { max-width: 1280px; }
.host-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.host-join { display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: center; }
.qr { width: 200px; height: 200px; padding: 10px; background: #fff; border-radius: 18px; border: 2px solid var(--line); }
.qr svg { width: 100%; height: 100%; }
.host-join .pinbox b { font-size: clamp(2.6rem, 7vw, 4.6rem); }
.host-q .qtext { font-size: clamp(1.4rem, 3.2vw, 2.4rem); padding: 26px; }
.host-q .opt { min-height: 110px; font-size: 1.35rem; }
.dist { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; align-items: end; height: 200px; margin: 14px 0; }
.dist div { border-radius: 14px 14px 6px 6px; color: #fff; font: 900 1.4rem var(--display); display: flex; align-items: flex-start; justify-content: center; padding-top: 8px; min-height: 40px; transition: height 0.6s; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 12px 18px; border-radius: 16px; background: var(--navy); color: #fff; font-weight: 700; transition: 0.25s; z-index: 80; max-width: 90vw; text-align: center; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 640px) {
  main { padding: 12px 10px 30px; }
  .card { padding: 16px; border-radius: 22px; }
  .opts { gap: 8px; }
  .opt { min-height: 72px; font-size: 1rem; padding: 12px; }
  .lobby-head, .host-join { grid-template-columns: 1fr; text-align: center; }
  .qr { margin: 0 auto; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.lv-me .sc { white-space: nowrap; }
.lv-brand b { white-space: nowrap; }
@media (max-width: 460px) { .lv-brand b { font-size: 0.8rem; letter-spacing: 0.02em; } .lv-brand img { width: 30px; height: 30px; } .lv-me .sc { padding: 4px 9px; font-size: 0.85rem; } .lv-me .av { font-size: 1.15rem; } }
@media (max-width: 370px) { .lv-brand b span { display: none; } }
/* Nhận mã qua Zalo OA */
.btn-zalo { background: linear-gradient(135deg, #3b9bff, #0068ff); color: #fff; box-shadow: 0 10px 22px -10px rgba(0, 104, 255, 0.9); }
.zl { background: #fff; color: #0068ff; font-weight: 900; font-size: 0.72rem; padding: 3px 6px; border-radius: 6px; }
.entry-acts { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.or { display: flex; align-items: center; gap: 10px; margin: 16px 0 12px; color: #94a3b8; font-weight: 700; font-size: 0.85rem; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: #e2e8f0; }
.zok { margin: 12px 0 0; padding: 8px 12px; border-radius: 12px; background: #ecfdf5; color: #047857; font-weight: 700; font-size: 0.92rem; }
.host-zalo { margin: 10px 0 0; font-weight: 700; color: #0068ff; }
button.room-it { width: 100%; font: inherit; text-align: left; cursor: pointer; }
p .btn-zalo { padding: 8px 14px; font-size: 0.9rem; margin-left: 4px; }
.scope-tag{display:inline-block;margin:8px 0 4px;padding:6px 12px;border-radius:999px;background:#e0f2fe;color:#0369a1;font-weight:800;font-size:.9rem}
