/* Design tokens: copied verbatim from .ai/output/design-system/tokens.css (17/11/2026). Keep in sync until a shared tokens file ships. */
:root {
  /* ---- Màu nền + chữ (lớp áo phẳng: cổng, cửa hàng, danh sách) ---- */
  --ds-bg: #f2f4f5;
  --ds-surface: #ffffff;
  --ds-surface-2: #f7f8f9;
  --ds-line: #e3e5e8;
  --ds-line-strong: #c9ccd1;
  --ds-text: #191b1d;
  --ds-text-muted: #606368;

  /* ---- Màu hành động ---- */
  --ds-primary: #335fff;       /* Nút chính, đang chọn */
  --ds-primary-soft: #eef2ff;
  --ds-play: #00a862;          /* Nút Chơi, thành công */
  --ds-play-dark: #008f53;
  --ds-danger: #e5374f;
  --ds-warn: #ffb020;
  --ds-brand: #6c4dff;         /* Tím logo: chỉ làm điểm nhấn nhỏ */

  /* ---- Tiền tệ ---- */
  --ds-coin: #b87400;
  --ds-gem: #0a8fd0;
  --ds-medal-1: #f5b800; --ds-medal-2: #b4bcc6; --ds-medal-3: #d08a4e;  /* Rank podium (design system 17/11/2026) */

  /* ---- Độ hiếm ---- */
  --ds-r-common: #7d8590;
  --ds-r-rare: #335fff;
  --ds-r-epic: #8a5cff;
  --ds-r-legend: #f09a1c;
  --ds-r-mythic: #e5374f;

  /* ---- Loại chế độ chơi (vạch trái thẻ .big) ---- */
  --ds-m-online: #335fff;
  --ds-m-ai: #e5374f;
  --ds-m-local: #00a862;
  --ds-m-resume: #ffb020;
  --ds-m-practice: #8a5cff;
  --ds-m-ladder: #ff7a1a;

  /* ---- Lớp áo tranh vẽ (trang chủ game toàn màn hình, HUD trong trận) ---- */
  --ds-ink: #4a2a14;                       /* Viền nâu đậm của hình vẽ */
  --ds-glass: rgba(20, 60, 90, .78);       /* Chip xu / kim cương trên tranh */
  --ds-glass-line: rgba(255, 255, 255, .55);
  --ds-glass-soft: rgba(5, 38, 70, .22);   /* Thẻ thông tin trong trận: nhỏ, trong suốt */
  --ds-wood: #7a4a1c;
  --ds-gold: #d8a13a;
  --ds-playpill: linear-gradient(#8aea5a, #2fae2a 60%, #238a22);
  --ds-playpill-ink: #1d6a1d;
  --ds-plus: linear-gradient(#ffd36a, #f09a1c);
  --ds-stroke-dark: #1d3a5a;               /* Viền chữ trắng trên tranh */

  /* ---- Chữ ---- */
  --ds-font: "Builder Sans", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ds-font-display: "Arial Rounded MT Bold", system-ui, sans-serif;
  --ds-fs-xs: 12px;   /* Nhỏ nhất người chơi phải đọc */
  --ds-fs-sm: 13px;
  --ds-fs-md: 15px;
  --ds-fs-lg: 17px;
  --ds-fs-xl: 22px;
  --ds-fs-2xl: 30px;

  /* ---- Khoảng cách (bội số 4) ---- */
  --ds-s1: 4px; --ds-s2: 8px; --ds-s3: 12px; --ds-s4: 16px; --ds-s5: 24px; --ds-s6: 32px;

  /* ---- Bo góc: thang các game đang dùng thật (8 / 14 / 18 có ở gần như mọi game) ---- */
  --ds-r-xs: 6px;     /* Chip, nhãn */
  --ds-r-sm: 8px;     /* Ô nhỏ, hàng giá trong thẻ món */
  --ds-r-md: 10px;    /* Nút nhỏ */
  --ds-r-lg: 12px;    /* Thẻ, nút chế độ */
  --ds-r-xl: 14px;    /* Nút phụ kiểu cũ, thanh nổi */
  --ds-r-2xl: 16px;   /* Thẻ món */
  --ds-r-3xl: 18px;   /* Hộp thoại */
  --ds-r-pill: 999px;
  /* Cỡ lẻ (2, 3, 4, 5, 7, 9, 11, 13, 15…) làm tròn về bậc gần nhất khi sửa tới file đó */

  /* ---- Bóng ---- */
  --ds-sh-0: none;                                   /* Lớp áo phẳng: không bóng */
  --ds-sh-pop: 0 10px 30px rgba(0, 0, 0, .18);       /* Hộp thoại, bảng nổi */
  --ds-sh-art: 0 3px 6px rgba(0, 0, 0, .4);          /* Vật trên tranh */

  /* ---- Kích thước chạm ---- */
  --ds-tap: 44px;        /* Ô chạm tối thiểu trên điện thoại */
  --ds-tap-small: 32px;  /* Nút phụ vẽ nhỏ, vùng chạm vẫn nới ra 44px */

  /* ---- Lớp xếp chồng (đang dùng trong shell + game) ---- */
  --ds-z-home: 5;      /* Trang chủ tranh vẽ phủ màn */
  --ds-z-bar: 45;      /* Thanh cập nhật, thanh nổi */
  --ds-z-rotate: 70;   /* Nút quay lại khi trang bị xoay */
  --ds-z-modal: 80;
  --ds-z-toast: 90;

  /* ---- Vùng an toàn (sdk/land.js đặt lại khi trang bị xoay) ---- */
  --ds-safe-l: var(--sal, env(safe-area-inset-left));
  --ds-safe-t: var(--sat, env(safe-area-inset-top));
  --ds-safe-r: var(--sar, env(safe-area-inset-right));
  --ds-safe-b: var(--sab, env(safe-area-inset-bottom));

  /* ---- Trạng thái độ chín / đồng hồ (Quán Nhỏ Ven Đường là nguồn) ---- */
  --ds-st-wait: #ffb020;   /* Chưa xong */
  --ds-st-ok: #00a862;     /* Đúng lúc */
  --ds-st-bad: #e5374f;    /* Quá tay */

  /* ---- Chuyển động ---- */
  --ds-t-fast: .12s;
  --ds-t-mid: .25s;
  --ds-press: scale(.96);
}
/* ================= Dò Mìn — MonBlock (base copied from Tô Tranh Đông Hồ) ================= */
: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ủ ---------- */
.xpbar { height: 6px; border-radius: var(--ds-r-pill); background: var(--panel-2); overflow: hidden; }
.xpbar i { display: block; height: 100%; width: 0; background: #4f86ff; border-radius: var(--ds-r-pill); }

.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; }


/* ---------- 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: var(--ds-gem); }
.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: 1px solid var(--ds-line); border-radius: 16px; background: var(--panel); text-align: center; }
.item.locked .pv, .item.locked .pay { opacity: .55; }
.item b { font-size: 14px; }
.item .rar { font-size: 12px; 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: var(--ds-gem); }
.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; min-height: var(--ds-tap); 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 { min-height: var(--ds-tap); 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; }

h2 { font-size: 16px; margin: 16px 0 8px; }
.big-resume { --bar: #ffb020; }
.big-play { --bar: #00a862; }
.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: var(--ds-gem); }
.item .pr.gh { color: var(--muted); font-weight: 600; font-size: 12px; }
.item.poor .pay { opacity: .5; }

/* ---------- hộp kết quả ---------- */
.dialog.win { text-align: center; }
.dialog.win .wm { display: block; width: 104px; height: 104px; margin: -4px auto 0; 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: 30px; font-weight: 900; color: var(--ds-play); }
.dialog.win .ans { margin: 0 0 8px; font-size: 22px; font-weight: 900; color: var(--ds-text); }
.wstars { display: flex; justify-content: center; gap: 6px; margin: 4px 0 6px; }
.wstars .mbi { width: 44px; height: 44px; opacity: .25; filter: grayscale(1); }
.wstars .mbi.on { opacity: 1; filter: none; animation: starIn .5s ease backwards; }
.wstars .mbi.on:nth-child(2) { animation-delay: .15s; } .wstars .mbi.on:nth-child(3) { animation-delay: .3s; }
@keyframes starIn { from { transform: scale(0) rotate(-40deg); } }
.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: var(--ds-surface); border: 1px solid var(--ds-line-strong); font-size: 17px; color: var(--ds-text); }
.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: 12px; font-weight: 800; color: var(--ds-text-muted); }
.wtags { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.wtags span { padding: 3px 10px; border-radius: 999px; background: var(--ds-primary-soft); color: var(--ds-primary); font-size: 12px; font-weight: 800; }
.dialog .evtag, .item .evtag { font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: var(--ds-primary-soft); color: var(--ds-primary); }
.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; }
.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: var(--ds-surface); }
.dialog.win .wsub { margin: 0 0 6px; font-size: 14px; color: var(--ds-text-muted); font-weight: 700; }
.dialog .buyprev { display: flex; justify-content: center; margin: 6px 0 10px; }
.dialog .buyprev .boostpv { width: 100px; height: 100px; }
.dialog .stuck-tip { margin: 6px 0; color: var(--ds-text-muted); font-weight: 700; }


