:root { --c: #E2552B; --c2: #7CE0B5; --bg: #1d1626; --ink: #2a2018; --mut: #6a5a4a; --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; }
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(20, 14, 26, .55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
button { font: inherit; cursor: pointer; color: inherit; }

/* ---------- màn chính: trại chung 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); }
.home .dau { display: flex; flex-direction: column; gap: 8px; }
.logo { display: flex; align-items: center; gap: 12px; color: #fff; text-shadow: 0 3px 14px rgba(0,0,0,.55); }
.logo img { width: 58px; height: 58px; border-radius: 16px; box-shadow: 0 8px 22px rgba(0,0,0,.35); }
.logo h1 { margin: 0; font-size: 38px; font-weight: 900; letter-spacing: -1px; line-height: 1; }
.logo p { margin: 3px 0 0; font-weight: 800; font-size: 14px; opacity: .95; }
.song { align-self: flex-start; background: rgba(15, 20, 30, .62); color: #fff; border-radius: 14px; padding: 7px 12px; font-weight: 800; font-size: 13px; line-height: 1.35; }
.song small { display: block; font-weight: 700; opacity: .85; font-size: 12px; }
.home .mo { flex: 1; min-height: 32vh; border: 0; background: transparent; }
.sheet { background: rgba(255, 248, 238, .95); border-radius: 26px; padding: 14px; box-shadow: 0 -6px 30px rgba(0,0,0,.35); display: flex; flex-direction: column; gap: 9px; }
.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(0,0,0,.14); }
.btn.main { background: linear-gradient(180deg, #F2774A, #E2552B 60%, #c4421f); color: #fff; }
.btn.big { min-height: 70px; font-size: 25px; font-weight: 900; }
.btn small { display: block; font-size: 13.5px; font-weight: 700; opacity: .92; }
.btn.ngay { background: linear-gradient(180deg, #2f2a4a, #1f1a33); color: #fff; text-align: left; padding: 10px 16px; }
.btn.ngay b { font-size: 17px; }
.luoi { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.luoi .o { border: 0; background: #fff; border-radius: 16px; min-height: 76px; padding: 6px 4px; font-weight: 900; font-size: 13px; box-shadow: 0 3px 10px rgba(0,0,0,.1); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
.luoi .o i { font-style: normal; font-size: 24px; line-height: 1.1; }
.luoi .o small { font-size: 11px; font-weight: 700; color: var(--mut); }
.hang { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.link { border: 0; background: rgba(255,255,255,.9); border-radius: 14px; padding: 12px 8px; font-weight: 800; width: 100%; min-height: 46px; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.so112 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.so112 span { background: #eaf7f0; border-radius: 12px; padding: 5px 2px; text-align: center; font-size: 10.5px; font-weight: 700; color: #2e5a44; line-height: 1.2; }
.so112 b { display: block; font-size: 19px; font-weight: 900; color: #1f7a4f; }
.so112.lon b { font-size: 22px; }
.chuoi { margin: 0; text-align: center; font-weight: 900; color: #c4421f; }
.foot { color: var(--mut); font-size: 12.5px; text-align: center; margin: 2px 0 0; }
.foot a { color: inherit; }

/* ---------- bảng phụ ---------- */
.panel { background: #fff8ee; 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,.35); }
.panel h2 { margin: 0 0 6px; font-size: 22px; }
.panel h2 small { font-size: 14px; color: var(--mut); }
.panel h3 { margin: 16px 0 6px; font-size: 16px; }
.panel h3 small { display: block; font-size: 12.5px; font-weight: 700; color: var(--mut); }
.panel p, .panel li { color: var(--mut); font-weight: 600; line-height: 1.5; font-size: 14.5px; }
.panel li b { color: var(--ink); }
.mans { display: flex; flex-direction: column; gap: 6px; }
.man { display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 8px; text-align: left; border: 0; background: #fff; border-radius: 14px; padding: 8px 10px; box-shadow: 0 2px 8px rgba(0,0,0,.08); min-height: 56px; }
.man b { width: 36px; height: 36px; border-radius: 11px; background: #E2552B; color: #fff; display: grid; place-items: center; font-weight: 900; font-size: 17px; }
.man span { font-weight: 900; font-size: 15px; }
.man span small { display: block; font-weight: 600; font-size: 12px; color: var(--mut); line-height: 1.35; }
.man em { font-style: normal; color: #e8a33a; font-size: 15px; letter-spacing: 1px; }
.man.khoa { opacity: .55; }
.man.khoa b { background: #9a8e84; }
.thes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 8px; }
.the { border: 0; background: #fff; border-radius: 14px; padding: 9px 5px; min-height: 92px; display: flex; flex-direction: column; align-items: center; gap: 2px; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.the i { font-style: normal; font-size: 26px; }
.the b { font-size: 12.5px; line-height: 1.25; text-align: center; }
.the small { font-size: 10.5px; color: var(--mut); text-align: center; }
.the.khoa { background: #efe7dc; opacity: .8; }
.ct { background: #fff; border-radius: 16px; padding: 12px 14px; margin: 10px 0; border: 2px solid #7CE0B5; }
.ct .h { display: flex; align-items: center; gap: 8px; font-size: 18px; }
.ct .h i { font-style: normal; font-size: 28px; }
.ct h4 { margin: 10px 0 2px; font-size: 14px; color: #1f7a4f; }
.ct ul { margin: 4px 0; padding-left: 20px; }
.ct .th { font-style: italic; }
.ct .nd { color: #1f5a3c; background: #eaf7f0; border-radius: 10px; padding: 8px 10px; font-weight: 800; }
.ct .ng { font-size: 12px; }
.ticks { display: flex; flex-direction: column; gap: 4px; }
.ticks label { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 12px; padding: 10px 12px; min-height: 46px; font-weight: 700; }
.ticks input { width: 22px; height: 22px; accent-color: #1f7a4f; }
.tienDo { height: 10px; border-radius: 6px; background: #efe2d2; overflow: hidden; }
.tienDo i { display: block; height: 100%; background: #1f7a4f; }
.vl { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.vl span { background: #fff; border-radius: 10px; padding: 5px 9px; font-weight: 700; font-size: 13px; }
.cn { display: grid; grid-template-columns: 40px 1fr auto; gap: 8px; align-items: center; background: #fff; border-radius: 14px; padding: 9px 10px; margin: 6px 0; }
.cn > i { font-style: normal; font-size: 28px; }
.cn b em { font-style: normal; color: #e8a33a; letter-spacing: 1px; }
.cn small { display: block; color: var(--mut); font-weight: 600; font-size: 12px; }
.cn .gia { color: #7a4a20; font-weight: 800; }
.nang { border: 0; border-radius: 12px; background: #1f7a4f; color: #fff; font-weight: 900; min-height: 44px; padding: 0 12px; }
.nang:disabled { background: #cbbfb2; }
.vais { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.vais button { border: 2px solid transparent; background: #fff; border-radius: 14px; padding: 8px; text-align: left; display: grid; grid-template-columns: 32px 1fr; column-gap: 8px; align-items: center; min-height: 58px; }
.vais button i { grid-row: span 2; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-style: normal; }
.vais button small { font-size: 11px; color: var(--mut); line-height: 1.3; }
.vais button.on, .chon button.on { border-color: #E2552B; background: #fff1e8; }
.chon { display: flex; flex-wrap: wrap; gap: 6px; }
.chon button { border: 2px solid transparent; background: #fff; border-radius: 12px; padding: 8px 11px; font-weight: 800; font-size: 13px; min-height: 44px; display: flex; align-items: center; gap: 6px; }
.chon .cham { width: 16px; height: 16px; border-radius: 50%; display: inline-block; border: 1px solid rgba(0,0,0,.2); }

/* ---------- HUD trong lượt ---------- */
#tnHud { position: fixed; z-index: 12; left: 8px; right: 8px; top: calc(var(--sat) + 8px); display: none; flex-direction: column; gap: 5px; max-width: 560px; margin: 0 auto; pointer-events: none; }
#tnHud.on { display: flex; }
#tnHud .r1 { display: grid; grid-template-columns: 52px 1fr auto; gap: 6px; }
#tnHud button { pointer-events: auto; border: 0; }
#tnHud .ve { min-height: 52px; border-radius: 15px; background: rgba(255,250,240,.94); display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: 0 3px 10px rgba(0,0,0,.25); }
#tnHud .ve b { font-size: 14px; } #tnHud .ve small { font-size: 10px; font-weight: 800; }
#tnHud .tt { background: rgba(255,250,240,.94); border-radius: 15px; padding: 6px 10px; box-shadow: 0 3px 10px rgba(0,0,0,.25); min-width: 0; }
#tnHud .tt b { display: block; font-size: 14.5px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tnHud .tt span { display: block; font-size: 11.5px; font-weight: 800; color: #6a5a4a; white-space: nowrap; }
#tnHud .pha { height: 6px; border-radius: 4px; margin: 3px 0 2px; background: linear-gradient(90deg, #ffd27a 0%, #ffb06a 60%, #3a3f78 62%, #26294f 100%); overflow: hidden; position: relative; }
#tnHud .pha i { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(255,255,255,.55); border-right: 3px solid #fff; }
#tnHud .diem { background: #E2552B; color: #fff; border-radius: 15px; padding: 4px 12px; text-align: center; box-shadow: 0 3px 10px rgba(0,0,0,.25); display: flex; flex-direction: column; justify-content: center; min-width: 70px; }
#tnHud .diem b { font-size: 20px; font-weight: 900; line-height: 1.05; } #tnHud .diem small { font-size: 10px; font-weight: 800; }
#tnHud .r2 { display: grid; grid-template-columns: 96px 1fr; gap: 6px; align-items: start; }
#tnHud .suc { background: rgba(255,250,240,.92); border-radius: 12px; padding: 5px 8px; font-size: 11px; font-weight: 900; }
#tnHud .suc i { display: block; height: 8px; border-radius: 5px; background: rgba(0,0,0,.12); overflow: hidden; margin-top: 2px; }
#tnHud .suc b { display: block; height: 100%; background: #4fbf7a; transition: width .2s; }
#tnHud .suc b.thap { background: #b07cf0; }
#tnHud .muc { background: rgba(20,18,30,.62); color: #fff; border-radius: 12px; padding: 5px 8px; font-size: 11px; font-weight: 800; line-height: 1.45; }
#tnHud .muc .sao { display: flex; flex-wrap: wrap; column-gap: 7px; } #tnHud .muc .sao span { opacity: .8; white-space: nowrap; } #tnHud .muc .sao span.ok { color: #ffd76a; opacity: 1; }
#tnHud .muc .tui { color: #d6f5e6; }
#tnTin { position: fixed; z-index: 11; left: 16px; right: 16px; top: calc(var(--sat) + 140px); display: none; flex-direction: column; gap: 5px; align-items: center; pointer-events: none; max-width: 520px; margin: 0 auto; }
#tnTin.on { display: flex; }
#tnTin > div { background: rgba(28,24,40,.86); color: #fff; border-radius: 14px; padding: 7px 12px; font-weight: 800; font-size: 13.5px; text-align: center; line-height: 1.35; box-shadow: 0 4px 14px rgba(0,0,0,.25); animation: tnVao .25s ease-out; }
#tnTin > div.canh { background: rgba(170,60,30,.92); }
#tnTin > div.tot { background: rgba(31,122,79,.92); }
#tnTin > div.loa { background: rgba(255,232,170,.97); color: #4a2a00; }
@keyframes tnVao { from { transform: translateY(-6px); opacity: 0; } to { transform: none; opacity: 1; } }
#tnBan { position: fixed; z-index: 13; left: 16px; right: 16px; top: 34%; display: none; text-align: center; pointer-events: none; color: #fff; text-shadow: 0 3px 16px rgba(0,0,0,.7); max-width: 520px; margin: 0 auto; }
#tnBan.on { display: block; animation: tnBan 3.2s ease-out forwards; }
#tnBan small { display: block; font-weight: 800; font-size: 14px; color: #ffd27a; }
#tnBan b { display: block; font-size: 36px; font-weight: 900; line-height: 1.1; }
#tnBan span { display: block; font-weight: 700; font-size: 15px; margin-top: 4px; }
#tnBan em { display: inline-block; margin-top: 8px; font-style: normal; font-weight: 800; font-size: 13px; background: rgba(226,85,43,.9); border-radius: 10px; padding: 5px 10px; text-shadow: none; }
@keyframes tnBan { 0% { opacity: 0; transform: scale(.92); } 10% { opacity: 1; transform: none; } 85% { opacity: 1; } 100% { opacity: 0; } }
#tnHoi { position: fixed; z-index: 16; left: 10px; right: 10px; bottom: calc(var(--sab) + 136px); display: none; max-width: 520px; margin: 0 auto; }
#tnHoi.on { display: block; animation: tnVao .3s ease-out; }
#tnHoi .the { background: #fffaf0; border-radius: 20px; padding: 12px 14px; box-shadow: 0 10px 30px rgba(0,0,0,.4); border: 3px solid #7CE0B5; display: flex; flex-direction: column; gap: 7px; }
#tnHoi small { font-weight: 900; color: #1f7a4f; font-size: 12px; }
#tnHoi b { font-size: 15.5px; line-height: 1.4; }
#tnHoi button { border: 0; border-radius: 14px; background: #fff; min-height: 50px; padding: 8px 12px; font-weight: 800; font-size: 14.5px; text-align: left; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
#tnHoi button:active { background: #eaf7f0; }
#tnTay { position: fixed; z-index: 15; left: 0; top: 0; display: none; pointer-events: none; }
#tnTay.on { display: block; }
#tnTay i { position: absolute; left: -14px; top: 4px; font-style: normal; font-size: 36px; animation: tnTay 0.9s ease-in-out infinite; filter: drop-shadow(0 3px 6px rgba(0,0,0,.5)); }
#tnTay span { position: absolute; left: -90px; top: -46px; width: 180px; text-align: center; background: rgba(255,232,170,.97); color: #4a2a00; border-radius: 12px; padding: 5px 8px; font-weight: 900; font-size: 13px; box-shadow: 0 4px 12px rgba(0,0,0,.3); }
#tnTay.trai span { left: -170px; }
@keyframes tnTay { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(12px); } }
#tnNgam { position: fixed; z-index: 14; left: 16px; right: 16px; bottom: calc(var(--sab) + 140px); display: none; background: rgba(20,18,40,.88); color: #fff; border-radius: 16px; padding: 8px 12px; max-width: 480px; margin: 0 auto; text-align: center; font-weight: 800; font-size: 13px; }
#tnNgam.on { display: block; }
#tnNgam div { position: relative; height: 22px; border-radius: 11px; background: #3a3560; margin-top: 6px; }
#tnNgam .vach { position: absolute; top: 0; bottom: 0; background: #4fbf7a; border-radius: 11px; }
#tnNgam b { position: absolute; top: -4px; width: 6px; height: 30px; margin-left: -3px; background: #ffd23f; border-radius: 3px; box-shadow: 0 0 8px #ffd23f; }
#tnMo { position: fixed; inset: 0; z-index: 3; pointer-events: none; opacity: 0; background: radial-gradient(ellipse at center, rgba(120,80,200,0) 40%, rgba(90,50,160,.75) 100%); transition: opacity .3s; }
