/* เกมนามกิตก์ ธีม "โต๊ะนักสืบย้อนคำ" (/kitaka/<ด่าน>/study|play) — พี่น้องของห้องฉายอักขรวิธี
   พื้นครามยามค่ำ ทองเป็นสีเน้นของหน้า · สีอื่นมีความหมายเสมอ:
   --s-<สาธนะ> สีของสาธนะ ๗ (รูป ๓ ใช้สีของสาธนะชื่อเดียวกัน) · หมวดปัจจัยระบายด้วยสีของรูปที่ประกอบได้ (--g) */
@font-face { font-family: "Thunder Pali"; font-weight: 400 500; font-display: swap; src: url("/assets/fonts/thunder-pali/ThunderPali-400.woff2") format("woff2"); unicode-range: U+0E00-0E7F, U+25CC; }
@font-face { font-family: "Thunder Pali"; font-weight: 600 700; font-display: swap; src: url("/assets/fonts/thunder-pali/ThunderPali-700.woff2") format("woff2"); unicode-range: U+0E00-0E7F, U+25CC; }
@font-face { font-family: "Thunder Pali"; font-weight: 800 900; font-display: swap; src: url("/assets/fonts/thunder-pali/ThunderPali-800.woff2") format("woff2"); unicode-range: U+0E00-0E7F, U+25CC; }
@font-face { font-family: "Sriracha Local"; src: url("/assets/fonts/sriracha/Sriracha-Regular.ttf?v=20260806.1") format("truetype"); font-weight: 400; font-display: swap; }

