:root { --c: #3FA34D; --c2: #F4B942; --bg: #12301F; --ink: #1f2d1c; --mut: #5c6a55; --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, 30, 16, .5); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
#menu.day.on { display: flex; flex-direction: column; }
#menu.day .panel { margin: auto auto 0; border-radius: 22px 22px 0 0; padding-bottom: calc(var(--sab) + 18px); flex-shrink: 0; }
button { font: inherit; cursor: pointer; color: inherit; }

/* ---------- màn chính: làng 3D phía sau, bảng 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,.6); }
.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: 40px; font-weight: 900; letter-spacing: -1px; line-height: 1; }
.logo p { margin: 3px 0 0; font-weight: 800; font-size: 14px; opacity: .95; }
.home .mo { flex: 1; min-height: 30vh; }
.sheet { background: rgba(253, 250, 238, .96); border-radius: 26px; padding: 14px; box-shadow: 0 -6px 30px rgba(0,0,0,.35); 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(0,0,0,.12); margin: 6px 0; }
.btn[disabled] { opacity: .55; }
.btn.main { background: linear-gradient(180deg, #7fd06a, #3fa34d 60%, #2a8a3c); color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.18); }
.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.o2 { margin: 0; text-align: left; padding: 10px 12px; min-height: 64px; }
.btn.o2 b { font-size: 16px; } .btn.o2 small { color: var(--mut); font-size: 12px; line-height: 1.3; margin-top: 2px; }
.btn.ngay { background: linear-gradient(180deg, #f6c95a, #e8a020); color: #3a2608; text-align: left; padding: 10px 16px; margin: 0; }
.btn.ngay b { font-size: 17px; }
.btn.ngay small { opacity: .85; line-height: 1.35; margin-top: 2px; }
.luoi { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; }
.luoi .o { border: 2px solid transparent; background: #fff; border-radius: 16px; min-height: 70px; padding: 7px 8px; text-align: left; box-shadow: 0 3px 10px rgba(0,0,0,.08); display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto auto; column-gap: 6px; align-items: center; }
.luoi .o i { font-style: normal; font-size: 26px; grid-row: span 2; text-align: center; }
.luoi .o b { font-size: 14px; font-weight: 900; line-height: 1.2; }
.luoi .o small { font-size: 11.5px; font-weight: 700; color: var(--mut); line-height: 1.3; }
.luoi .o.chon { border-color: #3fa34d; background: #effae8; }
.luoi .o.khoa { opacity: .62; }
.luoi.qua { grid-template-columns: repeat(3, 1fr); }
.luoi.qua .o { grid-template-columns: 1fr; grid-template-rows: auto auto; text-align: center; min-height: 76px; }
.luoi.qua .o i { grid-row: auto; font-size: 28px; }
.luoi.qua .o b { font-size: 12.5px; }
.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: #e4eadf; overflow: hidden; }
.viec div i em { display: block; height: 100%; background: linear-gradient(90deg, #3fa34d, #f4b942); }
.viec div b { grid-row: 1 / span 2; grid-column: 2; align-self: center; color: #b07a10; font-size: 13px; }
.viec div.xong { background: #f0f9e8; }
.hang { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.link { border: 0; background: #fff; border-radius: 14px; padding: 12px 8px; font-weight: 800; width: 100%; min-height: 46px; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.foot { color: var(--mut); font-size: 12.5px; text-align: center; margin: 2px 0 0; }
.foot a { color: inherit; }

/* ---------- bảng phụ ---------- */
.panel { background: #fdfaee; 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); }
#menu.day .panel { width: 100%; }
.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: #b07a10; }
.panel h3 { margin: 16px 0 6px; font-size: 16px; display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.panel h3 small { 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 p.trong { background: #fff; border-radius: 12px; padding: 10px 12px; }
.panel ul { padding-left: 18px; margin: 4px 0; }
.panel li b { color: var(--ink); }
.panel li.chua { opacity: .6; }
.panel ul.so { list-style: none; padding: 0; }
.panel ul.so li { background: #fff; border-radius: 12px; padding: 8px 10px; margin: 6px 0; }
.panel ul.so li small { display: block; font-size: 12px; opacity: .8; }
.panel select { width: 100%; min-height: 48px; border-radius: 12px; border: 2px solid #d9e6cf; background: #fff; font: inherit; font-weight: 700; padding: 0 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 2px solid transparent; background: #fff; border-radius: 14px; min-height: 44px; padding: 6px 12px; font-weight: 800; font-size: 13.5px; box-shadow: 0 2px 8px rgba(0,0,0,.07); display: inline-flex; align-items: center; gap: 6px; }
.chip.chon { border-color: #3fa34d; background: #effae8; }
.chip i { width: 18px; height: 18px; border-radius: 6px; display: inline-block; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.chip.doi { flex-direction: column; align-items: flex-start; gap: 0; min-width: 96px; }
.chip.doi small { font-weight: 700; color: var(--mut); font-size: 12px; }
.chips.loi .chip { font-size: 13px; text-align: left; }
.lang { display: grid; grid-template-columns: 34px 1fr auto; gap: 8px; align-items: center; width: 100%; border: 0; background: #fff; border-radius: 14px; padding: 9px 10px; margin: 6px 0; text-align: left; box-shadow: 0 2px 8px rgba(0,0,0,.06); min-height: 56px; }
.lang i { font-style: normal; font-size: 24px; text-align: center; }
.lang b { display: block; font-size: 15px; }
.lang small { display: block; font-size: 12.5px; color: var(--mut); font-weight: 600; line-height: 1.35; }
.lang em { font-style: normal; font-weight: 900; background: linear-gradient(180deg, #7fd06a, #3fa34d); color: #fff; border-radius: 12px; padding: 10px 12px; }
.lang.co { background: #f4f9ec; }
.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(0,0,0,.06); }
.nc i { font-style: normal; font-size: 24px; text-align: center; }
.nc b { font-size: 15px; } .nc b small { color: #3fa34d; 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, #ffd96a, #f0a820); color: #3a2a08; }
.nc button.thieu { filter: grayscale(.7); opacity: .7; }
.nc button[disabled] { background: #e6e2d6; color: #8a8270; }

/* ---------- HUD trong lượt / trong cảnh ---------- */
#vtHud { position: fixed; left: 0; right: 0; top: 0; z-index: 8; display: none; padding: calc(var(--sat) + 8px) 10px 0; pointer-events: none; }
#vtHud.on { display: block; }
#vtHud .r1 { display: grid; grid-template-columns: 62px 1fr auto; gap: 8px; align-items: center; }
#vtHud .dung { pointer-events: auto; border: 0; border-radius: 14px; min-height: 48px; background: rgba(20,40,20,.62); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
#vtHud .dung b { font-size: 16px; } #vtHud .dung small { font-size: 11px; font-weight: 800; margin-top: 3px; }
#vtHud .tieu { background: rgba(253,250,238,.93); border-radius: 14px; padding: 6px 10px; min-height: 48px; box-shadow: 0 3px 10px rgba(0,0,0,.22); }
#vtHud .tieu b { display: block; font-size: 15px; font-weight: 900; line-height: 1.2; }
#vtHud .tieu small { font-size: 12px; font-weight: 700; color: var(--mut); }
#vtHud .diem { text-align: right; color: #fff; text-shadow: 0 2px 6px rgba(0,0,0,.8); min-width: 56px; }
#vtHud .diem b { display: block; font-size: 24px; font-weight: 900; line-height: 1; }
#vtHud .diem small { font-size: 11.5px; font-weight: 800; }
#vtHud .tien { display: none; margin-top: 7px; position: relative; height: 24px; border-radius: 12px; background: rgba(20,40,20,.62); overflow: hidden; border: 1.5px solid rgba(255,255,255,.3); }
#vtHud .tien.on { display: block; }
#vtHud .tien i { position: absolute; inset: 0; }
#vtHud .tien em { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #3fa34d, #a6e07a); transition: width .1s; }
#vtHud .tien.xanh em { background: linear-gradient(90deg, #f4b942, #ffe08a); }
#vtHud .tien span { position: absolute; inset: 0; text-align: center; font-size: 12.5px; line-height: 21px; color: #fff; font-weight: 800; text-shadow: 0 1px 3px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 8px; }

#vtBan { position: fixed; left: 50%; top: calc(var(--sat) + 22vh); transform: translate(-50%, -10px); z-index: 9; text-align: center; pointer-events: none; opacity: 0; transition: opacity .25s, transform .25s; width: min(78vw, 440px); }
#vtBan.on { opacity: 1; transform: translate(-50%, 0); }
#vtBan b { display: block; color: #fff; font-size: 24px; font-weight: 900; text-shadow: 0 3px 10px rgba(0,0,0,.85), 0 0 2px #000; line-height: 1.2; }
#vtBan span { display: inline-block; margin-top: 6px; background: rgba(20,40,20,.74); color: #fff; padding: 6px 12px; border-radius: 12px; font-size: 13.5px; font-weight: 700; line-height: 1.35; }
#vtTay { position: fixed; left: 0; top: 0; z-index: 10; pointer-events: none; display: none; }
#vtTay.on { display: block; }
#vtTay i { position: absolute; left: -14px; top: -4px; font-style: normal; font-size: 40px; animation: vtTayA 1.1s infinite; filter: drop-shadow(0 3px 4px rgba(0,0,0,.5)); }
#vtTay span { position: absolute; top: -92px; width: 220px; text-align: center; background: rgba(253,250,238,.96); color: var(--ink); padding: 7px 10px; border-radius: 12px; font-size: 14px; font-weight: 800; box-shadow: 0 4px 14px rgba(0,0,0,.3); }
#vtTay.duoi span { top: 46px; }
@keyframes vtTayA { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(10px); } }
