/* ================= Cờ Caro — MonBlock ================= */
:root {
  --bg: #0d1117;
  --panel: #151c26;
  --panel-2: #1b2431;
  --line: #2b3646;
  --txt: #e8eef6;
  --muted: #93a3b8;
  --accent: #ffcf5a;
  --red: #e5484d;
  --ok: #4fd18b;
  --coin: #ffcf4d;
  --gem: #7fe9ff;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
/* No double-tap zoom on the game page (once zoomed, touch-action on the board blocks pinching back out). */
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(900px 500px at 10% -10%, #14283a 0%, transparent 60%),
    radial-gradient(700px 420px at 100% 0%, #2a2414 0%, transparent 55%),
    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: 1100px; margin: 0 auto; padding: 8px 16px 32px; }
.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; }
.muted { color: var(--muted); font-weight: 500; font-size: 13px; }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; padding: 10px 0; font-size: 14px; }

/* ---------- trang chủ ---------- */
.me-card { display: flex; align-items: center; gap: 14px; padding: 16px; margin: 6px 0 14px; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(135deg, #142536, var(--panel)); }
.me-av { display: grid; place-items: center; width: 54px; height: 54px; flex: none; border-radius: 14px; background: var(--cb-bg); border: 3px solid var(--cb-line); color: var(--px); font-size: 28px; font-weight: 900; }
.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; }
.xpbar { height: 6px; border-radius: 9px; background: var(--panel-2); overflow: hidden; }
.xpbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), #ff8a3d); 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; }
.coin-chip b { color: var(--coin); }
.gem-chip b { color: var(--gem); }
.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-online { background: linear-gradient(135deg, #12304a, #151c26); border-color: #24507a; }
.big-ai { background: linear-gradient(135deg, #3a1616, #151c26); border-color: #6a2a2a; }
.big-local { background: linear-gradient(135deg, #1c3324, #151c26); border-color: #2e5a3c; }
.big-bai { background: linear-gradient(135deg, #2c1f3d, #151c26); border-color: #5a3d80; }
.cgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin: 12px 0; }
.cth { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px 8px; border: 2px solid var(--line); border-radius: 14px; background: var(--panel); }
.cth b { font-size: 18px; }
.cth small { color: var(--muted); font-size: 11.5px; text-align: center; }
.cth .st { font-size: 12px; letter-spacing: 1px; min-height: 16px; }
.cth.done { border-color: #4a7a3a; background: #17241a; }
.cth.locked { opacity: .45; }
.big-resume { background: linear-gradient(135deg, #3d3214, #151c26); border-color: #7a6324; }
.homegrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 4px 0 6px; }
.small { position: relative; padding: 12px 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); font-size: 14px; font-weight: 700; }
.badge { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--red); color: #fff; font-size: 12px; line-height: 20px; text-align: center; }

/* ---------- chọn mức / seg ---------- */
.levels { display: grid; gap: 8px; }
.lv { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 2px solid var(--line); border-radius: 14px; background: var(--panel); text-align: left; }
.lv.active { border-color: var(--accent); background: #2a2414; }
.lv i { font-style: normal; font-size: 26px; }
.lv b { display: block; }
.lv small { color: var(--muted); font-size: 12.5px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { flex: 1; min-width: 90px; padding: 10px 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); font-weight: 700; font-size: 14px; }
.seg button.active { border-color: var(--accent); background: #2a2414; color: var(--accent); }
.sticky-go { position: sticky; bottom: 8px; margin-top: 16px; box-shadow: 0 -8px 20px rgba(13, 17, 23, .9); }


/* ---------- online ---------- */
.on-head { display: flex; align-items: center; justify-content: space-between; }
.on-elo { color: var(--accent); font-weight: 800; }
.on-actions { margin-top: 14px; }
.on-join { display: flex; gap: 8px; }
.on-join input { flex: 1; min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); color: var(--txt); font-size: 16px; }
.on-wait { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 16px; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); text-align: center; }
.on-code { font-size: 34px; font-weight: 900; letter-spacing: 6px; color: var(--accent); }
.spinner { width: 34px; height: 34px; border: 4px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- ván cờ ---------- */
.play { display: flex; gap: 20px; align-items: flex-start; justify-content: center; }
.board-col { width: min(560px, calc((100dvh - 190px) * 0.9)); min-width: 280px; }
.side { width: 290px; flex: none; }
.pbar { display: flex; align-items: center; gap: 8px; padding: 6px 4px; font-weight: 700; min-height: 36px; }
.pname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pname small { color: var(--muted); font-weight: 600; }
.clock { padding: 4px 10px; border-radius: 8px; background: var(--panel-2); font-variant-numeric: tabular-nums; font-weight: 800; }
.clock.on { background: var(--accent); color: #1c1608; }
.clock.low { background: var(--red); color: #fff; }
.think { display: inline-flex; gap: 3px; }
.think i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: blink 1s infinite; }
.think i:nth-child(2) { animation-delay: .2s; }
.think i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 50% { opacity: .2; } }
.status { padding: 12px 14px; border-radius: 14px; background: var(--panel); font-weight: 800; margin-bottom: 10px; }
.status.check { background: #3a1f22; color: #ffb3a8; }
.status.over { background: #2a2412; color: var(--accent); }
.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.tools button { padding: 11px 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); font-weight: 700; font-size: 14px; }
.tools button:disabled { opacity: .35; cursor: default; }

/* ---------- cửa hàng ---------- */
.shop-head { display: flex; align-items: center; gap: 10px; }
.shop-head h2 { flex: 1; }
.shop { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.item { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 10px; border: 2px solid var(--line); border-radius: 14px; background: var(--panel); text-align: center; }
.item.active { border-color: var(--ok); }
.item.locked, .item.poor { opacity: .6; }
.item b { font-size: 14px; }
.item .rar { font-size: 12px; font-weight: 700; }
.item .act { font-size: 13px; font-weight: 800; color: var(--muted); }
.item .act.buy { color: var(--coin); }
.item .act .gem { color: var(--gem); }
.item .evtag { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: linear-gradient(90deg, #ff5f8f, #ffb347); color: #2a1033; }

/* ---------- ván đấu + xem lại ---------- */
.hlist { display: grid; gap: 6px; }
.hrow { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); text-align: left; }
.hres { flex: none; min-width: 74px; padding: 4px 8px; border-radius: 8px; font-size: 12px; font-weight: 900; text-align: center; background: var(--panel-2); }
.hres.win { background: #17331f; color: var(--ok); }
.hres.loss { background: #3a1f22; color: #ff8f86; }
.hres.draw { color: var(--muted); }
.hm { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hm b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hm small { color: var(--muted); font-size: 12px; }
.hgo { color: var(--accent); font-weight: 900; }
.replay-head { display: flex; align-items: center; gap: 10px; }
.replay-head > div { min-width: 0; }
#scReplay h2 { margin: 0 0 2px; font-size: 18px; }
#scReplay .replay-head .note { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- thành tích, xếp hạng, cài đặt ---------- */
.qlist { display: grid; gap: 8px; }
.q { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.q i { font-style: normal; font-size: 26px; }
.q .qb { flex: 1; min-width: 0; }
.q .qb small { display: block; color: var(--muted); font-size: 12.5px; }
.q .qbar { height: 5px; margin-top: 6px; border-radius: 9px; background: var(--panel-2); overflow: hidden; }
.q .qbar span { display: block; height: 100%; background: var(--ok); }
.q button { padding: 8px 12px; border: 0; border-radius: 10px; background: var(--accent); color: #1c1608; font-weight: 800; font-size: 13px; white-space: nowrap; }
.q.claimed { opacity: .55; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.stats div { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.stats b { display: block; font-size: 20px; }
.stats small { color: var(--muted); }
.rank { display: grid; gap: 6px; margin-top: 12px; }
.rrow { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.rrow.me { border-color: var(--accent); }
.rrow .no { width: 28px; color: var(--muted); font-weight: 800; }
.rrow .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.rrow .sc { font-weight: 800; color: var(--accent); }
.toggles { display: grid; gap: 8px; }
.tg { display: flex; align-items: center; justify-content: space-between; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); font-weight: 700; }
.tg input { width: 22px; height: 22px; }

/* ---------- hộp thoại ---------- */
.modal { position: fixed; inset: 0; z-index: 30; 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); box-shadow: 0 20px 60px rgba(0, 0, 0, .6); }
.dialog h3 { margin: 0 0 8px; font-size: 19px; }
.dialog p { line-height: 1.5; }
.dialog ul { padding-left: 18px; line-height: 1.7; }
.dialog li.coin { color: var(--coin); font-weight: 700; }
.mbtns { position: sticky; bottom: -18px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin: 14px -18px -18px; padding: 12px 18px 18px; background: var(--panel); }
.mbtns button { flex: 1; min-width: 110px; padding: 12px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); font-weight: 800; }
.mbtns button.pri { border-color: var(--accent); background: var(--accent); color: #1c1608; }
.buyprev { display: flex; justify-content: center; margin-bottom: 6px; }
.buyprev .prev { max-width: 240px; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
.confetti i { position: absolute; top: -10px; width: 8px; height: 14px; border-radius: 2px; animation: fall 1.6s linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(540deg); } }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; padding: 12px 18px; border-radius: 12px; background: #1b2431; color: var(--txt); font-weight: 700; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
.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; background: var(--accent); color: #1c1608; font-weight: 800; }

/* ---------- điện thoại ---------- */
@media (max-width: 860px) {
  .play { flex-direction: column; align-items: center; gap: 6px; }
  .board-col { width: min(100%, calc((100dvh - 210px) * 0.9)); }
  .side { width: min(100%, 560px); }
  .tools { display: flex; }
  .tools button { flex: 1; font-size: 12px; padding: 10px 2px; }
}
/* Short phones (iPhone SE): everything of the game screen on one page, no scrolling to reach the tools. */
@media (max-width: 860px) and (max-height: 760px) {
  .board-col { width: min(100%, calc((100dvh - 290px) * 0.9)); }
  .pbar { min-height: 28px; padding: 2px 4px; }
  .status { padding: 8px 12px; margin-bottom: 6px; font-size: 14px; }
  .tools { margin-top: 6px; }
  .side .link { padding: 6px 0; }
}
@media (max-width: 520px) {
  .wrap { padding: 4px 10px 24px; }
  .homegrid { grid-template-columns: repeat(3, 1fr); }
  .me-card { padding: 12px; }
}

/* ---------- bàn caro ---------- */
.rules { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.rules button { display: flex; flex-direction: column; gap: 2px; padding: 10px 8px; border: 2px solid var(--line); border-radius: 12px; background: var(--panel); text-align: left; }
.rules button small { color: var(--muted); font-size: 12px; font-weight: 600; }
.rules button.active { border-color: var(--accent); background: #2a2414; }
.rules button.active b { color: var(--accent); }
.rdesc { margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.rtag { display: block; width: 100%; margin-bottom: 8px; padding: 8px 12px; border: 1px solid #24507a; border-radius: 12px; background: #12243a; color: #9fd0ff; font-weight: 800; text-align: left; }
.pmark { display: inline-grid; place-items: center; min-width: 22px; font-weight: 900; }

.board-col { width: min(600px, calc(100dvh - 210px)); }
.replay-ctl { display: flex; gap: 6px; align-items: center; margin-top: 10px; }
.replay-ctl button { flex: 1; padding: 10px 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); font-weight: 800; }
.replay-ctl span { min-width: 64px; text-align: center; color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
#replayBoard { max-width: min(100%, calc(100svh - 280px)); margin: 10px auto 0; }
.replay-go { margin-top: 10px; }
.prev { position: relative; width: 100%; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; }
.prev.bd { background: repeating-linear-gradient(90deg, var(--cb-line) 0 1px, transparent 1px 20px), repeating-linear-gradient(0deg, var(--cb-line) 0 1px, transparent 1px 20px), var(--cb-bg); }
.prev.bd i { position: absolute; font-style: normal; font-weight: 900; font-size: 26px; color: #e5484d; }
.prev.bd i.so { color: #2f6fe0; }
.prev.pcs { display: flex; align-items: center; justify-content: center; gap: 14%; background: #fbf8ef; font-size: 40px; font-weight: 900; }
.prev.pcs i { font-style: normal; }
@media (max-width: 860px) {
  .board-col { width: min(100%, calc(100dvh - 230px)); }
  .rules button small { font-size: 11px; }
}
@media (max-width: 860px) and (max-height: 760px) { .board-col { width: min(100%, calc(100dvh - 280px)); } }

/* ===== Trang chủ tranh vẽ (design system 17/11/2026 — bố cục chuẩn: ‹ trên trái, loa + sách trên phải, logo + CHƠI, 4 ô đáy) ===== */
#scHome { position: fixed; inset: 0; z-index: 5; overflow: hidden; padding: 0; max-width: none; background: #f3e4c4; animation: none; container-type: size; }
#scHome .hm-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center top; }
body:has(#scHome:not(.hidden)) .mb-nav { display: none !important; }
#scHome button { -webkit-appearance: none; appearance: none; font-family: inherit; }
.hm-back, .hm-gear { position: absolute; top: max(10px, env(safe-area-inset-top)); width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; padding: 0; box-shadow: 0 3px 6px rgba(0, 0, 0, .35); }
.hm-back { left: max(10px, env(safe-area-inset-left)); background: #fff; border: 3px solid #e3e5e8; color: #191b1d; font: 700 28px/1 system-ui; padding-bottom: 4px; }
.hm-gear { right: max(10px, env(safe-area-inset-right)); border-radius: 12px; background: linear-gradient(#5ab4ff, #2a6fd8); border: 3px solid #e8f7ff; color: #fff; }
.hm-gear svg { width: 26px; height: 26px; display: block; }
.hm-mute { display: none; position: absolute; left: 7px; right: 7px; top: 50%; height: 3px; background: #ff4d4d; border-radius: 2px; transform: rotate(-45deg); }
.hm-gear.off .hm-mute { display: block; }
.hm-book { top: calc(max(10px, env(safe-area-inset-top)) + 54px); border-radius: 50%; }
.hm-top { position: absolute; left: calc(max(10px, env(safe-area-inset-left)) + 52px); top: max(10px, env(safe-area-inset-top)); display: flex; align-items: center; gap: 8px; }
.hm-av { position: relative; flex: none; width: 52px; height: 52px; padding: 0; border-radius: 50%; border: 3px solid #d8a13a; background: #fff3d6; display: grid; place-items: center; box-shadow: 0 3px 6px rgba(0, 0, 0, .35); cursor: pointer; }
.hm-av .me-avemo { position: absolute; inset: 0; display: grid; place-items: center; font-size: 28px; line-height: 1; border-radius: 50%; overflow: hidden; color: var(--px, #e5484d); font-weight: 900; }
.hm-lv { position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%); padding: 1px 8px; border-radius: 8px; background: #7a4a1c; border: 2px solid #d8a13a; color: #fff; font: 900 12px/1.2 system-ui, sans-serif; white-space: nowrap; }
.hm-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.hm-xp, .hm-pts { display: none; }
.hm-bar { display: flex; align-items: center; gap: 4px; min-width: 84px; height: 32px; padding: 0 10px 0 4px; border-radius: 16px; background: rgba(20, 60, 90, .78); border: 2px solid rgba(255, 255, 255, .55); }
.hm-bar img { width: 24px; height: auto; flex: none; }
.hm-bar b { flex: 1; color: #fff !important; font: 900 14px/1 system-ui, sans-serif; text-align: center; }
.hm-stack { position: absolute; left: 0; right: 0; top: calc(max(10px, env(safe-area-inset-top)) + 64px); bottom: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.6cqh; padding: 0 5cqw; }
.hm-logo { flex: 0 1 auto; min-height: 0; max-height: 16cqh; max-width: 84cqw; width: auto; height: auto; filter: drop-shadow(0 5px 6px rgba(0, 0, 0, .3)); pointer-events: none; }
.hm-hero { flex: 0 1 auto; min-height: 0; max-height: 28cqh; max-width: 72cqw; width: auto; height: auto; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .25)); pointer-events: none; }
.hm-play { flex: none; width: min(70cqw, 330px); padding: 1.2cqh 3cqw 1.4cqh; border-radius: 999px; text-align: center; color: #fff; background: linear-gradient(#8aea5a, #2fae2a 60%, #238a22); border: 4px solid #fff5cf; box-shadow: 0 5px 0 #1b6b1a, 0 9px 12px rgba(0, 0, 0, .35); }
.hm-play b { display: block; font: 900 clamp(26px, 5.2cqh, 44px)/1.05 "Arial Rounded MT Bold", system-ui, sans-serif; -webkit-text-stroke: .12em #1d6a1d; paint-order: stroke fill; letter-spacing: 2px; }
.hm-play small { display: block; font: 900 clamp(12px, 1.8cqh, 15px)/1.2 system-ui, sans-serif; -webkit-text-stroke: .2em #1d6a1d; paint-order: stroke fill; }
.hm-play:active, .hm-ic:active { transform: scale(.96); }
/* Khung ngang thấp (điện thoại cầm ngang 844×390): vùng giữa thanh trên và 4 ô cao hơn, 4 ô nhỏ lại (như Sudoku) */
@container (orientation: landscape) {
  .hm-stack { top: calc(max(10px, env(safe-area-inset-top)) + 58px); bottom: calc(max(10px, env(safe-area-inset-bottom)) + min(11cqw, 22cqh) + 22px); gap: 1.2cqh; }
  .hm-play { width: min(46cqw, 340px); padding: 0.8cqh 3cqw 1cqh; }
  .hm-play small { white-space: nowrap; font-size: clamp(12px, 3.2cqh, 15px); }
  .hm-play b { font-size: clamp(24px, 7cqh, 40px); }
  .hm-row { bottom: max(10px, env(safe-area-inset-bottom)); gap: 1.6cqw; }
  .hm-ic { width: min(11cqw, 22cqh, 96px); }
  .hm-ic span { font-size: clamp(12px, 3.2cqh, 14px); }
}
.hm-row { position: absolute; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: 2cqw; }
.hm-ic { position: relative; width: min(21cqw, 96px); padding: 0; background: none; border: 0; box-shadow: none; color: #fff; }
.hm-ic img { width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; display: block; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .4)); }
.hm-ic span { display: block; margin-top: -2px; text-align: center; font: 900 clamp(12px, 1.7cqh, 14px)/1.1 system-ui, sans-serif; -webkit-text-stroke: .22em #4a2a14; paint-order: stroke fill; white-space: nowrap; }
.hm-dot { position: absolute; top: 2px; right: 2px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; background: #e5374f; border: 2px solid #fff; color: #fff; font: 900 12px/18px system-ui; font-style: normal; }
.hm-dot.hidden { display: none; }
#scHome .hm-seo { position: absolute !important; width: 1px !important; height: 1px !important; margin: 0 !important; padding: 0 !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; }
#scBook a.bk-link { display: flex; align-items: center; min-height: 44px; padding: 8px 16px; border: 1px solid var(--skin-card-line, #e3e5e8); border-radius: 12px; background: var(--skin-card, #f7f8f9); color: var(--skin-ink, #191b1d); font-size: 15px; font-weight: 700; text-decoration: none; }
#scBook .bk-list, #scModes { display: flex; flex-direction: column; gap: 8px; }
#scModes .big { margin: 0; }
#scHelp .help ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; line-height: 1.4; }
.big-hist { margin-top: 12px; }

/* Phone held sideways (orient-check 19/11/2026): board on the left sized by the screen HEIGHT, status + tools in a column on
   the right — the portrait stack (player, board, player, tools) was 579 px tall on a 390 px screen. */
@media (orientation: landscape) and (max-height: 500px) {
  .wrap { padding-bottom: 8px; }
  .play { flex-direction: row; align-items: center; justify-content: center; gap: 16px; }
  .board-col { width: calc(100dvh - 124px); min-width: 0; }
  .side { width: min(290px, 40vw); }
  .tools { display: grid; grid-template-columns: 1fr 1fr; }
  .tools button { font-size: 13px; }
}

/* Home painting behind every screen (owner 19/11/2026) — drawn by sdk/game-light.css */
body.mb-light { --mb-scene: url(/caro/img/home-bg.webp); --mb-scene-on: ''; --muted: #4c4f54; }
.tools button:disabled { opacity: .6; }


/* 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; }