:root {
	--bg: #0a0f1e; --bg2: #0f1630; --bg3: #151d3b; --panel: #121a36; --panel2: #18214a;
	--ink: #eef1fb; --ink2: #c9d0ea; --muted: #97a1c4; --dim: #6c76a0; --strong: #ffffff;
	--gold: #f4c95d; --gold2: #ffd978; --on-gold: #241a02; --quote: #ffe2a0;
	--line: color-mix(in srgb, var(--strong) 11%, transparent); --line2: color-mix(in srgb, var(--strong) 18%, transparent);
	--ok: #34d399; --bad: #fb7185; --bad-bg: color-mix(in srgb, #fb7185 16%, transparent);
	--s-kattu: #8f9bff; --s-kamma: #34d399; --s-bhava: #f472b6; --s-karana: #38bdf8;
	--s-sampadana: #c084fc; --s-apadana: #fb923c; --s-adhikarana: #2dd4bf; --s-tassila: #a3e635;
	--f-body: "Sarabun", system-ui, sans-serif; --f-pali: "Thunder Pali", "Sarabun", sans-serif; --f-hand: "Sriracha Local", "Sarabun", cursive;
	--r: 16px; --shadow: 0 18px 40px -24px rgba(0, 0, 0, .7);
	color-scheme: dark;
}
@media (prefers-color-scheme: light) {
	:root:not([data-theme="dark"]) {
		--bg: #f5f7fc; --bg2: #ffffff; --bg3: #eef2fb; --panel: #ffffff; --panel2: #f3f5fc;
		--ink: #18203d; --ink2: #34406a; --muted: #5d6890; --dim: #8790b3; --strong: #0b1230;
		--gold: #b7791f; --gold2: #a16207; --on-gold: #ffffff; --quote: #8a5a07;
		--ok: #047857; --bad: #be123c; --bad-bg: #ffe4e8;
		--s-kattu: #4338ca; --s-kamma: #047857; --s-bhava: #be185d; --s-karana: #0369a1;
		--s-sampadana: #7e22ce; --s-apadana: #c2410c; --s-adhikarana: #0f766e; --s-tassila: #4d7c0f;
		--shadow: 0 16px 34px -24px rgba(24, 32, 61, .45);
		color-scheme: light;
	}
}
:root[data-theme="light"] {
	--bg: #f5f7fc; --bg2: #ffffff; --bg3: #eef2fb; --panel: #ffffff; --panel2: #f3f5fc;
	--ink: #18203d; --ink2: #34406a; --muted: #5d6890; --dim: #8790b3; --strong: #0b1230;
	--gold: #b7791f; --gold2: #a16207; --on-gold: #ffffff; --quote: #8a5a07;
	--ok: #047857; --bad: #be123c; --bad-bg: #ffe4e8;
	--s-kattu: #4338ca; --s-kamma: #047857; --s-bhava: #be185d; --s-karana: #0369a1;
	--s-sampadana: #7e22ce; --s-apadana: #c2410c; --s-adhikarana: #0f766e; --s-tassila: #4d7c0f;
	--shadow: 0 16px 34px -24px rgba(24, 32, 61, .45);
	color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body.ktk-page { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 16px; line-height: 1.6; overflow-x: hidden; }
body.ktk-page.kt-study { padding-bottom: 84px; }
a { color: inherit; }
button { font: inherit; color: inherit; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.pali, .pali-nt { font-family: var(--f-pali); }
.pali { font-weight: 700; white-space: nowrap; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 8px; }

/* ── แถบบน ── */
.ktk-bar { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.ktk-bar-in { display: flex; align-items: center; gap: 12px; min-height: 56px; }
.ktk-back, .ktk-link, .theme-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line2); background: transparent; text-decoration: none; font-weight: 700; font-size: 14px; cursor: pointer; color: var(--ink2); white-space: nowrap; }
.ktk-back:hover, .ktk-link:hover, .theme-btn:hover { border-color: var(--gold); color: var(--strong); }
.ktk-bar-title { flex: 1; text-align: center; font-weight: 800; font-size: 15px; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ktk-bar-title i { color: var(--gold); }
.ktk-bar-actions { display: flex; gap: 8px; }
.theme-btn svg { width: 18px; height: 18px; }
.theme-btn .i-sun { display: none; }
:root[data-theme="light"] .theme-btn .i-sun { display: block; }
:root[data-theme="light"] .theme-btn .i-moon { display: none; }
@media (prefers-color-scheme: light) { :root:not([data-theme]) .theme-btn .i-sun { display: block; } :root:not([data-theme]) .theme-btn .i-moon { display: none; } }

/* ── hero: ภาพนักสืบอยู่ขวา ข้อความอยู่ฝั่งมืดทางซ้าย ── */
.hero { position: relative; isolation: isolate; overflow: hidden; border-bottom: 1px solid var(--line); background: var(--bg2); }
.hero-art { position: absolute; inset: 0 0 0 auto; width: min(68%, 900px); z-index: -2; background: var(--hero-img) 72% 46% / cover no-repeat;
	-webkit-mask-image: linear-gradient(90deg, transparent 0, #000 42%); mask-image: linear-gradient(90deg, transparent 0, #000 42%); }
.hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, var(--bg2) 0, color-mix(in srgb, var(--bg2) 92%, transparent) 38%, color-mix(in srgb, var(--bg2) 30%, transparent) 70%, transparent 100%), linear-gradient(0deg, var(--bg2) 0, transparent 38%); }
.hero-inner { padding: 40px 0 18px; max-width: 640px; }
.hero-compact .hero-inner { padding: 22px 0 8px; }
.eyebrow { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.pill { display: inline-flex; align-items: center; min-height: 28px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 800; white-space: nowrap; }
.pill-gold { background: var(--gold); color: var(--on-gold); }
.pill-ghost { border: 1px solid var(--line2); color: var(--ink2); background: color-mix(in srgb, var(--bg2) 70%, transparent); }
.hero h1 { margin: 0 0 10px; font-size: clamp(28px, 4.4vw, 44px); line-height: 1.22; font-weight: 800; color: var(--strong); }
.hero-compact h1 { font-size: clamp(24px, 3.4vw, 34px); margin-bottom: 4px; }
.hero h1 em { font-style: normal; color: var(--gold); }
.hero-quote { margin: 0 0 10px; font-family: var(--f-hand); font-size: clamp(17px, 2vw, 21px); line-height: 1.55; color: var(--quote); }
.hero-lead { margin: 0; color: var(--ink2); font-size: 16px; max-width: 600px; }
.hero-lead b { color: var(--strong); }

/* ── เส้นทางด่าน ── */
.path { display: flex; gap: 6px; overflow-x: auto; padding: 14px 0 18px; scrollbar-width: thin; }
.stop { flex: 1 0 98px; display: grid; justify-items: center; gap: 2px; padding: 8px 6px; min-height: 76px; border-radius: 14px; border: 1px solid var(--line); background: color-mix(in srgb, var(--panel) 82%, transparent); text-decoration: none; text-align: center; color: var(--ink2); transition: border-color .15s, transform .15s; }
a.stop:hover { border-color: var(--gold); transform: translateY(-1px); }
.stop-dot { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line2); font-weight: 800; font-size: 13px; }
.stop.done .stop-dot { border-color: var(--gold); color: var(--gold); }
.stop.now { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 14%, var(--panel)); color: var(--strong); }
.stop.now .stop-dot { background: var(--gold); color: var(--on-gold); border-color: var(--gold); }
.stop-name { font-weight: 800; font-size: 13px; line-height: 1.3; white-space: nowrap; }
.stop-zone { font-size: 11px; color: var(--dim); white-space: nowrap; }
.stop-stars { font-size: 12px; letter-spacing: 1px; color: var(--dim); }
.stop-stars .on { color: var(--gold); }

/* ── ช่วงเนื้อหา ── */
.sec { padding-top: 40px; }
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.sec-kick { font-size: 13px; font-weight: 800; letter-spacing: .04em; color: var(--gold); }
.sec h2 { margin: 2px 0 4px; font-size: clamp(22px, 2.8vw, 28px); line-height: 1.3; color: var(--strong); }
.sec h2 em { font-style: normal; color: var(--gold); }
.sec-sub { margin: 0; color: var(--muted); font-size: 15px; max-width: 720px; }
.note { max-width: 1120px; margin: 40px auto 0; padding: 0 20px; color: var(--dim); font-size: 13px; text-align: center; }
.ktk-error { margin-top: 24px; padding: 14px 18px; border-radius: 12px; background: var(--bad-bg); color: var(--bad); font-weight: 700; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.kw { color: var(--c); font-weight: 800; white-space: nowrap; }
.seg-hi { color: var(--gold); font-weight: 800; }

/* ── ป้าย (รูป สาธนะ ปัจจัย) ── */
.tag { display: inline-flex; align-items: center; min-height: 26px; padding: 0 10px; border-radius: 999px; font-size: 13px; font-weight: 800; white-space: nowrap; flex: none;
	color: var(--c, var(--ink2)); border: 1.5px solid color-mix(in srgb, var(--c, var(--ink2)) 55%, transparent); background: color-mix(in srgb, var(--c, var(--ink2)) 12%, transparent); }
.tag-group { color: var(--ink); border: 0; padding-left: 14px; position: relative; overflow: hidden; background: color-mix(in srgb, var(--ink) 7%, transparent); font-family: var(--f-pali); }
.tag-group::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--g); }

