/* ================= Tinh Mắt Tìm Đồ — MonBlock (trang chủ, chọn map, cửa hàng, xếp hạng; màn chơi ở css/play.css) ================= */
: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; }
.muted { color: var(--muted); font-weight: 600; font-size: 13px; }
.note { color: var(--muted); font-size: 13px; line-height: 1.5; }

/* ---------- thẻ chế độ (hộp chọn kiểu chơi) ---------- */
.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; }

/* ---------- chọn ván ---------- */
.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: 26px; font-style: normal; line-height: 1; min-width: 34px; text-align: center; font-weight: 900; color: #335fff; }
.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; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { flex: 1; min-width: 0; padding: 11px 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); font-weight: 800; font-size: 14px; }
.seg button.on { border-color: #335fff; color: #335fff; box-shadow: inset 0 0 0 1px #335fff; }
.seg button:disabled { opacity: .4; cursor: default; }

/* ---------- 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.active { border-color: #335fff; }
.item b { font-size: 14px; }
.item .rar { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; }
.item .act { margin-top: auto; padding: 2px 8px; border-radius: 6px; font-size: 13px; font-weight: 800; color: var(--muted); }
.gem { color: #7fd8ff; }
.item .gboard { --size: 100%; min-width: 0; max-width: 132px; pointer-events: none; }
.buyprev { display: flex; justify-content: center; margin: 4px 0 8px; }
.buyprev .gboard { --size: 100%; min-width: 0; max-width: 220px; pointer-events: none; }

/* ---------- 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; }
.tabs button.on { border-color: #335fff; color: #335fff; }
.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: 34px; font-weight: 900; text-align: center; font-variant-numeric: tabular-nums; }
.dialog .rw { padding-left: 18px; line-height: 1.8; font-weight: 700; }
.dialog .tally { display: grid; grid-template-columns: 1fr auto auto; gap: 2px 14px; margin: 8px 0; font-size: 14px; }
.dialog .tally b { font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.dialog .tally .h { color: var(--muted); 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; color: #fff; 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; }

/* Limited event item tag (sdk/events.js) */
.evtag { display: inline-block; margin: 2px 0; padding: 1px 8px; border-radius: 999px; background: linear-gradient(90deg, #4fa8ff, #7a6bff); color: #fff; font-size: 11px; font-style: normal; font-weight: 800; }

/* ================= Tinh Mắt Tìm Đồ: khung nâu tối + vàng + ô kem (cùng ngôn ngữ với màn chơi) ================= */
.big .bt { display: none; }
.big-resume { border-left: 6px solid #ffcf5a; }

/* ---------- chọn map ---------- */
.maps { display: grid; gap: 12px; }
.mapcard { position: relative; display: block; width: 100%; height: 132px; padding: 0; border: 2px solid #4a3a2e; border-radius: 16px; overflow: hidden; background: #2d231c center 30% / cover no-repeat; text-align: left; color: #f6ecd8; }
.mapcard::before { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(36, 28, 22, .92) 0%, rgba(36, 28, 22, .55) 55%, rgba(36, 28, 22, .1) 100%); }
.mapcard > * { position: relative; }
.mapcard .mc-t { position: absolute; left: 14px; top: 12px; right: 90px; }
.mapcard .mc-t b { display: block; font-size: 19px; line-height: 1.2; }
.mapcard .mc-t small { display: block; margin-top: 3px; color: #d9c9ad; font-size: 13px; font-weight: 600; }
.mapcard .mc-s { position: absolute; left: 14px; bottom: 12px; display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 14px; color: #ffcf5a; }
.mapcard .mc-bar { width: 110px; height: 6px; border-radius: 9px; background: rgba(255, 255, 255, .25); overflow: hidden; }
.mapcard .mc-bar i { display: block; height: 100%; background: linear-gradient(90deg, #8bc34a, #ffcf5a); }
.mapcard .mc-go { position: absolute; right: 14px; bottom: 12px; padding: 7px 14px; border-radius: 999px; background: #ffcf5a; color: #3a2a1a; font-weight: 900; font-size: 14px; }
.mapcard.locked { filter: grayscale(.85) brightness(.75); }
.mapcard.locked .mc-go { background: rgba(255, 255, 255, .2); color: #f6ecd8; font-size: 12px; }

/* ---------- chọn màn ---------- */
.lvhead { display: flex; gap: 12px; align-items: center; margin: 4px 0 12px; padding: 10px; border-radius: 16px; background: #2d231c; color: #f6ecd8; }
.lvhead .th { width: 64px; height: 64px; flex: none; border-radius: 12px; background: #3a2d24 center 30% / cover no-repeat; border: 2px solid #5a4636; }
.lvhead b { display: block; font-size: 18px; }
.lvhead small { color: #d9c9ad; font-size: 13px; font-weight: 600; }
.levels { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.lvbtn { position: relative; aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 0; border: 2px solid #4a3a2e; border-radius: 14px; background: #2d231c; color: #f6ecd8; font-size: 20px; font-weight: 900; }
.lvbtn .stars { font-size: 12px; letter-spacing: 1px; color: #ffcf5a; }
.lvbtn .stars s { text-decoration: none; color: rgba(255, 255, 255, .22); }
.lvbtn small { font-size: 10px; font-weight: 700; color: #c9b79a; }
.lvbtn.cur { border-color: #ffcf5a; box-shadow: 0 0 0 2px rgba(255, 207, 90, .4); }
.lvbtn.locked { opacity: .45; }
.lvbtn.locked::after { content: ''; position: absolute; right: 7px; top: 7px; width: 14px; height: 14px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f6ecd8' stroke-width='2.4' stroke-linecap='round'%3E%3Crect x='5' y='11' width='14' height='9' rx='2'/%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E") center / contain no-repeat; }

/* ---------- cửa hàng vật phẩm ---------- */
.shop-top { flex-wrap: wrap; align-items: center; }
.shop-top .bag { margin-right: auto; display: flex; gap: 10px; font-size: 14px; font-weight: 800; }
.shop-top .bag span { display: inline-flex; align-items: center; gap: 4px; }
.bico { display: inline-block; width: 22px; height: 22px; vertical-align: middle; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pack { display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 12px 10px; border: 2px solid var(--line); border-radius: 16px; background: var(--panel); text-align: center; }
.pack .pic { position: relative; display: flex; justify-content: center; gap: 4px; padding: 14px 6px; border-radius: 12px; background: #2d231c; color: #ffcf5a; }
.pack .pic .bico { width: 40px; height: 40px; }
.pack .pic em { position: absolute; right: 8px; bottom: 6px; padding: 0 8px; border-radius: 999px; background: #ffcf5a; color: #3a2a1a; font-style: normal; font-weight: 900; font-size: 14px; line-height: 22px; }
.pack b { font-size: 15px; }
.pack small { color: var(--muted); font-size: 12px; line-height: 1.35; min-height: 32px; }
.pack .rar { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; }
.pack .pay { margin-top: auto; display: flex; flex-direction: column; gap: 3px; font-size: 14px; font-weight: 800; }
.pack .pay span { min-height: 20px; }
.pack .pay .none { visibility: hidden; }
.pack.poor { opacity: .6; }
.dialog .row-icons { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 6px 0 10px; }
.dialog .row-icons img { width: 52px; height: 52px; border-radius: 12px; background: #f6ecd8; padding: 3px; object-fit: cover; }
.dialog .stars-big { text-align: center; font-size: 40px; letter-spacing: 6px; color: #ffcf5a; line-height: 1.1; margin: 4px 0; }
.dialog .stars-big s { text-decoration: none; color: rgba(128, 128, 128, .35); }

/* ===== 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: #f6edd6; 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-dot-s { min-width: 16px; width: 16px; height: 16px; padding: 0; top: 6px; right: 10px; }
.hm-av .me-avemo { background: #3a2d24 center 30% / cover no-repeat; }
#scQuests { display: flex; flex-direction: column; gap: 10px; }
#scQuests .big { margin: 0; }
#scQuests .note { margin: 0; font-size: 14px; }
.qd-card { display: flex; flex-direction: column; gap: 4px; padding: 12px 16px; border: 1px solid #e3e5e8; border-radius: 12px; background: #f7f8f9; }
.qd-card b { font-size: 16px; }
.qd-card small { color: #606368; font-size: 14px; line-height: 1.4; }
.qd-done { margin: 4px 0 0; color: #00a862; font-size: 14px; font-weight: 800; }
/* Khung ngang thấp (điện thoại cầm ngang 844×390): logo + hình chính to hơn, gọn giữa thanh trên và 4 ô (như Người Que) */
@container (orientation: landscape) {
  #scHome .hm-bg { object-position: center 46%; }
  .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); }
}

/* Map picker under CHƠI: glass strip like the Cá Lớn level strip (one play mode, so CHƠI starts the next level) */
.hm-maps { flex: none; display: flex; align-items: center; gap: 6px; min-height: 44px; margin-top: 1cqh; padding: 0 16px 0 8px; border: 2px solid rgba(255, 255, 255, .55); border-radius: 999px; background: rgba(20, 60, 90, .78); color: #fff; font: 800 13px/40px system-ui, sans-serif; box-shadow: none; }
.hm-maps img { width: 32px; height: 32px; flex: none; object-fit: contain; }
.hm-maps:active { transform: scale(.96); }

/* 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; }
