:root { --c: #8a1f2b; --c2: #f2b84b; --bg: #1b0b0e; --ink: #2a1410; --mut: #6d5b4f; --kem: #fff7ea; --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; -webkit-touch-callout: none; }
input, textarea { -webkit-user-select: text; user-select: text; }
canvas#c { position: fixed; inset: 0; 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; }
button { font: inherit; cursor: pointer; color: inherit; }
a { color: inherit; }

/* trang chính: phủ lên cảnh 3D đang xoay chậm */
.home { min-height: 100dvh; display: flex; flex-direction: column; justify-content: space-between; align-items: center; gap: 14px; padding: calc(var(--sat) + 64px) 16px calc(var(--sab) + 20px); max-width: 520px; margin: 0 auto; }
.home .dau { text-align: center; }
.lich { color: #fff; font-weight: 700; font-size: 14px; text-shadow: 0 2px 8px rgba(0,0,0,.6); }
.lich b { font-weight: 900; }
.lich .le { display: block; margin: 6px auto 0; width: max-content; max-width: 90%; background: rgba(242,184,75,.94); color: #3a1a0c; padding: 4px 12px; border-radius: 999px; font-weight: 800; }
.logo { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 10px; color: #fff; text-shadow: 0 4px 18px rgba(0,0,0,.5); }
.logo img { width: 52px; height: 52px; border-radius: 14px; box-shadow: 0 8px 22px rgba(0,0,0,.4); }
.logo h1 { margin: 0; font-size: 36px; font-weight: 900; letter-spacing: -.5px; }
.khau { color: #fff; font-weight: 800; font-size: 15px; margin: 4px 0 0; text-shadow: 0 2px 8px rgba(0,0,0,.6); }
.the { width: 100%; background: rgba(32,10,12,.74); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-radius: 24px; padding: 14px; color: #f8e9d4; box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.the .mua { margin: 0 0 8px; font-size: 14px; line-height: 1.45; text-align: center; font-weight: 600; }
.the .mua b { color: #ffd98a; }
.btn { display: block; width: 100%; min-height: 52px; border: 0; border-radius: 18px; background: #fff; color: var(--ink); font-weight: 800; font-size: 17px; margin: 8px 0; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.btn.main { background: linear-gradient(180deg, #e0a43e, var(--c)); color: #fff; }
.btn.big { min-height: 72px; font-size: 22px; font-weight: 900; }
.btn small { display: block; font-size: 13px; font-weight: 700; opacity: .9; }
.btn.qa { background: #fff3dc; color: #3a1a0c; font-size: 16px; }
.link { border: 0; background: rgba(255,255,255,.12); color: #f8e9d4; border-radius: 14px; padding: 12px 16px; font-weight: 800; width: 100%; margin-top: 6px; min-height: 44px; }
.bon { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.bon button { border: 0; border-radius: 16px; min-height: 64px; background: rgba(255,243,220,.95); color: #3a1a0c; font-weight: 800; font-size: 13px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.bon i { font-style: normal; font-size: 22px; line-height: 1; }
.cung { text-align: center; font-size: 13px; margin: 12px 0 4px; opacity: .85; }
.cung a { color: #ffd98a; font-weight: 700; }
.foot { color: #f8e9d4; font-size: 12px; text-align: center; opacity: .75; margin: 6px 0 0; line-height: 1.45; }
.foot a { color: #fff; }

.panel { background: var(--kem); border-radius: 22px; padding: 20px; max-width: 480px; margin: calc(var(--sat) + 70px) auto 24px; width: calc(100% - 32px); box-shadow: 0 12px 40px rgba(0,0,0,.4); }
.panel h2 { margin: 0 0 8px; color: #5a1218; }
.panel h3 { margin: 16px 0 6px; font-size: 15px; color: var(--c); }
.panel p, .panel li { color: var(--mut); font-weight: 600; line-height: 1.5; }
.panel li { margin: 6px 0; }
.panel input { width: 100%; min-height: 48px; border: 1px solid #e3cfb0; border-radius: 14px; padding: 0 14px; font: inherit; font-size: 16px; margin: 6px 0; background: #fff; }
.panel .link { background: #f3e5cc; color: #3a1a0c; }
.nho { font-size: 13px; color: var(--mut); font-weight: 600; margin: 6px 0; }
.noi { display: grid; gap: 10px; margin: 10px 0; }
.noi button { text-align: left; border: 0; border-left: 6px solid var(--m); background: #fff; border-radius: 16px; padding: 12px 14px; box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.noi b { display: block; font-size: 16px; color: #3a1a0c; }
.noi span { display: block; font-size: 13px; font-weight: 700; color: var(--m); margin: 2px 0 4px; }
.noi small { display: block; font-size: 13px; color: var(--mut); font-weight: 600; line-height: 1.4; }
.so .chuoi { font-size: 18px; font-weight: 900; color: #3a1a0c; margin: 0; }
.so .luoi { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 12px; }
.so .luoi div { background: #fbefd9; border-radius: 12px; padding: 8px; text-align: center; }
.so .luoi b { display: block; font-size: 20px; color: #3a1a0c; }
.so .luoi span { font-size: 12px; color: var(--mut); font-weight: 700; }
.lich28 { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; }
.lich28 i { aspect-ratio: 1; border-radius: 4px; background: #efe2cc; }
.lich28 .m1 { background: #f3d9a4; } .lich28 .m2 { background: #e8b75c; } .lich28 .m3 { background: #c98a2c; } .lich28 .m4 { background: #8a1f2b; }
.tich { display: flex; flex-wrap: wrap; gap: 6px; }
.tich span { background: #efe2cc; border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 700; color: #a08a70; }
.tich span.co { background: #fff0cc; color: #5a1218; }
.huy { display: grid; gap: 6px; }
.huy div { background: #f3ece0; border-radius: 12px; padding: 8px 10px; opacity: .55; }
.huy div.co { background: #fff0cc; opacity: 1; }
.huy small { display: block; color: var(--mut); font-weight: 600; }
.ao { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin: 8px 0; }
.ao button { border: 2px solid #eadfcd; background: #fff; border-radius: 12px; min-height: 48px; font-weight: 700; display: flex; align-items: center; gap: 8px; padding: 0 10px; font-size: 14px; }
.ao button.on { border-color: var(--c); background: #fff4e0; }
.ao i { width: 20px; height: 20px; border-radius: 50%; flex: none; border: 1px solid rgba(0,0,0,.15); }

/* trong lúc viếng */
#tren { position: fixed; z-index: 15; left: 8px; right: 8px; top: calc(var(--sat) + 58px); display: none; align-items: center; gap: 6px; pointer-events: none; }
#tren.on { display: flex; }
#tren > * { pointer-events: auto; }
#tren button { border: 0; min-height: 44px; border-radius: 12px; padding: 0 10px; font-weight: 800; background: rgba(255,247,234,.92); color: #3a1a0c; font-size: 13px; white-space: nowrap; }
#tren .tt { flex: 1; min-width: 0; color: #fff; text-shadow: 0 2px 6px rgba(0,0,0,.7); line-height: 1.25; pointer-events: none; }
#tren .tt b { display: block; font-size: 15px; } #tren .tt small { font-size: 12px; font-weight: 700; opacity: .92; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#cam { position: fixed; z-index: 15; right: 8px; top: 42%; transform: translateY(-50%); display: none; flex-direction: column; gap: 8px; }
#cam.on { display: flex; }
#cam button { width: 52px; min-height: 52px; border: 0; border-radius: 14px; background: rgba(255,247,234,.88); color: #3a1a0c; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; box-shadow: 0 4px 12px rgba(0,0,0,.25); }
#cam small { font-size: 10px; font-weight: 800; }
#dock { position: fixed; z-index: 15; left: 0; right: 0; bottom: 0; display: none; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 10px 8px calc(var(--sab) + 8px); background: linear-gradient(180deg, rgba(27,11,14,0), rgba(27,11,14,.9) 24%); max-width: 640px; margin: 0 auto; }
#dock.on { display: grid; }
#dock button { position: relative; border: 0; border-radius: 14px; min-height: 54px; background: rgba(255,247,234,.95); color: #3a1a0c; font-weight: 800; font-size: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 4px 2px; }
#dock button i { font-style: normal; font-size: 21px; line-height: 1; }
#dock button.on { background: linear-gradient(180deg, #f2b84b, #c98a2c); color: #2a1608; }
#dock button.xong::after { content: '✓'; position: absolute; top: 3px; right: 6px; font-size: 11px; color: #2f8a4a; font-weight: 900; }
#chao { position: fixed; z-index: 16; left: 50%; transform: translateX(-50%); bottom: calc(var(--sab) + 140px); display: none; border: 0; border-radius: 999px; min-height: 48px; padding: 0 18px; background: linear-gradient(180deg, #f2b84b, #c98a2c); color: #2a1608; font-weight: 800; box-shadow: 0 8px 20px rgba(0,0,0,.35); max-width: calc(100% - 32px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#chao.on { display: block; }
#panel { position: fixed; z-index: 16; left: 8px; right: 8px; bottom: calc(var(--sab) + 136px); display: none; background: rgba(255,247,234,.97); border-radius: 18px; padding: 12px 14px; max-width: 560px; margin: 0 auto; max-height: 48dvh; overflow-y: auto; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
#panel.on { display: block; }
#panel h3 { margin: 2px 0 6px; font-size: 17px; color: #5a1218; padding-right: 80px; }
#panel .dong { float: right; border: 0; background: #f0e2c8; border-radius: 999px; min-height: 36px; padding: 0 12px; font-weight: 800; font-size: 12px; color: #3a1a0c; margin: -2px -4px 0 0; }
#panel .lon { border: 0; min-height: 52px; padding: 0 22px; border-radius: 16px; font-weight: 900; font-size: 17px; color: #fff; background: linear-gradient(180deg, #d0952e, var(--c)); width: 100%; margin-top: 6px; }
#panel .chip { border: 1px solid #e3cfb0; background: #fff; border-radius: 999px; min-height: 44px; padding: 0 14px; font-weight: 800; font-size: 13px; color: #3a1a0c; display: inline-flex; align-items: center; gap: 6px; }
#panel .chip.on { border-color: var(--c); background: #fff0cc; }
#panel .chip i { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0,0,0,.2); }
#panel .hang { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
#panel .hang .lon { flex: 1; width: auto; }
#panel .ba { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
#panel .ba button { border: 0; border-radius: 16px; min-height: 76px; background: #fff; box-shadow: 0 3px 10px rgba(0,0,0,.08); font-weight: 800; font-size: 13px; color: #3a1a0c; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
#panel .ba i { font-style: normal; font-size: 26px; line-height: 1; }
#panel .nhac { text-align: center; font-weight: 800; color: #8a1f2b; font-size: 13px; margin: 8px 0 0; }
#panel .ket { border-radius: 14px; padding: 10px 12px; margin: 6px 0; background: #fff; border: 2px solid #e8c37a; text-align: center; }
#panel .ket b { display: block; font-size: 20px; color: #5a1218; }
#panel .ket span { font-size: 14px; color: var(--mut); font-weight: 600; }
#panel .cho { text-align: center; font-size: 22px; margin: 6px 0; }
#panel .dstich { display: grid; gap: 6px; }
#panel .dstich button { text-align: left; border: 0; background: #fff; border-radius: 14px; padding: 10px 12px; min-height: 52px; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
#panel .dstich b { display: block; color: #3a1a0c; } #panel .dstich small { color: var(--mut); font-weight: 700; }
#panel .loai { margin: 0; font-size: 12px; font-weight: 800; color: #b07a22; text-transform: uppercase; letter-spacing: .5px; }
#panel .doan { font-size: 16px; line-height: 1.6; color: #3a1a0c; font-weight: 600; margin: 6px 0 8px; -webkit-user-select: text; user-select: text; }
#panel textarea { width: 100%; border: 1px solid #e3cfb0; border-radius: 14px; padding: 10px 12px; font: inherit; font-size: 16px; background: #fff; resize: none; }
#panel .tho { display: flex; align-items: center; gap: 14px; margin: 8px 0; }
#panel .tho i { width: 54px; height: 54px; border-radius: 50%; background: radial-gradient(circle, #ffe9b0, #e0a43e); box-shadow: 0 0 24px rgba(242,184,75,.7); transition: transform .3s linear; flex: none; }
#panel .tho b { font-size: 20px; color: #5a1218; }
#panel ul.vl { list-style: none; padding: 0; margin: 6px 0; }
#panel ul.vl li { padding: 8px 10px; border-radius: 12px; background: #f6ecd9; margin: 4px 0; font-weight: 700; color: #6d5b4f; }
#panel ul.vl li.co { background: #fff0cc; color: #3a1a0c; }
@media (min-width: 700px) { #panel { bottom: 150px; } #cam { right: 16px; } }
body.dangvieng .agt-toast { bottom: auto; top: calc(var(--sat) + 120px); }