/* ── สวิตช์กลุ่ม ── */
.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.seg-b { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line2); background: var(--panel); cursor: pointer; font-weight: 700; font-size: 14px; color: var(--ink2); white-space: nowrap; }
.seg-b[aria-checked="true"] { border-color: var(--c, var(--gold)); background: color-mix(in srgb, var(--c, var(--gold)) 16%, var(--panel)); color: var(--strong); }
.seg-n { font-size: 12px; min-width: 22px; text-align: center; padding: 1px 6px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 9%, transparent); color: var(--muted); }
.recite-bar { display: flex; }
.switch { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line2); background: var(--panel); cursor: pointer; font-weight: 800; font-size: 14px; color: var(--ink2); white-space: nowrap; }
.switch[aria-pressed="true"] { background: var(--gold); color: var(--on-gold); border-color: var(--gold); }
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ══════ ลิ้นชักปัจจัย (ด่าน ๑) ══════ */
.board { display: grid; grid-template-columns: 1fr 320px; gap: 18px; align-items: start; }
.drawers { display: grid; gap: 10px; }
.drawer { position: relative; display: grid; grid-template-columns: 180px 1fr; gap: 6px 16px; align-items: center; padding: 14px 14px 14px 22px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); overflow: hidden; }
.drawer::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 7px; background: var(--g); }
.drawer-h { display: grid; gap: 0; }
.drawer-h b { font-size: 18px; color: var(--strong); white-space: nowrap; }
.drawer-h span { font-size: 13px; color: var(--muted); white-space: nowrap; }
.drawer-use { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.drawer-use .tag { font-size: 12px; min-height: 24px; padding: 0 8px; }
.drawer-cells { display: flex; flex-wrap: wrap; gap: 8px; }
.drawer-cells .cell { width: 78px; }
.cell { display: grid; place-items: center; min-height: 64px; border-radius: 12px; border: 1px solid var(--line2); background: var(--panel2); cursor: pointer; font-family: var(--f-pali); font-weight: 800; font-size: clamp(22px, 2.4vw, 28px); line-height: 1.3; color: var(--strong); transition: transform .12s, border-color .12s, opacity .2s; }
.cell small { display: block; font-family: var(--f-body); font-size: 11px; font-weight: 700; color: var(--dim); line-height: 1.2; }
.cell:hover { transform: translateY(-2px); border-color: var(--gold); }
.cell[aria-pressed="true"] { border-color: var(--gold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 30%, transparent); }
.board.spot .cell:not(.lit) { opacity: .28; }
.board.hide .cell .cv { filter: blur(7px); }
.board.hide .cell.shown .cv { filter: none; }
.legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.leg { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line2); background: var(--panel); cursor: pointer; font-weight: 700; font-size: 14px; color: var(--ink2); white-space: nowrap; }
.leg i { width: 14px; height: 14px; border-radius: 4px; background: var(--g); flex: none; }
.leg b { color: var(--muted); font-size: 13px; }
.leg[aria-pressed="true"] { border-color: var(--gold); color: var(--strong); background: color-mix(in srgb, var(--gold) 12%, var(--panel)); }

/* ── แผงรายละเอียด ── */
.detail { position: sticky; top: 76px; padding: 18px; }
.detail .big { font-family: var(--f-pali); font-weight: 800; font-size: 48px; line-height: 1.3; color: var(--strong); text-align: center; }
.detail .d-sub { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 4px 0 12px; }
.facts { margin: 0; display: grid; gap: 10px; }
.facts > div { display: grid; grid-template-columns: 76px 1fr; gap: 8px; font-size: 14px; }
.facts dt { color: var(--muted); font-weight: 700; }
.facts dd { margin: 0; color: var(--ink); }
.facts dd b { color: var(--strong); }
.hint { margin: 12px 0 0; font-size: 13px; color: var(--dim); }
.d-words { display: grid; gap: 6px; margin-top: 4px; }
.wl { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.wl .pali { font-size: 16px; color: var(--s-kattu); }
.wl > span:last-child { color: var(--muted); }

/* ══════ รายการคำละบรรทัด (ธาตุ · ศัพท์) ══════ */
.lex { display: grid; gap: 0; }
.lex-row { display: grid; grid-template-columns: minmax(78px, 110px) minmax(110px, 1fr) minmax(130px, 1.2fr) auto; gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); min-height: 52px; cursor: pointer; background: transparent; border-left: 0; border-right: 0; border-top: 0; text-align: left; width: 100%; }
.lex-row:hover { background: color-mix(in srgb, var(--gold) 6%, transparent); }
.lex-row[aria-expanded="true"] { background: color-mix(in srgb, var(--gold) 9%, transparent); }
.lex-d { font-family: var(--f-pali); font-weight: 800; font-size: 19px; color: var(--s-kattu); white-space: nowrap; }
.lex-m { color: var(--muted); font-size: 15px; }
.lex-v { font-family: var(--f-pali); font-weight: 700; font-size: 18px; white-space: nowrap; color: var(--ink); }
.lex-v em { font-style: normal; color: var(--s-kamma); text-decoration: underline 3px; text-underline-offset: 4px; }
.lex-why { grid-column: 1 / -1; margin: 0; font-size: 14px; color: var(--ink2); padding: 0 0 4px; }
.lex.spot .lex-row:not(.lit) { opacity: .3; }
.lex-head { display: grid; grid-template-columns: minmax(78px, 110px) minmax(110px, 1fr) minmax(130px, 1.2fr) auto; gap: 12px; padding: 8px 14px; font-size: 13px; font-weight: 800; color: var(--dim); border-bottom: 1px solid var(--line2); }
.trap-ico { color: var(--s-apadana); }
.lex.hide .lex-m { filter: blur(6px); }
.lex.hide .lex-row.shown .lex-m { filter: none; }

/* ══════ การ์ดกฎ (ใช้หลายด่าน) ══════ */
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.cards-2 { grid-template-columns: repeat(2, 1fr); }
.cards-3 { grid-template-columns: repeat(3, 1fr); }
.card { position: relative; padding: 16px 16px 14px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; }
.card.hued::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--c); }
.card-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.card-h h3 { margin: 0; font-size: 18px; color: var(--strong); white-space: nowrap; }
.card-k { font-size: 13px; font-weight: 800; color: var(--gold); white-space: nowrap; }
.card p { margin: 6px 0 0; font-size: 15px; color: var(--ink2); }
.card .formula { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--gold) 9%, transparent); border: 1px dashed color-mix(in srgb, var(--gold) 45%, transparent); font-size: 14px; color: var(--ink); }
.card .formula b:first-child { color: var(--gold); margin-right: 6px; }
.dirs { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.flow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; counter-reset: f; }
.fstep { position: relative; padding: 14px 14px 12px 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.fnum { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--gold); color: var(--on-gold); font-weight: 800; font-size: 14px; margin-bottom: 6px; }
.fstep b { display: block; color: var(--strong); font-size: 16px; }
.fstep span { display: block; color: var(--muted); font-size: 14px; margin-top: 2px; }
.warn { margin-top: 14px; padding: 14px 16px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--s-apadana) 50%, transparent); background: color-mix(in srgb, var(--s-apadana) 9%, var(--panel)); font-size: 15px; color: var(--ink); }
.warn b { color: var(--s-apadana); }

