/* ================= Đuổi Hình Bắt Chữ — MonBlock (base copied from Ếch Bắn Bóng) ================= */
:root {
  --bg: #0d1117;
  --panel: #151c26;
  --panel-2: #1b2431;
  --line: #2b3646;
  --txt: #e8eef6;
  --muted: #93a3b8;
  --accent: #ffcf5a;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--txt);
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.hidden { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--accent); }
.wrap { max-width: 640px; margin: 0 auto; padding: 8px 14px 28px; }
.screen { animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
h2 { font-size: 17px; margin: 18px 0 10px; }
.note { color: var(--muted); font-size: 13px; line-height: 1.5; }
body.touch .no-touch { display: none; }

/* ---------- trang chủ ---------- */
.me-card { display: flex; align-items: center; gap: 14px; padding: 12px 16px 12px 12px; margin: 6px 0 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.me-tile { position: relative; display: grid; place-items: center; width: 60px; height: 60px; flex: none; border-radius: 12px; border: 3px solid var(--frame, #2b3a55); background: var(--cell-img, none), var(--cell, #fff); }
.me-num { font-size: 24px; font-weight: 800; line-height: 1; color: var(--user, #335fff); }
.me-tile .me-avemo { position: absolute; inset: 0; display: grid; place-items: center; font-size: 34px; line-height: 1; }
.me-tile.has-av .me-num { display: none; }
.me-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.me-info b { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-info span { color: var(--muted); font-size: 13px; font-weight: 600; }
.xpbar { height: 6px; border-radius: 9px; background: var(--panel-2); overflow: hidden; }
.xpbar i { display: block; height: 100%; width: 0; background: #4f86ff; border-radius: 9px; }
.me-chips { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; font-size: 14px; font-weight: 700; white-space: nowrap; }

.big { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; margin: 0 0 10px; padding: 15px 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); font-size: 17px; font-weight: 800; text-align: left; }
.big small { color: var(--muted); font-size: 13px; font-weight: 600; }
.big-daily.done small { color: #00a862; }
.homegrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 6px; }
.small { padding: 12px 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); font-size: 14px; font-weight: 700; }

/* ---------- chọn độ khó ---------- */
.variants { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin-top: 6px; }
.variant { display: flex; align-items: flex-start; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); text-align: left; }
.variant.on { border-color: #335fff; box-shadow: inset 0 0 0 1px #335fff; }
.variant > i { font-size: 30px; font-style: normal; line-height: 1; }
.variant span { display: flex; flex-direction: column; gap: 3px; }
.variant b { font-size: 16px; }
.variant small { color: var(--muted); font-size: 13px; line-height: 1.4; }
.variant em { color: #b87400; font-size: 12px; font-style: normal; font-weight: 800; }

/* ---------- cửa hàng ---------- */
.shop-top { display: flex; justify-content: flex-end; gap: 16px; margin: 4px 0; font-size: 17px; font-weight: 800; }
.gem-chip b { color: #7fd8ff; }
.shop { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.item { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 8px 12px; border: 2px solid var(--line); border-radius: 16px; background: var(--panel); text-align: center; }
.item.locked { opacity: .55; }
.item b { font-size: 14px; }
.item .rar { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; }
.item .act { padding: 2px 8px; border-radius: 6px; font-size: 13px; font-weight: 800; color: var(--muted); }
.gem { color: #7fd8ff; }
.buyprev { display: flex; justify-content: center; margin: 4px 0 8px; }

/* ---------- xếp hạng ---------- */
.tabs { display: flex; gap: 6px; margin: 6px 0 10px; }
.tabs button { flex: 1; padding: 10px 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); font-weight: 800; font-size: 14px; }
.rank .row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.rank .no { width: 28px; color: var(--muted); font-weight: 800; text-align: center; }
.rank .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.rank .nm small { color: var(--muted); font-weight: 600; }
.rank .sc { font-weight: 900; color: #b87400; }

.help { line-height: 1.6; }
.help ul { padding-left: 20px; }

/* ---------- hộp thoại ---------- */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; background: rgba(5, 8, 12, .72); }
.dialog { width: min(420px, 100%); max-height: calc(100dvh - 32px); overflow: auto; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.dialog h3 { margin: 0 0 8px; font-size: 20px; }
.dialog p { line-height: 1.5; }
.dialog .score { margin: 4px 0; font-size: 40px; font-weight: 900; text-align: center; font-variant-numeric: tabular-nums; }
.dialog .rw { padding-left: 18px; line-height: 1.8; font-weight: 700; }
.dlg-btns { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.dlg-btns button { padding: 10px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); font-weight: 800; }
.toast { position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 90; transform: translateX(-50%); padding: 10px 16px; border-radius: 12px; background: #222c3a; font-weight: 700; }
.updatebar { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 45; display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-2); }
.updatebar button { padding: 8px 12px; border: 0; border-radius: 10px; font-weight: 800; }

.today { display: flex; align-items: center; gap: 10px; margin: -4px 0 12px; padding: 10px 14px; border: 1px dashed #c9d2e0; border-radius: 14px; background: #fff; font-size: 14px; }
.today b { font-size: 17px; color: #335fff; }
.today small { color: var(--muted); }
h2 { font-size: 16px; margin: 16px 0 8px; }
.big-resume { --bar: #ffb020; }
.big-play { --bar: #00a862; }
.big-daily { --bar: #335fff; }
.big-daily.done small { color: #00a862; }
.item { position: relative; }
.item .pay { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 2px; width: 100%; }
.item .pr { font-size: 13px; font-weight: 800; color: #191b1d; }
.item .pr.on { color: #00a862; }
.item .pr.g { color: #1a8fd8; }
.item .pr.gh { color: var(--muted); font-weight: 600; font-size: 11px; }
.item.poor .pay { opacity: .5; }
.item .lock { position: absolute; top: 6px; right: 6px; z-index: 2; padding: 1px 6px; border-radius: 8px; background: #191b1d; color: #fff; font-size: 11px; font-weight: 800; }
.item.active { border-color: #335fff; }
.item .own { font-size: 12px; font-weight: 800; color: #6b3f16; }

/* ================= Đuổi Hình Bắt Chữ — riêng của game ================= */
img.me-num { width: 52px; height: 52px; object-fit: contain; }
.me-tile { border: 0; background: radial-gradient(circle at 40% 35%, #fff2c8, #f2c46a); box-shadow: inset 0 0 0 3px #a8701e; overflow: hidden; }
.big-sprint { --bar: #ff8a1f; }
.big-sprint.done small { color: #00a862; }
#btnSound .mbi { width: 22px; height: 22px; display: block; }
.nstat { min-height: 20px; margin: 6px 0 2px; text-align: center; font-size: 14px; font-weight: 800; }

/* ---------- bàn chơi: nền dịu mắt (BGS), khung ảnh (FRAMES), phím chữ (KEYS) ---------- */
.field { --fg: #fff; --fg2: rgba(255, 255, 255, .78); max-width: 560px; margin: 8px auto 0; padding: 12px 12px 16px; border-radius: 18px; color: var(--fg); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18), 0 2px 8px rgba(0, 0, 0, .12); }
.bg-ngoc { background: linear-gradient(180deg, #4f9a73, #2f7a5a); }
.bg-rung { background: linear-gradient(180deg, #5f8a52, #3d6a3a); }
.bg-bien { background: linear-gradient(180deg, #5b86a8, #3a5f80); }
.bg-tim { background: linear-gradient(180deg, #7a5f94, #55406f); }
.bg-nau { background: linear-gradient(180deg, #8a6a4a, #5e452e); }
.bg-dem { background: linear-gradient(180deg, #2f4258, #1c2a3c); }
.hud { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.hud b { display: block; font-size: 18px; line-height: 1.1; }
.hud small { display: block; font-size: 12px; font-weight: 700; color: var(--fg2); }
.hud-m, .hud-r { text-align: center; }
.hud-r { text-align: right; }
.hud-l { min-width: 0; }
.hud-m b { font-size: 24px; font-variant-numeric: tabular-nums; }
.hud-m.low b { color: #ffb4a8; animation: lowPulse .6s ease-in-out infinite alternate; }
@keyframes lowPulse { to { transform: scale(1.12); } }

.frame { --fr-edge: #8a5a2e; --fr-in: #fbf3e0; --fr-glow: rgba(0, 0, 0, .25); padding: 10px; border-radius: 18px; background: var(--fr-in); border: 7px solid var(--fr-edge); box-shadow: 0 4px 0 var(--fr-glow), inset 0 0 0 2px rgba(0, 0, 0, .08); }
.fr-go { --fr-edge: #8a5a2e; --fr-in: #fbf3e0; }
.fr-tre { --fr-edge: #86b05a; --fr-in: #f3f8e6; --fr-glow: rgba(60, 100, 30, .3); background-image: repeating-linear-gradient(90deg, rgba(120, 160, 70, .12) 0 2px, transparent 2px 22px); }
.fr-vang { --fr-edge: #d9a920; --fr-in: #fff8e0; --fr-glow: rgba(150, 100, 0, .35); border-image: linear-gradient(135deg, #f7d760, #c98a10, #f7d760) 1; border-radius: 0; }
.fr-sonmai { --fr-edge: #2e2323; --fr-in: #fdf4e6; box-shadow: 0 4px 0 rgba(0, 0, 0, .35), inset 0 0 0 3px #c2362e; }
.fr-ngoc { --fr-edge: #3aa38e; --fr-in: #eefaf6; --fr-glow: rgba(20, 100, 85, .3); box-shadow: 0 4px 0 var(--fr-glow), inset 0 0 0 3px #bdeede; }
.fr-denlong { --fr-edge: #d8341e; --fr-in: #fff3d0; --fr-glow: rgba(150, 30, 10, .35); box-shadow: 0 4px 0 var(--fr-glow), inset 0 0 0 3px #f3c33a; }
.pics { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 6px; min-height: 120px; }
.pics .pic { width: var(--ps, 104px); height: var(--ps, 104px); object-fit: contain; filter: drop-shadow(0 3px 2px rgba(60, 30, 5, .28)); animation: picIn .3s ease backwards; }
.pics .pic:nth-of-type(2) { animation-delay: .06s; } .pics .pic:nth-of-type(3) { animation-delay: .12s; } .pics .pic:nth-of-type(4) { animation-delay: .18s; }
@keyframes picIn { from { transform: scale(.6); opacity: 0; } }
.pics .pl { font-size: 24px; font-weight: 900; color: #a8701e; line-height: 1; }
.pics.n1 { --ps: 150px; } .pics.n2 { --ps: 118px; } .pics.n3 { --ps: 92px; } .pics.n4 { --ps: 74px; } .pics.n4 .pl { display: none; }

.slots { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 14px; margin: 14px 0 12px; min-height: 52px; }
.slots .w { display: flex; gap: 5px; }
.slot { width: 44px; height: 50px; display: grid; place-items: center; padding: 0; border: 2px dashed rgba(255, 255, 255, .5); border-radius: 12px; background: rgba(0, 0, 0, .2); font-size: 24px; font-weight: 900; color: #fff; }
.slot.fill { border-style: solid; }
.slot.lk { box-shadow: 0 0 0 3px #ffd54a; }
.slots.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
.slots.ok .slot { animation: hop .5s ease backwards; border-color: #7ee08a; }
.slots.ok .slot:nth-child(2n) { animation-delay: .08s; }
@keyframes hop { 40% { transform: translateY(-9px); } }
.tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 420px; margin: 0 auto; }
.tile { width: 46px; height: 46px; display: grid; place-items: center; padding: 0; border-radius: 50%; font-size: 22px; font-weight: 900; line-height: 1; transition: transform .1s; }
.tile:active { transform: scale(.92); }
.tile.used { visibility: hidden; }
.tile.gone { visibility: hidden; pointer-events: none; }
/* Letter style (KEYS): .tk-<id> on #tiles and #slots (filled slots take the same look) */
.tk-go .tile, .tk-go .slot.fill { background: radial-gradient(circle at 35% 30%, #fbe3b0, #e6b96a); border: 2px solid #8a5a2e; color: #4a2a14; box-shadow: 0 3px 0 #8a5a2e; }
.tk-keo .tile, .tk-keo .slot.fill { background: radial-gradient(circle at 35% 30%, #ffd3e6, #ff9ec4); border: 2px solid #c2547f; color: #7a1e48; box-shadow: 0 3px 0 #c2547f; }
.tk-ngoc .tile, .tk-ngoc .slot.fill { background: radial-gradient(circle at 35% 30%, #c9f6ea, #5fd3b6); border: 2px solid #1f8a72; color: #0b4a3b; box-shadow: 0 3px 0 #1f8a72; }
.tk-vang .tile, .tk-vang .slot.fill { background: radial-gradient(circle at 35% 30%, #fff1a8, #eab02a); border: 2px solid #a8730a; color: #5a3a00; box-shadow: 0 3px 0 #a8730a; }
.tk-tuyet .tile, .tk-tuyet .slot.fill { background: radial-gradient(circle at 35% 30%, #ffffff, #cfe6fb); border: 2px solid #6fa8dc; color: #1d3a5a; box-shadow: 0 3px 0 #6fa8dc; }
.tiles[class*="tk-"] .tile { cursor: pointer; }
.ctl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.ctl.off { display: none; }
.ctl button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 58px; padding: 6px 4px; border: 1px solid rgba(255, 255, 255, .3); border-radius: 14px; background: rgba(255, 255, 255, .14); color: #fff; font-size: 13px; font-weight: 800; }
.ctl button:active { transform: scale(.97); }
.ctl button.dis { opacity: .45; }
.ctl .orb .mbi { width: 24px; height: 24px; display: block; }
.ctl u { position: absolute; top: -6px; right: -4px; min-width: 22px; padding: 1px 6px; border-radius: 10px; background: #ffd54a; color: #4a2a14; font-size: 12px; font-weight: 900; text-align: center; text-decoration: none; }
.ctl u:empty { display: none; }

/* ---------- chọn câu ---------- */
.mapcard { margin: 0 0 14px; border-radius: 16px; overflow: hidden; background: #fff; border: 1px solid #e3e5e8; scroll-margin-top: 70px; }
.mapcard.locked { opacity: .6; }
.mhead { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: linear-gradient(90deg, #3f8a68, #4f9a73); color: #fff; }
.mhead .mhi { width: 46px; height: 46px; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .3)); }
.mhead span { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.mhead b { font-size: 17px; }
.mhead small { font-size: 13px; font-weight: 700; opacity: .92; }
.mhead .mc { font-weight: 900; font-size: 15px; white-space: nowrap; }
.lvgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; padding: 12px; }
.lv { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 52px; justify-content: center; padding: 6px 2px; border: 2px solid #d4e6dc; border-radius: 14px; background: #f3faf6; font-weight: 900; color: #2e6b52; }
.lv b { font-size: 17px; }
.lv small { font-size: 11px; font-weight: 800; }
.lv.done { background: #dff3e8; border-color: #5aae85; }
.lv.clean { background: #fff3c9; border-color: #e0a83a; color: #7a4f08; }
.lv.cur { border-color: #335fff; box-shadow: 0 0 0 3px rgba(51, 95, 255, .22); }
.lv:disabled { opacity: .45; background: #f0f1f2; border-color: #e3e5e8; color: #9aa0a6; }

/* ---------- cửa hàng ---------- */
.shop .item { position: relative; }
.pv { position: relative; display: flex; justify-content: center; align-items: center; width: 100%; min-height: 84px; pointer-events: none; }
.pv-frame .frame { width: 112px; padding: 5px; border-width: 5px; border-radius: 12px; }
.pv-frame .pics { min-height: 0; gap: 2px; --ps: 36px; }
.pv-frame .pics .pic { animation: none; }
.pv-bg .field { width: 124px; max-width: none; margin: 0; padding: 14px 8px 10px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pv-bg .pvslots { display: flex; gap: 4px; }
.pv-bg .pvslots i { width: 18px; height: 20px; border: 2px dashed rgba(255, 255, 255, .55); border-radius: 6px; background: rgba(0, 0, 0, .2); }
.pv-bg .pvslots i:nth-child(2) { border-style: solid; background: rgba(255, 255, 255, .85); }
.pv-key .tiles { gap: 5px; flex-wrap: nowrap; }
.pv-key .tile { width: 32px; height: 32px; font-size: 16px; box-shadow: none; }
.pv-key .tk-go .tile, .pv-key.tk-go .tile { box-shadow: 0 2px 0 #8a5a2e; }
.buyprev .pv-frame .frame { width: 200px; padding: 8px; border-width: 7px; } .buyprev .pv-frame .pics { --ps: 70px; }
.buyprev .pv-bg .field { width: 220px; padding: 22px 12px 16px; } .buyprev .pv-bg .pvslots i { width: 28px; height: 32px; }
.buyprev .pv-key .tile { width: 50px; height: 50px; font-size: 24px; }
.boostpv { display: flex; align-items: center; gap: 6px; font-size: 20px; font-weight: 900; color: #6b3f16; }
.boostpv .mbi { width: 46px; height: 46px; }

/* ---------- hộp kết quả ---------- */
.dialog.win { text-align: center; }
.dialog.win .wm { display: block; width: 104px; height: 104px; margin: -4px auto 0; object-fit: contain; animation: cheer 1.4s ease-in-out infinite; }
@keyframes cheer { 50% { transform: translateY(-6px) rotate(3deg); } }
.dialog.win h3 { margin: 4px 0 2px; font-size: 26px; font-weight: 900; color: #2f8f1f; }
.dialog.win .ans { margin: 0 0 8px; font-size: 24px; font-weight: 900; color: #3b1f06; text-transform: capitalize; }
.dialog.win .ansp { display: flex; justify-content: center; gap: 4px; margin: 0 0 6px; }
.dialog.win .ansp img { width: 40px; height: 40px; object-fit: contain; }
.wchips { display: flex; justify-content: center; gap: 8px; margin: 2px 0 6px; flex-wrap: wrap; }
.wc { display: flex; align-items: center; gap: 4px; padding: 5px 11px 5px 7px; border-radius: 999px; background: #fff; border: 2px solid #e2bb72; font-size: 17px; color: #3b1f06; }
.wc i { font-style: normal; font-size: 20px; line-height: 1; }
.wc i .mb-coin { width: 22px; height: 22px; vertical-align: -4px; }
.wc .mbi { width: 22px; height: 22px; }
.wc b { font-weight: 900; }
.wc small { font-size: 11px; font-weight: 800; color: #8a5a22; }
.wtags { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.wtags span { padding: 3px 10px; border-radius: 999px; background: #e9f7d9; color: #2f6f1a; font-size: 12px; font-weight: 800; }
.dialog .sad { display: block; width: 96px; height: 96px; margin: -4px auto 0; object-fit: contain; }
.dialog .evtag { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: linear-gradient(90deg, #8fd0ff, #c9b8ff); color: #1d2a4a; }
.item .evtag { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: linear-gradient(90deg, #8fd0ff, #c9b8ff); color: #1d2a4a; }
@media (max-width: 380px) { .slot { width: 40px; height: 46px; font-size: 22px; } .tile { width: 44px; height: 44px; } .tiles { gap: 6px; } .pics.n1 { --ps: 130px; } }

/* ---------- nút hộp kết quả (copied from Ếch Bắn Bóng) ---------- */
.dialog.win .more { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 16px; padding: 14px; border: 0; border-radius: 999px;
  background: linear-gradient(#7ed957, #2f9e2a); color: #fff; font-size: 20px; font-weight: 900; box-shadow: inset 0 3px 0 rgba(255, 255, 255, .45), 0 5px 0 #1d6b18; text-shadow: 0 2px 0 #1d6b18; }
.dialog.win .more:active { transform: translateY(3px); box-shadow: inset 0 3px 0 rgba(255, 255, 255, .45), 0 2px 0 #1d6b18; }
.dialog.win .more .mbi { width: 30px; height: 30px; flex: none; }
.dialog.win .links { display: flex; justify-content: center; gap: 22px; margin-top: 12px; flex-wrap: wrap; }
.dialog.win .links button { display: flex; align-items: center; gap: 6px; padding: 8px 4px; border: 0; background: none; font-size: 16px; font-weight: 900; color: #6b4418; }
.dialog.win .links .mbi { width: 24px; height: 24px; }
.wbtns { display: flex; gap: 8px; margin-top: 14px; }
.dialog.win .wbtns .more { flex: 1; margin-top: 0; }
.wshare { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; width: 76px; padding: 6px 4px; border: 0; border-radius: 18px;
  background: linear-gradient(#5aa8ff, #2f6fe0); color: #fff; font-size: 13px; font-weight: 900; box-shadow: inset 0 3px 0 rgba(255, 255, 255, .4), 0 5px 0 #1a4aa8; }
.wshare:active { transform: translateY(3px); box-shadow: inset 0 3px 0 rgba(255, 255, 255, .4), 0 2px 0 #1a4aa8; }
.wshare .mbi { width: 26px; height: 26px; }
.wshare .mbi * { stroke: #fff; }
.modal:has(.dialog.win) { place-items: safe center; overflow-y: auto; }
.dialog.win { background: #fffdf5; }
.dialog.win .wsub { margin: 0 0 6px; font-size: 14px; color: #6b4418; font-weight: 700; }
.dialog .buyprev { display: flex; justify-content: center; margin: 6px 0 10px; }
.dialog .buyprev .boostpv { width: 100px; height: 100px; }

/* Phone held sideways (orient-check 19/11/2026): picture on the left, answer slots + letters + help buttons on the right —
   the portrait stack was 615 px tall on a 390 px screen (letters and help buttons below the fold). */
@media (orientation: landscape) and (max-height: 500px) {
  #scPlay .field { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); grid-template-areas: "hud stat" "frame slots" "frame tiles" "frame ctl";
    grid-template-rows: auto auto auto 1fr; align-items: center; column-gap: 18px; max-width: 880px; margin-top: 4px; padding: 8px 12px 10px; }
  #scPlay .hud { grid-area: hud; margin-bottom: 6px; }
  #scPlay .frame { grid-area: frame; align-self: center; }
  #scPlay .nstat { grid-area: stat; margin: 0; }
  #scPlay .slots { grid-area: slots; margin: 4px 0 8px; }
  #scPlay .tiles { grid-area: tiles; }
  #scPlay .ctl { grid-area: ctl; align-self: start; margin-top: 8px; }
  #scPlay .ctl button { min-height: 48px; }
  #scPlay .tiles { max-width: none; gap: 6px; }
  #scPlay .tile { width: 44px; height: 44px; }
  #scPlay .pics { min-height: 0; flex-wrap: nowrap; }
  #scPlay .pics.n1 { --ps: 140px; } #scPlay .pics.n2 { --ps: 104px; } #scPlay .pics.n3 { --ps: 74px; } #scPlay .pics.n4 { --ps: 60px; }
}

/* ===== Trang chủ tranh vẽ (design system 17/11/2026 — bố cục chuẩn: ‹ trên trái, loa + sách trên phải, logo + CHƠI, 4 ô đáy) ===== */
#scHome { position: fixed; inset: 0; z-index: 5; overflow: hidden; padding: 0; max-width: none; background: #f3e4c4; animation: none; container-type: size; }
#scHome .hm-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center top; }
body:has(#scHome:not(.hidden)) .mb-nav { display: none !important; }
#scHome button { -webkit-appearance: none; appearance: none; font-family: inherit; }
.hm-back, .hm-gear { position: absolute; top: max(10px, env(safe-area-inset-top)); width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; padding: 0; box-shadow: 0 3px 6px rgba(0, 0, 0, .35); }
.hm-back { left: max(10px, env(safe-area-inset-left)); background: #fff; border: 3px solid #e3e5e8; color: #191b1d; font: 700 28px/1 system-ui; padding-bottom: 4px; }
.hm-gear { right: max(10px, env(safe-area-inset-right)); border-radius: 12px; background: linear-gradient(#5ab4ff, #2a6fd8); border: 3px solid #e8f7ff; color: #fff; }
.hm-gear svg { width: 26px; height: 26px; display: block; }
.hm-mute { display: none; position: absolute; left: 7px; right: 7px; top: 50%; height: 3px; background: #ff4d4d; border-radius: 2px; transform: rotate(-45deg); }
.hm-gear.off .hm-mute { display: block; }
.hm-book { top: calc(max(10px, env(safe-area-inset-top)) + 54px); border-radius: 50%; }
.hm-top { position: absolute; left: calc(max(10px, env(safe-area-inset-left)) + 52px); top: max(10px, env(safe-area-inset-top)); display: flex; align-items: center; gap: 8px; }
.hm-av { position: relative; flex: none; width: 52px; height: 52px; padding: 0; border-radius: 50%; border: 3px solid #d8a13a; background: #fff3d6; display: grid; place-items: center; box-shadow: 0 3px 6px rgba(0, 0, 0, .35); cursor: pointer; }
.hm-av .me-avemo { position: absolute; inset: 0; display: grid; place-items: center; font-size: 28px; line-height: 1; border-radius: 50%; overflow: hidden; color: var(--px, #e5484d); font-weight: 900; }
.hm-lv { position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%); padding: 1px 8px; border-radius: 8px; background: #7a4a1c; border: 2px solid #d8a13a; color: #fff; font: 900 12px/1.2 system-ui, sans-serif; white-space: nowrap; }
.hm-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.hm-xp, .hm-pts { display: none; }
.hm-bar { display: flex; align-items: center; gap: 4px; min-width: 84px; height: 32px; padding: 0 10px 0 4px; border-radius: 16px; background: rgba(20, 60, 90, .78); border: 2px solid rgba(255, 255, 255, .55); }
.hm-bar img { width: 24px; height: auto; flex: none; }
.hm-bar b { flex: 1; color: #fff !important; font: 900 14px/1 system-ui, sans-serif; text-align: center; }
.hm-stack { position: absolute; left: 0; right: 0; top: calc(max(10px, env(safe-area-inset-top)) + 64px); bottom: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.6cqh; padding: 0 5cqw; }
.hm-logo { flex: 0 1 auto; min-height: 0; max-height: 16cqh; max-width: 84cqw; width: auto; height: auto; filter: drop-shadow(0 5px 6px rgba(0, 0, 0, .3)); pointer-events: none; }
.hm-hero { flex: 0 1 auto; min-height: 0; max-height: 28cqh; max-width: 72cqw; width: auto; height: auto; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .25)); pointer-events: none; }
.hm-play { flex: none; width: min(70cqw, 330px); padding: 1.2cqh 3cqw 1.4cqh; border-radius: 999px; text-align: center; color: #fff; background: linear-gradient(#8aea5a, #2fae2a 60%, #238a22); border: 4px solid #fff5cf; box-shadow: 0 5px 0 #1b6b1a, 0 9px 12px rgba(0, 0, 0, .35); }
.hm-play b { display: block; font: 900 clamp(26px, 5.2cqh, 44px)/1.05 "Arial Rounded MT Bold", system-ui, sans-serif; -webkit-text-stroke: .12em #1d6a1d; paint-order: stroke fill; letter-spacing: 2px; }
.hm-play small { display: block; font: 900 clamp(12px, 1.8cqh, 15px)/1.2 system-ui, sans-serif; -webkit-text-stroke: .2em #1d6a1d; paint-order: stroke fill; }
.hm-play:active, .hm-ic:active { transform: scale(.96); }
.hm-row { position: absolute; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: 2cqw; }
.hm-ic { position: relative; width: min(21cqw, 96px); padding: 0; background: none; border: 0; box-shadow: none; color: #fff; }
.hm-ic img { width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; display: block; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .4)); }
.hm-ic span { display: block; margin-top: -2px; text-align: center; font: 900 clamp(12px, 1.7cqh, 14px)/1.1 system-ui, sans-serif; -webkit-text-stroke: .22em #4a2a14; paint-order: stroke fill; white-space: nowrap; }
.hm-dot { position: absolute; top: 2px; right: 2px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; background: #e5374f; border: 2px solid #fff; color: #fff; font: 900 12px/18px system-ui; font-style: normal; }
.hm-dot.hidden { display: none; }
#scHome .hm-seo { position: absolute !important; width: 1px !important; height: 1px !important; margin: 0 !important; padding: 0 !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; }
#scBook a.bk-link { display: flex; align-items: center; min-height: 44px; padding: 8px 16px; border: 1px solid var(--skin-card-line, #e3e5e8); border-radius: 12px; background: var(--skin-card, #f7f8f9); color: var(--skin-ink, #191b1d); font-size: 15px; font-weight: 700; text-decoration: none; }
#scBook .bk-list, #scModes { display: flex; flex-direction: column; gap: 8px; }
#scModes .big { margin: 0; }
#scHelp .help ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; line-height: 1.4; }
.hm-dot-s { min-width: 16px; width: 16px; height: 16px; padding: 0; top: 6px; right: 10px; }
.hm-av .me-avemo .hm-mascot { width: 86%; height: 86%; object-fit: contain; }
#scQuests { display: flex; flex-direction: column; gap: 10px; }
#scQuests .big { margin: 0; }
#scQuests .note { margin: 0; font-size: 14px; }
.qd-card { display: flex; flex-direction: column; gap: 4px; padding: 12px 16px; border: 1px solid #e3e5e8; border-radius: 12px; background: #f7f8f9; }
.qd-card b { font-size: 16px; }
.qd-card small { color: #606368; font-size: 14px; line-height: 1.4; }
.qd-done { margin: 4px 0 0; color: #00a862; font-size: 14px; font-weight: 800; }
/* Khung ngang thấp (điện thoại cầm ngang 844×390): logo + hình chính to hơn, gọn giữa thanh trên và 4 ô (như Người Que) */
@container (orientation: landscape) {
  .hm-stack { top: calc(max(10px, env(safe-area-inset-top)) + 58px); bottom: calc(max(10px, env(safe-area-inset-bottom)) + min(11cqw, 22cqh) + 22px); gap: 1.2cqh; }
  .hm-logo { max-height: 19cqh; max-width: 46cqw; }
  .hm-hero { max-height: 25cqh; max-width: 40cqw; }
  .hm-play { width: min(46cqw, 340px); padding: 0.8cqh 3cqw 1cqh; }
  .hm-play small { white-space: nowrap; font-size: clamp(12px, 3.2cqh, 15px); }
  .hm-play b { font-size: clamp(24px, 7cqh, 40px); }
  .hm-row { bottom: max(10px, env(safe-area-inset-bottom)); gap: 1.6cqw; }
  .hm-ic { width: min(11cqw, 22cqh, 96px); }
  .hm-ic span { font-size: clamp(12px, 3.2cqh, 14px); }
}

/* Sheet skin "wood": small sheets take the colours of the painted home (owner 30/11/2026). */
body.mb-light { --skin-frame: #6b3d17; --skin-head: linear-gradient(#93592a, #6b3d17); --skin-head-ink: #fff3d6; --skin-line: #d8a13a;
  --skin-paper: #f4e6c6; --skin-card: #fffaf0; --skin-card-line: #d6b886; --skin-ink: #3a1d0c; --skin-muted: #765536; --skin-hover: #fff3dc; }
