/* 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);
}
/* ================= Tô Tranh Đông Hồ — MonBlock (base copied from Bé Tô Màu) ================= */
: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: #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: 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(/dongho/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; }
/* Mẫu A (chủ dự án duyệt 29/11/2026): cầm dọc = logo trên, cảnh lợn gà giữa nền (hm-bg), CHƠI dưới cảnh */
@container (orientation: portrait) {
  #scHome .hm-stack { justify-content: flex-start; padding-top: 1cqh; }
  #scHome .hm-logo { max-height: 22cqh; max-width: 62cqw; }
  #scHome .hm-gap { flex: 1; }
  #scHome .hm-play { width: min(60cqw, 300px); }
  #scHome .hm-hero { display: none; }
}
#scHome .hm-top, #scHome .hm-back { z-index: 2; }
/* Cầm ngang: nền chỉ còn giấy, cảnh lợn gà là hình chính (.hm-hero) trong lưới chung của game-light.css (design system "Phần chung bổ sung" 3) */
@container (orientation: landscape) {
  #scHome .hm-bg { object-position: center top; }
  #scHome .hm-gap { display: none; }
}
.dialog .pz { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.dialog .pz button { min-height: 48px; border: 1px solid #c9ccd1; border-radius: 12px; background: #fff; font-size: 16px; font-weight: 800; }
.dialog .pz button.pri { border-color: #00a862; background: #00a862; color: #fff; }
.dialog.lose { text-align: center; background: var(--ds-surface, #fff); }
.dialog.lose h3 { font-size: 24px; color: #b3271c; }
.dialog.lose .why { margin: 0 0 6px; font-weight: 700; color: var(--ds-text-muted); }
.dialog.win .wm { width: 120px; height: auto; }

/* ===== Design system: sub-screen header + result buttons (22/11/2026) ===== */
body.mb-light.dh-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.dh-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.dh-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; }

/* ================= Tô Tranh Đông Hồ — khung tranh, con dấu ================= */
.frame { position: relative; display: block; padding: 6px; border-radius: 4px; background: #c79a5a; box-shadow: 0 4px 8px rgba(0, 0, 0, .25); }
.frame .fpaper { display: block; padding: 5px; border-radius: 2px; box-shadow: inset 0 0 0 1px rgba(90, 60, 20, .25); }
.frame img { display: block; width: 100%; height: auto; }
.fr-tre { padding: 7px; background: repeating-linear-gradient(90deg, #d9b66a 0 18px, #b8913f 18px 20px), #d9b66a; box-shadow: inset 0 0 0 2px #8a6a28, 0 4px 8px rgba(0, 0, 0, .25); }
.fr-go { padding: 9px; background: linear-gradient(135deg, #a0662e, #6e3f16 50%, #8e5624); box-shadow: inset 0 0 0 2px #4a2a10, 0 4px 8px rgba(0, 0, 0, .3); }
.fr-son { padding: 9px; background: linear-gradient(135deg, #b3271c, #6e120c 55%, #9a1f16); box-shadow: inset 0 0 0 2px #e8b84a, 0 4px 8px rgba(0, 0, 0, .3); }
.fr-vang { padding: 10px; background: linear-gradient(135deg, #fff1a0, #d9a520 30%, #fff1a0 55%, #b8820a 80%, #f2c84a); box-shadow: inset 0 0 0 2px #8a5a00, 0 4px 8px rgba(0, 0, 0, .3); }
.fr-trai { padding: 10px; background: linear-gradient(135deg, #1d2a3a, #0e1620 60%, #2a3a4e); box-shadow: inset 0 0 0 3px #d8e6f2, inset 0 0 0 5px #1d2a3a, inset 0 0 0 6px #b9a8ff, 0 4px 8px rgba(0, 0, 0, .35); }
.seal { display: block; width: 100%; height: 100%; }
.art-seal { position: absolute; right: 4%; bottom: 4%; width: 26%; aspect-ratio: 1; transform: rotate(-8deg); mix-blend-mode: multiply; }
.pv .frame { width: 104px; }
.pv-seal { position: relative; display: block; width: 104px; }
.pv-boost { display: flex; gap: 8px; }
.bst { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 56px; height: 64px; border-radius: 12px; background: #fff7e6; border: 2px solid #d8a13a; }
.bst .mbi { width: 30px; height: 30px; }
.bst b { font-size: 14px; color: var(--ds-ink); }
.buyprev .pv .frame, .buyprev .pv-seal { width: 170px; }
.big-pv .frame { width: min(220px, 60vw); }
.dialog .mean { margin: 4px 0; font-size: 15px; line-height: 1.45; color: var(--ds-text); }
.dialog.win .art { width: min(240px, 62vw); animation: none; }
.dialog.win .art .art-seal { animation: stampIn .45s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes stampIn { from { transform: scale(2.4) rotate(-20deg); opacity: 0; } }

/* ================= Bản đồ làng Hồ (mẫu B) ================= */
#scMap { position: fixed; inset: 0; z-index: 5; padding: 0; max-width: none; background: #efe3c6 url(../img/home-bg.webp) center top / cover; animation: none; }
#scMap::before { content: ""; position: fixed; left: 0; right: 0; top: 0; z-index: 5; height: calc(max(10px, env(safe-area-inset-top)) + 58px); background: linear-gradient(rgba(239, 227, 198, .97) 70%, rgba(239, 227, 198, 0)); pointer-events: none; }
body:has(#scMap:not(.hidden)) .mb-nav { display: none !important; }
.mp-scroll { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.mp-col { position: relative; width: min(100%, 560px); margin: 0 auto; padding-bottom: 110px; }
.mp-khu { position: relative; width: 100%; aspect-ratio: 9 / 16; overflow: hidden; }
.mp-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mp-banner { position: absolute; z-index: 2; left: 50%; top: 1.2%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; padding: 6px 22px 7px;
  border-radius: 10px; background: linear-gradient(#a8322a, #7d1d16); border: 2px solid #e8c06a; box-shadow: var(--ds-sh-art); color: #fff3d6; white-space: nowrap; }
.mp-banner b { font: 900 18px/1.15 "Times New Roman", serif; letter-spacing: .3px; }
.mp-banner small { font-size: 12px; font-weight: 800; color: #ffe3a8; }
.mp-node { position: absolute; width: 18%; transform: translate(-50%, -50%); padding: 0; border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.mp-node:active { transform: translate(-50%, -50%) scale(.95); }
.mp-pic { position: relative; display: block; width: 100%; }
.mp-pic .frame { padding: 4px; }
.mp-pic .frame .fpaper { padding: 3px; }
.mp-name { max-width: none; white-space: nowrap; margin-top: -8px; position: relative; z-index: 1; padding: 2px 8px; border-radius: 8px; background: rgba(255, 246, 225, .94); border: 1px solid #b88a4a; color: #4a2a14;
  font-size: 12px; font-weight: 800; line-height: 1.25; text-align: center; }
.mp-stars { display: flex; gap: 1px; margin-top: -2px; font-size: 13px; line-height: 1; }
.mp-stars i { font-style: normal; color: rgba(90, 60, 20, .35); -webkit-text-stroke: .5px #fff; }
.mp-stars i.on { color: #f2b51c; }
.mp-seal { position: absolute; right: -10%; bottom: -10%; width: 44%; aspect-ratio: 1; transform: rotate(-10deg); filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .3)); }
.mp-lock { position: absolute; inset: 0; display: grid; place-items: center; }
.mp-lock .mbi { width: 40%; height: 40%; padding: 6px; border-radius: 50%; background: rgba(255, 246, 225, .95); box-shadow: 0 2px 4px rgba(0, 0, 0, .35); }
.mp-node.lock .mp-pic img { filter: grayscale(.6) brightness(.85); }
.mp-node.lock .mp-name { opacity: .75; }
.mp-tag { position: absolute; left: 50%; top: -9px; transform: translateX(-50%); padding: 1px 8px; border-radius: 999px; background: var(--ds-primary); color: #fff;
  font-size: 12px; font-weight: 800; white-space: nowrap; }
.mp-tag.wip { background: #e08a00; }
.mp-node.next .mp-pic { animation: nodeBob 1.6s ease-in-out infinite; }
.mp-node.next .mp-pic::after { content: ''; position: absolute; inset: -6px; border-radius: 8px; border: 3px solid #ffd23a; box-shadow: 0 0 12px rgba(255, 210, 58, .8); pointer-events: none; }
@keyframes nodeBob { 50% { transform: translateY(-5px); } }
.mp-back { position: fixed; z-index: 6; }
.mp-chips { position: fixed; z-index: 6; top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); display: flex; gap: 6px; }
.mp-star { color: #ffd23a; font-size: 18px; line-height: 1; padding-left: 4px; }
.mp-play { position: fixed; z-index: 6; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(70vw, 320px); padding: 8px 18px 10px; }
.mp-play b { font-size: 30px; }
.mp-play:active { transform: translateX(-50%) scale(.96); }
@media (orientation: landscape) and (max-height: 560px) {
  .mp-col { width: min(100%, 420px); }
  .mp-play { left: auto; right: max(14px, env(safe-area-inset-right)); transform: none; width: 220px; padding: 6px 14px 8px; }
  .mp-play b { font-size: 24px; }
  .mp-play:active { transform: scale(.96); }
}

/* ================= Màn tô (mẫu A) ================= */
#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: radial-gradient(ellipse at 50% 40%, #f6ecd4, #e6d4ae 75%, #d9c193); }
#scPlay .top { position: relative; z-index: 3; flex: none; display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 10px; 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; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-width: var(--ds-tap); min-height: var(--ds-tap);
  padding: 4px 10px; border: 2px solid #8a5a2a; border-radius: 12px; background: linear-gradient(#f0d3a0, #cfa066); box-shadow: 0 3px 0 #7a4a1c, inset 0 1px 0 rgba(255, 245, 225, .7);
  color: #4a2a14; font-weight: 800; }
.wbtn:active { transform: translateY(2px); box-shadow: 0 1px 0 #7a4a1c; }
.wbtn.round { width: 46px; height: 46px; padding: 0; border-radius: 50%; }
.wbtn.round svg { width: 22px; height: 22px; fill: none; stroke: #4a2a14; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.wbtn small { font-size: 12px; font-weight: 800; line-height: 1.1; }
.wbtn .ic { display: block; width: 24px; height: 24px; }
.wbtn .ic .mbi { width: 24px; height: 24px; display: block; }
.wbtn .cnt { position: absolute; top: -8px; right: -8px; 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; }
.prog { min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.pbar { position: relative; width: 100%; max-width: 300px; height: 24px; border-radius: 12px; border: 2px solid #6e4220; background: #6e4220; overflow: hidden; }
.pbar i { position: absolute; inset: 0; transform-origin: left center; transform: scaleX(0); background: linear-gradient(#f5c95a, #d8962a); transition: transform .3s ease; }
.pbar b { position: relative; display: block; text-align: center; font: 900 13px/20px system-ui, sans-serif; color: #fff; -webkit-text-stroke: 2.5px #4a2a14; paint-order: stroke fill; }
.prog small { max-width: 100%; overflow-wrap: anywhere; text-align: center; line-height: 1.2; font-size: 13px; font-weight: 800; color: #4a2a14; }
.stage { position: relative; z-index: 2; flex: 1 1 auto; min-height: 0; width: 100%; max-width: 760px; margin: 4px 0; overflow: hidden; }
.stage canvas { position: absolute; inset: 0; display: block; touch-action: none; cursor: crosshair; }
.sealfx { position: absolute; left: 50%; top: 50%; width: 30%; max-width: 150px; aspect-ratio: 1; transform: translate(-50%, -50%) rotate(-10deg); pointer-events: none;
  mix-blend-mode: multiply; animation: stampIn .45s cubic-bezier(.2, 1.6, .4, 1) both; }
.ripple { position: absolute; z-index: 3; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; border: 3px solid var(--c); pointer-events: none; animation: rip .55s ease-out forwards; }
@keyframes rip { to { transform: scale(4); opacity: 0; } }
.pal { position: relative; z-index: 3; flex: none; display: flex; gap: 20px; width: 100%; max-width: 640px; padding: 16px 14px 10px; overflow-x: auto; scrollbar-width: none; justify-content: safe center; }
.pal::-webkit-scrollbar { display: none; }
.pal .sw { flex: none; position: relative; width: 52px; height: 52px; padding: 0; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--c);
  box-shadow: 0 0 0 3px #fff6e1, 0 0 0 5px #8a5423, 0 3px 5px rgba(0, 0, 0, .3); transition: transform var(--ds-t-fast); }
.pal .sw::before { content: ''; position: absolute; inset: -9px; border-radius: 50%; background: conic-gradient(#3f8f2a var(--f), transparent 0); -webkit-mask: radial-gradient(circle, transparent 31px, #000 32px); mask: radial-gradient(circle, transparent 31px, #000 32px); }
.pal .sw b { position: relative; font: 900 20px/1 system-ui, sans-serif; color: #fff; -webkit-text-stroke: 3px rgba(40, 20, 10, .75); paint-order: stroke fill; }
.pal .sw.light b { color: #2a1a0c; -webkit-text-stroke: 3px rgba(255, 255, 255, .85); }
.pal .sw.on { transform: translateY(-4px) scale(1.1); box-shadow: 0 0 0 3px #fff6e1, 0 0 0 6px #d8a13a, 0 5px 8px rgba(0, 0, 0, .35); }
.pal .sw.done { opacity: .55; }
.pal .sw.nudge { animation: nudge .4s ease; }
@keyframes nudge { 25% { transform: translateY(-8px) scale(1.15); } 75% { transform: translateY(-2px) scale(1.05); } }
.acts { position: relative; z-index: 3; flex: none; display: flex; justify-content: center; gap: 12px; width: 100%; max-width: 640px;
  padding: 4px 14px max(12px, env(safe-area-inset-bottom)); }
.acts .wbtn { flex: 1; max-width: 140px; min-height: 56px; }
body.mb-light #scPlay .wbtn, body.mb-light #scPlay .wbtn:hover { background: linear-gradient(#f0d3a0, #cfa066); border-color: #8a5a2a; color: #4a2a14; }
@media (orientation: landscape) and (max-height: 560px) {
  #scPlay .field { display: grid; grid-template-columns: min(300px, 40vw) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; align-items: stretch;
    padding-left: max(0px, env(safe-area-inset-left)); padding-right: max(0px, env(safe-area-inset-right)); }
  #scPlay .top { grid-column: 1; grid-row: 1; max-width: none; padding-right: 8px; }
  .prog small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .stage { grid-column: 2; grid-row: 1 / span 3; max-width: none; margin: 0; }
  .pal { grid-column: 1; grid-row: 2; flex-wrap: wrap; align-content: center; overflow-y: auto; max-width: none; padding: 12px; gap: 20px; }
  .pal .sw { width: 46px; height: 46px; }
  .pal .sw::before { -webkit-mask: radial-gradient(circle, transparent 28px, #000 29px); mask: radial-gradient(circle, transparent 28px, #000 29px); }
  .acts { grid-column: 1; grid-row: 3; max-width: none; gap: 8px; padding: 4px 8px max(8px, env(safe-area-inset-bottom)); }
  .acts .wbtn { min-height: 50px; }
}
.frame img.mp-th { aspect-ratio: 1; object-fit: contain; }
/* Hero is a crop of the home painting: fade its edges into the paper so no rectangle shows */
#scHome .hm-hero { -webkit-mask-image: radial-gradient(ellipse 50% 50% at center, #000 70%, transparent 100%); mask-image: radial-gradient(ellipse 50% 50% at center, #000 70%, transparent 100%); }

/* Sheet skin "lacquer": small sheets take the colours of the painted home (owner 30/11/2026). */
body.mb-light { --skin-frame: #7a2416; --skin-head: linear-gradient(#a83a22, #7a2416); --skin-head-ink: #fff1d0; --skin-line: #e0b04a;
  --skin-paper: #f6e8cc; --skin-card: #fffaf0; --skin-card-line: #dcb88a; --skin-ink: #2b1a10; --skin-muted: #74503a; --skin-hover: #fff1dc; }
