:root { --c: #166534; --c2: #f59e0b; --bg: #1d1915; --kem: #fbf6ea; --ink: #1d2a1f; --mut: #5a6657; --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; }
body.nha #menu { background: linear-gradient(180deg, rgba(20,16,12,.55) 0, rgba(20,16,12,0) 20%, rgba(20,16,12,0) 44%, rgba(20,16,12,.78) 58%, #1d1915 80%); }
body:not(.nha) #menu.on:not(.day) { background: rgba(20,16,12,.6); }
#menu.day { background: linear-gradient(180deg, rgba(20,16,12,0) 0, rgba(20,16,12,0) 30%, rgba(20,16,12,.55) 46%); }
#menu.day .panel { margin-top: calc(var(--sat) + 38vh); }
button { font: inherit; cursor: pointer; color: inherit; }

/* ---------- trang chính ---------- */
.home { min-height: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: calc(var(--sat) + 64px) 16px 28px; max-width: 520px; margin: 0 auto; }
.logo { text-align: center; color: #fff; text-shadow: 0 3px 14px rgba(0,0,0,.55); }
.logo .mark { width: 70px; height: 70px; margin: 0 auto 6px; border-radius: 20px; overflow: hidden; box-shadow: 0 10px 28px rgba(0,0,0,.45), 0 0 0 3px rgba(245,158,11,.8); transform: rotate(-6deg); }
.logo .mark img { width: 100%; height: 100%; display: block; }
.logo h1 { margin: 0; font-size: clamp(40px, 11vw, 58px); font-weight: 900; letter-spacing: -1px; line-height: 1; }
.logo p { margin: 6px 0 0; font-weight: 700; font-size: 15px; }
.san { width: 100%; height: 30vh; min-height: 150px; cursor: pointer; }
.btn { display: block; width: 100%; min-height: 52px; border: 0; border-radius: 18px; background: var(--kem); color: var(--ink); font-weight: 800; font-size: 17px; margin: 5px 0; padding: 8px 12px; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.btn small { display: block; font-size: 12.5px; font-weight: 600; opacity: .85; margin-top: 2px; }
.btn.main { background: linear-gradient(180deg, #2fa35a, #166534); color: #fff; }
.btn.big { min-height: 72px; font-size: 22px; font-weight: 900; }
.btn:disabled { opacity: .5; }
.ches { display: grid; gap: 8px; width: 100%; }
.ches button { text-align: left; border: 0; border-radius: 16px; padding: 10px 14px; min-height: 60px; background: rgba(251,246,234,.95); box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.ches b { display: block; font-size: 16px; }
.ches span { display: block; font-size: 13px; color: var(--mut); font-weight: 600; margin-top: 2px; }
.links { display: flex; gap: 8px; width: 100%; }
.link { border: 0; background: rgba(251,246,234,.9); border-radius: 14px; padding: 10px; min-height: 48px; font-weight: 800; width: 100%; color: var(--ink); }
.note { color: #e9dfc9; font-size: 12.5px; line-height: 1.5; text-align: center; margin: 6px 4px 0; font-weight: 600; }
.note.dam { color: var(--mut); text-align: left; }
.foot { color: #fff; font-size: 13px; text-align: center; opacity: .8; }
.foot a { color: #ffd98a; }

/* ---------- bảng ---------- */
.panel { background: var(--kem); border-radius: 22px; padding: 18px; max-width: 520px; margin: calc(var(--sat) + 64px) auto 24px; width: calc(100% - 24px); box-shadow: 0 20px 50px rgba(0,0,0,.45); }
.panel h2 { margin: 0 0 8px; font-size: 23px; }
.panel h3 { margin: 14px 0 6px; font-size: 16px; }
.panel h3 small { color: var(--mut); font-weight: 700; }
.panel p, .panel li { color: var(--mut); font-weight: 600; line-height: 1.5; }
.panel ul { padding-left: 18px; }
.panel li b, .panel p b { color: var(--ink); }
.panel .tot { color: #166534; }
.nho { font-size: 13.5px; margin: 4px 0 8px; }
.ca { display: inline-block; font-weight: 800; color: #9a5b06; background: #fff0d0; border-radius: 99px; padding: 3px 10px; font-size: 12.5px; }
.moi { background: #eaf6ea; border-radius: 14px; padding: 10px 12px; margin: 8px 0; }
.moi b { color: #166534; }
.moi p { margin: 4px 0 0; }
.theloai { background: #fff; border-radius: 16px; padding: 10px 12px; margin: 8px 0; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.tl1 { display: flex; align-items: center; gap: 10px; }
.tl1 .bt { font-size: 30px; }
.tl1 b { display: block; font-size: 16px; color: var(--ink); }
.tl1 small { color: var(--mut); font-weight: 600; font-style: italic; }
.tl1 .mua { margin-left: auto; font-size: 12.5px; font-weight: 800; background: #f3ecdc; border-radius: 99px; padding: 4px 8px; white-space: nowrap; }
.theloai p { margin: 6px 0; font-size: 14px; }
.sos { display: flex; flex-wrap: wrap; gap: 6px; }
.sos span { font-size: 12.5px; font-weight: 700; background: #f3ecdc; border-radius: 10px; padding: 4px 8px; color: var(--mut); }
.sos b { color: var(--ink); }
.luoi { display: grid; gap: 8px; }
.luoi button { position: relative; text-align: left; border: 0; border-radius: 16px; padding: 10px 12px 10px 48px; min-height: 64px; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.luoi button:disabled { background: #ece6da; color: #8a857a; }
.luoi em { position: absolute; left: 12px; top: 12px; font-style: normal; font-weight: 900; font-size: 20px; color: #166534; }
.luoi b { display: block; font-size: 15.5px; }
.luoi span { display: block; font-size: 12.5px; color: var(--mut); font-weight: 600; }
.luoi i { position: absolute; right: 12px; top: 10px; font-style: normal; color: #e0a020; letter-spacing: 1px; }
.chons { display: grid; gap: 8px; margin: 8px 0; }
.chons button { text-align: left; border: 2px solid #e3dccb; border-radius: 14px; padding: 10px 12px; min-height: 56px; background: #fff; }
.chons button b { display: block; }
.chons button span { font-size: 13px; color: var(--mut); font-weight: 600; }
.chons button.sai { border-color: #e5b3a8; background: #fbeae6; opacity: .7; }
.the h2 { font-size: 26px; }
/* bày chuồng */
.bay .tien { display: flex; align-items: baseline; gap: 8px; margin: 8px 0 2px; font-weight: 800; color: var(--mut); }
.bay .tien b { font-size: 28px; color: #166534; }
.bay .tien span { margin-left: auto; font-size: 13px; background: #eaf6ea; color: #166534; border-radius: 99px; padding: 3px 10px; }
.bay .tien.lo b { color: #b4321f; } .bay .tien.lo span { background: #fbe4df; color: #b4321f; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 2px solid #e3dccb; background: #fff; border-radius: 99px; padding: 8px 12px; min-height: 44px; font-weight: 800; font-size: 13.5px; }
.chip.on { background: #166534; color: #fff; border-color: #166534; }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.do { position: relative; text-align: left; border: 2px solid #e3dccb; background: #fff; border-radius: 14px; padding: 8px 8px 8px 38px; min-height: 64px; }
.do i { position: absolute; left: 8px; top: 9px; font-style: normal; font-size: 20px; }
.do b { display: block; font-size: 13.5px; }
.do span { display: block; font-size: 11.5px; color: var(--mut); font-weight: 600; line-height: 1.35; }
.do.on { border-color: #2fa35a; background: #eaf6ea; }
.do.on::after { content: '✓'; position: absolute; right: 8px; top: 6px; color: #166534; font-weight: 900; }
.soat { list-style: none; padding: 0 !important; margin: 0; }
.soat li { font-size: 13.5px; padding: 3px 0; }
.soat li.ok { color: #166534; } .soat li.x { color: #b4321f; }
/* sổ */
.tts { display: grid; gap: 6px; }
.tts div { background: #ece6da; border-radius: 12px; padding: 8px 10px; opacity: .7; }
.tts div.on { background: #fff; opacity: 1; box-shadow: 0 2px 6px rgba(0,0,0,.06); }
.tts b { display: block; font-size: 14px; color: var(--ink); }
.tts span { font-size: 12.5px; color: var(--mut); font-weight: 600; }
.huys { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.huys div { background: #ece6da; border-radius: 12px; padding: 8px; opacity: .55; }
.huys div.on { background: #fff4d8; opacity: 1; box-shadow: 0 0 0 2px #f5b84a inset; }
.huys i { font-style: normal; font-size: 22px; }
.huys b { display: block; font-size: 13.5px; }
.huys span { font-size: 12px; color: var(--mut); font-weight: 600; }

/* ---------- HUD khi đang chăm ---------- */
#hud { position: fixed; left: 8px; right: 8px; top: calc(var(--sat) + 8px); z-index: 12; display: none; background: rgba(22,30,22,.72); color: #fff; border-radius: 18px; padding: 8px 10px 8px; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: 0 6px 20px rgba(0,0,0,.3); max-width: 560px; margin: 0 auto; }
body.dang #hud { display: block; }
#hud .h1 { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 14px; }
#hud .h1 .loai { flex: 1; text-align: center; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#hud .h1 .diem { font-size: 18px; font-weight: 900; color: #ffd36a; min-width: 60px; text-align: right; }
#hud .bars { display: flex; gap: 6px; margin-top: 6px; }
#hud .bars span { flex: 1; display: flex; align-items: center; gap: 3px; font-size: 12.5px; font-weight: 800; background: rgba(255,255,255,.12); border-radius: 10px; padding: 3px 6px; min-width: 0; white-space: nowrap; }
#hud .bars i { font-style: normal; font-size: 13px; }
#hud .bars em { flex: 1; height: 7px; border-radius: 9px; background: rgba(255,255,255,.2); overflow: hidden; display: block; }
#hud .bars em u { display: block; height: 100%; border-radius: 9px; background: #6ee08f; }
#hud .bars .vua em u { background: #ffd36a; } #hud .bars .thap em u { background: #ff7a6a; }
#hud .bars .thap { background: rgba(255,90,70,.35); } #hud .bars .vua:not(:has(em)) { background: rgba(255,200,80,.3); }
#hud .dai { width: 100%; height: 44px; display: block; margin-top: 4px; }
#hud .goi { font-size: 13px; font-weight: 700; margin-top: 4px; color: #e9f5e6; line-height: 1.35; }
#tin { display: none; margin-top: 6px; font-size: 13.5px; font-weight: 800; border-radius: 12px; padding: 7px 10px; background: #fff6d8; color: #4a3203; }
#tin.on { display: block; animation: tinV .3s ease-out; }
#tin.tot { background: #dcf7e2; color: #14532d; } #tin.xau { background: #ffe1da; color: #7a1d0e; }
@keyframes tinV { from { transform: translateY(-6px); opacity: 0; } to { transform: none; opacity: 1; } }
#t3Khay > button.nhay { animation: nhay 1s ease-in-out infinite; }
@keyframes nhay { 0%, 100% { box-shadow: 0 4px 14px rgba(0,0,0,.22); } 50% { box-shadow: 0 0 0 4px rgba(255,210,58,.85), 0 4px 14px rgba(0,0,0,.22); } }
@media (min-width: 700px) { #hud { left: 50%; right: auto; width: 540px; transform: translateX(-50%); } }
#tay { position: fixed; left: 0; top: 0; z-index: 13; pointer-events: none; display: none; }
#tay.on { display: block; }
#tay i { position: absolute; left: -14px; top: 6px; font-style: normal; font-size: 40px; filter: drop-shadow(0 3px 6px rgba(0,0,0,.4)); animation: tayCham 0.9s ease-in-out infinite; }
#tay span { position: absolute; left: -48px; top: 56px; width: 96px; text-align: center; font-weight: 900; font-size: 13px; color: #fff; background: rgba(22,101,52,.92); border-radius: 99px; padding: 4px 6px; }
@keyframes tayCham { 0%, 100% { transform: translateY(8px); } 50% { transform: translateY(-2px); } }
.bay-diem { position: fixed; z-index: 13; pointer-events: none; transform: translateX(-50%); font-weight: 900; font-size: 24px; color: #ffd36a; text-shadow: 0 2px 0 #6b3d00, 0 4px 12px rgba(0,0,0,.5); animation: bayLen 1.2s ease-out forwards; }
@keyframes bayLen { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.7); } 15% { opacity: 1; transform: translate(-50%, 0) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -60px) scale(1); } }
