/* Mini Hackathon AI20K · phong cách pixel tự thiết kế. Biến màu ở assets/palette.css. */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--text);
  background:
    linear-gradient(var(--bg-sky) 0 120px, color-mix(in srgb, var(--bg-sky) 55%, var(--bg)) 120px 168px, var(--bg) 168px);
  background-color: var(--bg);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
img.px-img { image-rendering: pixelated; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: .01em; }
h1 { font-size: clamp(1.35rem, 4vw, 1.9rem); }
h2 { font-size: 1.15rem; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; background: var(--surface-2); padding: 0 .3em; border-radius: 2px; }
pre { background: var(--surface-2); padding: .75rem; overflow-x: auto; box-shadow: 0 0 0 2px var(--border); font-size: .85rem; }
pre code { background: none; padding: 0; }
.muted { color: var(--text-muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 0; z-index: 99; background: var(--accent-2); color: #2a1a12; padding: .5rem 1rem; }
.skip-link:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--px-orange); outline-offset: 2px; }

/* ---------------- HUD */
.hud {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .5rem 1rem; flex-wrap: wrap;
  padding: .4rem 1rem; background: var(--px-red); color: #fff3c4;
  box-shadow: 0 3px 0 var(--px-red-dark), 0 6px 0 var(--shadow);
}
.hud-logo { display: flex; align-items: center; gap: .4rem; color: inherit; text-decoration: none; font-weight: 800; letter-spacing: .06em; }
.hud-logo b { color: var(--px-yellow); }
.hud-clock { display: flex; align-items: center; gap: .4rem; background: #2a1a12; color: var(--px-yellow); padding: .15rem .6rem; box-shadow: 0 0 0 2px #000; font-size: .85rem; }
.hud-clock b { font-family: ui-monospace, Menlo, monospace; font-size: 1rem; letter-spacing: .05em; }
.hud-nav { display: flex; gap: .25rem; flex-wrap: wrap; margin-left: auto; }
.hud-nav a { color: #fff3c4; text-decoration: none; padding: .3rem .6rem; font-weight: 700; font-size: .92rem; }
.hud-nav a:hover { background: var(--px-red-dark); }
.hud-nav a.active { background: var(--px-yellow); color: #2a1a12; box-shadow: 0 0 0 2px #2a1a12; }
.hud-tools { display: flex; gap: .25rem; }
.icon-btn { background: transparent; border: 2px solid currentColor; color: inherit; width: 2.2rem; height: 2.2rem; font-size: 1rem; cursor: pointer; padding: 0; line-height: 1; }
.icon-btn:hover { background: rgba(0,0,0,.2); }
.mock-banner, .net-banner { text-align: center; font-size: .8rem; padding: .25rem 1rem; background: var(--px-purple); color: #fff; font-weight: 700; letter-spacing: .04em; }
.net-banner { background: var(--px-orange); color: #2a1a12; }
.btn-link { background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; }

/* ---------------- khung chung */
main { max-width: 1120px; margin: 0 auto; padding: 1rem 1rem 3rem; outline: none; }
.screen { animation: pop .25s steps(3); }
@keyframes pop { from { transform: translateY(6px); opacity: .4; } }
.panel {
  background: var(--surface); padding: 1.1rem 1.2rem; margin: 0 0 1.4rem;
  box-shadow: var(--px-box);
}
.panel.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.4rem; }
@media (max-width: 820px) { .grid-2 { grid-template-columns: 1fr; } }
.notice { background: var(--surface-2); padding: .6rem .8rem; box-shadow: 0 0 0 2px var(--border); margin: .5rem 0 1rem; }
.warn-box { background: #fff1c2; color: #5a3a00; padding: .5rem .7rem; box-shadow: 0 0 0 2px #c99700; }
:root[data-theme="dark"] .warn-box { background: #3a2c05; color: #ffe97a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .warn-box { background: #3a2c05; color: #ffe97a; } }
.foot { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 1rem; font-size: .8rem; color: var(--text-muted); max-width: 1120px; margin: 0 auto; }

/* ---------------- nút */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem; min-height: 44px;
  padding: .45rem 1rem; font: inherit; font-weight: 800; cursor: pointer; text-decoration: none;
  background: var(--surface-2); color: var(--text); border: 0;
  box-shadow: inset -3px -3px 0 rgba(0,0,0,.18), 0 0 0 3px var(--border), 3px 3px 0 3px var(--shadow);
  transition: transform .05s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translate(2px, 2px); box-shadow: inset 3px 3px 0 rgba(0,0,0,.18), 0 0 0 3px var(--border), 1px 1px 0 3px var(--shadow); }
.btn[disabled] { filter: grayscale(1); opacity: .55; cursor: not-allowed; transform: none; }
.btn-yellow { background: var(--px-yellow); color: #2a1a12; }
.btn-green { background: var(--px-green); color: #fff; }
.btn-red { background: var(--px-red); color: #fff; }
.btn-ghost { background: transparent; }
.btn-big { font-size: 1.1rem; padding: .6rem 1.4rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: .8rem; }

/* ---------------- tab */
.tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin: .4rem 0 1rem; }
.tab { font: inherit; font-weight: 700; padding: .4rem .8rem; min-height: 40px; cursor: pointer; background: var(--surface-2); color: var(--text); border: 0; box-shadow: 0 0 0 2px var(--border); }
.tab[aria-selected="true"] { background: var(--px-yellow); color: #2a1a12; box-shadow: 0 0 0 3px var(--border), 3px 3px 0 3px var(--shadow); }

/* ---------------- form */
.form { display: grid; gap: .8rem; }
.form label, .field > label { display: grid; gap: .25rem; font-weight: 700; font-size: .95rem; }
.field { display: grid; gap: .25rem; }
.field-check label { display: flex; gap: .5rem; align-items: flex-start; }
.field-check input { width: 1.3rem; height: 1.3rem; margin-top: .1rem; flex: none; }
input, select, textarea {
  font: inherit; font-weight: 400; color: var(--text); background: var(--bg); border: 0; padding: .55rem .65rem; min-height: 44px; width: 100%;
  box-shadow: inset 2px 2px 0 rgba(0,0,0,.12), 0 0 0 2px var(--border);
}
input[type=radio], input[type=checkbox] { width: auto; min-height: 0; box-shadow: none; accent-color: var(--px-red); }
textarea { resize: vertical; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 700; margin-bottom: .3rem; }
.inline-radios { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
.inline-radios legend { width: 100%; }
.inline-radios label { display: flex; gap: .4rem; align-items: center; font-weight: 700; }
.inline-form { grid-template-columns: 1fr auto; align-items: end; }
.inline-form .form-msg { grid-column: 1 / -1; }
@media (max-width: 480px) { .inline-form { grid-template-columns: 1fr; } }
.hint { font-size: .82rem; color: var(--text-muted); font-weight: 400; }
.req { color: var(--accent); }
.form-msg { margin: 0; min-height: 1.2em; font-weight: 700; }
.form-msg.bad { color: var(--accent); }
.form-msg.ok { color: var(--px-green); }

/* ---------------- avatar */
.avatar-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; margin: 1rem 0; }
.avatar-grid.small { grid-template-columns: repeat(4, 1fr); margin: .3rem 0; }
@media (min-width: 700px) { .avatar-grid { grid-template-columns: repeat(8, 1fr); } }
.avatar-opt { position: relative; cursor: pointer; }
.avatar-opt input { position: absolute; opacity: 0; }
.avatar-card { display: flex; flex-direction: column; align-items: center; gap: .2rem; padding: .5rem .2rem; background: var(--surface-2); box-shadow: 0 0 0 2px var(--border); text-align: center; }
.avatar-card img { width: 64px; height: 64px; }
.avatar-grid.small .avatar-card img { width: 48px; height: 48px; }
.avatar-name { font-size: .72rem; font-weight: 700; line-height: 1.2; }
.avatar-opt input:checked + .avatar-card { background: var(--px-yellow); color: #2a1a12; box-shadow: 0 0 0 3px var(--border), 3px 3px 0 3px var(--shadow); }
.avatar-opt input:checked + .avatar-card img { animation: px-bob .6s steps(2) infinite; }
.avatar-opt input:focus-visible + .avatar-card { outline: 3px solid var(--px-orange); outline-offset: 2px; }

/* ---------------- cánh cửa */
.door-wrap { display: flex; flex-direction: column; align-items: center; gap: 1rem; margin-top: 1rem; }
.door { position: relative; width: 128px; height: 160px; }
.door-img { width: 128px; height: 160px; }
.door-hero { position: absolute; left: 32px; bottom: -6px; width: 64px; height: 64px; transition: transform 1s steps(8), opacity .3s 1s; }
.door.walking .door-hero { transform: translateY(-40px) scale(.55); opacity: 0; }

/* ---------------- story */
.screen-story { animation: none; }
body[data-screen="story"] main, body[data-screen="avatar"] main { max-width: 900px; }
.story-stage { position: relative; background: var(--px-night); color: #fff3c4; box-shadow: var(--px-box); overflow: hidden; }
.story-scene { position: relative; height: clamp(220px, 52vw, 420px); overflow: hidden; background: #1c1440; }
.story-scene .sc-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.story-scene .sc-layer { position: absolute; image-rendering: pixelated; }
.story-scene .sc-title { position: absolute; left: 0; right: 0; top: 10%; text-align: center; font-weight: 900; font-size: clamp(1.4rem, 5vw, 2.6rem); color: var(--px-yellow); text-shadow: 3px 3px 0 #2a1a12, -2px -2px 0 #2a1a12, 2px -2px 0 #2a1a12, -2px 2px 0 #2a1a12; letter-spacing: .04em; }
.story-scene .sc-sub { position: absolute; left: 0; right: 0; top: calc(10% + 3.2rem); text-align: center; font-weight: 800; color: #fff3c4; text-shadow: 2px 2px 0 #2a1a12; }
.sc-stars { position: absolute; inset: 0; background-image: radial-gradient(#fff 1px, transparent 1.5px), radial-gradient(#ffe97a 1px, transparent 1.5px); background-size: 37px 41px, 53px 59px; background-position: 0 0, 19px 23px; opacity: .6; }
.sc-ground { position: absolute; left: 0; right: 0; bottom: 0; height: 22%; background: repeating-linear-gradient(90deg, #2e9e5b 0 16px, #1e6b3c 16px 32px); box-shadow: inset 0 6px 0 #7cdb8a; }
.sc-walk { animation: walk 6s steps(24) infinite; }
@keyframes walk { from { transform: translateX(-20vw); } to { transform: translateX(110vw); } }
.sc-float { animation: px-bob 1s steps(2) infinite; }
.no-motion .sc-walk, .no-motion .sc-float, .no-motion .px-bob, .no-motion .avatar-opt input:checked + .avatar-card img { animation: none !important; }
.no-motion .screen { animation: none; }
.story-box { padding: 1rem 1.2rem 1.1rem; border-top: 4px solid #000; background: #241a33; }
.story-text { min-height: 4.8em; margin: 0 0 .8rem; font-size: clamp(1rem, 2.6vw, 1.2rem); font-weight: 600; line-height: 1.6; }
.story-text::after { content: "▌"; color: var(--px-yellow); animation: blink 1s steps(2) infinite; }
.story-text.done::after { content: " ▼"; }
@keyframes blink { 50% { opacity: 0; } }
.story-ctrl { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.story-ctrl .btn { color: #fff3c4; box-shadow: 0 0 0 3px #000, 3px 3px 0 3px rgba(0,0,0,.5); }
.story-ctrl .btn-yellow { color: #2a1a12; margin-left: auto; }
.story-dots { display: flex; gap: 6px; }
.story-dots i { width: 10px; height: 10px; background: #5b4a7a; display: block; }
.story-dots i.on { background: var(--px-yellow); }

/* ---------------- sảnh cổng */
.gate-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem .8rem; margin: 1.2rem 0; }
@media (min-width: 760px) { .gate-row { grid-template-columns: repeat(6, 1fr); } }
.gate { display: flex; flex-direction: column; align-items: center; gap: .3rem; background: none; border: 0; cursor: pointer; color: var(--text); font: inherit; padding: .4rem; }
.gate img { width: 96px; height: 128px; transition: transform .1s steps(2); }
.gate:hover img, .gate:focus-visible img { transform: translateY(-6px); filter: drop-shadow(0 0 6px var(--px-yellow)); }
.gate b { font-size: 1rem; }
.gate .small { line-height: 1.2; text-align: center; }
.gate .gate-count { font-size: .75rem; color: var(--text-muted); }
.hall-next { display: flex; gap: .8rem; flex-wrap: wrap; justify-content: center; }

/* ---------------- dialog */
.dlg { width: min(860px, calc(100vw - 16px)); max-height: calc(100vh - 32px); padding: 0; border: 0; background: var(--surface); color: var(--text); box-shadow: 0 0 0 4px var(--border), 8px 8px 0 4px var(--shadow); }
.dlg::backdrop { background: rgba(18, 13, 31, .72); }
.dlg-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: .6rem; padding: .7rem 1rem; background: var(--px-yellow); color: #2a1a12; border-bottom: 4px solid var(--border); }
.dlg-head h2 { margin: 0; flex: 1; font-size: 1.15rem; }
.dlg-close { color: #2a1a12; }
.dlg-body { padding: 1rem 1.2rem 1.4rem; overflow-y: auto; max-height: calc(100vh - 110px); }
.dlg.track-a .dlg-head { background: var(--track-a); color: #fff; } .dlg.track-b .dlg-head { background: var(--track-b); color: #fff; }
.dlg.track-c .dlg-head { background: var(--track-c); color: #fff; } .dlg.track-d .dlg-head { background: var(--track-d); }
.dlg.track-e .dlg-head { background: var(--track-e); color: #fff; } .dlg.track-f .dlg-head { background: var(--track-f); color: #fff; }
.dlg[class*="track-"] .dlg-close { color: inherit; }

/* track content */
.trk-hero { display: flex; gap: 1rem; align-items: center; margin-bottom: .6rem; }
.trk-hero img { width: 96px; height: 128px; flex: none; }
.trk-block { margin: 0 0 1rem; }
.trk-block h3 { font-size: 1rem; margin: 0 0 .3rem; color: var(--accent); }
.trk-block p { margin: .2rem 0 .5rem; }
.trk-block ul, .trk-block ol { margin: .2rem 0 .5rem; padding-left: 1.3rem; }
.trk-dir { box-shadow: 0 0 0 2px var(--border); margin: 0 0 .8rem; background: var(--bg); }
.trk-dir > summary { cursor: pointer; padding: .6rem .8rem; font-weight: 800; list-style: none; display: flex; gap: .5rem; align-items: center; }
.trk-dir > summary::-webkit-details-marker { display: none; }
.trk-dir > summary::before { content: "▶"; font-size: .75rem; transition: transform .1s; }
.trk-dir[open] > summary::before { transform: rotate(90deg); }
.trk-dir > div { padding: 0 .9rem .5rem; }
.trk-slice { background: var(--surface-2); padding: .5rem .7rem; box-shadow: inset 4px 0 0 var(--px-yellow); }
.trk-note { background: var(--surface-2); padding: .5rem .7rem; font-size: .92rem; }
.md-table { border-collapse: collapse; font-size: .85rem; margin: .4rem 0; }
.md-table th, .md-table td { border: 1px solid var(--border); padding: .3rem .45rem; text-align: left; vertical-align: top; }
.trk-foot { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: 1rem; }

/* ---------------- trang chủ */
.home-hero { display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: center; }
.hero-map { width: 320px; height: 160px; box-shadow: 0 0 0 3px var(--border); }
@media (max-width: 760px) { .home-hero { grid-template-columns: 1fr; } .hero-map { width: 100%; height: auto; } }
.big-clock { display: grid; gap: .15rem; margin: .8rem 0 .2rem; background: #2a1a12; color: var(--px-yellow); padding: .7rem 1rem; box-shadow: 0 0 0 3px #000, 4px 4px 0 3px var(--shadow); max-width: 460px; }
.big-clock-label { font-size: .85rem; color: #fff3c4; font-weight: 700; }
.big-clock-time { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: clamp(2.2rem, 9vw, 3.4rem); font-weight: 800; letter-spacing: .06em; line-height: 1.1; }
.big-clock-time.urgent { color: #ff5a6e; animation: blink 1s steps(2) infinite; }
.no-motion .big-clock-time.urgent { animation: none; }
.big-clock-sub { font-size: .85rem; color: #b9a9d6; }
.cp-list { list-style: none; padding: 0; margin: 0 0 .6rem; display: grid; gap: .5rem; }
.cp-item { display: grid; grid-template-columns: 32px 1fr auto; gap: .7rem; align-items: center; padding: .45rem .6rem; background: var(--bg); box-shadow: 0 0 0 2px var(--border); }
.cp-item img { width: 32px; height: 32px; }
.cp-item.past { opacity: .65; }
.cp-item.next { background: var(--px-yellow); color: #2a1a12; box-shadow: 0 0 0 3px var(--border), 3px 3px 0 3px var(--shadow); }
.cp-count { text-align: right; line-height: 1.1; }
.cp-count b { font-size: 1.3rem; display: block; }
.feed { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; max-height: 420px; overflow-y: auto; }
.feed-item { display: grid; grid-template-columns: 1.6rem 1fr auto; gap: .4rem; align-items: baseline; padding: .3rem .4rem; background: var(--bg); font-size: .92rem; }
.feed-item b { word-break: break-word; }
.feed-time { font-size: .75rem; color: var(--text-muted); white-space: nowrap; }
.feed-first_blood { box-shadow: inset 4px 0 0 var(--state-first-blood); }
.feed-spin { box-shadow: inset 4px 0 0 var(--px-yellow); }
.table-wrap { overflow-x: auto; }
.lb { width: 100%; border-collapse: collapse; font-size: .92rem; }
.lb th { text-align: left; font-size: .78rem; color: var(--text-muted); padding: .3rem .4rem; border-bottom: 3px solid var(--border); }
.lb td { padding: .3rem .4rem; border-bottom: 1px dashed color-mix(in srgb, var(--border) 40%, transparent); }
.lb tr.mine td { background: color-mix(in srgb, var(--px-yellow) 35%, transparent); }
.lb-name { display: flex; align-items: center; gap: .35rem; min-width: 9rem; }
.lb-name span { word-break: break-word; }
.chip { display: inline-grid; place-items: center; min-width: 1.6rem; height: 1.6rem; font-weight: 900; font-size: .8rem; color: #fff; box-shadow: 0 0 0 2px var(--border); }
.chip-a { background: var(--track-a); } .chip-b { background: var(--track-b); } .chip-c { background: var(--track-c); }
.chip-d { background: var(--track-d); color: #2a1a12; } .chip-e { background: var(--track-e); } .chip-f { background: var(--track-f); } .chip-x { background: var(--state-locked); }
.prize-stock { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .6rem; }
.prize-card { display: grid; grid-template-columns: 24px 1fr auto; gap: .5rem; align-items: center; padding: .45rem .6rem; background: var(--bg); box-shadow: 0 0 0 2px var(--border); }
.prize-card.r-legendary { box-shadow: 0 0 0 3px var(--px-yellow-dark), 0 0 10px var(--px-yellow); }
.prize-card.r-epic { box-shadow: 0 0 0 3px var(--px-purple); }
.prize-card.r-rare { box-shadow: 0 0 0 3px var(--px-blue); }
.prize-card.empty { opacity: .45; filter: grayscale(1); }
.prize-label { font-weight: 700; font-size: .88rem; line-height: 1.25; }
.prize-qty { font-family: ui-monospace, Menlo, monospace; }
.bar { height: 6px; background: var(--surface-2); margin-top: .25rem; box-shadow: 0 0 0 1px var(--border); }
.bar span { display: block; height: 100%; background: var(--px-green); }

/* team */
.team-sum { display: flex; gap: .9rem; align-items: center; margin-bottom: .6rem; }
.team-av { width: 64px; height: 64px; background: var(--surface-2); box-shadow: 0 0 0 2px var(--border); flex: none; }
.team-name { font-weight: 900; font-size: 1.2rem; word-break: break-word; }
.team-stats { display: flex; gap: .4rem .9rem; flex-wrap: wrap; margin-top: .3rem; font-size: .9rem; }
.team-stats span { display: inline-flex; align-items: center; gap: .2rem; }

/* ---------------- nộp checkpoint */
.cp-head { display: flex; gap: 1rem; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; }
.cp-head h2 { margin: 0; }
.cp-deadline { padding: .45rem .7rem; background: var(--surface-2); box-shadow: 0 0 0 2px var(--border); font-weight: 800; max-width: 420px; }
.cp-deadline.late { background: var(--px-red); color: #fff; box-shadow: 0 0 0 3px var(--px-red-dark); }
.sub-card { box-shadow: 0 0 0 2px var(--border); padding: .5rem .8rem; margin: 0 0 .8rem; background: var(--bg); }
.sub-card > summary { cursor: pointer; font-size: .95rem; }
.sub-card.late { box-shadow: 0 0 0 3px var(--px-red); }
.badge { display: inline-block; padding: 0 .4rem; font-size: .75rem; font-weight: 900; }
.badge-ok { background: var(--px-green); color: #fff; }
.badge-bad { background: var(--px-red); color: #fff; }
.sub-status { font-size: .85rem; font-weight: 700; }
.checks { list-style: none; padding: 0; margin: .5rem 0; display: grid; gap: .25rem; }
.checks li { display: grid; grid-template-columns: 1.6rem 1fr; align-items: baseline; padding: .25rem .4rem; background: var(--surface); }
.check-fail { box-shadow: inset 4px 0 0 var(--px-red); }
.check-warn { box-shadow: inset 4px 0 0 var(--px-orange); }
.check-ok { box-shadow: inset 4px 0 0 var(--px-green); }
.feedback { background: var(--surface-2); padding: .4rem .6rem; font-size: .92rem; }
.loading-bar { height: 8px; background: var(--surface-2); overflow: hidden; margin: .4rem 0; box-shadow: 0 0 0 2px var(--border); }
.loading-bar span { display: block; width: 30%; height: 100%; background: var(--px-yellow); animation: load 1.2s steps(10) infinite; }
@keyframes load { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
.no-motion .loading-bar span { animation: none; width: 100%; opacity: .5; }

/* ---------------- bản đồ + rương */
.map-stats { display: flex; gap: .5rem 1.2rem; flex-wrap: wrap; margin: .5rem 0 1rem; font-weight: 700; }
.stages { display: grid; gap: 1rem; }
.stage { padding: .7rem .8rem; background: var(--bg); box-shadow: 0 0 0 2px var(--border); }
.stage.locked { background: repeating-linear-gradient(45deg, var(--bg) 0 10px, var(--surface-2) 10px 20px); }
.stage-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem; }
.stage-head img { width: 32px; height: 32px; }
.stage-head b { font-size: 1rem; }
.chest-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.chest {
  position: relative; display: grid; grid-template-columns: 48px 1fr; gap: .5rem; align-items: center; text-align: left;
  padding: .5rem; background: var(--surface); color: var(--text); border: 0; font: inherit; cursor: pointer;
  box-shadow: 0 0 0 2px var(--border), 3px 3px 0 2px var(--shadow);
}
.chest img { width: 48px; height: 48px; }
.chest:hover:not([disabled]) { transform: translateY(-2px); }
.chest[disabled] { cursor: not-allowed; opacity: .8; }
.chest.ready { box-shadow: 0 0 0 3px var(--px-yellow-dark), 0 0 12px var(--px-yellow); }
.chest.open { background: color-mix(in srgb, var(--px-green) 15%, var(--surface)); }
.chest-day { font-weight: 900; font-size: .9rem; }
.chest-title { font-size: .75rem; line-height: 1.2; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chest-pts { font-size: .78rem; font-weight: 800; }
.chest .fb { position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; }
.chest-state { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.quiz-q { margin: 0 0 1rem; padding: .7rem .8rem; background: var(--bg); box-shadow: 0 0 0 2px var(--border); }
.quiz-q legend { font-weight: 800; margin-bottom: .4rem; float: left; width: 100%; padding: 0; line-height: 1.35; }  /* float: kéo legend vào trong khung, không nằm trên mép viền */
.quiz-q legend + * { clear: both; }
.quiz-q::after { content: ''; display: block; clear: both; }
.quiz-opt { display: flex; gap: .5rem; align-items: flex-start; padding: .4rem .5rem; cursor: pointer; font-weight: 400 !important; }
.quiz-opt:hover { background: var(--surface-2); }
.quiz-opt input { margin-top: .3rem; }
.quiz-opt.elim { text-decoration: line-through; opacity: .45; cursor: not-allowed; }
.quiz-opt.right { background: color-mix(in srgb, var(--px-green) 25%, transparent); }
.quiz-hook { font-weight: 700; font-style: italic; }
.quiz-actions { display: flex; gap: .8rem; flex-wrap: wrap; align-items: center; position: sticky; bottom: -1.4rem; background: var(--surface); padding: .7rem 0; }
.result-big { text-align: center; padding: 1rem; }
.result-big img { width: 96px; height: 96px; }
.result-big .pts { font-size: 2rem; font-weight: 900; color: var(--accent); }
.review { margin: .6rem 0; padding: .5rem .7rem; background: var(--bg); box-shadow: inset 4px 0 0 var(--px-green); }
.flag-list { list-style: none; padding: 0; display: grid; gap: .4rem; margin: .8rem 0 0; }
.flag-list li { display: grid; grid-template-columns: 24px 1fr auto; gap: .5rem; align-items: center; padding: .35rem .5rem; background: var(--bg); }
.flag-list img { width: 24px; height: 36px; }

/* vòng quay */
.wheel-box { display: flex; flex-direction: column; align-items: center; gap: .6rem; }
.wheel-wrap { position: relative; width: 256px; height: 280px; padding-top: 24px; }
.wheel { width: 256px; height: 256px; transform-origin: 50% 50%; will-change: transform; }
.wheel-pointer { position: absolute; left: 112px; top: 0; z-index: 2; width: 32px; height: 64px; }
.spin-left { font-weight: 800; margin: 0; }
.spin-result { min-height: 1.5em; font-weight: 800; text-align: center; margin: 0; }
.my-prizes { list-style: none; padding: 0; margin: .6rem 0 0; display: grid; gap: .6rem; }
.my-prize { padding: .6rem .7rem; background: var(--bg); box-shadow: 0 0 0 2px var(--border); }
.my-prize-head { display: flex; gap: .5rem; align-items: center; font-weight: 800; }
.payload { display: flex; gap: .4rem; align-items: center; margin-top: .4rem; }
.payload code { flex: 1; overflow-x: auto; white-space: nowrap; padding: .35rem .5rem; display: block; }
.payload .btn { min-height: 36px; padding: .2rem .7rem; font-size: .85rem; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); z-index: 50; max-width: calc(100vw - 32px); padding: .7rem 1rem; background: #2a1a12; color: #fff3c4; font-weight: 700; box-shadow: 0 0 0 3px #000, 4px 4px 0 3px rgba(0,0,0,.4); }
.toast-ok { background: var(--px-green-dark); }
.toast-bad { background: var(--px-red-dark); }

/* điện thoại */
@media (max-width: 560px) {
  main { padding: .8rem .6rem 3rem; }
  .panel { padding: .9rem .8rem; }
  .hud { padding: .35rem .5rem; gap: .35rem .5rem; }
  .hud-nav { order: 3; width: 100%; margin-left: 0; justify-content: space-between; }
  .hud-nav a { padding: .25rem .35rem; font-size: .82rem; }
  .hud-logo span { display: none; }
  .hud-clock { flex: 1; justify-content: center; }
  .icon-btn { width: 2rem; height: 2rem; }
  .gate img { width: 72px; height: 96px; }
  .trk-hero img { width: 64px; height: 85px; }
  .chest-row { grid-template-columns: 1fr 1fr; }
  .wheel-wrap { transform: scale(.85); margin: -18px 0; }
  .story-ctrl .btn { padding: .4rem .6rem; font-size: .9rem; }
}

/* ---------------- campus VinUni (trang chủ) */
.campus { padding: .6rem; background: #1c1440; }
.campus-wrap { position: relative; width: 100%; aspect-ratio: 3 / 1; }
.campus-bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.campus-pins { position: absolute; inset: 0; }
.campus-label { position: absolute; top: 4%; transform: translateX(-50%); font-size: clamp(.55rem, 1.6vw, .78rem); font-weight: 900; padding: 0 .3rem; background: rgba(42,26,18,.82); color: #fff3c4; white-space: nowrap; }
.campus-label.done { background: var(--px-yellow); color: #2a1a12; }
.campus-hero { position: absolute; bottom: 3%; width: 8%; height: auto; transform: translateX(-50%); filter: drop-shadow(0 0 4px var(--px-yellow)); }
.campus-hero.px-bob { animation: campus-bob 1s steps(2) infinite; }
@keyframes campus-bob { 0%,100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, -4px); } }
.no-motion .campus-hero.px-bob { animation: none; }
.cp-item { grid-template-columns: 40px 1fr auto; }
.cp-item img { width: 40px; height: 40px; object-fit: contain; }
.hero-end { object-fit: contain; background: var(--surface-2); }
.sc-caption { position: absolute; left: 4%; right: 4%; top: 5%; text-align: center; font-weight: 900; font-size: clamp(.95rem, 3.2vw, 1.5rem); color: var(--px-yellow); text-shadow: 2px 2px 0 #2a1a12, -2px -2px 0 #2a1a12, 2px -2px 0 #2a1a12, -2px 2px 0 #2a1a12; line-height: 1.3; }
.story-scene { height: auto; aspect-ratio: 2 / 1; }
.story-scene .sc-bg { object-fit: cover; }
.trk-illus { width: 100%; max-width: 480px; height: auto; display: block; margin: 0 auto .8rem; box-shadow: 0 0 0 3px var(--border); }
.stage-head img { width: 40px; height: 40px; object-fit: contain; }
.btn-sm { min-height: 34px; padding: .2rem .7rem; font-size: .85rem; }
.hall-scene { position: relative; width: 100%; aspect-ratio: 2 / 1; margin: 1rem 0 .4rem; box-shadow: 0 0 0 3px var(--border); overflow: hidden; }
.hall-bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.hall-hot { position: absolute; background: transparent; border: 0; cursor: pointer; padding: 0; }
.hall-hot:hover { background: rgba(255, 212, 0, .18); box-shadow: 0 0 0 3px var(--px-yellow), 0 0 14px var(--px-yellow); }
.sc-caption { background: rgba(28, 20, 64, .72); padding: .2rem .5rem; }
.gate-row { margin-top: .4rem; }
.gate img { width: 48px; height: 48px; }
@media (max-width: 560px) { .gate img { width: 40px; height: 40px; } }
.field > label { display: block; }
.grid-2 > .panel, .my-prize, .payload { min-width: 0; }
.payload code { min-width: 0; }
.chest-row { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
@media (max-width: 560px) { .chest-row { grid-template-columns: 1fr 1fr; } .chest { grid-template-columns: 36px 1fr; } .chest img { width: 36px; height: 36px; } }
@media (max-width: 560px) {
  .lab-time { display: none; }
  .campus-label:first-child { transform: translateX(-30%); }
  .hud-nav a { font-size: .78rem; padding: .25rem .3rem; }
  #navTeam { max-width: 4.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mock-banner { font-size: .7rem; }
}
.unverified { color: var(--px-orange); font-weight: 700; flex-basis: 100%; }
.now-tip { background: color-mix(in srgb, var(--px-yellow) 22%, var(--surface)); padding: .45rem .6rem; box-shadow: inset 4px 0 0 var(--px-yellow-dark); font-size: .9rem; margin: .4rem 0; }
.stage-tips { list-style: none; padding: 0; margin: 0 0 .6rem; display: grid; gap: .3rem; }
.stage-tips .now-tip { margin: 0; display: inline; box-shadow: none; padding: 0; background: none; }
.stage-tips li { background: color-mix(in srgb, var(--px-yellow) 18%, var(--surface)); padding: .35rem .5rem; box-shadow: inset 4px 0 0 var(--px-yellow-dark); font-size: .88rem; }
.quiz-img { display: block; width: 100%; max-width: 480px; height: auto; margin: .2rem 0 .5rem; box-shadow: 0 0 0 2px var(--border); }
@media (max-width: 560px) { .hero-map { display: none; } .team-sum { align-items: flex-start; } .team-av { width: 48px; height: 48px; } }
@keyframes pop { from { transform: translateY(6px); } }

/* ---------------- tìm đồng đội */
.lfg-filters { display: flex; flex-wrap: wrap; gap: .5rem .8rem; align-items: end; margin: .6rem 0; }
.lfg-filters label { display: grid; gap: .2rem; font-weight: 700; font-size: .85rem; }
.lfg-filters select { min-height: 38px; padding: .3rem .5rem; width: auto; }
.lfg-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .8rem; }
.lfg-card { padding: .6rem .7rem; background: var(--bg); box-shadow: 0 0 0 2px var(--border); display: grid; gap: .35rem; align-content: start; min-width: 0; }
.lfg-team { box-shadow: 0 0 0 3px var(--px-green); }
.lfg-head { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.lfg-name { font-size: 1.05rem; word-break: break-word; }
.lfg-tracks { display: inline-flex; gap: .2rem; }
.lfg-intro { margin: 0; font-size: .92rem; white-space: pre-wrap; word-break: break-word; }
.tags { display: inline-flex; flex-wrap: wrap; gap: .25rem; }
.tag { font-size: .72rem; font-weight: 800; padding: .05rem .4rem; background: var(--surface-2); box-shadow: 0 0 0 1px var(--border); }
.contact { font-size: .9rem; display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.contact b { word-break: break-all; }
.check-grid { display: flex; flex-wrap: wrap; gap: .4rem; }
.check-chip { display: inline-flex !important; align-items: center; gap: .3rem; padding: .3rem .55rem; background: var(--surface-2); box-shadow: 0 0 0 2px var(--border); font-weight: 700; font-size: .85rem; cursor: pointer; }
.check-chip input { width: 1.05rem; height: 1.05rem; }
.team-invite { margin: 1rem 0; padding-top: .8rem; border-top: 3px dashed var(--border); }
.roster { list-style: none; padding: 0; margin: .3rem 0 .8rem; display: grid; gap: .3rem; }
.roster li { display: flex; gap: .4rem; align-items: center; padding: .3rem .5rem; background: var(--bg); }
.team-invite .payload input { flex: 1; min-width: 0; font-family: ui-monospace, Menlo, monospace; font-size: .85rem; }
.recruit { margin-top: 1rem; }
.recruit h3 { margin: 0; }
label.field-check { display: flex !important; gap: .5rem; align-items: center; }
label.field-check input { width: 1.3rem; height: 1.3rem; flex: none; }
@media (max-width: 560px) {
  .hud-nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; justify-content: flex-start; gap: .1rem; }
  .hud-nav::-webkit-scrollbar { display: none; }
  .hud-nav a { flex: none; font-size: .76rem; padding: .25rem .32rem; }
}
.gift-box { background: color-mix(in srgb, var(--px-green) 18%, var(--surface)); padding: .5rem .7rem; box-shadow: inset 4px 0 0 var(--px-green); margin: .5rem 0; }
.prize-guide { text-align: left; background: var(--surface-2); padding: .4rem .7rem; margin: .5rem 0; font-size: .9rem; box-shadow: 0 0 0 1px var(--border); }
.prize-guide p { margin: .3rem 0; }

.team-howto ol { margin: .3rem 0 .3rem 1.2rem; padding: 0; }
.team-howto li { margin: .15rem 0; }
.team-howto p { margin: .3rem 0 0; }

/* rương đang chờ thử lại: màu cam, không xám như rương khoá */
.chest.ready.waiting { box-shadow: 0 0 0 3px #E08A00; filter: none; opacity: 1; }
.chest.ready.waiting .chest-state { color: #E08A00; }
