/* เกมสมาส (/samasa/<ด่าน>/play) — ต่อจาก samasa-stages.css (โทเคนสี/ใบลาน/การ์ดพับคำ)
   โต๊ะพับใบลาน: แถบสถานะ · การ์ดโจทย์ · ตัวเลือก ๗ แบบ (bins two coins grid list tokens tiles) · เฉลยที่คลี่คำให้ดู · หน้าผล */
.wrap-play { max-width: 880px; margin: 0 auto; padding: 0 20px; }
.sm-play .smk-path { margin-top: 12px; }

/* ── หน้าเริ่ม ── */
.intro { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; margin-top: 14px; padding: 22px; border-radius: 20px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); }
.intro-h { margin: 4px 0 12px; font-size: 24px; font-weight: 800; color: var(--strong); }
.rules { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rules li { display: grid; grid-template-columns: 22px 1fr; gap: 8px; font-size: 15px; color: var(--ink2); line-height: 1.55; }
.rules i { color: var(--stamp); margin-top: 4px; }
.intro .meter { margin: 16px 0 0; }
.intro-r { display: flex; flex-direction: column; align-items: stretch; justify-content: center; gap: 8px; padding: 16px; border-radius: 16px; background: var(--panel2); border: 1px dashed var(--line2); text-align: center; }
.intro-best-l { font-size: 13px; font-weight: 700; color: var(--muted); }
.intro-best { font-size: 18px; color: var(--strong); }
.intro-plays { font-size: 13px; color: var(--muted); }
.stars { display: flex; justify-content: center; gap: 6px; font-size: 34px; line-height: 1; color: var(--line2); }
.stars .on { color: var(--gold); animation: star-pop .5s cubic-bezier(.3, 1.6, .5, 1) both; animation-delay: var(--d); }
@keyframes star-pop { from { transform: scale(.2) rotate(-40deg); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 680px) { .intro { grid-template-columns: 1fr; padding: 16px; } }

.play-toggles { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 18px 0 0; }
.ptog { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line2); background: var(--panel); color: var(--muted); font: 700 14px var(--f-body); cursor: pointer; }
.ptog[aria-pressed="true"] { color: var(--strong); border-color: color-mix(in srgb, var(--stamp) 50%, var(--line2)); }

/* ── แถบสถานะ ── */
.hud { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 14px; align-items: center; margin-top: 14px; padding: 10px 16px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); position: sticky; top: 64px; z-index: 20; }
.hud-hearts { display: flex; gap: 2px; font-size: 22px; color: var(--bad); line-height: 1; }
.heart.lost { color: var(--line2); }
.hud-prog { display: grid; gap: 4px; }
.hud-n { font-size: 13px; font-weight: 700; color: var(--muted); }
.hud-bar { height: 8px; border-radius: 99px; background: var(--sunk); overflow: hidden; }
.hud-bar span { display: block; height: 100%; background: var(--stamp); border-radius: 99px; transition: width .3s; }
.hud-score { text-align: right; line-height: 1.1; }
.hud-score b { display: block; font-size: 20px; color: var(--strong); }
.hud-score span, .hud-combo span { font-size: 11px; color: var(--muted); }
.hud-combo { display: grid; grid-template-columns: auto auto; column-gap: 5px; align-items: center; color: var(--dim); line-height: 1.1; }
.hud-combo span { grid-column: 1 / -1; }
.hud-combo b { font-size: 18px; }
.hud-combo.hot { color: var(--t-dvan); }
.hud-combo.hot i { animation: flame .7s ease-in-out infinite alternate; }
@keyframes flame { to { transform: scale(1.25) rotate(-8deg); } }
@media (max-width: 480px) { .hud { gap: 10px; padding: 8px 12px; top: 58px; } .hud-hearts { font-size: 18px; } .hud-combo span { display: none; } }