/* ══════ ชั้นรอย (ด่าน ๓) ══════ */
.tiers { display: grid; gap: 10px; }
.tier { display: grid; grid-template-columns: 210px 1fr; gap: 14px; align-items: center; padding: 12px 14px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); }
.tier-h { display: flex; align-items: center; gap: 10px; }
.tier-lens { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; flex: none; border: 2px solid var(--gold); color: var(--gold); font-size: 16px; position: relative; }
.tier-lens::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--gold); opacity: var(--clear); }
.tier-h b { color: var(--strong); font-size: 16px; line-height: 1.3; }
.tier-h small { display: block; color: var(--dim); font-size: 12px; font-weight: 700; }
.tier-cells { display: flex; flex-wrap: wrap; gap: 8px; }
.tcell { display: inline-flex; align-items: center; gap: 8px; min-height: 52px; padding: 4px 14px 4px 4px; border-radius: 12px; border: 1px solid var(--line2); background: var(--panel2); cursor: pointer; }
.tcell .pv { display: grid; place-items: center; min-width: 52px; height: 44px; padding: 0 8px; border-radius: 9px; background: color-mix(in srgb, var(--ink) 6%, transparent); position: relative; overflow: hidden; font-family: var(--f-pali); font-weight: 800; font-size: 22px; color: var(--strong); white-space: nowrap; }
.tcell .pv::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--g); }
.tcell .mk { font-family: var(--f-pali); font-weight: 700; font-size: 15px; color: var(--gold); white-space: nowrap; }
.tcell[aria-pressed="true"] { border-color: var(--gold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 28%, transparent); }
.trace { margin-top: 14px; display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; padding: 18px; }
.trace-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.trace-head .big { font-family: var(--f-pali); font-weight: 800; font-size: 40px; line-height: 1.3; color: var(--strong); }
.trace-trail { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 12px 0; font-family: var(--f-pali); font-weight: 800; font-size: 22px; line-height: 1.4; }
.trace-trail .t-src { color: var(--s-kattu); white-space: nowrap; }
.trace-trail .t-aff { color: var(--gold); white-space: nowrap; }
.trace-trail .t-op { color: var(--dim); font-family: var(--f-body); font-weight: 700; }
.trace-trail .t-out { color: var(--strong); white-space: nowrap; }
.trace-trail .t-out b { color: var(--gold); text-decoration: underline 3px; text-underline-offset: 5px; }
.trace dl { margin: 0; display: grid; gap: 10px; }
.trace dt { font-size: 13px; font-weight: 800; color: var(--gold); }
.trace dd { margin: 0; font-size: 15px; color: var(--ink2); }
.trace .ex-words { display: flex; flex-wrap: wrap; gap: 6px 10px; }
.trace .ex-words .pali { font-size: 17px; color: var(--s-kattu); }
.bank-words { display: grid; gap: 8px; }
.bank-words .wl .pali { font-size: 17px; }

