:root { --c: #7C5CFF; --c2: #39E6C8; --bg: #120a22; --ink: #1d1530; --mut: #6a6088; --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); font-family: "Be Vietnam Pro", system-ui, sans-serif; color: var(--ink); overscroll-behavior: none; -webkit-user-select: none; user-select: none; }
canvas#c { position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; }
#menu { position: fixed; inset: 0; z-index: 20; display: none; overflow-y: auto; -webkit-overflow-scrolling: touch; }
#menu.on { display: block; }
#menu.nen { background: rgba(14, 8, 28, .62); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
button { font: inherit; cursor: pointer; color: inherit; }

/* ---------- màn chính: trạm 3D phía sau, bảng nút phía dưới (cuộn được) ---------- */
.home { min-height: 100%; display: flex; flex-direction: column; max-width: 520px; margin: 0 auto; padding: calc(var(--sat) + 62px) 14px calc(var(--sab) + 18px); }
.logo { display: flex; align-items: center; gap: 12px; color: #fff; text-shadow: 0 3px 14px rgba(0,0,0,.7); background: rgba(18,10,34,.72); border-radius: 22px; padding: 8px 14px 8px 8px; align-self: flex-start; box-shadow: 0 6px 24px rgba(0,0,0,.35); }
.logo img { width: 58px; height: 58px; border-radius: 16px; box-shadow: 0 8px 22px rgba(0,0,0,.5), 0 0 0 2px rgba(190,170,255,.35); }
.logo h1 { margin: 0; font-size: 40px; font-weight: 900; letter-spacing: -1px; line-height: 1; }
.logo p { margin: 3px 0 0; font-weight: 800; font-size: 14px; color: #cfc3ff; }
.home .mo { flex: 1; min-height: 32vh; }
.sheet { background: rgba(246, 243, 255, .95); border-radius: 26px; padding: 14px; box-shadow: 0 -6px 34px rgba(60,20,140,.45); display: flex; flex-direction: column; gap: 9px; }
.sheet h3 { margin: 6px 2px 0; font-size: 15px; display: flex; justify-content: space-between; align-items: baseline; }
.sheet h3 small { font-size: 13px; color: var(--mut); }
.btn { display: block; width: 100%; min-height: 52px; border: 0; border-radius: 18px; background: #fff; font-weight: 800; font-size: 17px; box-shadow: 0 5px 14px rgba(40,10,90,.14); margin: 6px 0; }
.btn.main { background: linear-gradient(180deg, #9b7dff, #7C5CFF 55%, #5b3fd6); color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.2); }
.btn.big { min-height: 72px; font-size: 26px; font-weight: 900; margin: 0; }
.btn small { display: block; font-size: 13.5px; font-weight: 700; opacity: .92; }
.btn.ngay, .btn.dem { color: #fff; text-align: left; padding: 10px 16px; margin: 0; }
.btn.ngay { background: linear-gradient(180deg, #2c2a5a, #1b1840); }
.btn.dem { background: linear-gradient(180deg, #3a1d3e, #241228); }
.btn.ngay b, .btn.dem b { font-size: 17px; }
.btn.ngay small, .btn.dem small { opacity: .85; line-height: 1.35; margin-top: 2px; }
.luoi { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.luoi .o { border: 2px solid transparent; background: #fff; border-radius: 14px; min-height: 66px; padding: 6px 6px; text-align: left; box-shadow: 0 3px 10px rgba(40,10,90,.08); display: flex; flex-direction: column; justify-content: center; }
.luoi .o small { font-size: 11px; font-weight: 800; color: var(--mut); }
.luoi .o b { font-size: 13px; font-weight: 900; line-height: 1.2; }
.luoi .o em { font-style: normal; font-size: 12.5px; color: #e0a514; letter-spacing: 1px; }
.luoi .o.chon { border-color: #7C5CFF; background: #f1ecff; }
.luoi .o.khoa { opacity: .55; }
.viec { display: flex; flex-direction: column; gap: 6px; }
.viec div { display: grid; grid-template-columns: 1fr auto; gap: 3px 8px; background: #fff; border-radius: 12px; padding: 7px 10px; font-size: 13.5px; font-weight: 700; }
.viec div i { grid-column: 1; height: 6px; border-radius: 4px; background: #e8e3f6; overflow: hidden; }
.viec div i em { display: block; height: 100%; background: linear-gradient(90deg, #7C5CFF, #39E6C8); }
.viec div b { grid-row: 1 / span 2; grid-column: 2; align-self: center; color: #b07a10; font-size: 13px; }
.viec div.xong { background: #ecfbf5; }
.hang { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.link { border: 0; background: #fff; border-radius: 14px; padding: 10px 8px; font-weight: 800; width: 100%; min-height: 48px; box-shadow: 0 2px 8px rgba(40,10,90,.08); }
.link small { display: block; font-size: 12px; font-weight: 700; color: var(--mut); }
.foot { color: var(--mut); font-size: 12.5px; text-align: center; margin: 2px 0 0; }
.foot a { color: inherit; }

/* ---------- bảng phụ ---------- */
.panel { background: #f6f3ff; border-radius: 22px; padding: 18px 16px; max-width: 520px; margin: calc(var(--sat) + 64px) auto 24px; width: calc(100% - 24px); box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.panel h2 { margin: 0 0 6px; font-size: 22px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.panel h2 small { font-size: 14px; color: #7C5CFF; }
.panel h3 { margin: 16px 0 6px; font-size: 16px; }
.panel p, .panel li { color: var(--mut); font-weight: 600; line-height: 1.5; font-size: 14.5px; }
.panel ul { padding-left: 18px; margin: 4px 0; }
.panel li b { color: var(--ink); }
.hoso { list-style: none; padding: 0 !important; display: flex; flex-direction: column; gap: 7px; }
.hoso li { display: grid; grid-template-columns: 16px 1fr; gap: 10px; background: #fff; border-radius: 14px; padding: 10px 12px; box-shadow: 0 2px 8px rgba(40,10,90,.06); }
.hoso li.du { box-shadow: 0 0 0 2px #39E6C8 inset; }
.hoso li.chua { opacity: .6; }
.hoso .cham { width: 16px; height: 16px; border-radius: 50%; margin-top: 3px; box-shadow: 0 0 10px rgba(124,92,255,.5); }
.hoso b { display: block; font-size: 15px; color: var(--ink); }
.hoso em { display: block; font-style: normal; font-size: 13px; font-weight: 700; color: #4b3f74; }
.hoso em i { font-style: normal; color: #b4a8d8; }
.hoso em.co { color: #8a5cc7; font-size: 12.5px; }
.hoso p { margin: 4px 0 0; font-size: 13px; line-height: 1.45; }
.nc { display: grid; grid-template-columns: 34px 1fr auto; gap: 8px; align-items: center; background: #fff; border-radius: 14px; padding: 9px 10px; margin: 6px 0; box-shadow: 0 2px 8px rgba(40,10,90,.06); }
.nc i { font-style: normal; font-size: 24px; text-align: center; }
.nc b { font-size: 15px; } .nc b small { color: #7C5CFF; letter-spacing: 1px; font-size: 12px; }
.nc em { display: block; font-style: normal; font-size: 12.5px; color: var(--mut); font-weight: 600; }
.nc button { border: 0; border-radius: 12px; min-height: 44px; min-width: 84px; padding: 0 10px; font-weight: 900; background: linear-gradient(180deg, #ffd56a, #f0a820); color: #3a2a08; }
.nc button.thieu { filter: grayscale(.7); opacity: .7; }
.nc button[disabled] { background: #e3def0; color: #8a80a8; }

/* ---------- HUD trong ca ---------- */
#dtTop { position: fixed; left: 0; right: 0; top: 0; z-index: 8; display: none; padding: calc(var(--sat) + 6px) 10px 0; grid-template-columns: 64px 1fr auto; gap: 8px; align-items: center; pointer-events: none; }
#dtTop.on { display: grid; }
#dtTop .dung { pointer-events: auto; border: 0; border-radius: 14px; min-height: 48px; background: rgba(20,10,40,.7); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; border: 1px solid rgba(190,170,255,.3); }
#dtTop .dung b { font-size: 15px; } #dtTop .dung small { font-size: 11px; font-weight: 800; margin-top: 3px; }
#dtTop .gio { text-align: center; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.8); }
#dtTop .gio b { font-size: 30px; font-weight: 900; display: block; line-height: 1; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; }
#dtTop .gio small { font-size: 12px; font-weight: 800; color: #cfc3ff; }
#dtTop .diem { display: flex; gap: 6px; }
#dtTop .diem span { background: rgba(20,10,40,.7); border-radius: 12px; padding: 4px 9px; text-align: center; color: #fff; min-width: 56px; border: 1px solid rgba(190,170,255,.25); }
#dtTop .diem b { display: block; font-size: 17px; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; }
#dtTop .diem small { font-size: 10.5px; font-weight: 800; color: #cfc3ff; }
#dtTop .diem .yen b { color: #7dffcf; }
#dtTop .r2 { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
#dtTop .r2 span { background: rgba(20,10,40,.62); color: #e8e1ff; border-radius: 10px; padding: 4px 9px; font-size: 12px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#dtNgay { max-width: 64%; }
#dtSuCo i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-left: 4px; background: rgba(255,255,255,.18); vertical-align: -1px; }
#dtSuCo i.on { background: #ff3b5c; box-shadow: 0 0 8px #ff3b5c; }
#dtSuCo.nguy { animation: nguy .6s infinite alternate; }
@keyframes nguy { to { background: rgba(140,10,40,.85); } }

#dtBot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 8; display: none; padding: 8px 10px calc(var(--sab) + 10px); background: linear-gradient(180deg, rgba(18,10,34,0), rgba(18,10,34,.86) 26%); }
#dtBot.on { display: block; }
#dtBot .dong { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; color: #fff; margin: 2px 2px 6px; min-height: 36px; }
#dtBot .ten { font-size: 15px; line-height: 1.2; }
#dtBot .ten b { font-weight: 900; }
#dtBot .ten small { display: block; font-size: 11.5px; font-weight: 700; color: #cfc3ff; }
#dtBot .ten em { font-style: normal; font-size: 11px; background: #ffe066; color: #3a2a08; border-radius: 6px; padding: 1px 5px; }
#dtBot .tiep { font-size: 11.5px; font-weight: 700; color: #b9aefc; text-align: right; max-width: 42%; }
#dtMay { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
#dtMay button { position: relative; overflow: hidden; border-radius: 16px; min-height: 64px; padding: 6px 4px; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 6px; align-items: center; text-align: left; color: #fff; background: linear-gradient(180deg, #3a2c66, #2a1f4c); box-shadow: 0 4px 0 #160e2c, 0 6px 14px rgba(0,0,0,.35); border: 1px solid rgba(190,170,255,.25); }
#dtMay button i { font-style: normal; font-size: 24px; grid-row: span 2; padding-left: 4px; }
#dtMay button b { font-size: 14.5px; font-weight: 900; }
#dtMay button span { font-size: 13px; font-weight: 800; color: #cfc3ff; }
#dtMay button u { position: absolute; left: 0; bottom: 0; height: 5px; width: 0; background: currentColor; text-decoration: none; transition: width .08s linear; }
#dtMay button.mn u { color: #ff7a59; } #dtMay button.mt u { color: #5aa9ff; } #dtMay button.ma u { color: #7dffb2; }
#dtMay button:active { transform: translateY(2px); box-shadow: 0 2px 0 #160e2c; }
#dtMay button.biet { background: linear-gradient(180deg, #4b3d86, #34286a); }
#dtMay button.biet span { color: #fff; }
#dtMay button.nong { background: linear-gradient(180deg, #a3452a, #6e2a1a); }
#dtMay button.lanh { background: linear-gradient(180deg, #2a6aa3, #1a426e); }
#dtMay button.do { box-shadow: 0 0 0 2px #fff inset, 0 4px 0 #160e2c; }
#dtMay button.khoa { opacity: .4; }
#dtPhong { display: none; flex-wrap: wrap; gap: 6px; align-items: center; background: rgba(36,24,70,.92); border: 1px solid rgba(190,170,255,.35); border-radius: 16px; padding: 7px; margin-bottom: 7px; }
#dtPhong.on { display: flex; }
#dtPhong .pt { flex: 1 1 100%; color: #fff; font-weight: 900; font-size: 13.5px; padding: 0 3px; }
#dtPhong .pt.nho { font-size: 12px; color: #cfc3ff; font-weight: 700; }
#dtPhong button { flex: 1 1 0; min-height: 46px; border: 0; border-radius: 12px; background: linear-gradient(180deg, #ffd56a, #f0a820); color: #3a2a08; font-weight: 900; font-size: 13px; line-height: 1.1; padding: 4px 6px; }
#dtPhong button small { display: block; font-size: 11px; font-weight: 800; opacity: .8; }
#dtPhong button.thieu { filter: grayscale(.8); opacity: .6; }
#dtPhong button.bo { flex: 0 0 auto; background: rgba(255,255,255,.14); color: #fff; min-width: 64px; }

#dtChips, #dtLy, #dtBay { position: fixed; inset: 0; z-index: 6; pointer-events: none; display: none; }
#dtChips.on, #dtLy.on { display: block; }
#dtBay { display: block; z-index: 9; }
#dtChips span { position: absolute; left: 0; top: 0; margin: -10px 0 0; translate: -50% 0; white-space: nowrap; font-size: 11px; font-weight: 900; padding: 2px 7px; border-radius: 8px; background: rgba(20,10,40,.75); color: #e8e1ff; border: 1px solid rgba(190,170,255,.35); }
#dtChips span.k-1 { color: #9fe6ff; border-color: rgba(95,212,255,.6); }
#dtChips span.k1 { color: #ffc28a; border-color: rgba(255,164,94,.6); }
#dtChips span.tat { background: rgba(80,10,25,.85); animation: nguy .5s infinite alternate; }
#dtLy span { position: absolute; left: 0; top: 0; translate: -50% -100%; white-space: nowrap; font-size: 12px; font-weight: 900; padding: 4px 9px; border-radius: 10px; color: #3a2a08; background: #ffd166; box-shadow: 0 4px 12px rgba(0,0,0,.4); }
#dtLy span.do { background: #ff3b5c; color: #fff; animation: rungChu .25s infinite alternate; }
@keyframes rungChu { to { margin-left: 3px; } }
#dtBay .bay { position: absolute; translate: -50% -100%; font-size: 19px; font-weight: 900; white-space: nowrap; text-shadow: 0 2px 0 #1a0f33, 0 0 12px rgba(0,0,0,.8); animation: bay 1.5s ease-out forwards; }
@keyframes bay { 0% { opacity: 0; transform: translateY(10px) scale(.6); } 15% { opacity: 1; transform: translateY(0) scale(1.15); } 30% { transform: scale(1); } 100% { opacity: 0; transform: translateY(-46px); } }
#dtBan { position: fixed; left: 50%; top: calc(var(--sat) + 112px); z-index: 9; transform: translate(-50%, -10px); opacity: 0; pointer-events: none; background: rgba(24,14,48,.9); color: #fff; border-radius: 16px; padding: 9px 16px; text-align: center; width: max-content; max-width: calc(100% - 32px); border: 1px solid rgba(190,170,255,.4); box-shadow: 0 10px 30px rgba(0,0,0,.45); transition: opacity .25s, transform .25s; }
#dtBan.on { opacity: 1; transform: translate(-50%, 0); }
#dtBan b { display: block; font-size: 19px; font-weight: 900; }
#dtBan span { display: block; font-size: 13px; font-weight: 700; color: #d8ceff; margin-top: 2px; }
#dtTay { position: fixed; left: 0; top: 0; z-index: 10; pointer-events: none; display: none; }
#dtTay.on { display: block; }
#dtTay i { position: absolute; left: -14px; top: -6px; font-style: normal; font-size: 40px; filter: drop-shadow(0 4px 6px rgba(0,0,0,.6)); animation: tay 1s ease-in-out infinite; }
#dtTay span { position: absolute; top: 46px; width: 220px; text-align: center; background: #fff; color: #2a1a4a; font-size: 13.5px; font-weight: 900; padding: 6px 8px; border-radius: 12px; box-shadow: 0 6px 16px rgba(0,0,0,.4); }
#dtTay.keo { animation: tayKeo 1.8s ease-in-out infinite; }
#dtTay.keo i { animation: none; }
@keyframes tay { 50% { transform: translateY(8px) scale(.92); } }
@keyframes tayKeo { 0%, 12% { transform: translate(var(--x0), var(--y0)); opacity: 0; } 20% { opacity: 1; transform: translate(var(--x0), var(--y0)); } 75% { transform: translate(var(--x1), var(--y1)); opacity: 1; } 100% { transform: translate(var(--x1), var(--y1)); opacity: 0; } }
#dtLoe { position: fixed; inset: 0; z-index: 7; pointer-events: none; opacity: 0; }
#dtLoe.on { animation: loe .7s ease-out; }
#dtLoe.do { background: radial-gradient(circle, rgba(255,40,80,0) 40%, rgba(255,40,80,.45)); }
#dtLoe.toi { background: rgba(10,0,6,.6); }
#dtLoe.tim { background: radial-gradient(circle, rgba(170,120,255,.35), rgba(170,120,255,0) 70%); }
@keyframes loe { 0% { opacity: 1; } 100% { opacity: 0; } }