/* ── การ์ดโจทย์ ── */
.qcard { position: relative; margin-top: 14px; padding: 20px 22px 22px; border-radius: 20px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; }
.qcard::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(90deg, transparent 0 60px, color-mix(in srgb, var(--ink) 2.5%, transparent) 60px 61px); }
.qcard > * { position: relative; }
.qcard.gold { border-color: var(--gold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 30%, 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; }
.qtag { display: inline-flex; align-items: center; min-height: 26px; padding: 0 10px; border-radius: 99px; background: var(--stamp-soft); color: var(--stamp); font-size: 13px; font-weight: 800; white-space: nowrap; }
.qgold { display: inline-flex; align-items: center; gap: 4px; min-height: 26px; padding: 0 10px; border-radius: 99px; background: color-mix(in srgb, var(--gold) 20%, transparent); color: var(--gold); font-size: 13px; font-weight: 800; }
.qchain { margin-left: auto; font-size: 13px; font-weight: 800; color: var(--muted); }
.qtimer { height: 5px; margin: 12px 0 0; border-radius: 99px; background: var(--sunk); overflow: hidden; }
.qtimer span { display: block; height: 100%; background: var(--t-tap); transform-origin: left; transition: transform .08s linear; }
.qtimer.low span { background: var(--bad); }
.qprompt { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 16px 0 4px; text-align: center; }
.qtext { margin: 0; font-size: 19px; font-weight: 700; color: var(--strong); line-height: 1.6; max-width: 46ch; }
.qtext-long { font-size: 17px; text-align: left; max-width: none; align-self: stretch; padding: 12px 16px; border-radius: 14px; background: var(--panel2); }
.qword { font-size: clamp(30px, 6vw, 44px); font-weight: 800; color: var(--strong); line-height: 1.3; white-space: nowrap; padding: 4px 18px; border-bottom: 3px double var(--line2); }
.qsub { margin: 0; font-size: 15px; color: var(--muted); font-weight: 700; }
.qvik { justify-content: center; }
.qvik .leaf { font-size: 20px; min-height: 44px; padding: 4px 13px; }
.qtrail { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 10px 0 0; }
.qtrail-i { display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 0 11px; border-radius: 99px; font-size: 14px; font-weight: 800; background: color-mix(in srgb, var(--ok) 12%, var(--panel)); color: var(--ok); }
.qtrail-i.bad { background: color-mix(in srgb, var(--bad) 10%, var(--panel)); color: var(--bad); }
.qtray { justify-content: center; padding: 10px; border-radius: 14px; background: var(--sunk); border: 1px dashed var(--line2); width: 100%; }
.qtray .leaf { animation: leaf-open .35s cubic-bezier(.2, .8, .3, 1.1) both; }
.qtray .leaf.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, transparent); }
.leaf-gap { min-width: 52px; justify-content: center; color: var(--dim); background: transparent; border-style: dashed; }
.qask { margin: 16px 0 10px; text-align: center; font-size: 15px; font-weight: 800; color: var(--ink2); }

/* ── ตัวเลือก ── */
.choices { display: grid; gap: 10px; }
.choice { --c: var(--stamp); position: relative; display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--line2); background: var(--panel2); color: var(--strong); font: 700 16px var(--f-body); text-align: left; cursor: pointer; transition: transform .1s, border-color .15s, background .15s; }
.choice:hover:not(:disabled) { border-color: var(--c); transform: translateY(-1px); }
.choice:disabled { cursor: default; }
.ckey { flex: none; width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: var(--sunk); color: var(--muted); }
.cdot { flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--c); }
.cbody { display: flex; flex-direction: column; min-width: 0; }
.ctext { font-size: 17px; font-weight: 800; line-height: 1.4; }
.ctext.pali { font-size: 18px; }
.csub { font-size: 13px; font-weight: 600; color: var(--muted); line-height: 1.4; }
.choice.is-right { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, var(--panel)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.choice.is-wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, var(--panel)); }
.choice:disabled:not(.is-right):not(.is-wrong) { opacity: .55; }

