/* 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);
}
/* ================= Cá Lớn Nuốt Cá Bé — MonBlock (base copied from Đuổi Hình Bắt Chữ) ================= */
: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: 9px; background: var(--panel-2); overflow: hidden; }
.xpbar i { display: block; height: 100%; width: 0; background: #4f86ff; border-radius: 9px; }

.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; }

/* ---------- 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; }

.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 { box-shadow: var(--ds-sh-pop); 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-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(--ds-text-muted); font-weight: 600; font-size: var(--ds-fs-xs); }
.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; }


/* ---------- chọn màn ---------- */
.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, #1f5f7c, #2f7f9c); color: #fff; }
.mhead .mini { display: flex; gap: 4px; flex: none; }
.mhead .mini .board { --tw: 15px; display: flex; gap: 3px; margin: 0; padding: 0; }
.mhead .mini .tube .glass { border-width: 2px; padding: 1px; box-shadow: 0 0 0 1px rgba(8, 22, 36, .5); }
.mhead .mini .tube .glass::after { display: none; }
.mhead span.mt { 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: 54px; justify-content: center; padding: 6px 2px; border: 2px solid #cfe3ee; border-radius: 14px; background: #f1f8fc; font-weight: 900; color: #245a75; }
.lv b { font-size: 17px; }
.lv small { font-size: 11px; font-weight: 800; letter-spacing: 1px; color: var(--ds-text-muted); }
.lv small i { font-style: normal; color: #e0a020; }
.lv.done { background: #e0f0f8; border-color: #6fb0d2; }
.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: 96px; pointer-events: none; }
.pv .board { --tw: 26px; display: flex; gap: 7px; margin: 0; padding: 0; }
.pv .board .tube { width: var(--tw); }
.pv .board .tube .glass { border-width: 2px; padding: 2px; box-shadow: 0 0 0 1px rgba(8, 22, 36, .6), 0 4px 5px rgba(0, 0, 0, .25); }
.pv .board .tube .glass::after { width: 12%; }
.pv-bg .field { display: flex; justify-content: center; width: 124px; max-width: none; margin: 0; padding: 12px 8px 8px; border-radius: 12px; }
.pv-bg .board { --tw: 20px; }
.buyprev .pv .board { --tw: 40px; gap: 12px; }
.buyprev .pv-bg .field { width: 220px; padding: 18px 10px 12px; }
.buyprev .pv-bg .board { --tw: 32px; }
.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; 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: 22px; font-weight: 900; color: #3b1f06; }
.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: #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: 12px; 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 .evtag, .item .evtag { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: linear-gradient(90deg, #8fd0ff, #c9b8ff); color: #1d2a4a; }
.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; }
.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; }
.dialog .stuck-tip { margin: 6px 0; color: #6b4418; font-weight: 700; }
@media (max-width: 380px) { .ctl button { font-size: 11px; } }


/* ================= Cá Lớn Nuốt Cá Bé — riêng của game (mẫu của chủ dự án 14/11/2026) ================= */
html body.mb-light { background: linear-gradient(180deg, #46c1f2 0%, #1e8fd0 38%, #0d5c9e 100%) fixed; color: #fff; }
html body.mb-light .wrap { max-width: 560px; }
.xpbar { background: rgba(255, 255, 255, .25); }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, #7dff9a, #2fd36a); border-radius: 9px; }
@keyframes bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } }
.today { background: rgba(255, 255, 255, .92); border-color: transparent; color: #1b3550; }
.today small { color: #4a6985; }
html body.mb-light .big { border: 0; box-shadow: 0 5px 0 rgba(0, 0, 0, .18); color: #fff; }
html body.mb-light .big small { color: rgba(255, 255, 255, .92); }
html body.mb-light .big::before { display: none; }
html body.mb-light .big-daily { background: linear-gradient(180deg, #5ab8ff, #2b82e6); }
html body.mb-light .big-sprint { background: linear-gradient(180deg, #ffa24d, #ec6a1a); }
.big-daily.done small { color: #fff !important; opacity: .85; }
html body.mb-light .small { background: linear-gradient(180deg, #d99a52, #a96a2a); border: 3px solid #7a4a1c; color: #fff; text-shadow: 0 2px 0 rgba(60, 30, 5, .5); border-radius: 14px; box-shadow: 0 4px 0 #5e3612; padding: 10px 2px; font-size: 13px; display: flex; flex-direction: column; align-items: center; gap: 3px; }
html body.mb-light .small .mbi { width: 28px; height: 28px; }
html body.mb-light .note { color: rgba(255, 255, 255, .85); }
html body.mb-light .note a { color: #ffe27a; }

/* ---------- chọn vùng biển ---------- */
html body.mb-light .mapcard { background: rgba(255, 255, 255, .95); color: #1b3550; }
.mhead { background: #0d4f87 center/cover no-repeat; min-height: 72px; text-shadow: 0 2px 4px rgba(0, 20, 50, .7); }
.mhead span.mt, .mhead .mc { text-shadow: 0 2px 4px rgba(0, 20, 50, .8); }
html body.mb-light .lv { color: #1b3550; }

/* ---------- màn chơi ngang ---------- */
#scPlay { margin: 0 -14px; }
.stage { position: relative; margin: 0 auto; background: #0b3d6c; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; border-radius: 0; --u: .5; }
.stage canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.stage .hud { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: flex-start; justify-content: space-between; padding: calc(10px * var(--u) * 2) calc(14px * var(--u) * 2); pointer-events: none; }
.stage .hearts { display: flex; gap: calc(4px * var(--u) * 2); }
.stage .hrt { display: block; width: clamp(20px, calc(46px * var(--u)), 34px); height: clamp(20px, calc(46px * var(--u)), 34px); filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .35)); }
.stage .hrt .mbi { width: 100%; height: 100%; }
.stage .hrt.off { opacity: .28; filter: grayscale(1); }
.stage .plank { min-width: clamp(110px, calc(260px * var(--u)), 190px); padding: 4px 12px 5px; text-align: center; color: #fff7e0; background: linear-gradient(180deg, #b9763a, #8a5222); border: 3px solid #5e3612; border-radius: 12px; box-shadow: 0 3px 0 rgba(0, 0, 0, .25); }
.stage .plank b { display: block; font-size: clamp(13px, calc(30px * var(--u)), 18px); text-shadow: 0 2px 0 rgba(60, 30, 5, .6); }
.stage .plank small { display: block; font-size: clamp(12px, calc(22px * var(--u)), 13px); opacity: .9; }
.stage .gbar { height: clamp(6px, calc(12px * var(--u)), 9px); margin: 2px 0; border-radius: 9px; background: rgba(0, 0, 0, .35); overflow: hidden; }
.stage .gbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #8bff7a, #2fd36a); border-radius: 9px; transition: width .15s; }
.hbtn { pointer-events: auto; width: clamp(36px, calc(60px * var(--u)), 46px); height: clamp(36px, calc(60px * var(--u)), 46px); border-radius: 50%; border: 3px solid #5e3612; background: linear-gradient(180deg, #ffd36a, #f09a1c); color: #5e3612; font-size: 16px; font-weight: 900; box-shadow: 0 3px 0 rgba(0, 0, 0, .25); }
.stage .nstat { position: absolute; left: var(--sal, 0px); right: var(--sar, 0px); bottom: 6%; margin: 0; text-align: center; font-weight: 800; color: #fff; text-shadow: 0 2px 4px rgba(0, 30, 70, .9); font-size: clamp(13px, calc(30px * var(--u)), 18px); pointer-events: none; }
.acts { position: absolute; right: calc(14px * var(--u) * 2); bottom: calc(12px * var(--u) * 2); display: flex; align-items: flex-end; gap: calc(10px * var(--u) * 2); }
.act { position: relative; width: clamp(44px, calc(92px * var(--u)), 64px); height: clamp(44px, calc(92px * var(--u)), 64px); padding: 0; border: 0; background: none; touch-action: manipulation; }
.act .orb { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; border: 3px solid #fff; background: radial-gradient(circle at 35% 30%, #8fd8ff, #2b82e6); box-shadow: 0 4px 0 rgba(0, 40, 90, .45); font-size: 22px; color: #fff; overflow: hidden; }
.act .orb .mbi { width: 58%; height: 58%; }
.act.dash .orb { background: radial-gradient(circle at 35% 30%, #ffe27a, #f0a21a); }
.act b { position: absolute; right: -4px; top: -4px; min-width: 22px; padding: 1px 5px; border-radius: 12px; background: #ff4d5a; border: 2px solid #fff; color: #fff; font-size: 12px; line-height: 16px; text-align: center; }
.act.on .orb { box-shadow: 0 0 0 4px rgba(255, 255, 255, .75), 0 0 18px rgba(130, 210, 255, .9); }
.act .cd { position: absolute; inset: 3px; border-radius: 50%; background: rgba(0, 20, 50, .5); transform-origin: bottom; transform: scaleY(0); pointer-events: none; }
.rotate { display: none; position: fixed; inset: 0; z-index: 70; place-items: center; text-align: center; color: #fff; background: rgba(5, 40, 80, .94); }
.rotate.on { display: grid; }
.rotate b { display: block; font-size: 22px; margin: 8px 0 4px; }
.rotate small { font-size: 14px; opacity: .85; }
.rot-ic { display: block; font-size: 64px; animation: spin 2.4s ease-in-out infinite; }
@keyframes spin { 0%, 30% { transform: rotate(0); } 70%, 100% { transform: rotate(90deg); } }
body.mb-play .wrap { padding: 0; max-width: none; }

/* ---------- cửa hàng ---------- */
.pv.sk img { width: 90%; max-height: 64px; object-fit: contain; }
.pv.fxv { position: relative; flex-direction: column; gap: 2px; }
.pv.fxv img { width: 70%; max-height: 44px; object-fit: contain; }
.pv.fxv i { font-style: normal; font-size: 16px; font-weight: 900; color: #ffb020; letter-spacing: 2px; }
.pv.fx-tim i { color: #ff5d8a; } .pv.fx-bot i, .pv.fx-song i { color: #4aa3ff; } .pv.fx-phaohoa i { color: #ff7a2e; }
.pv { background: linear-gradient(180deg, #bfe8ff, #7cc4ee); border-radius: 12px; }

/* ---------- Sổ cá ---------- */
.dex { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.dcard { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 6px 10px; border-radius: 14px; background: rgba(255, 255, 255, .95); color: #1b3550; border: 1px solid #cfe2f0; text-align: center; }
.dcard .dpic { display: grid; place-items: center; width: 100%; height: 66px; border-radius: 10px; background: linear-gradient(180deg, #bfe8ff, #7cc4ee); }
.dcard img { max-width: 86%; max-height: 54px; object-fit: contain; }
.dcard.unk img { filter: brightness(0) opacity(.55); }
.dcard b { font-size: 13px; } .dcard small { font-size: 11px; color: #5a7692; }
.wfish { display: grid; place-items: center; margin: 0 auto 4px; width: 120px; height: 70px; }
.wfish img { max-width: 100%; max-height: 100%; object-fit: contain; animation: bob 2.2s ease-in-out infinite; }
.wfish.sad img { filter: grayscale(.6); transform: rotate(180deg); animation: none; }
.ans { font-size: 28px; font-weight: 900; text-align: center; margin: 4px 0; }
@media (orientation: landscape) and (max-height: 520px) { .stage .nstat { bottom: 3%; } }

/* ---------- chỉnh theo ảnh chụp thử ---------- */
html body.mb-light .me-card { background: rgba(8, 54, 98, .62); border: 1px solid rgba(255, 255, 255, .3); box-shadow: 0 4px 14px rgba(0, 30, 70, .25); }
html body.mb-light .me-card, html body.mb-light .me-card b, html body.mb-light .me-card span { color: #fff; }
html body.mb-light .me-chips span { background: rgba(255, 255, 255, .14); border: 0; }
html body.mb-light .xpbar { background: rgba(255, 255, 255, .25); }
html body.mb-light .small { min-height: 74px; justify-content: center; }
html body.mb-light .small .mbi { width: 30px; height: 30px; }
.today { margin: 0 0 8px; padding: 8px 12px; }
.today { display: none !important; }
html body.mb-light .small { min-height: 66px; }
@media (min-height: 860px) { .duel { aspect-ratio: 16 / 7; } }
html body.mb-light { color: #1b3550; }
.shop-top { color: #fff; }
.help { background: rgba(255, 255, 255, .96); color: #1b3550; padding: 4px 16px 12px; border-radius: 16px; }
.help h2 { color: #0d4f87; }
html body.mb-light .shop .item b { color: #1b3550; }
html body.mb-light .dialog { color: #1b3550; }
@media (max-height: 480px) { .wfish { height: 44px; width: 80px; margin-bottom: 0; } .dialog.win h3 { margin: 0 0 2px; } .dialog.win .wstars { margin: 0; } }

/* Portrait phones: the stage is turned 90deg by fitStage(), the modal lives inside it */
.stage .modal { position: absolute; padding: 8px; }
.stage .dialog { max-height: calc(100% - 8px); }
.stage .hl { display: flex; align-items: center; gap: 8px; }
#btnExit { display: flex; pointer-events: auto; }
/* Turned phone while playing: the stage is centred in the whole screen (sdk/land.js) */
#scPlay.rot .stage { position: fixed; left: var(--ls-cx, 50%); top: 50%; margin: 0 !important; transform: translate(-50%, -50%); }

/* ================= Trang chủ kiểu tranh minh hoạ (mẫu của chủ dự án 15/11/2026) =================
   Cả màn hình là một bức tranh biển: thanh người chơi trên cùng, logo giữa, cá của người chơi, nút CHƠI xanh, bốn ô gỗ ở đáy.
   Mọi cỡ tính theo khung tranh (cqw / cqh) nên cùng một bố cục vừa mọi cửa sổ ngang và điện thoại dọc được xoay (sdk/land.js). */
#scHome { position: fixed; inset: 0; z-index: 5; overflow: hidden; background: #1c9ccf; animation: none; container-type: size; }
#scHome .hm-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 60%; }
body.mb-full .mb-nav, body.mb-full .mb-top, body.mb-full .mb-event, .ls-back { display: none !important; }
#scHome button { -webkit-appearance: none; appearance: none; font-family: inherit; }

/* Thanh trên: avatar + cấp, xu, kim cương */
.hm-top { position: absolute; left: max(10px, var(--sal, 0px)); top: max(8px, var(--sat, 0px)); display: flex; align-items: center; gap: 8px; }
.hm-av { position: relative; flex: none; width: 15cqh; height: 15cqh; min-width: 44px; min-height: 44px; max-width: 60px; max-height: 60px; border-radius: 50%; border: 3px solid #d8a13a; background: #8fd0ff; display: grid; place-items: center; box-shadow: 0 3px 6px rgba(0, 0, 0, .4); }
.hm-av .me-num { font-size: 22px; line-height: 1; }
.hm-av .me-num .mbi { width: 70%; height: 70%; }
.hm-av .me-avemo { position: absolute; inset: 0; display: grid; place-items: center; font-size: 30px; line-height: 1; border-radius: 50%; overflow: hidden; }
.hm-av.has-av .me-num { display: none; }
.hm-lv { position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%); padding: 1px 8px; border-radius: 9px; background: #7a4a1c; border: 2px solid #d8a13a; color: #fff; font: 900 11px/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-stars { display: none; }
.hm-bar { display: flex; align-items: center; gap: 6px; min-width: 110px; height: 30px; padding: 0 4px 0 4px; border-radius: 15px; background: rgba(20, 60, 90, .78); border: 2px solid rgba(255, 255, 255, .55); box-shadow: inset 0 2px 3px rgba(0, 0, 0, .35); cursor: pointer; }
.hm-bar img { width: 26px; height: auto; flex: none; }
.hm-bar b { flex: 1; color: #fff !important; font: 900 15px/1 system-ui, sans-serif; text-align: center; }
.hm-plus { flex: none; width: 22px; height: 22px; border-radius: 7px; background: linear-gradient(#ffd36a, #f09a1c); border: 2px solid #8a5a14; color: #5e3612; font: 900 17px/18px system-ui; text-align: center; }

/* Logo + cá */
.hm-logo { position: absolute; left: 50%; top: max(1cqh, var(--sat, 0px)); transform: translateX(-50%); width: min(34cqw, 40cqh * 760 / 391); height: auto; filter: drop-shadow(0 5px 6px rgba(0, 40, 80, .35)); pointer-events: none; }
.hm-duel { position: absolute; left: 0; right: 0; top: 36cqh; height: 34cqh; pointer-events: none; }
.hm-duel .d-big { position: absolute; left: 16cqw; top: 0; height: 100%; width: auto; max-width: 28cqw; object-fit: contain; animation: bob 3s ease-in-out infinite; filter: drop-shadow(0 8px 10px rgba(0, 30, 70, .4)); }
.hm-duel .d-small { position: absolute; right: 18cqw; top: 22%; height: 40%; width: auto; transform: scaleX(-1); animation: bob 2.4s ease-in-out -1s infinite; filter: drop-shadow(0 4px 6px rgba(0, 30, 70, .35)); }

/* CHƠI */
.hm-play { position: absolute; left: 50%; top: 45cqh; transform: translateX(-50%); width: min(24cqw, 56cqh); padding: 1.4cqh 1cqw 1.6cqh; border-radius: 26px; text-align: center; color: #fff;
  background: linear-gradient(#8aea5a, #2fae2a 60%, #238a22); border: 4px solid #e8f7ff; box-shadow: 0 5px 0 #1b6b1a, 0 9px 12px rgba(0, 0, 0, .4); }
.hm-play b { display: block; font: 900 clamp(22px, 10cqh, 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(11px, 3.8cqh, 16px)/1.2 system-ui, sans-serif; -webkit-text-stroke: .2em #1d6a1d; paint-order: stroke fill; }
.hm-play:active { transform: translateX(-50%) scale(.96); }

/* Bốn ô gỗ */
.hm-row { position: absolute; left: 50%; bottom: max(2.5cqh, var(--sab, 0px)); transform: translateX(-50%); display: flex; gap: 1.6cqw; }
.hm-ic { position: relative; width: min(11cqw, 27cqh); padding: 0; background: none; border: 0; box-shadow: none; color: #fff; }
.hm-ic img { width: 100%; height: auto; 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, 3cqh, 13px)/1.1 system-ui, sans-serif; -webkit-text-stroke: .22em #1d3a5a; paint-order: stroke fill; white-space: nowrap; }
.hm-ic:active { transform: scale(.94); }

.hm-seo { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hm-dex { display: block; width: 100%; min-height: var(--ds-tap); margin: 12px 0 0; padding: 10px; border-radius: var(--ds-r-lg); background: var(--ds-surface); color: var(--ds-text); font-weight: 800; border: 1px solid var(--ds-line-strong); }
#btnSound { z-index: 60; }
#scHome button:focus, #scHome button:focus-visible { outline: none; }
.hm-back { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; padding: 0 0 4px; background: var(--ds-surface); border: 3px solid var(--ds-line); color: var(--ds-text); font: 700 30px/1 system-ui; box-shadow: var(--ds-sh-art); }
.hm-gear { position: relative; flex: none; width: 40px; height: 40px; padding: 7px; border-radius: 12px; background: linear-gradient(#5ab4ff, #2a6fd8); border: 3px solid #e8f7ff; color: #fff; box-shadow: 0 3px 6px rgba(0, 0, 0, .4); }
.hm-gear svg { width: 100%; height: 100%; display: block; }
.hm-mute { display: none; position: absolute; left: 6px; right: 6px; top: 50%; height: 3px; background: #ff4d4d; border-radius: 2px; transform: rotate(-45deg); }
.hm-gear.off .hm-mute { display: block; }
body:has(#scHome:not(.hidden)) #btnSound { display: none; }
.hm-gear { position: absolute; top: max(8px, var(--sat, 0px)); right: max(10px, var(--sar, 0px)); width: 46px; height: 46px; }
/* Book icon under the speaker: guide pages + data pages */
.hm-book { position: absolute; top: calc(max(8px, var(--sat, 0px)) + 54px); right: max(10px, var(--sar, 0px)); width: 46px; height: 46px; padding: 8px; border-radius: 50%; background: var(--ds-wood); border: 3px solid var(--ds-gold); color: var(--ds-surface); box-shadow: var(--ds-sh-art); }
.hm-book .mbic, .hm-book svg { display: block; width: 100%; height: 100%; }
.hm-book:active { transform: var(--ds-press); }

/* Dialogs: the page may be turned (html.ls), so the usable height is the page height, not the screen's long side */
.dialog { max-height: var(--dlg-max, calc(100dvh - 32px)); }
html.ls .dialog { --dlg-max: calc(var(--ls-h) - 24px); }
html.ls .modal { padding: 12px; }

/* HUD big enough for a thumb on a phone (owner 15/11/2026: icons in play screens too small): hearts >= 36, round buttons >= 54, power orbs >= 72 */
.stage .hrt { width: clamp(36px, calc(60px * var(--u)), 48px); height: clamp(36px, calc(60px * var(--u)), 48px); }
.hbtn { width: clamp(54px, calc(84px * var(--u)), 64px); height: clamp(54px, calc(84px * var(--u)), 64px); font-size: 24px; }
.hbtn .mbic { width: 58% !important; height: 58% !important; }
.stage .plank { min-width: clamp(150px, calc(300px * var(--u)), 220px); padding: 6px 14px 7px; }
.stage .plank b { font-size: clamp(18px, calc(34px * var(--u)), 24px); }
.stage .plank small { font-size: clamp(13px, calc(24px * var(--u)), 16px); }
.act { width: clamp(72px, calc(110px * var(--u)), 84px); height: clamp(72px, calc(110px * var(--u)), 84px); }
.act .orb { font-size: 30px; }
.act .orb .mbic { width: 62% !important; height: 62% !important; }
.act b { min-width: 28px; font-size: 15px; line-height: 20px; right: -6px; top: -6px; }
.acts { gap: calc(12px * var(--u) * 2); }

/* The wrapper .mbic is already 62%; the inner .mbi must fill it (it was 58% of that = tiny icons) */
.act .orb .mbi, .hbtn .mbi { width: 100%; height: 100%; }
.hbtn { font-size: 34px; line-height: 1; }
.act .orb { font-size: 38px; }

/* Play screen v2 (owner 17/11/2026): full-screen sea, small see-through level tag, floating stick */
.stage .hud { padding-left: calc(14px * var(--u) * 2 + var(--sal, 0px)); padding-right: calc(14px * var(--u) * 2 + var(--sar, 0px)); }
.stage .plank { min-width: 0; padding: 2px 12px 3px; background: rgba(5, 38, 70, .22); border: 0; border-radius: 10px; box-shadow: none; text-shadow: 0 1px 3px rgba(0, 20, 50, .8); }
.stage .plank b { font-size: clamp(13px, calc(24px * var(--u)), 17px); }
.stage .plank small { font-size: clamp(12px, calc(18px * var(--u)), 13px); }
.stage .gbar { width: clamp(70px, calc(150px * var(--u)), 120px); height: clamp(4px, calc(8px * var(--u)), 6px); margin: 2px auto; background: rgba(255, 255, 255, .25); }
.acts { right: calc(14px * var(--u) * 2 + var(--sar, 0px)); }
.cstick { position: absolute; left: 0; top: 0; display: none; border-radius: 50%; pointer-events: none; background: rgba(255, 255, 255, .12); border: 2px solid rgba(255, 255, 255, .55); box-shadow: 0 0 14px rgba(255, 255, 255, .25); }
.cstick.on { display: block; }
.cstick i { position: absolute; left: 50%; top: 50%; width: 46%; height: 46%; margin: -23% 0 0 -23%; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #bfe6ff); box-shadow: 0 2px 6px rgba(0, 40, 90, .5); will-change: transform; }

/* Home v2 (owner 17/11/2026): top bar no longer runs under the logo; the strip beyond the page takes the sea colour */
html.ls body:has(#scHome:not(.hidden)) { background: #2b9fd0 !important; }
.hm-top { gap: 6px; }
.hm-av { width: 12cqh; height: 12cqh; min-width: 40px; min-height: 40px; max-width: 48px; max-height: 48px; }
.hm-bar { min-width: 0; width: clamp(70px, 10cqw, 90px); height: 30px; }
.hm-bar b { font-size: 13px; }
.hm-bar img { width: 20px; }
.hm-plus { width: 18px; height: 18px; font-size: 14px; line-height: 14px; border-radius: 6px; }
.hm-logo { width: min(26cqw, 34cqh * 760 / 391); top: max(2cqh, var(--sat, 0px)); }
.hm-play { top: 47cqh; }


/* ================= Design system 17/11/2026 (.ai/output/design-system) ================= */
/* Sub screens (shop, rank, map, quest, dex, help): flat page, own header with ‹ on the top left */
html body.mb-light.cl-sub { background: var(--ds-bg) !important; color: var(--ds-text); }
html.ls body.cl-sub { background: var(--ds-bg) !important; }
.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(--sar, 0px)) var(--ds-s2) max(var(--ds-s3), var(--sal, 0px)); padding-top: max(var(--ds-s2), var(--sat, 0px)); 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-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.cl-sub .wrap { max-width: 600px; padding-top: calc(56px + max(var(--ds-s2), var(--sat, 0px)) + var(--ds-s3)); padding-bottom: calc(var(--ds-s6) + var(--sab, 0px)); }
body.cl-sub .note { color: var(--ds-text-muted); }
body.cl-sub .note a { color: var(--ds-primary); }
body.cl-sub .help { border: 1px solid var(--ds-line); }
body.cl-sub .dcard, body.cl-sub .mapcard { border: 1px solid var(--ds-line); }

/* Group cards: the chosen one is solid blue */
body.cl-sub .tabs button { min-height: var(--ds-tap); border-radius: var(--ds-r-lg); background: var(--ds-surface); border: 1px solid var(--ds-line); color: var(--ds-text); font-size: var(--ds-fs-md); }
body.cl-sub .tabs button.on { background: var(--ds-primary); border-color: var(--ds-primary); color: #fff; box-shadow: none; }
body.cl-sub .tabs button.on .mbi * { stroke: #fff; }

/* Shop: two columns on a phone, rows of the card stay fixed so prices line up */
body.cl-sub .shop { grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); }
body.cl-sub .shop .item { border-radius: var(--ds-r-2xl); border-width: 1px; background: var(--ds-surface); color: var(--ds-text); }
body.cl-sub .shop .item.active { border-color: var(--ds-primary); box-shadow: inset 0 0 0 1px var(--ds-primary); }
.item .rar { font-size: var(--ds-fs-xs); }
.item .pr.gh { font-size: var(--ds-fs-xs); }
.item .lock { font-size: var(--ds-fs-xs); }
.lv small, .dcard small { font-size: var(--ds-fs-xs); }
.lv { min-height: var(--ds-tap); }

/* Book panel (guide + data pages) and its close button */
.dialog.bk { position: relative; }
.dlg-x { position: absolute; right: var(--ds-s3); top: var(--ds-s3); width: var(--ds-tap); height: var(--ds-tap); border: 1px solid var(--ds-line); border-radius: 50%; background: var(--ds-surface); font-size: var(--ds-fs-lg); font-weight: 800; }
.dialog.bk h3 { margin: 0 var(--ds-tap) var(--ds-s3) 0; }
.bk-list { display: flex; flex-direction: column; gap: var(--ds-s2); }
.bk-link { display: flex; align-items: center; min-height: var(--ds-tap); padding: var(--ds-s2) var(--ds-s4); border: 1px solid var(--ds-line); border-radius: var(--ds-r-lg); background: var(--ds-surface-2); color: var(--ds-text); font-size: var(--ds-fs-md); font-weight: 700; text-decoration: none; }

/* Result box: Về · Chơi lại · main button last on the right */
.rbtns { display: flex; gap: var(--ds-s2); margin-top: var(--ds-s4); }
.rb { flex: 1; min-height: var(--ds-tap); padding: var(--ds-s2) var(--ds-s3); border: 1px solid var(--ds-line); border-radius: var(--ds-r-lg); background: var(--ds-surface); color: var(--ds-text); font-size: var(--ds-fs-md); font-weight: 800; }
.rb.pri { flex: 1.4; border-color: var(--ds-primary); background: var(--ds-primary); color: #fff; }
.rb:active { transform: var(--ds-press); }
.dialog.win .links { margin-top: var(--ds-s2); gap: var(--ds-s4); }
.dialog.win .links button { min-height: var(--ds-tap); }

/* Playing: ‹ + hearts top left, level tag top centre, pause top right; floating stick bottom left;
   actions in a column bottom right, the main one (dash) biggest and lowest */
.acts { flex-direction: column; align-items: flex-end; gap: calc(8px * var(--u) * 2); }
.act { width: clamp(56px, calc(88px * var(--u)), 68px); height: clamp(56px, calc(88px * var(--u)), 68px); }
.act.dash { width: clamp(72px, calc(120px * var(--u)), 92px); height: clamp(72px, calc(120px * var(--u)), 92px); }
html body.mb-light.cl-sub .tabs button.on { background: var(--ds-primary); border-color: var(--ds-primary); color: #fff; }
.dialog a.bk-link { color: var(--ds-text); }
html:has(body.cl-sub) #ls-root, html:has(body.cl-sub) { background: var(--ds-bg) !important; }

/* Touch area of the coin / gem chips on the home: drawn 30 px, tappable 44 px (design system --ds-tap) */
.hm-bar { position: relative; }
.hm-bar::after { content: ""; position: absolute; inset: -7px -4px; }
.hm-av { cursor: pointer; }

/* Quests screen: flat cards (white, 1 px line, coloured stripe by mode) instead of toy buttons */
html body.mb-light.cl-sub .big { position: relative; padding: var(--ds-s4) var(--ds-s4) var(--ds-s4) var(--ds-s5); border: 1px solid var(--ds-line); border-radius: var(--ds-r-lg); background: var(--ds-surface); box-shadow: var(--ds-sh-0); color: var(--ds-text); }
html body.mb-light.cl-sub .big::before { content: ""; display: block; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; border-radius: var(--ds-r-lg) 0 0 var(--ds-r-lg); background: var(--ds-m-ai); }
html body.mb-light.cl-sub .big-daily::before { background: var(--ds-m-online); }
html body.mb-light.cl-sub .big-sprint::before { background: var(--ds-m-ladder); }
html body.mb-light.cl-sub .big-daily, html body.mb-light.cl-sub .big-sprint { background: var(--ds-surface); }
html body.mb-light.cl-sub .big small, html body.mb-light.cl-sub .big-daily.done small { color: var(--ds-text-muted) !important; opacity: 1; }
html body.mb-light.cl-sub .big-daily.done small { color: var(--ds-play) !important; }

/* Phone (turned page or landscape): sub screens use almost the whole long side (cap 820 px) instead of a 600 px column */
html.ls body.cl-sub .wrap, html.ls body.mb-light.cl-sub .wrap { max-width: 820px; padding-left: max(var(--ds-s4), var(--sal, 0px)); padding-right: max(var(--ds-s4), var(--sar, 0px)); }
@media (max-height: 500px) and (pointer: coarse) { body.cl-sub .wrap, body.mb-light.cl-sub .wrap { max-width: 820px; } }

/* Play-screen buttons: drawn icons sit exactly in the middle of the round button */
.hbtn, .act .orb { display: grid; place-items: center; padding: 0; line-height: 0; }
.hbtn svg { display: block; width: 62%; height: 62%; }
.act .orb svg { display: block; width: 64%; height: 64%; filter: drop-shadow(0 2px 1px rgba(0, 30, 70, .45)); }
.act.dash .orb svg { width: 68%; height: 68%; }

/* Home top row: back button and avatar share one size (48 px, >= --ds-tap), chips a touch taller to match */
.hm-back, .hm-av { width: 48px; height: 48px; min-width: 48px; min-height: 48px; max-width: 48px; max-height: 48px; }
.hm-av { background: #8fd0ff; border: 3px solid var(--ds-gold); overflow: visible; box-shadow: var(--ds-sh-art); }
.hm-av .me-num { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; overflow: hidden; }
.hm-av .me-num svg { display: block; width: 88%; height: 88%; }
.hm-bar { height: 34px; border-radius: 17px; }
.hm-gear, .hm-book { width: 48px; height: 48px; }
.hm-book { top: calc(max(8px, var(--sat, 0px)) + 56px); }
@media (max-width: 700px) { .hm-top { gap: 4px; } .hm-bar { width: 62px; } .hm-logo { left: 56%; width: min(24cqw, 34cqh * 760 / 391); } }

/* ================= Home v3 (owner 17/11/2026, reference picture): ruins + shipwreck sea, logo on a wooden plank with a crown,
   goldfish chasing a small fish, round CHƠI pill with a play triangle (green = design system), ‹ Màn N › picker, four tan wood tiles
   with the icon and the label inside. Sizes are fractions of the picture (cqw / cqh) so it matches the reference at any landscape size. */
#scHome { background: #1f8fc4; }
#scHome .hm-bg { object-position: center 55%; }
html.ls body:has(#scHome:not(.hidden)) { background: #1f8fc4 !important; }
.hm-logo { left: 50%; top: max(3cqh, var(--sat, 0px)); width: min(26cqw, 31cqh * 760 / 438); }
.hm-duel { left: 50%; right: auto; top: 28cqh; height: 26cqh; width: calc(26cqh * 640 / 384); transform: translateX(-50%); }
.hm-duel .d-duo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; animation: bob 3s ease-in-out infinite; filter: drop-shadow(0 8px 10px rgba(0, 30, 70, .35)); }
.hm-duel .d-big { left: 0; top: 0; height: 100%; max-width: 70%; }
.hm-duel .d-small { left: auto; right: 0; top: 30%; height: 34%; transform: none; }
.hm-duel .hidden { display: none; }

/* CHƠI: fully rounded glossy pill, white play triangle, label with a dark stroke */
.hm-play { top: 55cqh; width: min(20cqw, 46cqh); height: max(48px, 12.5cqh); padding: 0 1cqw; display: flex; align-items: center; justify-content: center; gap: 1.2cqw;
  border-radius: var(--ds-r-pill); background: var(--ds-playpill); border: 4px solid #e8f7ff; box-shadow: inset 0 3px 0 rgba(255, 255, 255, .45), 0 5px 0 var(--ds-playpill-ink), 0 9px 12px rgba(0, 0, 0, .35); }
.hm-play b { font: 900 clamp(22px, 7.4cqh, 54px)/1 var(--ds-font-display); letter-spacing: 1px; color: var(--ds-surface); -webkit-text-stroke: .1em var(--ds-playpill-ink); paint-order: stroke fill; text-shadow: 0 3px 0 rgba(0, 0, 0, .25); }
.hm-tri { flex: none; width: 0; height: 0; border-style: solid; border-width: clamp(11px, 3.3cqh, 24px) 0 clamp(11px, 3.3cqh, 24px) clamp(17px, 5cqh, 36px); border-color: transparent transparent transparent var(--ds-surface); filter: drop-shadow(0 0 0 var(--ds-playpill-ink)) drop-shadow(1.5px 0 0 var(--ds-playpill-ink)) drop-shadow(-1.5px 0 0 var(--ds-playpill-ink)) drop-shadow(0 1.5px 0 var(--ds-playpill-ink)) drop-shadow(0 -1.5px 0 var(--ds-playpill-ink)); }

/* ‹ Màn N › under the button: pick any open level (design system 17/11/2026, "dải chọn màn") */
.hm-pick { position: absolute; left: 50%; top: calc(55cqh + max(48px, 12.5cqh) + .4cqh); transform: translateX(-50%); display: flex; align-items: center; gap: 4px; padding: 2px; border-radius: var(--ds-r-pill); background: var(--ds-glass); }
.hm-pick b { min-width: 9cqw; padding: 0 6px; text-align: center; color: var(--ds-surface); font: 800 clamp(12px, 3.4cqh, 18px)/1 var(--ds-font); white-space: nowrap; }
.hm-arr { position: relative; width: var(--ds-tap-small); height: var(--ds-tap-small); padding: 0 0 3px; border-radius: 50%; display: grid; place-items: center; background: var(--ds-plus); border: 2px solid #8a5a14; color: #5e3612; font: 900 20px/1 system-ui; }
.hm-arr::after { content: ""; position: absolute; inset: -6px; }
.hm-arr:disabled { opacity: .45; }
.hm-arr:active { transform: var(--ds-press); }

/* Four tan wood tiles: picture of the tile behind, icon on top, label inside at the bottom */
.hm-row { bottom: max(11cqh, var(--sab, 0px)); gap: 1cqw; }
.hm-ic { width: min(9.4cqw, 22cqh); aspect-ratio: 1.08; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding: 0 0 5%;
  background: url(../img/tile.webp) center / 100% 100% no-repeat; filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .35)); }
.hm-ic img { width: auto; height: 64%; margin-bottom: 1%; filter: none; }
.hm-ic span { margin: 0; color: var(--ds-surface); font: 900 clamp(12px, 2.6cqh, 16px)/1.1 var(--ds-font); -webkit-text-stroke: .22em var(--ds-stroke-dark); paint-order: stroke fill; }
.hm-dot { position: absolute; right: -4%; top: -4%; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--ds-danger); border: 2px solid var(--ds-surface); color: var(--ds-surface); font: 900 14px/1 system-ui; font-style: normal; }
.hm-dot.hidden { display: none; }

/* Top right: sound button (design system .rbtn.snd), book below */
.hm-gear { border-radius: var(--ds-r-lg); padding: 7px; background: linear-gradient(#5ab4ff, #2a6fd8); border: 3px solid #e8f7ff; }
.hm-plus { border-radius: 50%; }
@media (max-width: 700px) { .hm-logo { left: 50%; width: min(24cqw, 30cqh * 760 / 438); } }
/* Short landscape phones (picture < 520 px tall): fixed minimum sizes (48 px button, 12 px labels) need the stack pulled up */
@container (max-height: 520px) {
  .hm-logo { width: min(26cqw, 26cqh * 760 / 438); top: max(2cqh, var(--sat, 0px)); }
  .hm-duel { top: 28cqh; height: 18cqh; width: calc(18cqh * 640 / 384); }
  .hm-play { top: 46cqh; }
  .hm-pick { top: calc(46cqh + max(48px, 12.5cqh) + 2px); }
  .hm-row { bottom: max(3cqh, var(--sab, 0px)); }
  .hm-ic { width: min(11cqw, 24cqh); }
}
/* Coin / gem chips grow with the number (1.020 used to push the + over the next chip) */
.hm-bar { width: auto; min-width: 72px; padding: 0 4px 0 6px; }
.hm-bar b { flex: 1 0 auto; padding: 0 2px; }

/* Rank board (flat layer): podium for the top three (2 · 1 · 3) + table for the rest; side by side when the screen is wide (turned phone) */
body.cl-sub .wrap:has(#scRank:not(.hidden)) { max-width: 940px; }
#scRank { container-type: inline-size; }
.rk-board { display: grid; gap: var(--ds-s3); }
@container (min-width: 640px) { .rk-board { grid-template-columns: minmax(280px, 38%) 1fr; align-items: start; } }
.rk-pod { display: grid; grid-template-columns: repeat(3, 1fr); align-items: end; gap: var(--ds-s2); padding: var(--ds-s4) var(--ds-s3) 0; border: 1px solid var(--ds-line); border-radius: var(--ds-r-2xl); background: var(--ds-surface); overflow: hidden; }
.pd { --medal: var(--ds-medal-1); display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; text-align: center; }
.pd2 { --medal: var(--ds-medal-2); }
.pd3 { --medal: var(--ds-medal-3); }
.pd-no { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--medal); color: var(--ds-text); font-size: var(--ds-fs-md); font-weight: 900; }
.pd-av { display: grid; place-items: center; width: 56px; height: 56px; margin-top: var(--ds-s1); border-radius: 50%; background: var(--ds-surface-2); border: 3px solid var(--medal); font-size: 38px; line-height: 1; overflow: hidden; }
.pd1 .pd-av { width: 68px; height: 68px; font-size: 48px; }
.pd b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--ds-fs-md); font-weight: 800; }
.pd small { color: var(--ds-text-muted); font-size: var(--ds-fs-xs); }
.pd-sc { color: var(--ds-coin); font-size: var(--ds-fs-lg); font-weight: 900; }
.pd::after { content: ""; display: block; align-self: stretch; height: 30px; margin-top: var(--ds-s2); border-radius: var(--ds-r-sm) var(--ds-r-sm) 0 0; background: var(--medal); }
.pd1::after { height: 52px; }
.pd2::after { height: 40px; }
.pd.me b { color: var(--ds-primary); }
.pd.empty { opacity: .45; }
.pd.empty .pd-av { border-style: dashed; }
.rk-table { border: 1px solid var(--ds-line); border-radius: var(--ds-r-2xl); background: var(--ds-surface); overflow: hidden; }
.rk-note { margin: 0; padding: var(--ds-s3) var(--ds-s4) 0; color: var(--ds-text-muted); font-size: var(--ds-fs-sm); }
.rk-cols, .rank .row { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: var(--ds-s2); padding: 0 var(--ds-s4); }
.rk-cols { padding-top: var(--ds-s2); padding-bottom: var(--ds-s2); border-bottom: 1px solid var(--ds-line); color: var(--ds-text-muted); font-size: var(--ds-fs-xs); font-weight: 700; }
.rk-cols span:last-child { text-align: right; }
.rank .row { min-height: 52px; border-bottom: 1px solid var(--ds-line); }
.rank .row:last-child { border-bottom: 0; }
.rank .row.me { background: var(--ds-primary-soft); box-shadow: inset 4px 0 0 var(--ds-primary); }
.rank .no { color: var(--ds-text-muted); font-size: var(--ds-fs-md); font-weight: 800; text-align: center; }
.rank .nm { display: flex; align-items: center; gap: var(--ds-s2); min-width: 0; font-size: 26px; line-height: 1; }
.rank .nm b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--ds-fs-md); font-weight: 800; }
.rank .nm small { flex: none; color: var(--ds-text-muted); font-size: var(--ds-fs-xs); font-weight: 600; }
.rank .sc { color: var(--ds-coin); font-size: var(--ds-fs-md); font-weight: 900; text-align: right; }
.rk-msg { margin: 0; padding: var(--ds-s5) var(--ds-s4); color: var(--ds-text-muted); font-size: var(--ds-fs-sm); text-align: center; }
.rk-me { padding: var(--ds-s3) var(--ds-s4); border-top: 1px solid var(--ds-line); background: var(--ds-surface-2); font-size: var(--ds-fs-sm); color: var(--ds-text); }
.rk-me b { color: var(--ds-primary); }
.rk-me.hidden { display: none; }
#scRank .tabs button { display: inline-flex; align-items: center; justify-content: center; gap: var(--ds-s1); }

/* Quests panel over the home (opened by the Nhiệm vụ tile): flat white cards with a coloured stripe, like the sub screens */
.dialog.qd { width: min(400px, 100%); }
.dialog.qd .big { position: relative; margin: 0 0 var(--ds-s2); padding: var(--ds-s3) var(--ds-s4) var(--ds-s3) var(--ds-s5); min-height: var(--ds-tap); border: 1px solid var(--ds-line); border-radius: var(--ds-r-lg); background: var(--ds-surface); box-shadow: var(--ds-sh-0); color: var(--ds-text); font-size: var(--ds-fs-lg); }
.dialog.qd .big::before { content: ""; display: block; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; border-radius: var(--ds-r-lg) 0 0 var(--ds-r-lg); background: var(--ds-m-ladder); }
.dialog.qd .big-daily::before { background: var(--ds-m-online); }
.dialog.qd .big small { color: var(--ds-text-muted) !important; opacity: 1; font-size: var(--ds-fs-sm); }
.dialog.qd .big-daily.done small { color: var(--ds-play) !important; }
.dialog.qd .big:active { transform: var(--ds-press); }
.qd-stats { margin: var(--ds-s2) 0 0; color: var(--ds-text-muted); font-size: var(--ds-fs-sm); }
.dialog.qd h3 { display: flex; align-items: center; min-height: var(--ds-tap); margin-bottom: var(--ds-s3); }

/* ================= Home motion (game-ui skill, 19/11/2026): the still picture split into moving layers.
   Far → near: light rays, a far fish school, rising bubbles, swaying seaweed at the corners, the hero pair (big + small fish move apart).
   Only transform / opacity, every loop has its own phase; stops with prefers-reduced-motion and when the home screen is display: none. */
.hm-fx { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.fx-ray { position: absolute; top: -12cqh; height: 95cqh; width: 9cqw; transform-origin: 50% 0; background: linear-gradient(rgba(255, 255, 255, .42), rgba(255, 255, 255, .12) 55%, rgba(255, 255, 255, 0)); border-radius: 0 0 50% 50%; opacity: .25; animation: rayPulse 7s ease-in-out infinite; }
.fx-ray.r1 { left: 30cqw; transform: rotate(16deg); }
.fx-ray.r2 { left: 46cqw; width: 6cqw; transform: rotate(10deg); animation-delay: -2.5s; animation-duration: 9s; }
.fx-ray.r3 { left: 62cqw; width: 11cqw; transform: rotate(4deg); animation-delay: -5s; }
@keyframes rayPulse { 0%, 100% { opacity: .12; } 50% { opacity: .42; } }
.fx-swim { position: absolute; left: 0; height: 6cqh; width: auto; opacity: .7; animation: swimAcross 30s linear infinite; }
.fx-swim.s1 { top: 22cqh; animation-delay: -6s; }
.fx-swim.s2 { top: 30cqh; height: 4cqh; animation-duration: 22s; animation-delay: -15s; opacity: .55; }
.fx-swim.s3 { top: 46cqh; height: 5cqh; animation-duration: 38s; animation-delay: -27s; }
@keyframes swimAcross { 0% { transform: translate(-12cqw, 0); } 25% { transform: translate(18cqw, -1.5cqh); } 50% { transform: translate(48cqw, 0); } 75% { transform: translate(78cqw, 1.5cqh); } 100% { transform: translate(112cqw, 0); } }
.fx-bub { position: absolute; bottom: -4cqh; width: 1.6cqh; height: 1.6cqh; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, .75); background: radial-gradient(circle at 32% 30%, rgba(255, 255, 255, .9) 0 18%, rgba(255, 255, 255, .15) 30%, rgba(255, 255, 255, .05)); opacity: 0; animation: bubRise 9s linear infinite; }
.fx-bub.b1 { left: 8cqw; animation-delay: -1s; }
.fx-bub.b2 { left: 21cqw; width: 1cqh; height: 1cqh; animation-duration: 7s; animation-delay: -4s; }
.fx-bub.b3 { left: 35cqw; animation-duration: 11s; animation-delay: -7s; }
.fx-bub.b4 { left: 57cqw; width: 2.2cqh; height: 2.2cqh; animation-duration: 12s; animation-delay: -2s; }
.fx-bub.b5 { left: 69cqw; width: 1.2cqh; height: 1.2cqh; animation-delay: -6s; }
.fx-bub.b6 { left: 80cqw; animation-duration: 8s; animation-delay: -3s; }
.fx-bub.b7 { left: 90cqw; width: 1cqh; height: 1cqh; animation-duration: 10s; animation-delay: -8s; }
.fx-bub.b8 { left: 14cqw; width: 2cqh; height: 2cqh; animation-duration: 13s; animation-delay: -10s; }
@keyframes bubRise { 0% { transform: translate(0, 0); opacity: 0; } 10% { opacity: .9; } 50% { transform: translate(1.2cqw, -55cqh); } 90% { opacity: .7; } 100% { transform: translate(-.6cqw, -108cqh); opacity: 0; } }
.fx-weed { position: absolute; bottom: -2cqh; height: 34cqh; width: auto; transform-origin: 50% 96%; animation: weedSway 5s ease-in-out infinite alternate; filter: drop-shadow(0 4px 4px rgba(0, 30, 70, .3)); }
.fx-weed.w1 { left: -1cqw; }
.fx-weed.w2 { left: 7cqw; height: 26cqh; animation-duration: 6.2s; animation-delay: -2s; }
.fx-weed.w3 { right: -1cqw; height: 30cqh; animation-duration: 5.6s; animation-delay: -3.4s; }
@keyframes weedSway { 0% { transform: rotate(-4deg); } 100% { transform: rotate(4deg); } }
/* Hero pair: same boxes as the old single picture (split-parts.py %), each fish moves on its own */
.hm-duel span.d-duo { display: block; animation: none; filter: none; }
.hm-duel .d-duo .dd-big { position: absolute; left: .31%; top: .52%; width: 78.12%; height: auto; transform-origin: 60% 55%; animation: heroSwim 3.2s ease-in-out infinite; filter: drop-shadow(0 8px 10px rgba(0, 30, 70, .35)); }
.hm-duel .d-duo .dd-small { position: absolute; left: 80.31%; top: 41.67%; width: 16.88%; height: auto; animation: heroFlee 2.2s ease-in-out -.7s infinite; filter: drop-shadow(0 4px 6px rgba(0, 30, 70, .3)); }
@keyframes heroSwim { 0%, 100% { transform: translate(0, 0) rotate(-1.5deg); } 50% { transform: translate(1.5%, 3%) rotate(1.5deg); } }
@keyframes heroFlee { 0%, 100% { transform: translate(0, 0) rotate(0); } 30% { transform: translate(14%, -12%) rotate(-6deg); } 60% { transform: translate(6%, 6%) rotate(4deg); } }
/* Water tone matched to the reference (ref-compare palette: teal → blue), same approved picture */
#scHome .hm-bg { filter: hue-rotate(12deg) saturate(1.1); }
@media (prefers-reduced-motion: reduce) {
  .hm-fx *, .hm-duel .d-duo img { animation: none !important; }
  .fx-swim, .fx-bub { display: none; }
}

/* Sheet skin "ocean": small sheets take the colours of the painted home (owner 30/11/2026). */
body.mb-light { --skin-frame: #1d4e6e; --skin-head: linear-gradient(#2f78a0, #1d4e6e); --skin-head-ink: #effaff; --skin-line: #7fd3e6;
  --skin-paper: #e6f3f6; --skin-card: #ffffff; --skin-card-line: #b8dbe4; --skin-ink: #12324a; --skin-muted: #46667a; --skin-hover: #f0fafc; }