/* ===== 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: #3a2616; 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: var(--ds-r-lg); 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 var(--ds-stroke-dark); 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: var(--ds-r-pill); 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 .dropsvg { width: 78%; height: 78%; display: block; }
#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: 50cqh; max-width: 30cqw; }
  .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); }
}

/* Painted art corner behind every screen (design system "Tranh nền sau mọi màn") */
:root { --ts: 64px; }
body.mb-light { --mb-scene: url(/domin/img/home-bg.webp); --mb-scene-on: ''; }
#btnSound .mbi { width: 22px; height: 22px; display: block; }
.big-daily .mbi { width: 22px; height: 22px; }

/* ---------- dải lối tắt dưới CHƠI (design system "Phần chung bổ sung" 1) ---------- */
.hm-go { flex: none; display: flex; align-items: stretch; margin-top: .4cqh; padding: 2px; border: 2px solid var(--ds-glass-line, rgba(255, 255, 255, .55)); border-radius: 999px; background: var(--ds-glass, rgba(20, 60, 90, .78)); }
.hm-go button { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px 0 6px; border: 0; border-radius: 999px; background: none; color: #fff; font: 800 13px/1 system-ui, sans-serif; white-space: nowrap; box-shadow: none; }
.hm-go button + button { border-left: 1px solid rgba(255, 255, 255, .35); border-radius: 0 999px 999px 0; }
.hm-go img { width: 32px; height: 32px; flex: none; object-fit: contain; }
.hm-go button:active { transform: scale(.96); }
.hm-go button.done img { filter: grayscale(.2); }
.hm-go button.done::after { content: '✓'; margin-left: 2px; color: #7dff9a; font-weight: 900; }
/* ===== Design system: sub-screen header + result buttons (22/11/2026) ===== */
body.mb-light.dm-sub { color: var(--ds-text); --mb-scene-veil: var(--ds-scene-veil, rgba(242, 244, 245, .66)); }
.sc-bar { position: fixed; left: 0; right: 0; top: 0; z-index: 50; display: flex; align-items: center; gap: var(--ds-s3); min-height: 56px; padding: var(--ds-s2) max(var(--ds-s3), var(--ds-safe-r)) var(--ds-s2) max(var(--ds-s3), var(--ds-safe-l)); padding-top: max(var(--ds-s2), var(--ds-safe-t)); background: var(--ds-surface); border-bottom: 1px solid var(--ds-line); color: var(--ds-text); }
.sc-bar.hidden { display: none !important; }
.sc-back { flex: none; width: var(--ds-tap); height: var(--ds-tap); display: grid; place-items: center; padding: 0 0 4px; border: 1px solid var(--ds-line); border-radius: 50%; background: var(--ds-surface); color: var(--ds-text); font: 700 28px/1 system-ui; }
.sc-back:active { transform: var(--ds-press); }
.sc-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--ds-fs-xl); font-weight: 800; }
.sc-chips { display: flex; gap: var(--ds-s2); }
.sc-chips.hidden { display: none; }
.sc-chip { display: flex; align-items: center; gap: var(--ds-s1); height: 34px; padding: 0 var(--ds-s3) 0 var(--ds-s2); border-radius: var(--ds-r-pill); background: var(--ds-surface-2); border: 1px solid var(--ds-line); font-size: var(--ds-fs-lg); }
.sc-chip img { width: 22px; height: auto; }
.sc-chip b { color: var(--ds-coin); font-weight: 800; }
.sc-chip.gem-chip b { color: var(--ds-gem); }
body.dm-sub .wrap { padding-top: calc(56px + max(var(--ds-s2), var(--ds-safe-t)) + var(--ds-s3)); padding-bottom: calc(var(--ds-s6) + var(--ds-safe-b)); padding-left: max(14px, var(--ds-safe-l)); padding-right: max(14px, var(--ds-safe-r)); }