.ch-bins { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ch-bins .choice { border-left: 5px solid var(--c); }
.ch-two { grid-template-columns: repeat(var(--n), minmax(0, 1fr)); }
.ch-two .choice { min-height: 76px; justify-content: center; text-align: center; }
.ch-two .choice .cbody { align-items: center; }
.ch-two .choice[data-main] { border-top: 4px solid var(--c); }
.ch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ch-list { grid-template-columns: 1fr; }
.ch-list .ctext { font-size: 16px; font-weight: 700; }
.ch-list .ctext.pali { font-size: 18px; font-weight: 800; }
.ch-coins { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.ch-coins .choice { width: 76px; height: 76px; min-height: 0; padding: 0; border-radius: 50%; justify-content: center; text-align: center; border-width: 2px; }
.ch-coins .cbody { align-items: center; }
.ch-coins .ctext { font-size: 26px; line-height: 1; }
.ch-coins .csub { font-size: 11px; }
.ch-tokens, .ch-tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.ch-tokens .choice, .ch-tiles .choice { min-height: 52px; padding: 6px 16px; border-radius: 10px; background: var(--panel2); box-shadow: 0 2px 0 var(--line2); }
.ch-tokens .ctext, .ch-tiles .ctext { font-size: 21px; white-space: nowrap; }
.ch-tiles .choice { background: color-mix(in srgb, var(--gold) 8%, var(--panel)); }
@media (max-width: 620px) {
	.qcard { padding: 16px 14px 18px; }
	.ch-bins { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.ch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.ch-grid .ctext { font-size: 15px; }
	.choice { padding: 10px 12px; }
	.ch-two .choice { min-height: 70px; padding: 8px; }
	.ch-coins .choice { width: 68px; height: 68px; }
}

/* ── เฉลย ── */
.qexp:empty { display: none; }
.qexp { display: grid; gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line2); }
.qexp-h { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 800; }
.qexp-h.ok { color: var(--ok); } .qexp-h.bad { color: var(--bad); }
.qexp-t { margin: 0; font-size: 15px; line-height: 1.75; color: var(--ink2); }
.qexp .fold { box-shadow: none; }
.qnext-bar { display: flex; justify-content: center; margin-top: 14px; }
.qnext-bar .btn { min-width: 240px; }

.burst { position: fixed; z-index: 60; pointer-events: none; }
.burst i { position: absolute; width: 7px; height: 7px; border-radius: 2px; background: var(--gold); animation: burst .75s ease-out forwards; transform: rotate(var(--a)); }
@keyframes burst { from { opacity: 1; transform: rotate(var(--a)) translateY(0) scale(1); } to { opacity: 0; transform: rotate(var(--a)) translateY(calc(var(--d) * -1)) scale(.4); } }
.burst-pts { position: absolute; left: -30px; top: -30px; width: 60px; text-align: center; font-size: 18px; font-weight: 800; color: var(--gold); animation: pts .9s ease-out forwards; }
@keyframes pts { to { transform: translateY(-36px); opacity: 0; } }

/* ── หน้าผล ── */
.result { margin-top: 14px; padding: 26px 22px; border-radius: 20px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); text-align: center; }
.result.win { border-top: 5px solid var(--gold); } .result.lose { border-top: 5px solid var(--bad); }
.result-h { margin: 4px 0 12px; font-size: 30px; font-weight: 800; color: var(--strong); }
.result .stars { font-size: 46px; }
.result-note { margin: 10px auto 0; max-width: 48ch; font-size: 14px; color: var(--muted); }
.result-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 20px 0; }
.rstat { padding: 12px 8px; border-radius: 14px; background: var(--panel2); border: 1px solid var(--line); }
.rstat b { display: block; font-size: 22px; color: var(--strong); }
.rstat span { font-size: 13px; color: var(--muted); }
.rstat.best { border-color: var(--gold); } .rstat.best span { color: var(--gold); font-weight: 800; }
.result-acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
@media (max-width: 560px) { .result-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .result-acts .btn { flex: 1 1 100%; } }
.miss { margin-top: 18px; }
.miss-h { margin: 0 0 10px; font-size: 17px; color: var(--strong); }
.miss-i { display: grid; gap: 8px; padding: 14px 16px; margin-bottom: 10px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); justify-items: start; }
.miss-i .fold { width: 100%; box-shadow: none; }
.miss-t, .miss-e { margin: 0; font-size: 15px; color: var(--ink2); line-height: 1.65; }
/* ชื่อสมาสในตัวเลือกห้ามตัดกลางคำ — มือถือซ่อนเลขแป้นในช่องชนิด ให้ชื่อเต็มบรรทัด */
.ch-bins .ctext, .ch-grid .ctext, .ch-two .ctext { white-space: nowrap; }
@media (max-width: 620px) { .ch-bins .ckey { display: none; } .ch-bins .choice { padding: 10px; gap: 8px; } .ch-bins .ctext { font-size: clamp(14px, 4.1vw, 17px); } .ch-grid .ckey { display: none; } }