/* ══════ ★ แถบรูปวิเคราะห์ใต้แว่นขยาย (ปฏิสัมพันธ์ประจำชุด) ══════ */
.vik { position: relative; padding: 14px 16px 12px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.vik-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; white-space: normal; font-size: clamp(18px, 2vw, 21px); line-height: 1.5; }
.vik-chip { display: inline-block; padding: 2px 10px; border-radius: 10px; border: 1px solid var(--line2); background: var(--panel2); color: var(--ink); white-space: nowrap; transition: background .25s, color .25s, border-color .25s, box-shadow .25s; }
.vik-chip.name { color: var(--strong); border-style: dashed; }
.vik-arrow { color: var(--dim); font-family: var(--f-body); font-weight: 700; }
.vik.lit .vik-chip.sig { background: color-mix(in srgb, var(--c) 22%, var(--panel)); border-color: var(--c); color: var(--strong); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 25%, transparent), 0 0 22px -4px var(--c); }
.vik.lit .vik-chip.name { border-style: solid; border-color: var(--c); color: var(--c); }
.vik-tags, .vik-why { display: none; }
.vik.lit .vik-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; animation: drop .35s ease-out; }
.vik.lit .vik-why { display: block; margin: 8px 0 0; font-size: 14px; color: var(--muted); }
.vik-why .pali { color: var(--c); font-size: 15px; }
.vik-lens { position: relative; margin-top: 10px; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line2); background: var(--panel2); cursor: pointer; font-size: 13px; font-weight: 800; color: var(--ink2); white-space: nowrap; }
.vik-lens::before { content: ""; position: absolute; inset: -5px; }   /* ขยายพื้นที่แตะเป็น ≥ ๔๔px */
.vik-lens:hover { border-color: var(--gold); color: var(--strong); }
.vik-lens[aria-pressed="true"] { color: var(--gold); border-color: var(--gold); }
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.viks { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.vik-card { display: grid; gap: 6px; }
.vik-card .vc-word { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.vik-card .vc-word .pali { font-size: 18px; color: var(--strong); }
.vik-trap { margin: 0; font-size: 14px; color: var(--ink2); padding: 8px 12px; border-radius: 10px; background: color-mix(in srgb, var(--s-apadana) 9%, transparent); border-left: 3px solid var(--s-apadana); }
.vik-trap b { color: var(--s-apadana); }

/* ── คำแปลระบายตามหน้าที่ ── */
.trans { margin: 8px 0 0; font-size: 16px; line-height: 1.8; color: var(--ink); }
.tw { white-space: nowrap; }
.tw-add { color: var(--muted); }
.tw-joint { color: var(--gold); font-weight: 800; }
.tw-name { color: var(--c); font-weight: 800; }
.hide-trans .trans { filter: blur(7px); cursor: pointer; }
.hide-trans .shown .trans { filter: none; }

/* ══════ สาธนะ ๗ มุม (ด่าน ๔) ══════ */
.roles-figure { max-width: 760px; margin: 0 auto 16px; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); background: var(--panel); }
.roles-figure img { display: block; width: 100%; height: auto; }
.roles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.role { display: grid; align-content: start; gap: 6px; min-height: 140px; padding: 14px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); border-top: 5px solid var(--c); cursor: pointer; text-align: left; }
.role:hover { transform: translateY(-2px); }
.role[aria-pressed="true"] { box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 40%, transparent); border-color: var(--c); }
.role .r-role { font-size: 14px; color: var(--muted); font-weight: 700; }
.role .r-name { font-size: 18px; font-weight: 800; color: var(--c); white-space: nowrap; }
.role .r-trans { font-size: 15px; color: var(--strong); font-weight: 700; }
.role .r-n { font-size: 12px; color: var(--dim); font-weight: 700; }
.role-focus { margin-top: 14px; padding: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.role-focus h3 { margin: 0 0 4px; font-size: 22px; color: var(--c); }
.role-focus .rf-def { font-size: 15px; color: var(--ink); padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--c) 8%, transparent); border-left: 4px solid var(--c); margin: 8px 0; }
.role-focus .rf-ex { display: grid; gap: 4px; font-size: 15px; }
.role-focus .rf-ex .pali { color: var(--c); font-size: 17px; }
.rups { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.rup { padding: 14px; border-radius: var(--r); border: 1px solid var(--line); background: var(--panel); border-left: 5px solid var(--c); }
.rup b { display: block; font-size: 18px; color: var(--c); }
.rup span { display: block; font-size: 14px; color: var(--muted); }

/* ══════ ตาราง (ตัวสังเกต · โครงแปล) ══════ */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 15px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.tbl th { text-align: left; padding: 10px 14px; font-size: 13px; color: var(--dim); font-weight: 800; border-bottom: 1px solid var(--line2); background: var(--panel2); white-space: nowrap; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--ink); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .pali { font-size: 17px; }
.tbl .seg-hi { color: var(--c, var(--gold)); }
.tbl-wrap { overflow-x: auto; border-radius: var(--r); }
.dec-row td:first-child { border-left: 5px solid var(--c); }

/* ── แบบฟอร์ม (ด่าน ๖) ── */
.form-tabs { margin-bottom: 14px; }
.pattern { padding: 16px 18px; }
.pattern .p-k { font-size: 13px; font-weight: 800; color: var(--gold); }
.pattern .p-body { margin: 6px 0; font-size: 18px; font-weight: 700; color: var(--strong); line-height: 1.7; }
.pattern .p-note { font-size: 14px; color: var(--muted); }
.slots { margin-top: 14px; display: grid; gap: 8px; counter-reset: s; }
.slot { display: grid; grid-template-columns: 34px minmax(140px, 220px) 1fr; gap: 12px; align-items: start; padding: 12px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); cursor: pointer; text-align: left; width: 100%; }
.slot .s-n { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: color-mix(in srgb, var(--gold) 18%, transparent); color: var(--gold); font-weight: 800; font-size: 14px; }
.slot .s-a { font-weight: 800; color: var(--strong); font-size: 16px; }
.slot .s-w { color: var(--muted); font-size: 14px; }
.slots.hide .slot .s-a { filter: blur(7px); }
.slots.hide .slot.shown .s-a { filter: none; }
.form-vik { margin-top: 14px; }

/* ══════ การ์ดพลิก (ด่าน ๑๐) ══════ */
.deck-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.def-meter { display: grid; gap: 6px; min-width: 220px; }
.def-mtxt { font-size: 14px; color: var(--ink2); }
.def-bar { height: 8px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 10%, transparent); overflow: hidden; }
.def-bar span { display: block; height: 100%; background: var(--gold); border-radius: 99px; transition: width .3s; }
.deck { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.dcard { perspective: 1200px; min-height: 230px; }
.dcard-in { position: relative; width: 100%; height: 100%; min-height: 230px; transition: transform .5s; transform-style: preserve-3d; }
.dcard.flip .dcard-in { transform: rotateY(180deg); }
.dface { position: absolute; inset: 0; padding: 16px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); border-top: 5px solid var(--c); backface-visibility: hidden; -webkit-backface-visibility: hidden; display: flex; flex-direction: column; gap: 6px; overflow: hidden; }
.dfront { align-items: center; justify-content: center; text-align: center; cursor: pointer; }
.dback { transform: rotateY(180deg); overflow-y: auto; cursor: pointer; }
.dfront .dw { font-family: var(--f-pali); font-size: 34px; font-weight: 800; color: var(--strong); line-height: 1.3; white-space: nowrap; }
.dfront .dm { color: var(--muted); font-size: 15px; }
.dfront .dhint { position: absolute; left: 12px; right: 12px; bottom: 12px; font-size: 12px; color: var(--dim); }
.dback .vik-line { font-size: 17px; }
.dback .trans { font-size: 14px; margin: 0; }
.dback .dtags { display: flex; flex-wrap: wrap; gap: 5px; }
.dback .dhow { font-size: 13px; color: var(--muted); margin: 0; }
.dbadge { position: absolute; top: 10px; display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 800; }
.dbadge.ex { left: 12px; color: var(--gold); }
.dbadge.ok { right: 12px; color: var(--ok); }
.dknown { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; margin-top: 8px; border-radius: 12px; border: 1px solid var(--line2); background: var(--panel); cursor: pointer; font-weight: 800; font-size: 14px; color: var(--ink2); width: 100%; }
.dknown[aria-pressed="true"] { border-color: var(--ok); color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, var(--panel)); }
.deck-empty { padding: 30px; text-align: center; color: var(--muted); border: 1px dashed var(--line2); border-radius: var(--r); }

