/* ================= Nối Từ — MonBlock (base copied from the Sudoku template) ================= */
: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; }

/* ================= Nối Từ: 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; }

/* ================= Nối Từ: bàn chơi ================= */
#scPlay { display: flex; flex-direction: column; gap: 8px; }
.arena { position: relative; display: flex; flex-direction: column; min-height: calc(100dvh - 250px); padding: 10px; border-radius: 18px; background: var(--bg-img, none), var(--bg-c, #fff); border: 1px solid var(--bd-c, #e3e5e8); overflow: hidden; }
.players { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.pl { position: relative; display: flex; align-items: center; gap: 8px; min-width: 0; padding: 6px 8px 10px; border-radius: 14px; background: var(--pl-bg, rgba(255, 255, 255, .85)); border: 2px solid transparent; transition: border-color .2s, transform .2s; }
.pl.right { flex-direction: row-reverse; text-align: right; }
.pl.on { border-color: #335fff; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(51, 95, 255, .18); }
.pl .av { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; overflow: hidden; background: #eef1f6; font-size: 22px; }
.pl .av img, .pl .av svg { width: 100%; height: 100%; }
.pl .pn { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.pl .pn b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; color: var(--pl-ink, #191b1d); }
.pl .pn small { color: var(--pl-sub, #606368); font-size: 12px; font-weight: 700; }
.tbar { position: absolute; left: 10px; right: 10px; bottom: 4px; height: 4px; border-radius: 4px; background: rgba(0, 0, 0, .08); overflow: hidden; }
.tbar > i { display: block; height: 100%; width: 100%; background: #00a862; transform-origin: 0 50%; transform: scaleX(0); }
.pl.right .tbar > i { transform-origin: 100% 50%; }
.tbar > i.mid { background: #ffb020; }
.tbar > i.low { background: #e5374f; }
.vs { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--pl-bg, #fff); border: 2px solid #e3e5e8; color: var(--pl-ink, #191b1d); font-size: 19px; font-weight: 900; font-variant-numeric: tabular-nums; }
.vs.low { border-color: #e5374f; color: #e5374f; animation: pulse .5s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: scale(1.08); } }

/* The chain: newest word at the bottom, big; older ones smaller and faded. The linking syllable is highlighted. */
.chain { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 8px; min-height: 200px; padding: 14px 4px 6px; overflow: hidden; }
.wcard { position: relative; display: flex; align-items: center; gap: .32em; max-width: 100%; padding: .42em .9em; border-radius: var(--wc-r, 999px); background: var(--wc-bg, #fff); color: var(--wc-ink, #191b1d); border: var(--wc-bd, 2px solid #e3e5e8);
  box-shadow: var(--wc-sh, 0 2px 0 rgba(0, 0, 0, .06)); font-family: var(--wc-font, inherit); font-size: 17px; font-weight: 800; white-space: nowrap; opacity: .55; transform: scale(.86); transition: transform .25s, opacity .25s; }
.wcard .who { position: absolute; top: -8px; font-size: 11px; font-weight: 800; padding: 0 6px; border-radius: 6px; background: var(--wc-tag, #eef1f6); color: #606368; font-family: "Segoe UI", Roboto, sans-serif; }
.wcard.me .who { left: 10px; background: #dfe7ff; color: #335fff; }
.wcard.op .who { right: 10px; background: #ffe2e6; color: #c42840; }
.wcard .link { color: var(--wc-link, #335fff); }
.wcard.start { border-style: dashed; }
.wcard.last { opacity: 1; transform: scale(1.18); margin: 6px 0 4px; }
.wcard.prev { opacity: .85; transform: scale(1); }
.wcard.pop { animation: wpop .35s ease; }
@keyframes wpop { from { transform: scale(.6) translateY(16px); opacity: 0; } }
.nstat { min-height: 22px; padding: 2px 4px; text-align: center; color: var(--pl-ink, #191b1d); font-size: 14px; font-weight: 800; }
.nstat.bad { color: #e5374f; }
.nstat.think::after { content: ' …'; animation: dots 1s steps(3) infinite; }
@keyframes dots { 50% { opacity: .2; } }

.inrow { display: flex; align-items: stretch; gap: 8px; }
.need { flex: none; display: grid; place-items: center; min-width: 64px; padding: 0 12px; border-radius: 14px; background: #335fff; color: #fff; font-size: 18px; font-weight: 900; }
.inrow input { flex: 1; min-width: 0; padding: 13px 14px; border: 2px solid #c9d2e0; border-radius: 14px; background: #fff; color: #191b1d; font: inherit; font-size: 18px; font-weight: 700; }
.inrow input:focus { outline: none; border-color: #335fff; }
.inrow input.shake { animation: shakeX .32s; border-color: #e5374f; }
@keyframes shakeX { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.inrow button { flex: none; padding: 0 20px; border: 0; border-radius: 14px; background: #00a862; color: #fff; font-size: 16px; font-weight: 900; }
.inrow button:disabled, .inrow input:disabled { opacity: .5; }
.pick { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.pick button { padding: 8px 14px; border: 2px solid #335fff; border-radius: 999px; background: #fff; color: #335fff; font-weight: 800; }
.ctl { display: flex; gap: 8px; }
.ctl button { flex: 1; padding: 11px 8px; border: 1px solid #e3e5e8; border-radius: 12px; background: #fff; color: #191b1d; font-weight: 800; }
.ctl button:disabled { opacity: .45; }
.ctl u { text-decoration: none; color: #335fff; }

/* ---------- nền (NoituCatalog.THEMES): lớp .nt-<id> đặt biến màu của khung bàn ---------- */
.nt-paper { --bg-c: #ffffff; --bg-img: none; }
.nt-sky { --bg-c: #dff1ff; --bg-img: radial-gradient(60px 26px at 18% 22%, #fff 60%, transparent 62%), radial-gradient(80px 30px at 78% 40%, #fff 60%, transparent 62%), radial-gradient(70px 24px at 40% 70%, rgba(255, 255, 255, .8) 60%, transparent 62%); --bd-c: #bfe0fb; }
.nt-olys { --bg-c: #fffef6; --bg-img: linear-gradient(90deg, transparent 34px, #ff9aa8 34px 36px, transparent 36px), repeating-linear-gradient(#fffef6 0 23px, #b9d4f0 23px 24px), repeating-linear-gradient(90deg, transparent 0 23px, rgba(185, 212, 240, .5) 23px 24px); --bd-c: #d6e3f2; }
.nt-bamboo { --bg-c: #eef8e8; --bg-img: repeating-linear-gradient(90deg, transparent 0 38px, rgba(90, 160, 70, .22) 38px 46px, transparent 46px 84px), linear-gradient(transparent 70%, rgba(90, 160, 70, .18)); --bd-c: #cfe8c2; }
.nt-tet { --bg-c: #c8202e; --bg-img: radial-gradient(circle at 12% 18%, rgba(255, 210, 90, .5) 0 3px, transparent 4px), radial-gradient(circle at 82% 30%, rgba(255, 210, 90, .5) 0 3px, transparent 4px), radial-gradient(circle at 30% 78%, rgba(255, 210, 90, .45) 0 2px, transparent 3px), radial-gradient(120% 80% at 50% 0, #e8414b, #b81424); --bd-c: #a0101d;
  --pl-bg: rgba(255, 244, 220, .95); --pl-ink: #5a1010; }
.nt-tet .nstat { color: #ffe9a8; }
.nt-night { --bg-c: #141a33; --bg-img: radial-gradient(circle at 15% 20%, #fff 0 1px, transparent 2px), radial-gradient(circle at 65% 12%, #fff 0 1.5px, transparent 2.5px), radial-gradient(circle at 85% 55%, #fff 0 1px, transparent 2px), radial-gradient(circle at 35% 45%, rgba(255, 255, 255, .7) 0 1px, transparent 2px), radial-gradient(circle at 80% 18%, #ffe9a8 0 16px, transparent 17px), linear-gradient(#1b2350, #0e1226); --bd-c: #2a335c;
  --pl-bg: rgba(40, 50, 90, .9); --pl-ink: #eef1ff; --pl-sub: #aab4e0; }
.nt-night .nstat { color: #eef1ff; }
.nt-lotus { --bg-c: #e6f6f1; --bg-img: radial-gradient(ellipse 46px 18px at 20% 82%, #5fb487 70%, transparent 72%), radial-gradient(ellipse 54px 20px at 78% 74%, #4fa477 70%, transparent 72%), radial-gradient(circle at 76% 66%, #ff8db0 0 9px, transparent 10px), radial-gradient(ellipse 40px 15px at 52% 92%, #5fb487 70%, transparent 72%), linear-gradient(#f1fbf7, #cfeee2); --bd-c: #bfe3d4; }
.nt-gold { --bg-c: #2a1d06; --bg-img: repeating-linear-gradient(45deg, rgba(255, 215, 110, .07) 0 10px, transparent 10px 20px), radial-gradient(120% 90% at 50% 0, #6a4a10, #2a1d06); --bd-c: #c99a2e;
  --pl-bg: rgba(255, 236, 180, .95); --pl-ink: #4a3200; }
.nt-gold .nstat { color: #ffe08a; }
.nt-suong { --bg-c: #eef3f6; --bg-img: radial-gradient(140px 34px at 20% 30%, rgba(255, 255, 255, .9) 40%, transparent 72%), radial-gradient(170px 40px at 80% 58%, rgba(255, 255, 255, .85) 40%, transparent 72%), radial-gradient(130px 30px at 35% 86%, rgba(255, 255, 255, .8) 40%, transparent 72%), linear-gradient(#f7fafc, #d9e4ea 70%, #c9d8cf); --bd-c: #d3dee5; }
.nt-tuyet_lapdong { --bg-c: #1d3a63; --bg-img: radial-gradient(circle at 14% 18%, #fff 0 2px, transparent 3px), radial-gradient(circle at 42% 9%, #fff 0 1.5px, transparent 2.5px), radial-gradient(circle at 72% 24%, #fff 0 2.5px, transparent 3.5px), radial-gradient(circle at 88% 46%, #fff 0 1.5px, transparent 2.5px), radial-gradient(circle at 26% 52%, rgba(255, 255, 255, .85) 0 2px, transparent 3px), radial-gradient(circle at 60% 66%, rgba(255, 255, 255, .8) 0 1.5px, transparent 2.5px), radial-gradient(130% 40% at 50% 112%, #ffffff 60%, #dcecff 64%, transparent 66%), linear-gradient(#24497c, #3d6fa8 70%, #8fb8e2); --bd-c: #9cc3ec;
  --pl-bg: rgba(235, 245, 255, .95); --pl-ink: #12305a; }
.nt-tuyet_lapdong .nstat { color: #eaf4ff; }

/* ---------- kiểu thẻ từ (NoituCatalog.CARDS): lớp .nc-<id> trên .chain ---------- */
.nc-round { --wc-r: 999px; }
.nc-note { --wc-r: 4px; --wc-bg: #fff6a8; --wc-bd: 0; --wc-sh: 2px 3px 0 rgba(0, 0, 0, .12); --wc-ink: #3a3200; --wc-link: #d2402a; --wc-font: "Comic Sans MS", "Chalkboard SE", "Segoe UI", sans-serif; }
.nc-note .wcard:nth-child(odd) { rotate: -1.5deg; } .nc-note .wcard:nth-child(even) { rotate: 1.2deg; background: #c8f0ff; }
.nc-chalk { --wc-r: 8px; --wc-bg: #2f4a3a; --wc-bd: 4px solid #a8763e; --wc-ink: #f4f4ec; --wc-link: #ffe27a; --wc-sh: 0 3px 0 rgba(0, 0, 0, .25); --wc-font: "Chalkboard SE", "Comic Sans MS", "Segoe UI", sans-serif; }
.nc-candy { --wc-r: 999px; --wc-bg: linear-gradient(#ff9ec4, #ff6fa6); --wc-bd: 3px solid #fff; --wc-ink: #fff; --wc-link: #fff36a; --wc-sh: 0 4px 0 #d64a86, 0 6px 10px rgba(214, 74, 134, .3); }
.nc-neon { --wc-r: 12px; --wc-bg: #10122a; --wc-bd: 2px solid #3cf2ff; --wc-ink: #e9fdff; --wc-link: #ff4fd8; --wc-sh: 0 0 10px rgba(60, 242, 255, .7), inset 0 0 8px rgba(60, 242, 255, .35); }
.nc-neon .wcard .link { text-shadow: 0 0 8px #ff4fd8; }
.nc-brush { --wc-r: 4px; --wc-bg: #fbf3df; --wc-bd: 0; --wc-ink: #1d140a; --wc-link: #b3121f; --wc-sh: inset 0 -3px 0 rgba(120, 80, 20, .15), 0 2px 6px rgba(0, 0, 0, .15); --wc-font: "Palatino", "Georgia", "Times New Roman", serif; }
.nc-brush .wcard { border-left: 6px solid #b3121f; }
.nc-len { --wc-r: 14px; --wc-bg: repeating-linear-gradient(90deg, rgba(255, 255, 255, .14) 0 3px, transparent 3px 7px), repeating-linear-gradient(0deg, rgba(0, 0, 0, .1) 0 2px, transparent 2px 6px), #c8323c; --wc-bd: 3px dashed #ffe1c8; --wc-ink: #fff8ee; --wc-link: #ffd84d; --wc-sh: 0 0 0 3px #c8323c, 0 4px 0 2px #8e1d25; }

/* ---------- xem thử trong cửa hàng: một khung bàn nhỏ dùng đúng lớp của bàn thật ---------- */
.mini { width: 100%; max-width: 170px; aspect-ratio: 4 / 3; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 5px; padding: 8px; border-radius: 12px; background: var(--bg-img, none), var(--bg-c, #fff); border: 1px solid var(--bd-c, #e3e5e8); pointer-events: none; overflow: hidden; }
.mini .wcard { font-size: 12px; opacity: 1; transform: none; }
.mini .wcard.last { transform: scale(1.1); margin: 2px 0; }
.buyprev .mini { max-width: 280px; }
.buyprev .mini .wcard { font-size: 15px; }

/* ---------- 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 .pr.gh:not(.g):empty, .item.owned .pr.gh { visibility: hidden; }
.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; }

/* ================= v2 (05/11/2026): drawn icons, play screen sized to the visible screen (above the keyboard) ================= */
.ntic { display: inline-flex; vertical-align: -0.22em; width: 1.25em; height: 1.25em; margin-right: .1em; }
.ntic .nti, .nti { width: 100%; height: 100%; display: block; }
.big .ntic { width: 1.5em; height: 1.5em; vertical-align: -0.35em; margin-right: .25em; }
.homegrid .ntic { width: 1.4em; height: 1.4em; }
.variant > i .ntic { width: 30px; height: 30px; margin: 0; }
.pl .av .nti { width: 100%; height: 100%; }
/* The play screen = the visible area under the app bar, so the input sits right above the on-screen keyboard. */
#scPlay { position: fixed; left: 0; right: 0; z-index: 5; max-width: 640px; margin: 0 auto; padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
  top: calc(var(--vvt, 0px) + var(--mb-top, 52px) + env(safe-area-inset-top)); height: calc(var(--vvh, 100dvh) - var(--mb-top, 52px) - env(safe-area-inset-top));
  display: flex; flex-direction: column; gap: 8px; animation: none; }
#scPlay.hidden { display: none !important; }
.arena { flex: 1; min-height: 0; padding: 8px; }
.chain { min-height: 0; padding-top: 8px; }
.players .pl { padding: 4px 8px 9px; }
.pl .av { width: 34px; height: 34px; }
.vs { width: 42px; height: 42px; font-size: 17px; }
.inrow input { font-size: 20px; padding: 12px 14px; }
.inrow.wait input { border-style: dashed; }
.inrow button { min-width: 72px; }
.ctl { gap: 8px; }
.ctl button { padding: 9px 8px; }
.pick { gap: 8px; }
.pick .addw { width: 100%; padding: 12px 14px; border: 0; border-radius: 14px; background: #00a862; color: #fff; font-size: 15px; font-weight: 800; }
.nstat { min-height: 20px; font-size: 14px; }
/* Mode cards: drawn icon on the left of the title + description. */
.big { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center; }
.big > .ntic { grid-row: 1 / span 2; width: 38px; height: 38px; margin: 0; }
.big > small { grid-column: 2; }
.chain { justify-content: flex-end; }
#btnSound .nti { width: 22px; height: 22px; display: block; }
.variant .ntic, .variant span.ntic { display: inline-flex; flex-direction: row; gap: 0; }

/* Event item tag (sdk/events.js) on shop cards. */
.item .evtag { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: linear-gradient(90deg, #5fb0ff, #b6e1ff); color: #0f2a4a; }
/* ===== 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: #e9dcb4; 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); }
.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; }
.hm-av .me-avemo .nti { width: 32px; height: 32px; }
#scQuest { display: flex; flex-direction: column; gap: 10px; }
#scQuest .big, #scQuest .today { margin: 0; }
#scQuest .note { margin: 0; font-size: 14px; }
/* Khung ngang thấp (điện thoại cầm ngang 844×390): logo + hình chính to hơn, gọn giữa thanh trên và 4 ô (như Người Que) */
@container (orientation: landscape) {
  .hm-stack { top: calc(max(10px, env(safe-area-inset-top)) + 58px); bottom: calc(max(10px, env(safe-area-inset-bottom)) + min(11cqw, 22cqh) + 22px); gap: 1.2cqh; }
  .hm-logo { max-height: 19cqh; max-width: 46cqw; }
  .hm-hero { max-height: 25cqh; max-width: 40cqw; }
  .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); }
}
/* Chấm báo Nhiệm vụ: một kiểu chấm trống cho mọi game (như Cờ Vây) */
#questDot { min-width: 16px; width: 16px; height: 16px; padding: 0; top: 6px; right: 10px; }
/* Thẻ thông tin trong hộp Nhiệm vụ cùng kiểu .qd-card của các game khác */
#scQuest .today { padding: 12px 16px; border: 1px solid var(--skin-card-line, #e3e5e8); border-radius: 12px; background: var(--skin-card, #f7f8f9); }
/* Home painting behind every screen (owner 19/11/2026, shared rule in sdk/game-light.css) */
body.mb-light { --mb-scene: url(/noitu/img/home-bg.webp); --mb-scene-on: ''; --muted: #4c4f54; }
.inrow button:disabled, .inrow input:disabled, .ctl button:disabled { opacity: .6; }
.item.locked { 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; }
