/* ธีมบอร์ดเกม: โต๊ะไม้เข้ม การ์ดกระดาษครีม ขอบน้ำตาลหนา เงาแบบการ์ดจริง */
:root {
  --ink: #2b2118; --paper: #fff3dc; --paper-2: #ffe7bf; --table: #20453b; --table-2: #183830;
  --muted: #6e5d4a; --card: #fffaf0; --acc: #ff8a1f; --good: #22b35e; --bad: #e5484d;
  --d-emo: #ff7a59; --d-item: #ffc93c; --d-aud: #5bc0eb; --d-hook: #9b6bff; --d-cta: #2ec4a0;
  --r: 22px; --line: 4px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { color: var(--ink); font-family: Anuphan, system-ui, sans-serif; line-height: 1.4; -webkit-tap-highlight-color: transparent; }
h1, h2, h3, .disp { font-family: Mitr, Anuphan, sans-serif; font-weight: 600; line-height: 1.3; margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; }
:focus-visible { outline: 3px solid #3d8bfd; outline-offset: 3px; }
.muted { color: var(--muted); }
.offline::after { content: 'กำลังต่อใหม่…'; position: fixed; top: 0; left: 0; right: 0; background: var(--ink); color: var(--paper); text-align: center; padding: 6px; font-size: .95rem; z-index: 99; }

/* ปุ่มแบบเม็ดเกม: กดแล้วยุบลง */
.btn { border: var(--line) solid var(--ink); background: var(--acc); color: var(--ink); border-radius: 18px; padding: .6em 1.3em; min-height: 52px;
  font-family: Mitr, sans-serif; font-weight: 600; font-size: 1.15rem; box-shadow: 0 5px 0 var(--ink); transition: transform .08s, box-shadow .08s; }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.btn.ghost { background: var(--card); }
.btn:disabled { opacity: .4; }

/* การ์ด: แถบสีสำรับ + ภาพ + ชื่อใหญ่ */
.gcard { --deck: var(--d-emo); background: var(--card); border: var(--line) solid var(--ink); border-radius: var(--r); box-shadow: 0 7px 0 var(--ink);
  overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.gcard .band { background: var(--deck); border-bottom: var(--line) solid var(--ink); padding: .25em .8em; display: flex; justify-content: space-between; align-items: center;
  font-family: Mitr, sans-serif; font-weight: 600; font-size: .95rem; }
.gcard .art { aspect-ratio: 1; background: var(--paper); display: grid; place-items: center; }
.gcard .art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gcard .lbl { padding: .45em .7em .6em; text-align: center; font-family: Mitr, sans-serif; font-weight: 600; font-size: 1.35rem; line-height: 1.3; }
.gcard .hint { padding: 0 .8em .7em; text-align: center; color: var(--muted); font-size: .95rem; }
.d-emo { --deck: var(--d-emo); } .d-item { --deck: var(--d-item); } .d-aud { --deck: var(--d-aud); } .d-hook { --deck: var(--d-hook); } .d-cta { --deck: var(--d-cta); }

/* หลังการ์ด */
.back { background: repeating-linear-gradient(45deg, var(--acc) 0 14px, color-mix(in srgb, var(--acc) 80%, #fff) 14px 28px); border: var(--line) solid var(--ink);
  border-radius: var(--r); box-shadow: 0 7px 0 var(--ink); display: grid; place-items: center; text-align: center; }
.back .seal { background: var(--paper); border: var(--line) solid var(--ink); border-radius: 50%; width: 62%; aspect-ratio: 1; display: grid; place-content: center; padding: 1em; }

/* ระดับอารมณ์ = จุดลูกเต๋า */
.pips { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; }
.pips i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--ink); background: var(--card); }
.pips i.on { background: var(--deck, var(--acc)); }

/* หมากทีม: สี + รูปทรง */
.pawn { --c: var(--acc); width: 1em; height: 1em; display: inline-block; background: var(--c); border: .1em solid var(--ink); flex: none; vertical-align: -.12em; }
.pawn.circle { border-radius: 50%; }
.pawn.square { border-radius: .15em; }
.pawn.diamond { transform: rotate(45deg) scale(.82); border-radius: .12em; }
.pawn.tri { border: 0; background: var(--ink); clip-path: polygon(50% 0, 100% 100%, 0 100%); position: relative; }
.pawn.tri::after { content: ''; position: absolute; inset: .17em .1em .07em; background: var(--c); clip-path: polygon(50% 0, 100% 100%, 0 100%); }

/* กติกา */
.rules ol { margin: 0; padding: 0; list-style: none; display: grid; gap: .6em; counter-reset: s; }
.rules li { counter-increment: s; display: grid; grid-template-columns: 2em 1fr; gap: .6em; align-items: start; }
.rules li::before { content: counter(s); font-family: Mitr, sans-serif; font-weight: 600; width: 1.8em; height: 1.8em; border-radius: 50%; background: var(--ink); color: var(--paper); display: grid; place-items: center; }
.rules .score { margin-top: .8em; background: var(--paper-2); border: 3px dashed var(--ink); border-radius: 14px; padding: .5em .8em; font-weight: 700; }

/* การ์ดพิเศษของครู */
.overlay { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; background: color-mix(in srgb, var(--table-2) 92%, transparent); z-index: 50; animation: pop .35s cubic-bezier(.3, 1.6, .5, 1); }
.overlay .gcard { width: min(88vw, 460px); --deck: #ffd23f; }
.overlay .lbl { font-size: max(2.2rem, min(10vw, 4.5rem)); }

@keyframes pop { from { transform: scale(.85); opacity: 0; } }
@keyframes flip { from { transform: perspective(900px) rotateY(90deg); } to { transform: none; } }
@keyframes bump { 50% { transform: scale(1.25); } }
.flip-in { animation: flip .45s cubic-bezier(.3, 1.4, .5, 1); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}
/* Mitr เขียนเลข 0 มีขีดคาด (ดูเหมือน Ø) ตัวเลขแต้มจึงใช้ Anuphan */
.num { font-family: Anuphan, sans-serif !important; font-weight: 700; }

/* --- อินฟลูจำเป็น --- */
/* รูปโปรไฟล์สัตว์ = emoji ในวงกลมพาสเทล */
.av { --bg: var(--paper-2); --s: 3.2rem; width: var(--s); height: var(--s); font-size: calc(var(--s) * .58); border-radius: 50%; background: var(--bg); border: var(--line) solid var(--ink);
  display: inline-grid; place-items: center; line-height: 1; flex: none; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
/* การ์ดโจทย์ 3 แถว */
.prompt { --deck: #ff5c9a; }
.prompt .row { display: grid; grid-template-columns: 3.2rem 1fr; gap: .7rem; align-items: center; padding: .7rem .9rem; border-top: 3px dashed #e3cfa8; }
.prompt .band + .row { border-top: 0; }
.prompt .ic { font-size: 2.4rem; text-align: center; line-height: 1; }
.prompt .row img { width: 3.2rem; height: 3.2rem; border-radius: 12px; border: 3px solid var(--ink); object-fit: cover; }
.prompt small { display: block; color: var(--muted); font-weight: 700; font-size: .85rem; }
.prompt b { display: block; font-family: Mitr, sans-serif; font-weight: 600; font-size: 1.35rem; line-height: 1.25; }
.prompt em { display: block; font-style: normal; color: var(--muted); font-size: .9rem; margin-top: 2px; }
.prompt .pips { justify-content: flex-start; margin-top: 4px; --deck: #ff5c9a; }