/* ══════ คำตอบสนามหลวง ══════ */
.qa-list { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.qa { padding: 16px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); }
.qa-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; justify-content: space-between; margin-bottom: 6px; }
.qa-topic { font-size: 12px; font-weight: 800; padding: 2px 10px; border-radius: 99px; background: color-mix(in srgb, var(--gold) 16%, transparent); color: var(--gold); white-space: nowrap; }
.qa-exams { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 700; }
.qa-exams i { color: var(--gold); }
.qa-year { padding: 0 6px; border-radius: 6px; background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink2); }
.qa-q { margin: 0 0 8px; font-weight: 800; color: var(--strong); font-size: 15px; }
.qa-a { display: block; width: 100%; text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); cursor: pointer; font-size: 15px; line-height: 1.75; color: var(--ink); white-space: pre-line; }
.qa-list.hide .qa-a { color: transparent; text-shadow: 0 0 10px color-mix(in srgb, var(--ink) 55%, transparent); }
.qa-list.hide .qa-a .kw { color: transparent; }
.qa-list.hide .qa-a.shown, .qa-list.hide .qa-a.shown .kw { color: var(--ink); text-shadow: none; }
.qa-list.hide .qa-a.shown .kw { color: var(--c); }

/* ── แถบล่าง ── */
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
.dock .wrap { display: flex; gap: 10px; justify-content: flex-end; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 999px; font-weight: 800; font-size: 15px; text-decoration: none; cursor: pointer; border: 1px solid transparent; white-space: nowrap; }
.btn-main { background: var(--gold); color: var(--on-gold); }
.btn-main:hover { background: var(--gold2); }
.btn-ghost { border-color: var(--line2); background: var(--panel); color: var(--ink2); }
.btn-ghost:hover { border-color: var(--gold); color: var(--strong); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ══════════ เกม ══════════ */
.play-wrap { max-width: 880px; padding-top: 18px; padding-bottom: 60px; }
.intro { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; padding: 22px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); }
.intro-h { margin: 4px 0 10px; font-size: 24px; color: var(--strong); }
.rules { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rules li { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; color: var(--ink2); }
.rules i { color: var(--gold); width: 18px; margin-top: 4px; text-align: center; }
.intro-r { display: grid; align-content: start; justify-items: center; gap: 10px; padding: 16px; border-radius: 14px; background: var(--panel2); text-align: center; }
.intro-best-l { font-size: 13px; color: var(--dim); font-weight: 700; }
.intro-best { color: var(--strong); font-size: 18px; }
.intro-plays { font-size: 13px; color: var(--muted); }
.btn-start { width: 100%; min-height: 54px; font-size: 17px; }
.intro-r .btn-ghost { width: 100%; }
.intro-bank { margin-top: 12px; display: grid; gap: 6px; }
.intro-bank > span { font-size: 13px; color: var(--muted); font-weight: 700; }
.stars { display: flex; gap: 4px; justify-content: center; font-size: 28px; color: var(--dim); }
.stars-big { font-size: 40px; }
.stars .on { color: var(--gold); animation: pop .4s var(--d, 0s) both; }
@keyframes pop { 0% { transform: scale(.3); opacity: 0; } 70% { transform: scale(1.2); opacity: 1; } 100% { transform: none; } }
.play-toggles { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px; }
.ptog { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line2); background: transparent; cursor: pointer; font-size: 14px; font-weight: 700; color: var(--muted); }
.ptog[aria-pressed="true"] { color: var(--ink); border-color: var(--gold); }

.hud { display: grid; grid-template-columns: auto 1fr auto auto; gap: 14px; align-items: center; padding: 10px 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); margin-bottom: 12px; }
.hud-hearts { display: flex; gap: 2px; font-size: 22px; color: var(--bad); }
.heart.lost { color: var(--dim); opacity: .4; }
.hud-prog { display: grid; gap: 4px; }
.hud-n { font-size: 13px; color: var(--muted); font-weight: 700; }
.hud-bar { height: 7px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 10%, transparent); overflow: hidden; }
.hud-bar span { display: block; height: 100%; background: var(--gold); border-radius: 99px; transition: width .3s; }
.hud-score { display: grid; justify-items: end; line-height: 1.2; }
.hud-score b { font-size: 20px; color: var(--strong); }
.hud-score span, .hud-combo span { font-size: 11px; color: var(--dim); font-weight: 700; }
.hud-combo { display: grid; grid-template-columns: auto auto; column-gap: 6px; align-items: center; justify-items: start; color: var(--dim); }
.hud-combo i { grid-row: span 2; font-size: 20px; }
.hud-combo b { font-size: 16px; }
.hud-combo.hot { color: var(--s-apadana); }
.hud-combo.hot i { animation: flame .8s infinite alternate; }
@keyframes flame { to { transform: scale(1.18) rotate(-6deg); } }