/* Result boxes: Về · Chơi lại · main button last on the right */
.dialog .wbtns { display: flex; gap: var(--ds-s2); margin-top: var(--ds-s3); }
.dialog .wbtns button { min-height: var(--ds-tap); border-radius: var(--ds-r-pill); font-size: var(--ds-fs-md); font-weight: 800; }
.dialog .wbtns .wsec { flex: none; padding: 0 var(--ds-s4); border: 1px solid var(--ds-line-strong); background: var(--ds-surface); color: var(--ds-text); }
.dialog .wbtns .more, .dialog.win .wbtns .more { flex: 1; display: flex; align-items: center; justify-content: center; margin: 0; padding: 0 var(--ds-s3); border: 0; background: var(--ds-play); color: #fff; box-shadow: none; text-shadow: none; font-size: var(--ds-fs-lg); }
.dialog .wbtns .more:disabled { opacity: .5; }
.dialog .wbtns .more:active, .dialog .wbtns .wsec:active { transform: var(--ds-press); box-shadow: none; }
.dialog .wshare { display: flex; flex-direction: row; align-items: center; justify-content: center; gap: var(--ds-s2); width: 100%; min-height: var(--ds-tap); margin-top: var(--ds-s2); padding: 0 var(--ds-s3); border: 1px solid var(--ds-primary); border-radius: var(--ds-r-pill); background: var(--ds-surface); color: var(--ds-primary); font-size: var(--ds-fs-md); font-weight: 800; box-shadow: none; }
.dialog .wshare:active { transform: var(--ds-press); box-shadow: none; }
.dialog .wshare:disabled { opacity: .5; }
.dialog .wshare .mbi { width: 22px; height: 22px; }
.dialog .wshare .mbi * { stroke: var(--ds-primary); }
.dialog .pz button { border-color: var(--ds-line-strong); border-radius: var(--ds-r-md, 12px); }
.dialog .pz button.pri { border-color: var(--ds-play); background: var(--ds-play); }
@media (orientation: landscape) and (max-height: 560px) {
  .dialog .wshare { margin-top: 4px; }
  .dialog .wbtns { margin-top: 6px; }
}

/* 2. Dialog radius + shadow from tokens (beats game-light.css) */
body.mb-light .dialog { border-radius: var(--ds-r-3xl, 18px); box-shadow: var(--ds-sh-pop, 0 10px 30px rgba(0, 0, 0, .18)); }
/* 3. Result box colours from tokens */
body.mb-light .dialog.win h3 { color: var(--ds-play); }
body.mb-light .dialog.lose h3 { color: var(--ds-danger); }
body.mb-light .dialog.win .wsub, body.mb-light .dialog.lose .why { color: var(--ds-text-muted); }
/* 6. Shop: lock reason is a corner label */
.item .lock { position: absolute; top: 6px; right: 6px; z-index: 2; padding: 2px 8px; border-radius: var(--ds-r-md); background: var(--ds-text); color: #fff; font-size: var(--ds-fs-xs); font-weight: 800; }
.item .lock .mbi, .item .lock img { width: 14px; height: 14px; vertical-align: -2px; }
/* Landscape: thin 44 px sub-screen bar */
@media (orientation: landscape) and (max-height: 560px) {
  .sc-bar { min-height: var(--ds-bar-thin, 44px); padding-top: max(2px, var(--ds-safe-t)); padding-bottom: 2px; }
  .sc-title { font-size: var(--ds-fs-lg); }
  body.dm-sub .wrap { padding-top: calc(var(--ds-bar-thin, 44px) + max(2px, var(--ds-safe-t)) + var(--ds-s3)); }
}

/* ================= Bé Tô Màu — màn tô (tờ giấy vuông, hàng dụng cụ, hộp màu) ================= */
.pv { position: relative; display: flex; justify-content: center; align-items: center; width: 100%; min-height: 96px; pointer-events: none; }
.pv .dots { flex-wrap: wrap; justify-content: center; max-width: 120px; gap: 4px; }
.pv .dots i { width: 22px; height: 22px; }
.dialog.win .art { position: relative; width: min(230px, 62vw); margin: 0 auto 4px; animation: dance 1.2s ease-in-out infinite; }
.dialog.win .art .frame { padding-top: 6px; }
@keyframes dance { 0%, 100% { transform: rotate(-4deg) translateY(0); } 25% { transform: rotate(3deg) translateY(-8px) scale(1.03); } 50% { transform: rotate(-2deg) translateY(0); } 75% { transform: rotate(4deg) translateY(-6px) scale(1.02); } }
.confetti { position: fixed; top: -20px; z-index: 79; width: 10px; height: 14px; pointer-events: none; animation: fall var(--d, 2.4s) linear forwards; }
@keyframes fall { to { transform: translate(var(--dx, 0), 110vh) rotate(var(--r, 540deg)); } }
/* Phone held sideways: picture on the left, title / rewards / buttons on the right, all in one screen. */
@media (orientation: landscape) and (max-height: 560px) {
  .dialog.win { width: min(640px, 100%); display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 18px; align-items: center; }
  .dialog.win > * { grid-column: 2; }
  .dialog.win > .art { grid-column: 1; grid-row: 1 / span 7; width: min(220px, 56vh); margin: 0; }
  .dialog.win .wshare { margin-top: 6px; }
}
/* Crayon tiles sit straight on the scene: drop the white card that game-light.css gives every .tools button. */
body.mb-light .item { border-radius: var(--ds-r-2xl, 16px); }
.toast { background: var(--ds-text); color: #fff; }


/* ================= Dò Mìn — mẫu B "hầm mỏ tìm vàng" (chủ dự án chọn 30/11/2026) ================= */
.hm-av .av-def { width: 80%; height: 80%; object-fit: contain; }
#scHome .hm-top, #scHome .hm-back { z-index: 2; }
#scHome .hm-hero { max-height: 26cqh; }
@container (orientation: portrait) {
  #scHome .hm-stack { justify-content: flex-start; padding-top: 2cqh; }
  #scHome .hm-logo { max-height: 18cqh; max-width: 74cqw; }
  #scHome .hm-hero { max-height: 30cqh; max-width: 80cqw; }
}
.hm-go span { font-weight: 800; }
.hm-go button + button:not(:last-child) { border-radius: 0; }
.hm-go button { padding: 0 11px 0 5px; }

/* ---------- các màn ---------- */
#lvList { display: flex; flex-direction: column; gap: var(--ds-s3); }
.khu { padding: var(--ds-s3); border: 1px solid var(--ds-line); border-radius: var(--ds-r-2xl, 16px); background: var(--ds-surface); }
.khu-h { display: flex; flex-direction: column; gap: 2px; margin-bottom: var(--ds-s2); }
.khu-h b { font-size: var(--ds-fs-lg); }
.khu-h small { color: var(--ds-text-muted); font-size: var(--ds-fs-sm); }
.lvgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--ds-s2); }
body.mb-light #lvList .lv { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 56px; padding: 4px 0; border: 2px solid #5a3b1d; border-radius: 12px;
  background: url(../img/t-stone.webp) center / cover; color: #fff; box-shadow: 0 2px 0 #3a2616; }
.lv b { font-size: 18px; font-weight: 900; -webkit-text-stroke: 3px #3a2616; paint-order: stroke fill; }
.lv .st { display: flex; gap: 0; font-size: 12px; line-height: 1; }
.lv .st i { font-style: normal; color: rgba(255, 255, 255, .55); -webkit-text-stroke: 2px #3a2616; paint-order: stroke fill; }
.lv .st i.on { color: #ffd24a; }
body.mb-light #lvList .lv.done { background: url(../img/o-gold.webp) center / cover; }
.lv.done b { color: #4a2a14; -webkit-text-stroke: 0; }
body.mb-light #lvList .lv.next { border-color: var(--ds-play); box-shadow: 0 0 0 3px rgba(0, 168, 98, .35), 0 2px 0 #3a2616; }
body.mb-light #lvList .lv.lock { filter: grayscale(.7) brightness(.8); }
.lv.lock b { font-size: 14px; }
.lv .mb-hardgem { position: absolute; top: -6px; right: -6px; }
.lv:active { transform: var(--ds-press); }

/* ---------- màn chơi ---------- */
#scPlay { position: fixed; inset: 0; z-index: 5; padding: 0; max-width: none; animation: none; }
#scPlay .field { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; overflow: hidden;
  background: linear-gradient(rgba(40, 24, 12, .45), rgba(40, 24, 12, .6)), url(../img/home-bg.webp) center / cover, #3a2616; }
#scPlay .top { position: relative; z-index: 3; flex: none; display: grid; grid-template-columns: 46px auto minmax(74px, 1fr) auto 46px; align-items: center; gap: 6px; width: 100%; max-width: 640px;
  padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 4px max(10px, env(safe-area-inset-left)); }
.wbtn { position: relative; display: flex; align-items: center; justify-content: center; min-width: var(--ds-tap); min-height: var(--ds-tap); padding: 0; border: 2px solid #8a5a2a; border-radius: 50%;
  background: linear-gradient(#f0d3a0, #cfa066); box-shadow: 0 3px 0 #7a4a1c, inset 0 1px 0 rgba(255, 245, 225, .7); color: #4a2a14; }
.wbtn.round { width: 46px; height: 46px; }
.wbtn.round svg { width: 22px; height: 22px; fill: none; stroke: #4a2a14; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.wbtn:active { transform: translateY(2px); box-shadow: 0 1px 0 #7a4a1c; }
body.mb-light #scPlay .wbtn, body.mb-light #scPlay .wbtn:hover { background: linear-gradient(#f0d3a0, #cfa066); border-color: #8a5a2a; color: #4a2a14; }
.chip { display: flex; align-items: center; gap: 3px; height: 36px; padding: 0 10px 0 4px; border-radius: 18px; background: var(--ds-glass, rgba(20, 60, 90, .78)); border: 2px solid var(--ds-glass-line, rgba(255, 255, 255, .55)); }
.chip img, .chip svg { width: 24px; height: 24px; flex: none; object-fit: contain; }
.chip b { color: #fff; font: 900 16px/1 system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.lvcard { min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 3px 4px; border-radius: 12px; background: var(--ds-glass-soft, rgba(5, 38, 70, .22)); border: 1px solid rgba(255, 255, 255, .35); }
.lvcard b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fff; font: 900 14px/1.2 system-ui, sans-serif; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
.hearts { display: flex; gap: 2px; }
.hearts i { display: block; width: 18px; height: 18px; opacity: .3; filter: grayscale(1); }
.hearts i.on { opacity: 1; filter: none; }
.hearts .mbi { width: 18px; height: 18px; display: block; }

.stage { position: relative; z-index: 2; flex: 1 1 auto; min-height: 0; width: 100%; display: grid; place-items: center; overflow: hidden; }
.frame { position: relative; padding: 10px; border-radius: 14px; background: linear-gradient(135deg, #b8803f, #7a4a1c 55%, #9a6430); box-shadow: inset 0 0 0 2px #4a2a14, 0 8px 18px rgba(0, 0, 0, .5); }
.frame .cn { position: absolute; z-index: 2; width: 28px; height: 28px; background: url(../img/corner.webp) center / contain no-repeat; pointer-events: none; }
.frame .tl { left: -9px; top: -9px; } .frame .tr { right: -9px; top: -9px; } .frame .bl { left: -9px; bottom: -9px; } .frame .br { right: -9px; bottom: -9px; }
.frame.shake { animation: shake .4s ease; }
@keyframes shake { 20% { transform: translate(-6px, 2px); } 40% { transform: translate(5px, -3px); } 60% { transform: translate(-3px, 2px); } 80% { transform: translate(2px, -1px); } }
.board { display: grid; grid-template-columns: repeat(var(--cols, 9), var(--cs, 36px)); gap: 2px; padding: 2px; border-radius: 6px; background: #5a3b1d; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }

/* Ô: h = chưa đào (kiểu ô đá), o = đã đào (cát), n1..n8 số, g = cát có vàng, f = cờ, x = mìn nổ, m = mìn lộ khi thua, wf = cờ sai */
.c { position: relative; display: grid; place-items: center; width: var(--cs, 36px); height: var(--cs, 36px); border-radius: 4px; cursor: pointer; }
.c.h { background: var(--tile, url(../img/t-stone.webp)) center / cover; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .25); transition: transform .08s; }
/* Default stone: art cut from the approved mock already has its own outline + bevel, so no extra shadow; 4 crack variants. */
.field[data-tile="stone"] .c.h { box-shadow: none; border-radius: var(--ds-r-xs, 6px); }
.field[data-tile="stone"] .c.h[data-v="1"] { background-image: url(../img/t-stone-2.webp); }
.field[data-tile="stone"] .c.h[data-v="2"] { background-image: url(../img/t-stone-3.webp); }
.field[data-tile="stone"] .c.h[data-v="3"] { background-image: url(../img/t-stone-4.webp); }
.c.o { background: url(../img/o-sand.webp) center / cover; animation: dig .22s ease-out var(--dl, 0ms) backwards; cursor: default; }
.c.o.g { background-image: url(../img/o-gold.webp); }
.c.o.n1, .c.o.n2, .c.o.n3, .c.o.n4, .c.o.n5, .c.o.n6, .c.o.n7, .c.o.n8 { cursor: pointer; }
@keyframes dig { from { transform: scale(.4); opacity: 0; } }
.c b { font: 900 calc(var(--cs, 36px) * .6) / 1 "Arial Rounded MT Bold", system-ui, sans-serif; -webkit-text-stroke: calc(var(--cs, 36px) * .07) #fff8e8; paint-order: stroke fill; pointer-events: none; }
.c.n1 b { color: #2560d8; } .c.n2 b { color: #27913a; } .c.n3 b { color: #d93426; } .c.n4 b { color: #6236b8; }
.c.n5 b { color: #9a3a12; } .c.n6 b { color: #0f8088; } .c.n7 b { color: #2a2a2a; } .c.n8 b { color: #6b6b6b; }
.c img { width: 80%; height: 80%; object-fit: contain; pointer-events: none; }
.c.f img { animation: plant .25s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes plant { from { transform: translateY(-40%) scale(.6); opacity: 0; } }
.c.x { background: radial-gradient(circle, #ffb08a, #d9442c 70%); }
.c.m { background: url(../img/o-sand.webp) center / cover; animation: none; }
.c.m img { animation: pop .3s ease backwards; }
@keyframes pop { from { transform: scale(0); } }
.c.wf::after { content: ''; position: absolute; inset: 14%; background: linear-gradient(45deg, transparent 44%, #d93426 44% 56%, transparent 56%), linear-gradient(-45deg, transparent 44%, #d93426 44% 56%, transparent 56%); }
.c.press { transform: scale(.88); filter: brightness(1.15); }
.c.cur { outline: 3px solid #ffd24a; outline-offset: -2px; z-index: 1; }
.c.hinted { z-index: 1; animation: hintGlow .65s ease-in-out 4; }
@keyframes hintGlow { 50% { box-shadow: 0 0 0 3px #ffe36a, 0 0 16px 6px rgba(255, 220, 80, .9); transform: scale(1.08); } }
.c.nudge { animation: nudge .3s ease; }
@keyframes nudge { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.boomfx { position: absolute; z-index: 4; left: 50%; top: 50%; width: 260% !important; height: 260% !important; transform: translate(-50%, -50%); animation: boom .75s ease-out forwards; }
@keyframes boom { from { transform: translate(-50%, -50%) scale(.2); opacity: 1; } 60% { opacity: 1; } to { transform: translate(-50%, -50%) scale(1.15); opacity: 0; } }

.acts { position: relative; z-index: 3; flex: none; display: flex; align-items: center; justify-content: center; gap: 14px; width: 100%; max-width: 640px;
  padding: 6px 14px max(14px, env(safe-area-inset-bottom)); }
.toggle { display: flex; padding: 4px; border-radius: 999px; background: var(--ds-glass, rgba(20, 60, 90, .78)); border: 2px solid var(--ds-glass-line, rgba(255, 255, 255, .55)); }
.toggle button { display: flex; align-items: center; gap: 6px; min-height: 52px; padding: 0 18px 0 10px; border: 0; border-radius: 999px; background: none; color: #f3e2c4; font: 900 16px/1 system-ui, sans-serif; box-shadow: none; }
.toggle button img { width: 34px; height: 34px; object-fit: contain; }
.toggle button.on { background: linear-gradient(#8aea5a, #2fae2a 60%, #238a22); color: #fff; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .2); }
.toggle.flag button.on { background: linear-gradient(#ff8a6b, #e0442c 60%, #b8321f); }
body.mb-light #scPlay .toggle button { color: #f3e2c4; }
body.mb-light #scPlay .toggle button.on { color: #fff; }
.hintbtn { position: relative; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 64px; height: 64px; padding: 0; border: 3px solid #fff5cf; border-radius: 50%;
  background: linear-gradient(#ffe27a, #f2b52a 60%, #d48f12); box-shadow: 0 4px 0 #8a5a10; color: #4a2a14; }
.hintbtn .ic, .hintbtn .ic .mbi { display: block; width: 26px; height: 26px; }
.hintbtn small { font-size: 12px; font-weight: 900; line-height: 1; }
.hintbtn .cnt { position: absolute; top: -6px; right: -6px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: var(--ds-r-pill); background: var(--ds-dot-c, #e5374f); border: 2px solid #fff3d6;
  color: #fff; font: 900 12px/18px system-ui, sans-serif; font-style: normal; text-align: center; }
.hintbtn:active, .toggle button:active { transform: translateY(2px); }
body.mb-light #scPlay .hintbtn { background: linear-gradient(#ffe27a, #f2b52a 60%, #d48f12); border-color: #fff5cf; color: #4a2a14; }

/* Phone held sideways: controls in a column on the left, board on the right (tall boards drawn transposed by main.js). */
@media (orientation: landscape) and (max-height: 560px) {
  /* Sideways phone: info + Dig/Flag on the left, board in the middle, pause top-right, hint bottom-right. */
  #scPlay .field { display: grid; grid-template-columns: min(232px, 30vw) minmax(0, 1fr) 76px; grid-template-rows: auto auto auto minmax(0, 1fr) auto;
    grid-template-areas: 'back stage pause' 'card stage .' 'chips stage .' '. stage .' 'acts stage hint'; align-items: center; column-gap: 8px; row-gap: 8px;
    padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
  #scPlay .top, #scPlay .acts { display: contents; }
  #btnQuit { grid-area: back; justify-self: start; } #btnPause { grid-area: pause; justify-self: end; align-self: start; }
  .lvcard { grid-area: card; }
  #scPlay .top .chip { grid-area: chips; } #scPlay .top .hchip { justify-self: start; } #scPlay .top .chip:not(.hchip) { justify-self: end; }
  .stage { grid-area: stage; height: 100%; }
  .toggle { grid-area: acts; width: 100%; }
  .toggle button { flex: 1; justify-content: center; min-height: 46px; padding: 0 8px 0 4px; font-size: 15px; }
  .toggle button img { width: 28px; height: 28px; }
  .hintbtn { grid-area: hint; justify-self: end; width: 62px; height: 62px; }
  .dialog.win, .dialog.lose { width: min(640px, 100%); display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 18px; align-items: center; }
  .dialog.win > *, .dialog.lose > * { grid-column: 2; }
  .dialog.win > .wm, .dialog.lose > .wm { grid-column: 1; grid-row: 1 / span 7; width: min(190px, 44vh); max-height: none; margin: 0; }
  .toast { bottom: auto; top: max(12px, env(safe-area-inset-top)); }
}

/* ---------- ô xem thử cửa hàng: 3×3 ô dùng chính lớp của bãi ---------- */
.pv { position: relative; display: flex; justify-content: center; align-items: center; width: 100%; min-height: 96px; pointer-events: none; }
.mini { --cs: 30px; display: grid; grid-template-columns: repeat(3, var(--cs)); gap: 2px; padding: 4px; border-radius: 8px; background: #5a3b1d; box-shadow: 0 0 0 4px #9a6430; }
.mini.lg { --cs: 50px; }
.mini .c { cursor: default; animation: none; }
.bst { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 64px; height: 72px; border-radius: 12px; background: #fff7e6; border: 2px solid #d8a13a; }
.bst .mbi { width: 32px; height: 32px; }
.bst b { font-size: 15px; color: var(--ds-ink); }
.dialog.win .wm, .dialog.lose .wm { display: block; width: 130px; height: auto; max-height: 110px; object-fit: contain; margin: -4px auto 0; }
.dialog.lose .wm { width: 84px; }
.dialog.lose .wbtns { justify-content: stretch; }

/* Level card: name on top, mines left under it; lives chip right after ‹. */
.lvcard .mines { display: flex; align-items: center; gap: 3px; }
.lvcard .mines img { width: 18px; height: 18px; }
.lvcard .mines b { color: #fff; font: 900 13px/1 system-ui, sans-serif; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
.hchip { padding: 0 8px; }
.hm-go .ic { display: grid; place-items: center; width: 32px; height: 32px; flex: none; }
.hm-go .ic .mbi { width: 28px; height: 28px; }
.toast { pointer-events: none; }
@media (max-width: 370px) { .hm-bar { min-width: 0; } .hm-top { gap: 6px; } }
/* Narrow phones (≤ 400 px): tighter top bar so ‹ … ⏸ fit in one row. */
@media (max-width: 400px) and (orientation: portrait) {
  #scPlay .top { grid-template-columns: 44px auto minmax(60px, 1fr) auto 44px; gap: 4px; }
  #scPlay .wbtn.round { width: 44px; height: 44px; }
  .hchip { padding: 0 6px; }
  .hearts i, .hearts .mbi { width: 15px; height: 15px; }
  #scPlay .top .chip:not(.hchip) { padding: 0 8px 0 3px; }
  #scPlay .top .chip:not(.hchip) svg { width: 20px; height: 20px; }
  #scPlay .top .chip b { font-size: 14px; }
}
/* Buy box: Thôi · Mua 💎 · Mua 🪙 stay on one row (primary last). */
.dlg-btns { flex-wrap: nowrap; }
.dlg-btns button { padding: 10px 12px; white-space: nowrap; }
.dlg-btns button:first-child { flex: none; }

/* Pause box buttons (full-width list, primary last). */
.dialog .pz { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.dialog .pz button { min-height: var(--ds-tap, 44px); padding: 10px 14px; border: 1px solid var(--ds-line-strong, #c9ccd1); border-radius: var(--ds-r-md, 12px); background: #fff; color: var(--ds-text, #191b1d); font-size: 16px; font-weight: 800; }
.dialog .pz button.pri { border-color: var(--ds-play, #00a862); background: var(--ds-play, #00a862); color: #fff; }
/* Win and lose boxes share one layout. */
.dialog.lose { text-align: center; }
body { font-family: var(--ds-font, "Builder Sans", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif); }
@media (max-width: 370px) { .hm-go button { padding: 0 8px 0 4px; gap: 4px; } .hm-go span { font-size: 12.5px; } }

/* Sheet skin "stone": small sheets take the colours of the painted home (owner 30/11/2026). */
body.mb-light { --skin-frame: #3b2f2a; --skin-head: linear-gradient(#5a4636, #3b2f2a); --skin-head-ink: #fbeed2; --skin-line: #e0a63a;
  --skin-paper: #ece3d3; --skin-card: #fbf7ef; --skin-card-line: #cdbfa6; --skin-ink: #2b211b; --skin-muted: #67574a; --skin-hover: #f6efe2; }
