:root { --c: #7BC043; --c2: #FF8A3D; --bg: #141C17; --ink: #1d2a22; --mut: #5c6b62; --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(12, 18, 14, .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(246, 250, 240, .95); 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, #9ad35a, #6aae38 60%, #4f8f26); 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, #2c3550, #1b2238); 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: #6aae38; background: #f1fae6; }
.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, #7BC043, #b5e36a); }
.viec div b { grid-row: 1 / span 2; grid-column: 2; align-self: center; color: #c0841a; font-size: 13px; }
.viec div.xong { background: #eef9e4; }
.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: #f6faf0; 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 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: #6aae38; 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: #dfe6d8; color: #7a8a7a; }

/* ---------- HUD trong lượt ---------- */
#xsJoy { position: fixed; inset: 0; z-index: 5; display: none; touch-action: none; }
#xsJoy.on { display: block; }
#xsJoy i { position: absolute; left: 0; top: 0; border-radius: 50%; pointer-events: none; opacity: 0; transition: opacity .12s; }
#xsJoy.cham i { opacity: 1; }
#xsJoy .de { width: 120px; height: 120px; margin: -60px 0 0 -60px; background: radial-gradient(circle, rgba(255,255,255,.1) 40%, rgba(255,255,255,.25) 72%, rgba(255,255,255,.04) 73%); border: 2px solid rgba(255,255,255,.4); }
#xsJoy .num { width: 54px; height: 54px; margin: -27px 0 0 -27px; background: radial-gradient(circle at 40% 35%, #fff, #d8f0c8); box-shadow: 0 4px 14px rgba(0,0,0,.35); }
#xsHud { position: fixed; left: 0; right: 0; top: 0; z-index: 8; display: none; padding: calc(var(--sat) + 6px) 10px 0; pointer-events: none; }
#xsHud.on { display: block; }
#xsHud .xp { position: relative; height: 16px; border-radius: 10px; background: rgba(10,20,14,.6); overflow: hidden; border: 1.5px solid rgba(255,255,255,.35); }
#xsHud .xp i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #3fdc8a, #9bffcf); box-shadow: 0 0 10px #5dff9e; transition: width .12s; }
#xsHud .xp b { position: absolute; inset: 0; text-align: center; font-size: 11.5px; line-height: 13px; color: #fff; font-weight: 900; text-shadow: 0 1px 2px #000; }
#xsHud .r1 { display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 8px; margin-top: 6px; }
#xsHud .dung { pointer-events: auto; border: 0; border-radius: 14px; min-height: 46px; background: rgba(10,20,14,.62); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
#xsHud .dung b { font-size: 15px; } #xsHud .dung small { font-size: 11px; font-weight: 800; margin-top: 3px; }
#xsHud .gio { text-align: center; color: #fff; text-shadow: 0 2px 6px rgba(0,0,0,.7); }
#xsHud .gio b { font-size: 30px; font-weight: 900; display: block; line-height: 1; letter-spacing: -0.5px; }
#xsHud .gio small { font-size: 11.5px; font-weight: 800; opacity: .9; }
#xsHud .dem { display: flex; gap: 6px; }
#xsHud .dem span { background: rgba(10,20,14,.62); border-radius: 12px; padding: 4px 8px; color: #fff; text-align: center; min-width: 52px; }
#xsHud .dem b { display: block; font-size: 16px; font-weight: 900; line-height: 1.1; } #xsHud .dem small { font-size: 10.5px; font-weight: 700; opacity: .85; }
#xsHud .dem span:last-child b { color: #ffd24a; }
#xsHud .o { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
#xsHud .o span { background: rgba(10,20,14,.55); border-radius: 10px; padding: 2px 5px 1px; display: flex; flex-direction: column; align-items: center; min-width: 32px; border: 1.5px solid rgba(255,255,255,.18); }
#xsHud .o span.evo { border-color: #ffd24a; box-shadow: 0 0 8px rgba(255,210,74,.6); }
#xsHud .o span.pv { border-style: dashed; }
#xsHud .o i { font-style: normal; font-size: 16px; line-height: 1.2; }
#xsHud .o em { font-style: normal; color: #9bffcf; font-size: 9px; letter-spacing: -1px; line-height: 1; }
#xsHud .trum { display: none; margin: 8px auto 0; max-width: 320px; text-align: center; }
#xsHud .trum.on { display: block; }
#xsHud .trum b { color: #fff; font-size: 13.5px; font-weight: 900; text-shadow: 0 2px 4px #000; }
#xsHud .trum i { display: block; height: 12px; border-radius: 8px; background: rgba(30,6,6,.7); border: 1.5px solid #ffb0a0; overflow: hidden; margin-top: 2px; }
#xsHud .trum em { display: block; height: 100%; background: linear-gradient(90deg, #ff4d5e, #ff9a6a); transition: width .15s; }
#xsChuoi { position: fixed; right: 10px; top: calc(var(--sat) + 168px); z-index: 8; display: none; text-align: right; pointer-events: none; }
#xsChuoi.on { display: block; }
#xsChuoi b { display: block; color: #fff; font-size: 15px; font-weight: 900; text-shadow: 0 2px 6px rgba(0,0,0,.8); opacity: 0; transition: opacity .2s; }
#xsChuoi b span { font-size: 26px; color: #ffd24a; }
#xsChuoi.hien b { opacity: 1; }
#xsChuoi i { display: block; width: 92px; height: 5px; margin-left: auto; border-radius: 4px; background: rgba(0,0,0,.35); overflow: hidden; opacity: 0; }
#xsChuoi.hien i { opacity: 1; }
#xsChuoi i em { display: block; height: 100%; background: #ffd24a; }
#xsChuoi.dut b { animation: xsDut .6s; }
@keyframes xsDut { 0% { opacity: 1; color: #ff6a6a; transform: translateX(0); } 30% { transform: translateX(-6px); } 60% { transform: translateX(5px); } 100% { opacity: 0; } }
#xsBan { 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(92vw, 420px); }
#xsBan.on { opacity: 1; transform: translate(-50%, 0); }
#xsBan 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; }
#xsBan span { display: inline-block; margin-top: 6px; background: rgba(10,20,14,.7); color: #fff; padding: 6px 12px; border-radius: 12px; font-size: 13.5px; font-weight: 700; line-height: 1.35; }
#xsRao { position: fixed; right: 14px; bottom: calc(var(--sab) + 22px); z-index: 9; display: none; }
#xsRao.on { display: block; }
#xsRao button { position: relative; width: 92px; height: 92px; border: 0; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #445247, #1a2420); color: #fff; box-shadow: 0 6px 18px rgba(0,0,0,.45); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0; }
#xsRao svg { position: absolute; left: 4px; top: 4px; transform: rotate(-90deg); }
#xsRao circle { fill: none; stroke-width: 7; }
#xsRao circle.n { stroke: rgba(255,255,255,.14); }
#xsRao circle.v { stroke: #ffd24a; stroke-linecap: round; stroke-dasharray: 232.5; stroke-dashoffset: 232.5; transition: stroke-dashoffset .15s; }
#xsRao b { position: relative; font-size: 13px; font-weight: 900; line-height: 1.1; max-width: 70px; text-align: center; }
#xsRao small { position: relative; font-size: 11px; font-weight: 800; opacity: .85; }
#xsRao.day button { background: radial-gradient(circle at 40% 35%, #ffdb6a, #e08a1a); color: #3a2205; animation: xsNhip 0.8s infinite; }
#xsRao.day circle.v { stroke: #fff; }
@keyframes xsNhip { 0%, 100% { transform: scale(1); box-shadow: 0 6px 18px rgba(0,0,0,.45), 0 0 0 0 rgba(255,210,74,.7); } 50% { transform: scale(1.07); box-shadow: 0 6px 18px rgba(0,0,0,.45), 0 0 0 12px rgba(255,210,74,0); } }
#xsDau { position: fixed; inset: 0; z-index: 7; pointer-events: none; opacity: 0; background: radial-gradient(ellipse at center, rgba(255,0,0,0) 55%, rgba(220,20,40,.55) 100%); }
#xsDau.nhay { animation: xsDauA .45s; }
@keyframes xsDauA { 0% { opacity: .95; } 100% { opacity: 0; } }
#xsLoe { position: fixed; inset: 0; z-index: 7; pointer-events: none; opacity: 0; background: #eaf4ff; }
#xsLoe.on { animation: xsLoeA .35s; }
@keyframes xsLoeA { 0% { opacity: .75; } 30% { opacity: .15; } 45% { opacity: .5; } 100% { opacity: 0; } }
#xsToi { position: fixed; inset: 0; z-index: 4; pointer-events: none; opacity: 0; transition: opacity .8s; background: radial-gradient(circle at 50% 56%, rgba(5,8,20,0) 18%, rgba(5,8,20,.9) 62%); }
#xsThach { position: fixed; left: 50%; top: auto; bottom: calc(var(--sab) + 128px); transform: translateX(-50%); z-index: 8; display: none; background: rgba(120,16,24,.82); color: #fff; padding: 6px 12px; border-radius: 12px; font-size: 13.5px; font-weight: 700; pointer-events: none; white-space: nowrap; }
#xsThach.on { display: block; }
#xsThach.noi { left: 0; top: 0; bottom: auto; }
#xsThach span { color: #ffd24a; font-weight: 900; font-size: 16px; }
#xsTay { position: fixed; left: 0; top: 0; z-index: 10; pointer-events: none; display: none; }
#xsTay.on { display: block; }
#xsTay i { position: absolute; left: -14px; top: -4px; font-style: normal; font-size: 40px; animation: xsTayA 1.1s infinite; filter: drop-shadow(0 3px 4px rgba(0,0,0,.5)); }
#xsTay.keo i { animation: xsKeo 1.6s infinite; }
#xsTay span { position: absolute; top: 46px; width: 220px; text-align: center; background: rgba(255,250,235,.96); color: #2a2a18; padding: 7px 10px; border-radius: 12px; font-size: 14px; font-weight: 800; box-shadow: 0 4px 14px rgba(0,0,0,.3); }
@keyframes xsTayA { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes xsKeo { 0% { transform: translate(-40px, 0); } 50% { transform: translate(40px, -10px); } 100% { transform: translate(-40px, 0); } }
#xsLen { position: fixed; inset: 0; z-index: 15; display: none; background: radial-gradient(circle at 50% 30%, rgba(30,60,30,.55), rgba(5,10,8,.82)); overflow-y: auto; }
#xsLen.on { display: block; animation: xsVao .25s; }
@keyframes xsVao { from { opacity: 0; } to { opacity: 1; } }
#xsLen .hop { max-width: 460px; margin: 0 auto; padding: calc(var(--sat) + 70px) 14px calc(var(--sab) + 20px); }
#xsLen h2 { margin: 0; color: #fff; text-align: center; font-size: 34px; font-weight: 900; text-shadow: 0 3px 14px rgba(0,0,0,.7), 0 0 24px rgba(255,210,74,.6); }
#xsLen p { margin: 2px 0 12px; color: #d8f0d0; text-align: center; font-weight: 800; }
#xsLen .the { display: flex; flex-direction: column; gap: 10px; }
#xsLen .t { display: grid; grid-template-columns: 56px 1fr; gap: 10px; align-items: center; text-align: left; border: 0; border-radius: 20px; background: linear-gradient(180deg, #ffffff, #eef6e6); padding: 12px; min-height: 96px; box-shadow: 0 8px 22px rgba(0,0,0,.35); position: relative; animation: xsThe .35s backwards; }
#xsLen .t:nth-child(2) { animation-delay: .06s; } #xsLen .t:nth-child(3) { animation-delay: .12s; }
@keyframes xsThe { from { transform: translateY(24px) scale(.96); opacity: 0; } }
#xsLen .t i { font-style: normal; font-size: 38px; width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: #e2f2d8; }
#xsLen .t small { display: inline-block; font-size: 11.5px; font-weight: 900; color: #fff; background: #6aae38; padding: 1px 8px; border-radius: 8px; }
#xsLen .t.pv small { background: #4f86d9; } #xsLen .t.banh small, #xsLen .t.tui small { background: #c0841a; }
#xsLen .t b { display: block; font-size: 18px; font-weight: 900; margin-top: 2px; }
#xsLen .t em { display: block; font-style: normal; font-size: 13.5px; font-weight: 600; color: #4a5a4e; line-height: 1.35; }
#xsLen .t u { display: block; text-decoration: none; font-size: 12px; font-weight: 800; color: #b0741a; margin-top: 2px; }
#xsLen .t s { position: absolute; right: 12px; top: 10px; text-decoration: none; font-size: 10px; color: #6aae38; letter-spacing: 1px; }
#xsLen .t.evo { background: linear-gradient(135deg, #fff6c8, #ffd96a); box-shadow: 0 0 0 3px #ffd24a, 0 8px 26px rgba(255,190,40,.55); }
#xsLen .t.evo i { background: #fff; }
#xsLen .t.evo small { background: #e0782f; }
#xsLen .phu { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
#xsLen .phu button { border: 0; border-radius: 14px; min-height: 48px; background: rgba(255,255,255,.88); font-weight: 800; font-size: 14px; }
#xsLen .phu button[disabled] { opacity: .45; }