.qcard { position: relative; padding: 20px 20px 18px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); }
.qcard.gold { border-color: var(--gold); box-shadow: 0 0 0 2px color-mix(in srgb, var(--gold) 35%, transparent), var(--shadow); }
.qcard.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.qtop { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.qtag, .qgold, .qchain { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 0 10px; border-radius: 999px; font-size: 13px; font-weight: 800; white-space: nowrap; }
.qtag { background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink2); }
.qgold { background: var(--gold); color: var(--on-gold); }
.qchain { border: 1px solid var(--gold); color: var(--gold); }
.qtimer { height: 6px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 9%, transparent); overflow: hidden; margin-bottom: 14px; }
.qtimer span { display: block; height: 100%; background: var(--gold); transform-origin: left; transition: transform .08s linear; }
.qtimer.low span { background: var(--bad); }
.qprompt { display: grid; justify-items: center; gap: 8px; text-align: center; margin-bottom: 6px; }
.qbig { font-family: var(--f-pali); font-weight: 800; font-size: clamp(40px, 7vw, 60px); line-height: 1.3; color: var(--strong); white-space: nowrap; }
.qmean { font-size: 16px; color: var(--muted); }
.qmean b { color: var(--ink); }
.qtext { margin: 0; font-size: 18px; font-weight: 700; color: var(--strong); max-width: 680px; }
.qtext-long { font-size: 16px; font-weight: 600; text-align: left; line-height: 1.75; color: var(--ink); }
.qprompt .vik { width: 100%; text-align: left; }
.qprompt .pattern { width: 100%; text-align: left; box-shadow: none; }
.qask { margin: 14px 0 10px; text-align: center; font-weight: 800; font-size: 17px; color: var(--gold); }
.qtrail { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 4px 0 0; }
.qtrail-i { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 10px; border-radius: 999px; font-size: 14px; font-weight: 700; }
.qtrail-i.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.qtrail-i.bad { background: var(--bad-bg); color: var(--bad); }

.choices { display: grid; gap: 10px; }
.ch-two { grid-template-columns: repeat(var(--n, 2), 1fr); }
.ch-grid { grid-template-columns: 1fr 1fr; }
.ch-list { grid-template-columns: 1fr; }
.ch-letters { grid-template-columns: repeat(4, 1fr); }
.ch-coins { grid-template-columns: repeat(4, 1fr); }
.ch-chips { display: flex; flex-wrap: wrap; justify-content: center; }
.ch-multi { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); }
.choice { position: relative; display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 10px 14px; border-radius: 14px; border: 1.5px solid var(--line2); background: var(--panel2); cursor: pointer; text-align: left; transition: border-color .12s, transform .12s, background .12s; }
.choice:hover:not([disabled]) { border-color: var(--gold); transform: translateY(-1px); }
.choice[disabled] { cursor: default; }
.ckey { display: grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 8px; background: color-mix(in srgb, var(--ink) 9%, transparent); font-size: 13px; font-weight: 800; color: var(--muted); }
.cbody { display: grid; gap: 2px; min-width: 0; }
.ctext { font-weight: 800; font-size: 16px; color: var(--strong); line-height: 1.45; }
.ctext.pali { font-size: 20px; }
.csub { font-size: 13px; color: var(--muted); }
.ch-list .ctext { font-weight: 700; font-size: 15px; }
.ch-two .choice, .ch-coins .choice, .ch-letters .choice { justify-content: center; text-align: center; flex-direction: column; gap: 4px; min-height: 72px; }
.ch-two .choice { border-top: 5px solid var(--c, var(--line2)); }
.ch-letters .ctext.pali, .ch-coins .ctext { font-size: clamp(22px, 3.4vw, 28px); }
.ch-letters .ckey, .ch-coins .ckey { position: absolute; left: 8px; top: 8px; }
.ch-chips .choice { min-height: 52px; padding: 8px 16px; }
.ch-chips .ctext.pali { font-size: 20px; }
.ch-multi .choice { justify-content: center; min-height: 58px; padding: 6px; }
.ch-multi .ctext.pali { font-size: 22px; }
.ch-multi .choice[aria-pressed="true"] { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 16%, var(--panel2)); }
.choice.is-right { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, var(--panel2)); }
.choice.is-right .ctext { color: var(--ok); }
.choice.is-wrong { border-color: var(--bad); background: var(--bad-bg); }
.choice.is-wrong .ctext { color: var(--bad); }
.choice.is-missed { border-style: dashed; border-color: var(--ok); }
.multi-go, .arr-go { display: flex; gap: 10px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.pac-groups { display: grid; gap: 10px; }
.pac-g-h { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 800; color: var(--muted); margin-bottom: 6px; }
.pac-g-h i { width: 12px; height: 12px; border-radius: 3px; background: var(--g); }

/* ── เรียงชิป ── */
.tray, .bankbox { display: flex; flex-wrap: wrap; gap: 8px; min-height: 64px; padding: 12px; border-radius: 14px; }
.tray { border: 2px dashed var(--line2); background: color-mix(in srgb, var(--gold) 5%, transparent); }
.tray.is-ok { border-color: var(--ok); border-style: solid; }
.tray.is-bad { border-color: var(--bad); border-style: solid; }
.tray-empty { color: var(--dim); font-size: 14px; align-self: center; }
.bankbox { margin-top: 10px; background: color-mix(in srgb, var(--ink) 4%, transparent); }
.tok { display: inline-flex; align-items: center; min-height: 46px; padding: 6px 14px; border-radius: 12px; border: 1.5px solid var(--line2); background: var(--panel2); cursor: pointer; font-size: 16px; font-weight: 700; color: var(--strong); white-space: nowrap; }
.tok.pali { font-size: 19px; font-weight: 800; }
.tok:hover:not([disabled]) { border-color: var(--gold); }
.tray .tok { border-color: color-mix(in srgb, var(--gold) 60%, transparent); }
.tok.ok { border-color: var(--ok); color: var(--ok); }
.tok.bad { border-color: var(--bad); color: var(--bad); background: var(--bad-bg); text-decoration: line-through; }

.qexp { margin-top: 14px; }
.qexp:empty { display: none; }
.qexp-h { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 17px; }
.qexp-h.ok { color: var(--ok); }
.qexp-h.bad { color: var(--bad); }
.qexp-t { margin: 8px 0 0; font-size: 15px; color: var(--ink2); }
.qexp .vik, .qexp .pattern { margin-top: 10px; }
.qexp .answer-line { margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--ok) 9%, transparent); border-left: 4px solid var(--ok); font-size: 15px; color: var(--ink); }
.qnext-bar { display: flex; justify-content: center; margin-top: 14px; }
.qnext-bar:empty { display: none; }
.btn-next { min-width: 220px; }

