:root { --c: #FF6B2C; --c2: #FFC93C; --bg: #2A1A14; --ink: #2a1d16; --mut: #6e5b50; --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(26, 16, 10, .55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
button { font: inherit; cursor: pointer; color: inherit; }

/* ---------- màn chính: cảnh 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,.6); }
.logo img { width: 58px; height: 58px; border-radius: 16px; box-shadow: 0 8px 22px rgba(0,0,0,.4); }
.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: 34vh; }
.sheet { background: rgba(255, 248, 238, .96); border-radius: 26px; padding: 14px; box-shadow: 0 -6px 30px rgba(0,0,0,.4); 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,.14); margin: 6px 0; }
.btn.main { background: linear-gradient(180deg, #ffb347, #ff7a2c 60%, #e2531a); 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.ngay { background: linear-gradient(180deg, #5a2a14, #3a1a0c); color: #fff; 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: 74px; 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: #ff7a2c; background: #fff1e6; }
.luoi .o.khoa { opacity: .62; }
.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, #ff7a2c, #ffc93c); }
.viec div b { grid-row: 1 / span 2; grid-column: 2; align-self: center; color: #c0841a; font-size: 13px; }
.viec div.xong { background: #fff3e2; }
.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: #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,.4); }
.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: #c0841a; }
.panel h2 small { font-size: 14px; color: #c0841a; }
.panel h3 { margin: 16px 0 6px; font-size: 16px; }
.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 ul { padding-left: 18px; margin: 4px 0; }
.panel li b { color: var(--ink); }
.panel li.chua { opacity: .6; }
.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: #e2531a; 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, #ffcf4a, #f0a820); color: #3a2a08; }
.nc button.thieu { filter: grayscale(.7); opacity: .7; }
.nc button[disabled] { background: #eadfd6; color: #8a7a70; }

/* ---------- HUD trong lượt ---------- */
#ncHud { position: fixed; left: 0; right: 0; top: 0; z-index: 8; display: none; padding: calc(var(--sat) + 8px) 10px 0; pointer-events: none; }
#ncHud.on { display: block; }
#ncHud .r1 { display: grid; grid-template-columns: 62px 1fr auto; gap: 8px; align-items: center; }
#ncHud .dung { pointer-events: auto; border: 0; border-radius: 14px; min-height: 48px; background: rgba(30,16,8,.62); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
#ncHud .dung b { font-size: 15px; } #ncHud .dung small { font-size: 11px; font-weight: 800; margin-top: 3px; }
#ncHud .don { background: rgba(255,248,238,.93); border-radius: 14px; padding: 6px 10px; min-height: 48px; box-shadow: 0 3px 10px rgba(0,0,0,.25); }
#ncHud .don b { display: block; font-size: 15px; font-weight: 900; line-height: 1.2; }
#ncHud .don small { font-size: 12px; font-weight: 700; color: var(--mut); }
#ncHud .diem { text-align: right; color: #fff; text-shadow: 0 2px 6px rgba(0,0,0,.8); min-width: 64px; }
#ncHud .diem b { display: block; font-size: 24px; font-weight: 900; line-height: 1; }
#ncHud .diem small { font-size: 11.5px; font-weight: 800; }
#ncHud .tien { display: none; margin-top: 7px; position: relative; height: 24px; border-radius: 12px; background: rgba(30,16,8,.62); overflow: hidden; border: 1.5px solid rgba(255,255,255,.3); }
#ncHud .tien.on { display: block; }
#ncHud .tien i { position: absolute; inset: 0; }
#ncHud .tien em { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ff7a2c, #ffc93c); transition: width .1s; }
#ncHud .tien.xanh em { background: linear-gradient(90deg, #3fcf7a, #a6f0b0); }
#ncHud .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; }

/* nhiệt kế + thanh khuôn: hai ống đứng hai bên */
#ncNhiet, #ncKhuon { position: fixed; z-index: 7; top: calc(var(--sat) + 132px); bottom: calc(var(--sab) + 150px); width: 64px; display: none; flex-direction: column; align-items: center; pointer-events: none; }
#ncNhiet { left: 8px; } #ncKhuon { right: 8px; }
#ncNhiet.on, #ncKhuon.on { display: flex; }
.ong { position: relative; flex: 1; width: 26px; border-radius: 14px; background: rgba(30,16,8,.7); border: 2px solid rgba(255,255,255,.55); overflow: visible; box-shadow: 0 4px 14px rgba(0,0,0,.4); }
.ong .cot { position: absolute; left: 3px; right: 3px; bottom: 3px; border-radius: 10px; background: linear-gradient(0deg, #ff3b1a, #ff9a2c 60%, #ffe27a); max-height: calc(100% - 6px); }
#ncKhuon .ong .cot { background: linear-gradient(0deg, #ff7a2c, #ffc93c); }
.ong .dai { position: absolute; left: -6px; right: -6px; background: rgba(70,220,120,.55); border: 2px solid #4fe08a; border-radius: 6px; }
.ong .tm { position: absolute; left: -4px; right: -4px; height: 0; border-top: 2px dashed #fff; }
.ong .tm span { position: absolute; left: 30px; top: -9px; font-style: normal; font-size: 10.5px; font-weight: 800; color: #fff; white-space: nowrap; text-shadow: 0 1px 3px #000; }
.ong .vach { position: absolute; left: -8px; right: -8px; height: 0; border-top: 3px solid #fff; box-shadow: 0 0 6px #fff; }
.ong .kim { position: absolute; left: 30px; transform: translateY(50%); background: #fff; color: #2a1d16; font-size: 12.5px; font-weight: 900; padding: 2px 6px; border-radius: 8px; white-space: nowrap; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.ong .kim::before { content: ''; position: absolute; left: -6px; top: 50%; margin-top: -5px; border: 5px solid transparent; border-right-color: #fff; border-left: 0; }
#ncNhiet small, #ncKhuon small { margin-top: 6px; color: #fff; font-size: 11px; font-weight: 800; text-align: center; text-shadow: 0 1px 3px #000; line-height: 1.2; }
#ncNhiet.dung .kim { background: #4fe08a; } #ncNhiet.qua .kim { background: #ff5a3c; color: #fff; }
#ncKhuon.dung .ong { border-color: #4fe08a; } #ncKhuon.qua .ong { border-color: #ff5a3c; }

/* nút một ngón dưới đáy */
#ncNut { position: fixed; left: 0; right: 0; bottom: 0; z-index: 8; display: none; gap: 8px; padding: 0 12px calc(var(--sab) + 14px); justify-content: center; }
#ncNut.on { display: flex; }
#ncNut button { border: 0; border-radius: 22px; min-height: 76px; padding: 8px 12px; color: #fff; font-weight: 900; box-shadow: 0 6px 18px rgba(0,0,0,.4); touch-action: none; -webkit-touch-callout: none; flex: 1; max-width: 340px; line-height: 1.15; }
#ncNut button b { display: block; font-size: 19px; }
#ncNut button small { display: block; font-size: 12px; font-weight: 700; opacity: .92; margin-top: 3px; }
#ncNut .giu { background: linear-gradient(180deg, #ff9a3c, #e2531a); transition: transform .06s; }
#ncNut .giu.rot { background: linear-gradient(180deg, #ffc93c, #e88a10); color: #3a1a08; }
#ncNut .giu.an { transform: scale(.95); filter: brightness(1.15); }
#ncNut .giu.mai { background: rgba(30,16,8,.7); }
#ncNut .phu { background: linear-gradient(180deg, #5a6b7a, #3a4652); }
#ncNut .phu.xanh { background: linear-gradient(180deg, #4fe08a, #22a35a); }
#ncNut .phu.nhung { background: linear-gradient(180deg, #4fb8ff, #1a78c8); }
#ncNut button.tat { filter: grayscale(.6); opacity: .62; }
#ncNut .giu.tat.mai { opacity: 1; filter: none; }

#ncBan { position: fixed; left: 50%; top: calc(var(--sat) + 27vh); transform: translate(-50%, -10px); z-index: 9; text-align: center; pointer-events: none; opacity: 0; transition: opacity .25s, transform .25s; width: min(72vw, 420px); }
#ncBan.on { opacity: 1; transform: translate(-50%, 0); }
#ncBan b { display: block; color: #fff; font-size: 26px; font-weight: 900; text-shadow: 0 3px 10px rgba(0,0,0,.85), 0 0 2px #000; line-height: 1.15; }
#ncBan span { display: inline-block; margin-top: 6px; background: rgba(30,16,8,.72); color: #fff; padding: 6px 12px; border-radius: 12px; font-size: 13.5px; font-weight: 700; line-height: 1.35; }
#ncTay { position: fixed; left: 0; top: 0; z-index: 10; pointer-events: none; display: none; }
#ncTay.on { display: block; }
#ncTay i { position: absolute; left: -14px; top: -4px; font-style: normal; font-size: 40px; animation: ncTayA 1.1s infinite; filter: drop-shadow(0 3px 4px rgba(0,0,0,.5)); }
#ncTay span { position: absolute; top: -92px; width: 220px; text-align: center; background: rgba(255,250,235,.96); color: #2a1d16; padding: 7px 10px; border-radius: 12px; font-size: 14px; font-weight: 800; box-shadow: 0 4px 14px rgba(0,0,0,.3); }
#ncTay.duoi span { top: 46px; }
@keyframes ncTayA { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(10px); } }

/* thẻ giao đơn */
#ncGiao { position: fixed; left: 0; right: 0; bottom: 0; z-index: 11; display: none; padding: 0 12px calc(var(--sab) + 12px); }
#ncGiao.on { display: block; animation: ncLen .3s ease-out; }
@keyframes ncLen { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
#ncGiao .the { max-width: 460px; margin: 0 auto; background: rgba(255,248,238,.97); border-radius: 24px; padding: 14px 16px; box-shadow: 0 -6px 30px rgba(0,0,0,.45); }
#ncGiao .sao { text-align: center; font-size: 38px; letter-spacing: 4px; color: #ffb21a; text-shadow: 0 2px 0 #b86a00; line-height: 1; }
#ncGiao .sao.s0 { color: #c9b8aa; text-shadow: none; }
#ncGiao h3 { margin: 6px 0 0; text-align: center; font-size: 20px; }
#ncGiao p { margin: 2px 0 6px; text-align: center; color: var(--mut); font-weight: 700; font-size: 14px; }
#ncGiao ul { list-style: none; padding: 0; margin: 0 0 6px; }
#ncGiao li { font-weight: 800; font-size: 14px; padding: 3px 0; }
#ncGiao li.tot { color: #1f8a4a; } #ncGiao li.vua { color: #b5761a; } #ncGiao li.te { color: #c8341a; }
#ncGiao .dg { text-align: center; margin: 4px 0; } #ncGiao .dg b { font-size: 28px; color: #e2531a; } #ncGiao .dg small { display: block; color: var(--mut); font-weight: 700; font-size: 12.5px; }
#ncGiao .btn { min-height: 56px; margin: 6px 0 0; }
