/* ================= Nối Ống Tưới Cây — MonBlock (base copied from Ô Ăn Quan) ================= */
:root {
  --bg: #0d1117;
  --panel: #151c26;
  --panel-2: #1b2431;
  --line: #2b3646;
  --txt: #e8eef6;
  --muted: #93a3b8;
  --accent: #ffcf5a;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--txt);
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.hidden { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--accent); }
.wrap { max-width: 640px; margin: 0 auto; padding: 8px 14px 28px; }
.screen { animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
h2 { font-size: 17px; margin: 18px 0 10px; }
.note { color: var(--muted); font-size: 13px; line-height: 1.5; }
body.touch .no-touch { display: none; }

/* ---------- trang chủ ---------- */
.me-card { display: flex; align-items: center; gap: 14px; padding: 12px 16px 12px 12px; margin: 6px 0 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.me-tile { position: relative; display: grid; place-items: center; width: 60px; height: 60px; flex: none; border-radius: 12px; border: 3px solid var(--frame, #2b3a55); background: var(--cell-img, none), var(--cell, #fff); }
.me-num { font-size: 24px; font-weight: 800; line-height: 1; color: var(--user, #335fff); }
.me-tile .me-avemo { position: absolute; inset: 0; display: grid; place-items: center; font-size: 34px; line-height: 1; }
.me-tile.has-av .me-num { display: none; }
.me-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.me-info b { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-info span { color: var(--muted); font-size: 13px; font-weight: 600; }
.xpbar { height: 6px; border-radius: 9px; background: var(--panel-2); overflow: hidden; }
.xpbar i { display: block; height: 100%; width: 0; background: #4f86ff; border-radius: 9px; }
.me-chips { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; font-size: 14px; font-weight: 700; white-space: nowrap; }

.big { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; margin: 0 0 10px; padding: 15px 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); font-size: 17px; font-weight: 800; text-align: left; }
.big small { color: var(--muted); font-size: 13px; font-weight: 600; }
.big-daily.done small { color: #00a862; }
.homegrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 6px; }
.small { padding: 12px 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); font-size: 14px; font-weight: 700; }

/* ---------- chọn độ khó ---------- */
.variants { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin-top: 6px; }
.variant { display: flex; align-items: flex-start; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); text-align: left; }
.variant.on { border-color: #335fff; box-shadow: inset 0 0 0 1px #335fff; }
.variant > i { font-size: 30px; font-style: normal; line-height: 1; }
.variant span { display: flex; flex-direction: column; gap: 3px; }
.variant b { font-size: 16px; }
.variant small { color: var(--muted); font-size: 13px; line-height: 1.4; }
.variant em { color: #b87400; font-size: 12px; font-style: normal; font-weight: 800; }

/* ---------- cửa hàng ---------- */
.shop-top { display: flex; justify-content: flex-end; gap: 16px; margin: 4px 0; font-size: 17px; font-weight: 800; }
.gem-chip b { color: #7fd8ff; }
.shop { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.item { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 8px 12px; border: 2px solid var(--line); border-radius: 16px; background: var(--panel); text-align: center; }
.item.locked { opacity: .55; }
.item b { font-size: 14px; }
.item .rar { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; }
.item .act { padding: 2px 8px; border-radius: 6px; font-size: 13px; font-weight: 800; color: var(--muted); }
.gem { color: #7fd8ff; }
.buyprev { display: flex; justify-content: center; margin: 4px 0 8px; }

/* ---------- xếp hạng ---------- */
.tabs { display: flex; gap: 6px; margin: 6px 0 10px; }
.tabs button { flex: 1; padding: 10px 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); font-weight: 800; font-size: 14px; }
.rank .row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.rank .no { width: 28px; color: var(--muted); font-weight: 800; text-align: center; }
.rank .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.rank .nm small { color: var(--muted); font-weight: 600; }
.rank .sc { font-weight: 900; color: #b87400; }

.help { line-height: 1.6; }
.help ul { padding-left: 20px; }

/* ---------- hộp thoại ---------- */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; background: rgba(5, 8, 12, .72); }
.dialog { width: min(420px, 100%); max-height: calc(100dvh - 32px); overflow: auto; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.dialog h3 { margin: 0 0 8px; font-size: 20px; }
.dialog p { line-height: 1.5; }
.dialog .score { margin: 4px 0; font-size: 40px; font-weight: 900; text-align: center; font-variant-numeric: tabular-nums; }
.dialog .rw { padding-left: 18px; line-height: 1.8; font-weight: 700; }
.dlg-btns { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.dlg-btns button { padding: 10px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); font-weight: 800; }
.toast { position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 90; transform: translateX(-50%); padding: 10px 16px; border-radius: 12px; background: #222c3a; font-weight: 700; }
.updatebar { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 45; display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-2); }
.updatebar button { padding: 8px 12px; border: 0; border-radius: 10px; font-weight: 800; }

/* ================= chọn mức, sảnh online ================= */
.big-sprint { --bar: #ffb020; }
.big-room { --bar: #8a5cff; }
.big-sprint.done small { color: #00a862; }
.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; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.seg button { flex: 1; min-width: 80px; padding: 10px 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); font-weight: 800; font-size: 14px; }
.joinrow { display: flex; gap: 8px; margin: 4px 0 8px; }
.joinrow input { flex: 1; min-width: 0; padding: 12px 14px; border: 1px solid #c9d2e0; border-radius: 12px; font: inherit; font-size: 16px; font-weight: 700; letter-spacing: 2px; }
.joinrow button { padding: 0 18px; border: 0; border-radius: 12px; background: #335fff; color: #fff; font-weight: 800; }
.roomcode { margin: 6px 0; font-size: 44px; font-weight: 900; letter-spacing: 8px; text-align: center; color: #335fff; }



/* ================= icons (js/icons.js) ================= */
.tcic { display: inline-flex; vertical-align: -0.22em; width: 1.25em; height: 1.25em; margin-right: .1em; }
.tcic .tci, .tci { width: 100%; height: 100%; display: block; }
.homegrid .tcic { width: 1.4em; height: 1.4em; }
.big { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center; }
.big > .tcic { grid-row: 1 / span 2; width: 38px; height: 38px; margin: 0; }
.big > small { grid-column: 2; }
.big-resume { --bar: #ffb020; }
.big-play { --bar: #00a862; }
.big-daily { --bar: #335fff; }
.big-daily.done small { color: #00a862; }
#btnSound .tci { width: 22px; height: 22px; display: block; }
.me-tile { border: 0; background: radial-gradient(circle at 40% 35%, #cfeab0, #8cc56a); box-shadow: inset 0 0 0 3px #4a6a2a; overflow: hidden; }
img.me-num { width: 52px; height: 52px; object-fit: contain; }

/* ================= bản đồ: 6 khu ================= */
.mapcard { margin: 0 0 16px; border-radius: 18px; overflow: hidden; background: #fff; border: 1px solid #e3e5e8; scroll-margin-top: 70px; }
.mapcard.locked { opacity: .6; }
.mhead { position: relative; display: flex; align-items: center; gap: 10px; padding: 14px 12px; min-height: 86px; background: #7aa04a center / cover no-repeat; }
.mhead::before { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(30, 18, 6, .72), rgba(30, 18, 6, .15)); }
.mhead > * { position: relative; }
.mhead > img:first-child { width: 54px; height: 54px; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .4)); }
.mhead span { flex: 1; display: flex; flex-direction: column; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
.mhead b { font-size: 17px; }
.mhead small { font-size: 13px; font-weight: 700; opacity: .95; }
.mhead .mp { width: 44px; height: 44px; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .4)); }
.lvgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; padding: 12px; }
.lv { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 2px 6px; border: 2px solid #d8e6c8; border-radius: 14px; background: #f6fbef; font-weight: 900; color: #3d5a1e; }
.lv b { font-size: 17px; }
.lv.done { background: #e4f6d4; border-color: #8cc56a; }
.lv.cur { border-color: #00a862; box-shadow: 0 0 0 3px rgba(0, 168, 98, .25); animation: curPulse 1.4s ease-in-out infinite; }
@keyframes curPulse { 50% { box-shadow: 0 0 0 6px rgba(0, 168, 98, .12); } }
.lv:disabled { opacity: .45; background: #f0f1f2; border-color: #e3e5e8; color: #9aa0a6; }
.st { display: flex; gap: 1px; font-style: normal; }
.st u, .hud-m u, .bigstars u { display: inline-block; width: 12px; height: 12px; background: #d6dbe0;
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.st u.on, .hud-m u.on, .bigstars u.on { background: #ffc21a; }

/* ================= màn chơi ================= */
#scPlay { position: fixed; left: 0; right: 0; z-index: 5; max-width: 600px; margin: 0 auto; padding: 0; animation: none;
  top: calc(var(--mb-top, 52px) + env(safe-area-inset-top)); bottom: 0; }
#scPlay.hidden { display: none !important; }
body.tc-play { background: #6f8f3a; }
.field { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 8px; padding: 8px 10px calc(10px + env(safe-area-inset-bottom)); background: #7aa04a center / cover no-repeat; }
.hud { flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 16px;
  background: linear-gradient(#fffaf0, #f6ead0); border: 3px solid #b9864e; box-shadow: 0 3px 0 #7d5428, 0 6px 12px rgba(40, 20, 0, .25); color: #3b2410; }
.hud-l { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.hud-l b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud-l small, .hud-r small { font-size: 12px; font-weight: 700; color: #8a6a48; }
.hud-m { display: flex; gap: 3px; }
.hud-m u { width: 22px; height: 22px; }
.hud-r { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.hud-r b { font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; }

.boardwrap { flex: 1; min-height: 0; display: grid; place-items: center; }
.board { --cs: 52px; display: grid; grid-template-columns: repeat(var(--cols), var(--cs)); grid-auto-rows: var(--cs); gap: 3px; padding: 8px; border-radius: 18px;
  background: #7b4e2a; border: 4px solid #4a2a14; box-shadow: inset 0 3px 0 rgba(255, 255, 255, .15), 0 8px 18px rgba(30, 15, 0, .35); }
.cell { position: relative; width: var(--cs); height: var(--cs); padding: 0; border: 0; border-radius: 10px; background: linear-gradient(145deg, #a2693a, #87532a);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .12), inset 0 -3px 0 rgba(0, 0, 0, .18); -webkit-tap-highlight-color: transparent; }
.cell.grass { background: linear-gradient(145deg, #8ec25a, #6fa242); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .25), inset 0 -3px 0 rgba(0, 0, 0, .12); }
.cell.grass::after { content: ''; position: absolute; left: 22%; top: 38%; width: 56%; height: 30%;
  background: radial-gradient(circle at 20% 80%, #5a8a30 0 3px, transparent 4px), radial-gradient(circle at 60% 40%, #5a8a30 0 3px, transparent 4px), radial-gradient(circle at 85% 85%, #5a8a30 0 2px, transparent 3px); }
.cell.rock svg, .cell .rot, .cell .rot svg, .cell .stub { position: absolute; inset: 0; width: 100%; height: 100%; }
.cell .rot { display: block; transition: transform .16s ease-out; }
.cell.pipe:active .rot svg { transform: scale(.94); }
.cell img { position: absolute; left: 6%; top: 2%; width: 88%; height: 88%; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .35)); }
.cell.src img { z-index: 1; }
.cell.plant img { z-index: 1; transition: filter .45s var(--wd, 0s), transform .45s var(--wd, 0s); filter: saturate(.3) brightness(1.02) sepia(.25) drop-shadow(0 2px 2px rgba(0, 0, 0, .35)); transform: rotate(-6deg) scaleY(.9); transform-origin: 50% 95%; }
.cell.plant.ok img { filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .35)); transform: none; }
.cell.plant.pop img { animation: pop .5s ease; }
@keyframes pop { 40% { transform: scale(1.18); } }
.cell.hinted { animation: hint .9s ease 2; }
@keyframes hint { 50% { box-shadow: 0 0 0 4px #ffd23f, 0 0 16px #ffd23f; } }

/* Water: hidden channel in every pipe, shown when the cell is wet (delay per cell = water running from the source). */
.wt { opacity: 0; transition: opacity .25s ease var(--wd, 0s); }
.cell.wet .wt { opacity: 1; }
/* Bridge: each run fills on its own (ax1 = north–south, ax2 = east–west). */
.cell.bridge { background: linear-gradient(145deg, #b8ae9a, #8d8371); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .3), inset 0 -3px 0 rgba(0, 0, 0, .2); }
.cell.bridge .br { position: absolute; inset: 0; width: 100%; height: 100%; }
.cell.bridge.wet .wt { opacity: 0; }
.cell.bridge.ax1 .wt.wv, .cell.bridge.ax2 .wt.wh { opacity: 1; }
.wfx { stroke-dashoffset: 0; }
.wet .wfx { animation: flowDash 1s linear infinite; }
@keyframes flowDash { to { stroke-dashoffset: -28; } }
.wa-trong .wfx { opacity: .55; }
.wa-ngoc .wfx { opacity: .7; }
.wa-bongbong .wfx { stroke-dasharray: 2 6 !important; stroke-width: 5px; opacity: .95; }
.wa-lapanh .wfx { stroke: #fff6a8; stroke-dasharray: 1.5 9 !important; stroke-width: 5px; filter: drop-shadow(0 0 2px #fff); }
.wa-suongsom .wfx { stroke: #ffffff; stroke-dasharray: 1 7 !important; stroke-width: 6px; opacity: .9; filter: drop-shadow(0 0 2px #e8fbff); }
.wa-cauvong .wt { animation: rainbow 3s linear infinite; }
@keyframes rainbow { to { filter: hue-rotate(360deg); } }

.field .nstat { flex: none; min-height: 22px; margin: 0 auto; max-width: 100%; padding: 3px 12px; border-radius: 999px; background: rgba(255, 250, 236, .92); color: #3b2410; text-align: center; font-size: 14px; font-weight: 800; }
.field .nstat:empty { visibility: hidden; }
.ctl { flex: none; display: flex; gap: 8px; }
.ctl button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 10px 6px; border: 2px solid #b9864e; border-radius: 14px; background: #fffaf0; color: #3b2410; font-weight: 800; font-size: 14px; box-shadow: 0 3px 0 #7d5428; }
.ctl button:active { transform: translateY(2px); box-shadow: 0 1px 0 #7d5428; }
.ctl button:disabled { opacity: .45; }
.ctl u { text-decoration: none; color: #335fff; }
.ptc { position: fixed; left: 0; top: 0; z-index: 60; width: 22px; height: 22px; pointer-events: none; }
.ptc svg { width: 100%; height: 100%; overflow: visible; }
.dialog .score small { color: #9aa0a6; font-size: 20px; }
.bigstars { display: flex; justify-content: center; gap: 6px; margin: 4px 0; }
.bigstars u { width: 44px; height: 44px; }
.newmap { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; background: #eef8e4; }
.newmap img { width: 54px; height: 70px; object-fit: cover; border-radius: 8px; }

/* ================= cửa hàng: ô xem thử vẽ bằng đúng hàm của bàn (js/art.js) ================= */
.pv { width: 100%; pointer-events: none; }
/* Shop grid previews stand still (owner 22/11/2026: a phone froze on lists of animated previews — 56 flowing pipes here).
   The big preview in the buy box (.buyprev) keeps moving. */
:not(.buyprev) > .pv *, :not(.buyprev) > .pv *::before, :not(.buyprev) > .pv *::after { animation: none !important; }
.pv-pipe { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; padding: 5px; border-radius: 12px; background: #7b4e2a; }
.pv-pipe .pc { position: relative; aspect-ratio: 1; border-radius: 6px; background: linear-gradient(145deg, #a2693a, #87532a); }
.pv-pipe .pc svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.pv-pipe .pc img { position: absolute; inset: 4%; width: 92%; height: 92%; object-fit: contain; z-index: 1; }
.pv-fx { position: relative; height: 96px; border-radius: 12px; background: linear-gradient(#cdeeff, #a8d98a); overflow: hidden; }
.pv-fx .pv-plant { position: absolute; left: 50%; bottom: 4px; width: 56px; height: 56px; transform: translateX(-50%); object-fit: contain; }
.pv-fx .fxs { position: absolute; inset: 0; width: 100%; height: 100%; }
.buyprev .pv { max-width: 300px; margin: 0 auto; }
.buyprev .pv-fx { height: 150px; }
.buyprev .pv-fx .pv-plant { width: 90px; height: 90px; }

/* ---------- thẻ món cửa hàng: giá dính đáy, hai hàng cố định (🪙 / 💎) để mọi thẻ thẳng hàng ---------- */
.item { position: relative; }
.item .pay { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 2px; width: 100%; }
.item .pr { font-size: 13px; font-weight: 800; color: #191b1d; }
.item .pr.on { color: #00a862; }
.item .pr.g { color: #1a8fd8; }
.item .pr.gh { color: var(--muted); font-weight: 600; font-size: 11px; }
.item.poor .pay { opacity: .5; }
.item .lock { position: absolute; top: 6px; right: 6px; z-index: 2; padding: 1px 6px; border-radius: 8px; background: #191b1d; color: #fff; font-size: 11px; font-weight: 800; }
.item.active { border-color: #335fff; }

/* Event-limited shop item tag (sdk/events.js). */
.item .evtag { align-self: center; margin: 2px 0; padding: 1px 8px; border-radius: 999px; background: linear-gradient(90deg, #4fa8ff, #9fdcf2); color: #0d2a44; font-size: 11px; font-weight: 800; }

/* ================= trang chủ v7 (mẫu "vườn có bơm nước", chủ dự án duyệt 16/11/2026 — y hệt ảnh mẫu, cùng khuôn Vườn trái cây) =================
   Trang chủ là tranh TOÀN MÀN HÌNH (khung app ẩn thanh trên / băng rôn / thanh dưới). Ảnh nền 714 x 1280 phủ kín màn (kiểu cover); mọi nút đặt theo toạ độ trong ảnh:
   --u = 1% bề ngang ảnh đã phóng, --ox / --oy = độ lệch của ảnh so với màn. Chừa 30px đáy cho dòng link hướng dẫn. */
#scHome { position: fixed; inset: 0; z-index: 5; margin: 0; padding: 0; overflow: hidden; background: linear-gradient(#8fdcf0 calc(var(--oy) + var(--H) * .5), #316b2e calc(var(--oy) + var(--H) * .5)); container-type: size;
  --avail: calc(100cqh - 46px); --u: calc(min(100cqw, var(--avail) * .5578) / 100); --H: calc(var(--u) * 179.27);
  --ox: calc((100cqw - var(--u) * 100) / 2); --oy: calc(var(--avail) - var(--H)); }
body:has(#scHome:not(.hidden)) { background: #316b2e; }
body:has(#scHome:not(.hidden)) .mb-nav { display: none !important; }
#scHome button { -webkit-appearance: none; appearance: none; font-family: inherit; }
#scHome button:focus, #scHome button:focus-visible { outline: none; }
#scHome .tc-hero { position: absolute; left: var(--ox); top: var(--oy); width: calc(var(--u) * 100); height: var(--H); margin: 0; pointer-events: none; }
#scHome .tc-hero img { display: block; width: 100%; height: 100%; -webkit-mask-image: linear-gradient(transparent 0, #000 6%, #000 96%, transparent 100%); mask-image: linear-gradient(transparent 0, #000 6%, #000 96%, transparent 100%); }
#scHome .today, #scHome .big-resume { display: none !important; }

/* nút ‹ (về cổng) và ⚙ (âm thanh) nổi ở góc phải, như Gộp Trái Cây */
.hm-back, .hm-gear { position: absolute; z-index: 6; 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 { right: max(10px, env(safe-area-inset-right)); background: #fff; border: 3px solid #e3e5e8; color: #191b1d; font: 700 28px/1 system-ui; padding-bottom: 4px; }
.hm-gear { top: calc(max(10px, env(safe-area-inset-top)) + 52px); right: max(10px, env(safe-area-inset-right)); border-radius: 13px; background: linear-gradient(#5ab4ff, #2a6fd8); border: 3px solid #e8f7ff; color: #fff; }
.hm-gear svg { width: 26px; height: 26px; display: block; }
.hm-gear .hm-mute { display: none; position: absolute; width: 30px; height: 4px; background: #fff; border-radius: 3px; transform: rotate(-45deg); box-shadow: 0 0 0 1px #2a6fd8; }
.hm-gear.off .hm-mute { display: block; }
#btnSound { display: none; }

/* thẻ người chơi + ô số */
#scHome .me-card { position: absolute; z-index: 3; left: max(8px, env(safe-area-inset-left)); right: 64px; top: max(8px, env(safe-area-inset-top)); margin: 0; padding: 0; border: 0; background: none; box-shadow: none;
  display: flex; align-items: flex-start; gap: calc(var(--u) * 1.2); }
#scHome .me-tile { position: relative; z-index: 2; flex: none; width: calc(var(--u) * 14); height: calc(var(--u) * 14); border-radius: 50%; border: calc(var(--u) * .9) solid #b98a52;
  box-shadow: 0 calc(var(--u) * .4) 0 rgba(120, 78, 30, .4); background: #fff4d6; }
#scHome img.me-num { width: 78%; height: 78%; }
#scHome .me-tile .me-avemo { font-size: calc(var(--u) * 6.4); }
#scHome .me-info { flex: 0 0 calc(var(--u) * 27); margin: calc(var(--u) * 2.4) 0 0 calc(var(--u) * -6); padding: calc(var(--u) * 1) calc(var(--u) * 1.6) calc(var(--u) * 1.2) calc(var(--u) * 8);
  gap: calc(var(--u) * .8); border: calc(var(--u) * .5) solid #c9a36a; border-radius: calc(var(--u) * 3); background: linear-gradient(#fff4d6, #f3dfae); box-shadow: 0 calc(var(--u) * .5) 0 rgba(120, 78, 30, .3); }
#scHome .me-info b { display: none; }
#scHome .me-info span { display: inline-block; align-self: flex-start; padding: 0 calc(var(--u) * 2.2); border-radius: calc(var(--u) * 1.8); background: rgba(200, 170, 120, .45);
  color: #7a5a38; font-size: calc(var(--u) * 3.2); font-weight: 800; line-height: 1.5; white-space: nowrap; }
#scHome .xpbar { position: relative; overflow: visible; height: calc(var(--u) * 2.6); margin-left: calc(var(--u) * 5.4); border: calc(var(--u) * .5) solid #5a4a36; border-radius: 9px; background: #6a5a46; }
#scHome .xpbar::before { content: 'XP'; position: absolute; left: calc(var(--u) * -5.6); top: 50%; transform: translateY(-50%); color: #5fb82a; font-size: calc(var(--u) * 2.8); font-weight: 900; text-shadow: 0 calc(var(--u) * .3) 0 #fff; }
#scHome .xpbar i { min-width: calc(var(--u) * 2); background: linear-gradient(#a3ea58, #3fa11e); }
#scHome .me-chips { flex: 1; min-width: 0; display: grid; grid-template-columns: 1fr 1fr; gap: calc(var(--u) * 2) calc(var(--u) * 1.4); margin-top: calc(var(--u) * 1.4); }
#scHome .me-chips > span { position: relative; display: flex; align-items: center; gap: calc(var(--u) * .8); min-height: calc(var(--u) * 6); padding: calc(var(--u) * .3) calc(var(--u) * 6.4) calc(var(--u) * .3) calc(var(--u) * 1.8);
  border: calc(var(--u) * .5) solid #c9a36a; border-radius: 999px; background: linear-gradient(#fff4d6, #f3dfae); color: #5a3a1c; font-size: calc(var(--u) * 3.3); font-weight: 900; white-space: nowrap;
  box-shadow: 0 calc(var(--u) * .5) 0 rgba(120, 78, 30, .3); }
#scHome .me-chips > span:nth-child(3) { grid-column: 2; }
#scHome .me-chips > span::after { content: '+'; position: absolute; right: calc(var(--u) * .7); top: 50%; transform: translateY(-50%); width: calc(var(--u) * 4.2); height: calc(var(--u) * 4.2); border-radius: 50%;
  background: #e8a23a; border: calc(var(--u) * .45) solid #b97a1c; color: #fff7dc; font-size: calc(var(--u) * 3.4); font-weight: 900; line-height: calc(var(--u) * 3.1); text-align: center; }

/* nút lớn — cùng chỗ, cùng cỡ với mẫu (toạ độ ảnh 714 x 1280) */
#scHome .big, #scHome .homegrid { position: absolute; }
#scHome .big { z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; margin: 0; padding: 0; text-align: center;
  white-space: nowrap; text-transform: uppercase; line-height: 1.05; font-weight: 900; font-family: "Arial Rounded MT Bold", "Nunito", "Trebuchet MS", "Segoe UI", Roboto, sans-serif;
  paint-order: stroke fill; letter-spacing: .02em; }
#scHome .big::before, #scHome .big::after { display: none; }
#scHome .big > .tcic { display: none; }
#scHome .big small { text-transform: none; letter-spacing: 0; font-weight: 800; margin-top: calc(var(--u) * .5); }
#scHome .big-play { left: calc(var(--ox) + var(--u) * 7.7); width: calc(var(--u) * 85); top: calc(var(--oy) + var(--H) * .6734); height: calc(var(--H) * .1016);
  border: calc(var(--u) * .9) solid #f0c040; border-radius: calc(var(--u) * 6); background: linear-gradient(#9be857 0, #4cb82a 55%, #35a01c 100%); color: #fff2a8; font-size: calc(var(--u) * 6.2); padding-left: calc(var(--u) * 11);
  -webkit-text-stroke: calc(var(--u) * 1.1) #6a3a10; text-shadow: 0 calc(var(--u) * .6) 0 #6a3a10; box-shadow: 0 calc(var(--u) * 1) 0 #8a6a1c, 0 calc(var(--u) * 1.6) calc(var(--u) * 2.4) rgba(0, 0, 0, .22); }
#scHome .big-play small { color: #fff6c8; font-size: calc(var(--u) * 3.4); -webkit-text-stroke: calc(var(--u) * .45) #2f5a10; text-shadow: none; }
#scHome .big-play::before { display: block; content: ''; position: absolute; left: 3.6%; top: 50%; width: 11%; aspect-ratio: 1; transform: translateY(-50%);
  border-radius: 26%; background: linear-gradient(#b6f27a, #62c83a); box-shadow: inset 0 0 0 calc(var(--u) * .5) #2f6b12; }
#scHome .big-play::after { display: block; content: ''; position: absolute; left: 6.7%; top: 50%; width: 5.2%; aspect-ratio: 1; transform: translateY(-50%);
  background: #fffbe0; clip-path: polygon(15% 8%, 92% 50%, 15% 92%); }
#scHome .big-daily { left: calc(var(--ox) + var(--u) * 26.6); width: calc(var(--u) * 46.8); top: calc(var(--oy) + var(--H) * .7813); height: calc(var(--H) * .0586);
  border: calc(var(--u) * .6) solid #b98a1c; border-radius: calc(var(--u) * 3.2); background: linear-gradient(#ffe36a, #f5b81c); color: #5a3a00; font-size: calc(var(--u) * 4.8);
  -webkit-text-stroke: calc(var(--u) * .7) #fff6d0; box-shadow: 0 calc(var(--u) * .9) 0 #9a6a10; }
#scHome .big-daily small { color: #6b4300; font-size: calc(var(--u) * 2.8); -webkit-text-stroke: 0; }
#scHome .big-daily.done small { color: #2f7a1c; }
#scHome .big:active { transform: translateY(calc(var(--u) * .6)); }

/* ba ô gỗ */
#scHome .homegrid { z-index: 2; left: calc(var(--ox) + var(--u) * 7.7); width: calc(var(--u) * 84.5); top: calc(var(--oy) + var(--H) * .8539); margin: 0; gap: 8.46%; display: grid; grid-template-columns: repeat(3, 1fr); }
#scHome .small { position: relative; display: flex; align-items: flex-end; justify-content: center; aspect-ratio: 1; padding: 0 0 6%; border: calc(var(--u) * .7) solid #4a2a14;
  border-radius: calc(var(--u) * 4); background: linear-gradient(#c98a52, #a8693a 60%, #9a5e30); box-shadow: 0 calc(var(--u) * .9) 0 #4a2a14, inset 0 calc(var(--u) * .5) 0 rgba(255, 255, 255, .25);
  color: #fff3d4; font-family: "Arial Rounded MT Bold", "Nunito", "Trebuchet MS", "Segoe UI", Roboto, sans-serif; font-size: calc(var(--u) * 3.1); font-weight: 900; text-transform: uppercase;
  white-space: nowrap; paint-order: stroke fill; -webkit-text-stroke: calc(var(--u) * .6) #4a2a14; }
#scHome .small .tcic { display: none; }
#scHome .small::before { content: ''; position: absolute; left: 8%; right: 8%; top: 7%; height: 58%; background: center / contain no-repeat; }
#scHome #btnShop::before { background-image: url(../img/ic-shop.webp); }
#scHome #btnRank::before { background-image: url(../img/ic-rank.webp); }
#scHome #btnHelp::before { background-image: url(../img/ic-help.webp); }
#scHome .small:active { transform: translateY(calc(var(--u) * .6)); }

/* dòng link hướng dẫn ở đáy (SEO) — ghi chú khác ẩn */
#scHome .note { position: absolute; z-index: 4; left: 8px; right: 8px; bottom: 5px; margin: 0; padding: 3px 8px; border-radius: 8px; background: rgba(40, 60, 20, .62); color: #fff;
  font-size: 10.5px; line-height: 1.3; text-align: center; text-shadow: none; }
#scHome .note a { color: #ffe9a0; }
#scHome #statsLine, #scHome #guestNote { display: none !important; }
#scHome .note.guide-link { display: block; line-height: 1.3; padding: 4px 8px; }
#scHome .note.guide-link a { display: inline; padding: 0; margin: 0 2px; min-height: 0; }
#scHome .note.guide-link a { display: inline !important; padding: 0 !important; margin: 0 2px !important; min-height: 0 !important; line-height: inherit !important; }

/* v6: nút + ô gỗ + chữ lớn đã vẽ sẵn trong ảnh nền (y hệt mẫu) — ở đây chỉ còn vùng bấm trong suốt và hai dòng chữ phụ đổi theo người chơi */
#scHome .big, #scHome .small { background: none !important; border: 0 !important; box-shadow: none !important; color: transparent !important; -webkit-text-stroke: 0 !important; text-shadow: none !important; }
#scHome .big-play::before, #scHome .big-play::after, #scHome .small::before { display: none !important; }
#scHome .big small { position: absolute; left: 0; right: 0; margin: 0; text-align: center; font-family: "Arial Rounded MT Bold", "Nunito", "Trebuchet MS", "Segoe UI", Roboto, sans-serif; }
#scHome .big-play small { top: calc(var(--u) * 11.6); padding-left: calc(var(--u) * 9.8); font-size: calc(var(--u) * 3.5); font-weight: 900; color: #fff6c8 !important;
  -webkit-text-stroke: calc(var(--u) * .9) #2f5a10 !important; paint-order: stroke fill; }
#scHome .big-daily small { top: calc(var(--u) * 7.9); font-size: calc(var(--u) * 3.2); font-weight: 900; color: #6b4300 !important; -webkit-text-stroke: 0 !important; }
#scHome .big-daily.done small { color: #2f7a1c !important; }
#scHome .small:active, #scHome .big:active { transform: none; opacity: .85; }

#scHome .big small { display: none !important; }
#scHome .me-info { flex-basis: calc(var(--u) * 31); }
#scHome .me-info span { padding: 0 calc(var(--u) * 1.6); font-size: calc(var(--u) * 2.9); }

/* v7b: chừa chỗ trên cùng cho thẻ người chơi + ô xu (tai thỏ iPhone) — ảnh thu nhỏ vừa đủ để không chồng lên tiêu đề, hai mép mờ dần vào nền */
#scHome { --u: calc(min(100cqw, (var(--avail) - max(8px, env(safe-area-inset-top)) - 22px) * .5578) / 100); }
#scHome .tc-hero img { -webkit-mask-image: linear-gradient(transparent 0, #000 6%, #000 96%, transparent 100%), linear-gradient(90deg, transparent 0, #000 3%, #000 97%, transparent 100%);
  mask-image: linear-gradient(transparent 0, #000 6%, #000 96%, transparent 100%), linear-gradient(90deg, transparent 0, #000 3%, #000 97%, transparent 100%);
  -webkit-mask-composite: source-in; mask-composite: intersect; }
#scHome { background: linear-gradient(#8fdcf0 calc(var(--oy) + var(--H) * .36), #6fb85a calc(var(--oy) + var(--H) * .56), #316b2e calc(var(--oy) + var(--H) * .72)); }

/* Book icon under the sound button: guide + data-page links in a dialog (design system 17/11/2026).
   The guide-link line stays in the page for search engines but is visually hidden. */
.hm-book { top: calc(max(10px, env(safe-area-inset-top)) + 104px); border-radius: 50%; }
#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; }

/* Book sheet list + painted-home guest rule (design system 17/11/2026) */
#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 { display: flex; flex-direction: column; gap: 8px; }
#scHome #guestNote { display: none !important; }
#scHome .me-tile { cursor: pointer; }

/* Sheet skin "wood": small sheets take the colours of the painted home (owner 30/11/2026). */
body.mb-light { --skin-frame: #6b3d17; --skin-head: linear-gradient(#93592a, #6b3d17); --skin-head-ink: #fff3d6; --skin-line: #d8a13a;
  --skin-paper: #f4e6c6; --skin-card: #fffaf0; --skin-card-line: #d6b886; --skin-ink: #3a1d0c; --skin-muted: #765536; --skin-hover: #fff3dc; }