.result { padding: 26px 22px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); text-align: center; }
.result.win { border-color: var(--gold); }
.result-h { margin: 4px 0 8px; font-size: 30px; color: var(--strong); }
.result-note { color: var(--muted); font-size: 14px; }
.result-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 18px 0; }
.rstat { padding: 12px 8px; border-radius: 12px; background: var(--panel2); display: grid; gap: 2px; }
.rstat b { font-size: 22px; color: var(--strong); }
.rstat span { font-size: 13px; color: var(--muted); }
.rstat.best b { color: var(--gold); }
.result-acts { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.miss { margin-top: 18px; }
.miss-h { font-size: 18px; color: var(--strong); margin: 0 0 10px; }
.miss-i { display: grid; gap: 6px; padding: 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); margin-bottom: 10px; }
.miss-i .miss-big { font-family: var(--f-pali); font-size: 22px; font-weight: 800; color: var(--strong); }
.miss-t { margin: 0; color: var(--ink2); font-size: 15px; font-weight: 700; }
.miss-e { margin: 0; color: var(--muted); font-size: 14px; }

.burst { position: fixed; z-index: 60; pointer-events: none; width: 0; height: 0; }
.burst i { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); animation: fly .8s ease-out forwards; transform: rotate(var(--a)) translateX(0); }
@keyframes fly { to { transform: rotate(var(--a)) translateX(var(--d)); opacity: 0; } }
.burst-pts { position: absolute; left: 50%; top: -18px; transform: translateX(-50%); font-weight: 800; font-size: 20px; color: var(--gold); white-space: nowrap; animation: rise .9s ease-out forwards; }
@keyframes rise { to { transform: translate(-50%, -40px); opacity: 0; } }

/* ── จอแคบ ── */
@media (max-width: 980px) {
	.board { grid-template-columns: 1fr; }
	.detail { position: static; }
	.roles { grid-template-columns: repeat(2, 1fr); }
	.flow { grid-template-columns: 1fr 1fr; }
	.trace, .role-focus { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
	.wrap { padding: 0 16px; }
	.hero-art { width: 100%; opacity: .5; background-position: 78% 40%; -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 60%); mask-image: linear-gradient(90deg, transparent 0, #000 60%); }
	.hero-inner { padding-top: 26px; }
	.ktk-bar-title { font-size: 14px; }
	.ktk-back span, .ktk-link span, #theme-label { display: none; }
	.drawer { grid-template-columns: 1fr; padding-left: 20px; }
	.drawer-h { grid-template-columns: auto auto; justify-content: space-between; align-items: baseline; }
	.drawer-cells .cell { width: calc(25% - 6px); }
	.dirs, .cards-2, .cards-3, .qa-list, .rups { grid-template-columns: 1fr; }
	.tier { grid-template-columns: 1fr; }
	.lex-row, .lex-head { grid-template-columns: 1fr auto; gap: 2px 10px; }
	.lex-head { display: none; }
	.lex-m { grid-column: 1 / -1; order: 3; }
	.lex-v { order: 2; }
	.slot { grid-template-columns: 30px 1fr; }
	.slot .s-w { grid-column: 2; }
	.viks { grid-template-columns: 1fr; }
	.intro { grid-template-columns: 1fr; padding: 18px; }
	.hud { grid-template-columns: auto 1fr auto; }
	.hud-combo { display: none; }
	.qcard { padding: 16px 14px; }
	.ch-grid { grid-template-columns: 1fr; }
	.tbl thead { display: none; }
	.tbl, .tbl tbody, .tbl tr, .tbl td { display: block; }
	.tbl tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
	.tbl tr:last-child { border-bottom: 0; }
	.tbl td { border: 0; padding: 2px 14px; }
	.dec-row { border-left: 5px solid var(--c); }
	.dec-row td:first-child { border-left: 0; font-weight: 700; }
	.deck { grid-template-columns: 1fr 1fr; gap: 10px; }
	.dcard, .dcard-in { min-height: 190px; }
	.dfront .dw { font-size: clamp(20px, 6.4vw, 30px); }
	.dfront .dm { font-size: 13px; }
	.dfront .dhint { display: none; }
	.dface { padding: 12px 10px; }
	.dback .vik-line { font-size: 15px; }
	.ch-two.n3 { grid-template-columns: 1fr; }
	.ch-two.n3 .choice { flex-direction: row; justify-content: space-between; min-height: 58px; text-align: left; }
	.ch-two.n3 .ctext { white-space: nowrap; }
	.ch-letters, .ch-coins { grid-template-columns: repeat(2, 1fr); }
	.result-stats { grid-template-columns: 1fr 1fr; }
	.dock .wrap { justify-content: stretch; }
	.dock .btn { flex: 1; padding: 0 12px; }
	.dock .btn-ghost span { display: none; }
	.roles { grid-template-columns: 1fr 1fr; }
	.role { min-height: 0; }
}
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ── ด่าน ๕/๖/๘ เพิ่มเติม ── */
.pali-cell { font-family: var(--f-pali); font-size: 16px; }
.pali-cell .seg-hi { color: var(--c); white-space: nowrap; }
.tbl td .kw { white-space: normal; }
.hide-vik .vik-card { cursor: pointer; }
.hide-vik .vik-ans .vik-line { filter: blur(8px); }
.hide-vik .vik-card.shown .vik-ans .vik-line { filter: none; }
.hide-trans .vik-card { cursor: pointer; }
.vik-ans { padding: 10px 14px; }
.choice.has-paint { overflow: hidden; }
.cpaint { position: absolute; left: 0; right: 0; top: 0; height: 6px; }
.ch-two .choice.has-paint { border-top-width: 1.5px; padding-top: 14px; }
.viks > .warn { grid-column: 1 / -1; margin-top: 0; }
