/* ===== Neo-Brutalism: ขอบดำหนา เงาแข็ง สีพาสเทลจัด ตัวหนังสือหนา ===== */
:root {
  --ink: #111111;
  --paper: #fff8ea;
  --bg: #c4b1ff;
  --bg-dot: #b19bff;
  --yellow: #ffd84d;
  --orange: #ffa65c;
  --green: #b9f27c;
  --pink: #ff9fd0;
  --blue: #8ed6ff;
  --lilac: #e3d8ff;
  --red: #ff6b5e;
  --muted: #4b4560;

  --surface: var(--paper);
  --text: var(--ink);
  --line: var(--ink);
  --accent: var(--yellow);
  --danger: #e2392b;
  --good: #1e8e4e;
  --wolf: #e2392b;

  --bw: 2.5px;               /* ความหนาขอบ */
  --shadow: 4px 4px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);
  --radius: 20px;
  --font-head: 'Kanit', 'Mitr', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans Thai', system-ui, sans-serif;
  color-scheme: light;
}

/* โหมดกลางคืน: พื้นม่วงเข้ม การ์ดเข้ม แต่ยังคงขอบหนาและเงาแข็ง */
body.night {
  --bg: #241d4a;
  --bg-dot: #2e2660;
  --surface: #3a3170;
  --text: #fff8ea;
  --muted: #c8bff0;
  --lilac: #4a3f8a;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background-color: var(--bg);
  background-image: radial-gradient(var(--bg-dot) 1.5px, transparent 1.5px);
  background-size: 18px 18px;
  color: var(--text);
  font: 16px/1.5 var(--font-body);
  min-height: 100dvh;
  transition: background-color .5s;
}
main {
  max-width: 520px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px calc(28px + env(safe-area-inset-bottom));
}
h1, h2, h3 { font-family: var(--font-head); font-weight: 700; margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 32px; }
h2 { font-size: 24px; }
h3 { font-size: 18px; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-lg { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }

/* ----- กล่องพื้นฐาน ----- */
.card {
  background: var(--surface);
  border: var(--bw) solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.card.c-yellow { background: var(--yellow); }
.card.c-green { background: var(--green); }
.card.c-pink { background: var(--pink); }
.card.c-blue { background: var(--blue); }
.card.c-orange { background: var(--orange); }
.card.c-lilac { background: var(--lilac); }
.night .card.c-yellow, .night .card.c-green, .night .card.c-pink,
.night .card.c-blue, .night .card.c-orange { color: var(--ink); }

input, select {
  width: 100%;
  font: 500 17px var(--font-body);
  color: var(--ink);
  background: #fff;
  border: var(--bw) solid var(--ink);
  border-radius: 14px;
  padding: 13px 14px;
  outline: none;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.08);
}
input::placeholder { color: #9a93ad; }
input:focus { box-shadow: var(--shadow-sm); transform: translate(-1px, -1px); }
input.code { text-transform: uppercase; letter-spacing: .35em; font: 700 26px var(--font-head); text-align: center; }
label.field { display: flex; flex-direction: column; gap: 6px; font: 600 15px var(--font-head); color: var(--ink); }

/* ----- ปุ่ม: กดแล้ว "จม" ลงไปทับเงา ----- */
button {
  font: 600 18px var(--font-head);
  border: var(--bw) solid var(--ink);
  border-radius: 999px;
  padding: 12px 20px;
  cursor: pointer;
  color: var(--ink);
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform .06s, box-shadow .06s;
}
button:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
button:disabled { opacity: .5; cursor: default; box-shadow: none; }
button.primary { background: var(--ink); color: #fff; }
.night button.primary { background: var(--yellow); color: var(--ink); }
button.accent { background: var(--yellow); }
button.with-icon { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
button.with-icon svg { flex: none; }
button.danger { background: var(--red); }
button.ghost {
  background: transparent; border-color: transparent; box-shadow: none;
  color: var(--text); padding: 8px 10px; font-size: 15px;
}
button.ghost:active:not(:disabled) { transform: scale(.95); }
button.block { width: 100%; padding: 15px 20px; }
button.icon { padding: 6px 12px; font-size: 18px; line-height: 1; }
button.round { width: 40px; height: 40px; padding: 0; display: grid; place-items: center; font-size: 20px; }
.night button:not(.primary):not(.ghost):not(.switch) { background: var(--surface); color: var(--text); }

.divider { display: flex; align-items: center; gap: 12px; font: 600 14px var(--font-head); }
.divider::before, .divider::after { content: ''; flex: 1; height: var(--bw); background: var(--ink); border-radius: 2px; }

.sticker {
  display: inline-flex; align-items: center; gap: 6px;
  font: 600 13px var(--font-head);
  padding: 4px 12px; border: var(--bw) solid var(--ink); border-radius: 999px;
  background: #fff; color: var(--ink); box-shadow: 2px 2px 0 var(--ink);
}

/* ----- หน้าแรก ----- */
.hero { text-align: center; padding: 20px 0 4px; position: relative; }
.hero .logo {
  width: 96px; height: 96px; margin: 0 auto 14px;
  display: grid; place-items: center; font-size: 52px;
  background: var(--yellow); border: var(--bw) solid var(--ink); border-radius: 28px;
  box-shadow: var(--shadow); transform: rotate(-6deg);
}
.hero h1 {
  display: inline-block; font-size: 38px; text-transform: uppercase;
  -webkit-text-stroke: 0; text-shadow: 3px 3px 0 #fff;
}
.hero p { margin-top: 6px; font-weight: 500; }
.sparkle { position: absolute; font-size: 26px; }

/* ----- lobby ----- */
.room-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.room-code {
  display: inline-block;
  font: 800 36px var(--font-head);
  letter-spacing: .18em;
  padding: 2px 14px 2px 18px;
  background: var(--yellow); color: var(--ink);
  border: var(--bw) solid var(--ink); border-radius: 16px; box-shadow: var(--shadow);
}
.section-title { display: flex; align-items: center; gap: 8px; }

.players { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.player {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: #fff; color: var(--ink);
  border: var(--bw) solid var(--ink);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  font-weight: 500;
}
.players > .player:nth-child(5n+1) { background: var(--green); }
.players > .player:nth-child(5n+2) { background: var(--pink); }
.players > .player:nth-child(5n+3) { background: var(--blue); }
.players > .player:nth-child(5n+4) { background: var(--orange); }
.players > .player:nth-child(5n+5) { background: var(--yellow); }
.player.offline { opacity: .5; box-shadow: none; }
.player .name-wrap { flex: 1; min-width: 0; display: flex; align-items: center; gap: 2px; }
.player .rename { flex: none; display: inline-flex; color: var(--ink); padding: 4px; }
.player .name { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-head); font-size: 17px; }
.badge {
  font: 600 12px var(--font-head); padding: 2px 9px; border-radius: 99px;
  background: #fff; color: var(--ink); border: 2px solid var(--ink); white-space: nowrap;
}
.badge.accent { background: var(--ink); color: #fff; }
.badge.with-icon { display: inline-flex; align-items: center; gap: 3px; }
.badge.wolf { background: var(--red); color: var(--ink); }
.badge.dead { background: transparent; border-style: dashed; color: inherit; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: #2fd36b; border: 2px solid var(--ink); flex: none; }
.offline .dot { background: #fff; }

.games { display: flex; flex-direction: column; gap: 10px; }
.game-tile {
  display: flex; gap: 14px; align-items: center; text-align: left;
  background: #fff; border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow);
  font: 400 15px var(--font-body);
}
.game-tile.selected { background: var(--orange); }
.game-tile .emoji {
  flex: none; width: 60px; height: 60px; display: grid; place-items: center; font-size: 34px;
  background: var(--lilac); border: var(--bw) solid var(--ink); border-radius: 16px;
}
.game-tile b { font: 700 19px var(--font-head); display: block; }

.opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 2px dashed rgba(0,0,0,.25); }
.opt:last-child { border-bottom: 0; }
.opt > div > div:first-child { font: 600 17px var(--font-head); }
.opt-label { display: flex; align-items: center; gap: 6px; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper span { min-width: 34px; text-align: center; font: 700 24px var(--font-head); }
.stepper button { width: 38px; height: 38px; padding: 0; font-size: 20px; }
.switch {
  width: 58px; height: 32px; border-radius: 99px; padding: 0; background: #fff; position: relative; flex: none;
  box-shadow: 2px 2px 0 var(--ink);
}
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 50%;
  background: var(--ink); transition: left .15s;
}
.switch.on { background: var(--ink); }
.switch.on::after { left: 28px; background: var(--green); }
.opt-col { flex-direction: column; align-items: stretch; }
.opt-group { font: 700 15px var(--font-head); margin-top: 10px; padding-bottom: 2px; border-bottom: var(--bw) solid var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rec-table summary { font: 600 16px var(--font-head); cursor: pointer; padding: 8px 0; }
.rec-table table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 6px 0; }
.rec-table th, .rec-table td { padding: 5px 4px; text-align: left; border-bottom: 1px dashed rgba(0,0,0,.25); }
.rec-table th { font: 600 13px var(--font-head); }
.rec-table tr.here td { background: var(--yellow); font-weight: 700; }
.seg { display: flex; border: var(--bw) solid var(--ink); border-radius: 99px; overflow: hidden; background: #fff; box-shadow: 2px 2px 0 var(--ink); }
.seg button { flex: 1; border: 0; border-radius: 0; box-shadow: none; background: transparent; padding: 8px 10px; font-size: 15px; }
.seg button + button { border-left: var(--bw) solid var(--ink); }
.seg button.on { background: var(--ink); color: #fff; }
.seg button:active:not(:disabled) { transform: none; }
.error {
  color: var(--ink); background: var(--red); font: 600 14px var(--font-head);
  border: var(--bw) solid var(--ink); border-radius: 14px; padding: 8px 12px;
}

.menu { display: flex; gap: 2px; }
.menu button.ghost { color: var(--ink); padding: 4px 8px; }

/* ----- modal ----- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(17,17,17,.55);
  display: grid; place-items: center; padding: 16px; z-index: 50;
}
.modal { max-width: 360px; width: 100%; background: var(--pink); }
.qr { background: #fff; border: var(--bw) solid var(--ink); border-radius: 16px; padding: 12px; }
.qr img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: contain; } /* จองพื้นที่สี่เหลี่ยมจัตุรัสไว้ก่อนรูปโหลดเสร็จ */
/* skeleton ระหว่างรอ QR โหลด: แถบไล่สีวิ่งผ่านกรอบสี่เหลี่ยม */
.qr { position: relative; }
.qr.loading img { opacity: 0; }
.qr img { transition: opacity .2s; }
.qr.loading::after {
  content: ''; position: absolute; inset: 12px; border-radius: 8px;
  background: linear-gradient(100deg, #ece6f7 30%, #f8f5ff 50%, #ece6f7 70%) 0 0 / 300% 100%;
  animation: qr-shimmer 1.2s linear infinite;
}
@keyframes qr-shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .qr.loading::after { animation: none; } }
.modal.picker { max-width: 420px; background: var(--lilac); max-height: calc(100dvh - 32px); overflow-y: auto; }
/* หัว modal: ชื่อตรงกลาง ปุ่ม x มุมขวาบน ติดอยู่ด้านบนแม้เลื่อนรายการเกม */
.modal-head { position: sticky; top: -16px; margin: -16px -16px 0; padding: 16px 64px; background: inherit; z-index: 1; }
.modal-head h2 { margin: 0; }
.modal-close { position: absolute; top: 10px; right: 10px; }
.game-tile.empty { opacity: 1; cursor: pointer; border-style: dashed; box-shadow: none; background: var(--surface); }
.game-tile:disabled:not(.empty) { opacity: 1; cursor: default; box-shadow: var(--shadow); }
.url { word-break: break-all; font: 600 14px var(--font-body); }

/* ----- เกม ----- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 18px;
  background: var(--surface); border: var(--bw) solid var(--ink); border-radius: 999px;
  padding: 4px 6px 4px 14px; box-shadow: var(--shadow-sm);
}
.phase-title { font: 600 14px var(--font-head); }
.day-chip { align-self: center; }

.role-card {
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  touch-action: none;
  min-height: 280px;
  display: grid; place-items: center; text-align: center;
  border-radius: 26px;
  border: var(--bw) solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
  background:
    repeating-linear-gradient(45deg, transparent 0 14px, rgba(0,0,0,.06) 14px 28px),
    var(--lilac);
  color: var(--ink);
  padding: 24px;
  cursor: pointer;
}
.role-card.shown { background: var(--green); }
.role-card.shown.wolf { background: var(--red); }
.role-card .big { font-size: 76px; line-height: 1.1; }
.role-card .role-name { font: 800 34px var(--font-head); margin: 6px 0 2px; }
.role-card .muted { color: rgba(0,0,0,.65); }
.peek { position: fixed; inset: 0; background: rgba(17,17,17,.8); display: grid; place-items: center; padding: 24px; z-index: 40; }
.peek .role-card { width: 100%; max-width: 360px; }

.targets { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.target {
  font: 600 17px var(--font-head);
  padding: 14px 10px; border-radius: 18px;
  display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 76px; justify-content: center;
  background: #fff;
}
.target.selected { background: var(--yellow) !important; color: var(--ink) !important; transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); }
.night .target.selected { background: var(--pink) !important; }
.target .tags { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }

.news {
  border-radius: var(--radius); padding: 20px 18px; text-align: center;
  background: var(--orange); color: var(--ink);
  border: var(--bw) solid var(--ink); box-shadow: var(--shadow);
}
.news.calm { background: var(--blue); }
.news .big { font-size: 46px; line-height: 1.1; }
.winner {
  text-align: center; padding: 26px 16px; border-radius: 26px; color: var(--ink);
  border: var(--bw) solid var(--ink); box-shadow: 6px 6px 0 var(--ink);
}
.winner.village { background: var(--green); }
.winner.wolves { background: var(--red); }
.winner .big { font-size: 70px; line-height: 1.1; }
.winner h1 { font-size: 40px; text-transform: uppercase; }

.progress {
  height: 16px; border-radius: 99px; background: var(--surface); overflow: hidden;
  border: var(--bw) solid var(--ink);
}
.progress > i {
  display: block; height: 100%; background: var(--green); border-right: var(--bw) solid var(--ink);
  transition: width .3s;
}
.progress > i[style*="width:0%"] { border-right: 0; }
.night .progress > i { background: var(--pink); }
.progress-label { font: 600 14px var(--font-head); }

.log { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; font-weight: 500; }
.log li { padding: 6px 10px; background: rgba(255,255,255,.6); border: 2px solid var(--ink); border-radius: 12px; color: var(--ink); }

details.card > summary { font: 600 17px var(--font-head); cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: '＋'; }
details.card[open] > summary::after { content: '－'; }

/* ----- ส่วนกลาง ----- */
.conn {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  background: var(--red); color: var(--ink); text-align: center; padding: 6px;
  font: 600 14px var(--font-head); border-bottom: var(--bw) solid var(--ink);
}
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--yellow); color: var(--ink); padding: 10px 18px; border-radius: 16px;
  border: var(--bw) solid var(--ink); box-shadow: var(--shadow);
  max-width: calc(100% - 32px); z-index: 70; font: 600 15px var(--font-head);
}
[hidden] { display: none !important; }

/* ===== ลวงตา: ตลาดผี ===== */
.g-treasure { --g: var(--yellow); }
.g-serpent { --g: var(--green); }
.g-eye { --g: var(--blue); }
.g-swirl { --g: var(--pink); }
.g-house { --g: var(--orange); }

.ghost-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-align: center; color: var(--ink);
  background: var(--g, #fff);
  border: var(--bw) solid var(--ink); border-radius: 18px; box-shadow: var(--shadow-sm);
  padding: 12px 8px; min-height: 132px; flex: 1 1 0; min-width: 0;
  font: 400 13px var(--font-body);
}
button.ghost-card { cursor: pointer; }
.ghost-card .g-emoji { font-size: 38px; line-height: 1.1; }
.ghost-card .g-name { font: 700 16px var(--font-head); line-height: 1.2; }
.ghost-card .g-power { font-size: 12px; line-height: 1.3; opacity: .85; }
.ghost-card.small { min-height: 84px; padding: 8px 4px; }
.ghost-card.small .g-emoji { font-size: 28px; }
.ghost-card.small .g-name { font-size: 13px; }
.ghost-card.selected { transform: translate(-2px, -4px); box-shadow: 5px 7px 0 var(--ink); outline: 3px solid #fff; outline-offset: -7px; }
.ghost-card.back {
  background: repeating-linear-gradient(45deg, transparent 0 10px, rgba(0,0,0,.08) 10px 20px), var(--lilac);
}
.hand-row { display: flex; gap: 8px; }
.claim-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.claim-grid .ghost-card { min-height: 86px; padding: 6px 2px; }
.claim-grid .ghost-card .g-name { font-size: 11.5px; }
.claim-grid .ghost-card .badge { font-size: 10px; padding: 1px 5px; }
.ghost-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ghost-legend .ghost-card { min-height: 0; }

.hand-hold {
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none;
  background: var(--surface); border: var(--bw) dashed var(--ink); border-radius: var(--radius);
  padding: 12px; cursor: pointer;
}
.hand-hold.shown { border-style: solid; background: #fff; }

.step {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--ink); color: #fff; font-size: 15px;
}
.announce {
  text-align: center; padding: 20px 16px; border-radius: 26px; color: var(--ink);
  background: var(--g); border: var(--bw) solid var(--ink); box-shadow: 6px 6px 0 var(--ink);
}
.announce .big { font-size: 64px; line-height: 1.1; }
.announce h2 { font-size: 30px; }

.chip {
  display: inline-block; font: 600 12px var(--font-head); padding: 2px 8px; border-radius: 99px;
  background: var(--g); color: var(--ink); border: 2px solid var(--ink); white-space: nowrap;
}
.score-row .coin-bar {
  flex: 0 0 72px; height: 12px; border: 2px solid var(--ink); border-radius: 99px; background: #fff; overflow: hidden;
}
.score-row .coin-bar > i { display: block; height: 100%; background: var(--ink); }
.coins { font: 700 16px var(--font-head); white-space: nowrap; }
.player.turn { outline: 3px solid var(--ink); outline-offset: 2px; }

/* ===== ไส้ศึกในวงคำ ===== */
.role-card.shown.leader { background: var(--yellow); }
.role-card.compact { min-height: 0; padding: 14px; }
.role-card.compact .big { font-size: 40px; }
.role-card.compact .role-name { font-size: 22px; }
.secret-word {
  display: inline-block; margin-top: 4px;
  font: 800 32px var(--font-head); line-height: 1.2;
  padding: 4px 18px; background: #fff; color: var(--ink);
  border: var(--bw) solid var(--ink); border-radius: 14px; box-shadow: var(--shadow-sm);
}
.counter { font: 800 64px var(--font-head); line-height: 1; }
.say-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.say { display: flex; align-items: center; gap: 8px; border: 2px solid var(--ink, #222); border-radius: 14px; padding: 10px 12px; font-weight: 700; font-size: 17px; }
.say-emoji { font-size: 20px; }
.say.c-green { background: var(--green); }
.say.c-pink { background: var(--pink); }
.say.c-lilac { background: var(--lilac); }
.say.c-yellow { background: var(--yellow); }
.say-notes { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.correct-btn { padding: 22px; font-size: 22px; }
.chip.c-green { background: var(--green); }
.chip.c-pink { background: var(--pink); }
.chip.c-lilac { background: var(--lilac); }
.timer-card.urgent { background: var(--red); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.03); } }
@media (prefers-reduced-motion: reduce) { .timer-card.urgent { animation: none; } }

/* ----- ศิลปินตัวปลอม ----- */
.fa-canvas {
  display: block; width: 100%; max-width: 520px; margin: 0 auto; aspect-ratio: 1;
  background: #fff; border: var(--bw) solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.role-card.face-stack > .face-slot { grid-area: 1 / 1; }
.role-card.face-stack > .face-slot.off { visibility: hidden; }
.fa-canvas.editable { cursor: crosshair; outline: 4px dashed var(--yellow); outline-offset: 4px; }
.fa-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fa-player {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-weight: 600;
  background: var(--surface); border: var(--bw) solid var(--line); border-radius: 12px;
}
.fa-player.now { background: var(--yellow); color: var(--ink); }
.fa-player .grow { min-width: 0; overflow-wrap: anywhere; }
.fa-swatch {
  display: inline-block; width: 18px; height: 18px; flex: none; vertical-align: -3px;
  border: 2px solid var(--ink); border-radius: 50%;
}

/* ----- เกมโอ้โห ----- */
:root { --oh-r: #ff5a4e; --oh-y: #ffd84d; --oh-g: #6fd36a; --oh-b: #4f8cff; }
.oh-card {
  position: relative; flex: none;
  width: 62px; height: 90px; padding: 0;
  border: var(--bw) solid var(--ink); border-radius: 12px;
  box-shadow: var(--shadow-sm);
  background: var(--surface); color: var(--ink);
  display: grid; place-items: center;
  font: 800 26px/1 var(--font-head);
  user-select: none; -webkit-user-select: none;
}
.oh-card .face {
  width: 76%; height: 64%; display: grid; place-items: center;
  background: #fff; border: 2px solid var(--ink); border-radius: 10px 4px 10px 4px;
  transform: rotate(-4deg);
}
.oh-card .corner { position: absolute; font-size: 12px; font-weight: 700; }
.oh-card .corner.tl { top: 4px; left: 6px; }
.oh-card .corner.br { bottom: 4px; right: 6px; transform: rotate(180deg); }
.oh-card.oc-r { background: var(--oh-r); }
.oh-card.oc-y { background: var(--oh-y); }
.oh-card.oc-g { background: var(--oh-g); }
.oh-card.oc-b { background: var(--oh-b); }
.oh-card.oc-wild {
  background: conic-gradient(var(--oh-r) 0 25%, var(--oh-y) 0 50%, var(--oh-g) 0 75%, var(--oh-b) 0);
  color: var(--ink);
}
.oh-card.oc-wild .face { background: var(--ink); color: #fff; }
.oh-card.oc-wild[style*="--chosen"] { outline: 5px solid var(--chosen); outline-offset: 2px; }
.oh-card.big { width: 92px; height: 134px; font-size: 40px; border-radius: 16px; box-shadow: var(--shadow); }
.oh-card.big .corner { font-size: 16px; }
.oh-card.small { width: 34px; height: 50px; font-size: 14px; border-radius: 7px; border-width: 2px; box-shadow: none; }
.oh-card.small .corner { display: none; }
.oh-card.back {
  background: repeating-linear-gradient(45deg, var(--ink) 0 8px, #2b2540 8px 16px);
  color: #fff;
}
.oh-card.back .face { background: var(--yellow); font-size: 34px; }
.oh-card.back .corner.br { transform: none; background: #fff; color: var(--ink); border-radius: 6px; padding: 1px 5px; border: 2px solid var(--ink); bottom: -10px; right: -10px; font-size: 14px; }
button.oh-card { cursor: pointer; }
button.oh-card:hover { transform: translate(-1px, -3px); }
button.oh-card.back { animation: oh-bob 1.4s ease-in-out infinite; }
.oh-card.dim { opacity: .45; box-shadow: none; }
.oh-card.ul .face, .oh-card.ul .corner { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 3px; }
.oh-card.glow { outline: 4px dashed var(--ink); outline-offset: 3px; }
.oh-card.sel { transform: translateY(-10px); outline: 4px solid var(--ink); outline-offset: 3px; }
.oh-hand .oh-card { transition: transform .12s; }
.oh-confirm { display: flex; gap: 10px; }
.oh-confirm .primary { flex: 1; }
@keyframes oh-bob { 50% { transform: translateY(-4px); } }

/* effect: ไพ่เข้ามือ / ไพ่ลงกอง / ทิศเปลี่ยน */
.oh-card.enter { animation: oh-deal .45s cubic-bezier(.2, .9, .3, 1.3) both; }
.oh-card.enter.hot { animation: oh-deal .45s cubic-bezier(.2, .9, .3, 1.3) both, oh-hot 2s .45s; }
.oh-card.land { animation: oh-land .35s cubic-bezier(.2, .9, .3, 1.2); }
.oh-table .dir.spin { animation: oh-spin .6s ease-out; }
@keyframes oh-deal { from { transform: translateY(-70px) rotate(-14deg) scale(.5); opacity: 0; } }
@keyframes oh-hot { 0%, 70% { outline: 4px solid var(--red); outline-offset: 3px; } }
@keyframes oh-land { from { transform: translateY(-46px) rotate(10deg) scale(1.25); opacity: .2; } }
@keyframes oh-spin { from { transform: rotate(-360deg) scale(1.5); } }

/* effect: ป๊อปอัปกลางจอ + แถบเหตุการณ์ด้านบน */
.fx-center { position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 80; }
.fx-pop {
  min-width: 200px; max-width: calc(100% - 48px); padding: 18px 26px; text-align: center;
  background: var(--yellow); color: var(--ink); border: var(--bw) solid var(--ink); border-radius: 26px;
  box-shadow: var(--shadow); animation: fx-pop .35s ease both; pointer-events: auto;
}
.fx-pop.leaving { animation: fx-leave .25s ease forwards; }
.fx-pop .fx-ok { margin-top: 14px; min-width: 140px; background: #fff; position: relative; overflow: hidden; }
.fx-pop .fx-ok span { position: relative; }
/* แถบเวลาในปุ่ม หดจากขวาไปซ้ายจนหมดตอนป๊อปอัปปิดเอง */
.fx-pop .fx-ok::before {
  content: ''; position: absolute; inset: 0; background: var(--yellow);
  transform-origin: left; animation: fx-countdown var(--dur, 5s) linear forwards;
}
.fx-pop:not(.bad):not(.good) .fx-ok::before { background: var(--green); }
@keyframes fx-countdown { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.fx-pop.bad { background: var(--red); }
.fx-pop.good { background: var(--green); }
.fx-pop .fx-big { font: 800 64px/1.1 var(--font-head); }
.fx-pop .fx-text { font: 700 18px var(--font-head); margin-top: 4px; }
.fx-chips {
  position: fixed; top: calc(10px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 32px);
  display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; z-index: 80;
}
.fx-chip {
  font: 600 14px var(--font-head); padding: 6px 14px; border-radius: 99px;
  background: #fff; color: var(--ink); border: var(--bw) solid var(--ink); box-shadow: 2px 2px 0 var(--ink);
  animation: fx-chip 2.6s ease forwards;
}
@keyframes fx-pop {
  0% { transform: scale(.3) rotate(-8deg); opacity: 0; }
  60% { transform: scale(1.1) rotate(2deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
@keyframes fx-leave { to { transform: scale(.85); opacity: 0; } }
@keyframes fx-chip {
  0% { transform: translateY(-16px); opacity: 0; }
  10% { transform: none; opacity: 1; }
  85% { opacity: 1; }
  100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .oh-card.enter, .oh-card.land, .oh-table .dir.spin { animation: none; }
  .oh-card.enter.hot { animation: oh-hot 2s; }
  .fx-pop { animation: none; }
  .fx-pop.leaving { animation: fx-fade .25s forwards; }
  .fx-chip { animation-name: fx-fade; }
  @keyframes fx-fade { 0%, 85% { opacity: 1; } 100% { opacity: 0; } }
}

.oh-table {
  display: flex; align-items: center; justify-content: center; gap: 28px;
  padding: 22px 12px 26px; border-radius: 26px;
  border: var(--bw) solid var(--ink); box-shadow: var(--shadow);
  position: relative; transition: background-color .3s;
}
.oh-table.tc-r { background: #ffb3ad; }
.oh-table.tc-y { background: #fff0a8; }
.oh-table.tc-g { background: #c4f2b8; }
.oh-table.tc-b { background: #b5ceff; }
.oh-table .pile { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.oh-table .pile-label { font-weight: 600; color: var(--ink); display: inline-flex; align-items: center; gap: 4px; }
.oh-table .dir {
  position: absolute; top: 8px; right: 12px; font: 800 26px var(--font-head); color: var(--ink);
}

.oh-hand { display: flex; flex-wrap: wrap; gap: 8px; }
.oh-hand.mini { width: 100%; gap: 4px; }
.oh-shout { font-size: 24px; animation: oh-bob .8s ease-in-out infinite; }

/* แถบสถานะตา: ติดขอบบนจอ เลื่อนดูไพ่ในมือก็ยังเห็นว่าตาใคร */
.oh-turnbar {
  position: sticky; top: calc(8px + env(safe-area-inset-top)); z-index: 20;
  display: flex; flex-direction: column; gap: 6px; padding: 10px 12px;
  background: var(--surface); color: var(--text);
  border: var(--bw) solid var(--ink); border-radius: 18px; box-shadow: var(--shadow-sm);
}
.oh-turnbar.mine { background: var(--orange); color: var(--ink); box-shadow: var(--shadow); animation: oh-ring 1.2s ease-in-out infinite; }
.oh-turn-title { font: 700 18px/1.2 var(--font-head); }
.oh-turnbar.mine .oh-turn-title { font-size: 24px; }
.oh-rank { flex: none; min-width: 2.2em; font: 700 16px var(--font-head); text-align: center; }
.oh-dot {
  display: inline-block; width: .8em; height: .8em; margin-right: .3em; vertical-align: -.05em;
  border-radius: 50%; background: var(--danger); border: 2px solid var(--ink); flex: none;
}
.oh-turnbar.mine .oh-dot { animation: oh-blink 1s ease-in-out infinite; }
@keyframes oh-blink { 50% { transform: scale(.75); } }
.oh-turn-hint { font-size: 14px; font-weight: 600; }
.oh-turnbar.soon .oh-turn-hint { display: inline-block; align-self: flex-start; background: var(--yellow); color: var(--ink); border-radius: 8px; padding: 0 6px; }
@keyframes oh-ring { 50% { box-shadow: 0 0 0 4px var(--yellow), var(--shadow); } }

.oh-seats {
  list-style: none; margin: 0; padding: 5px; display: flex; gap: 12px;
  overflow-x: auto; scrollbar-width: none;
}
.oh-seats::-webkit-scrollbar { display: none; }
.oh-seat {
  flex: none; display: flex; align-items: center; gap: 4px; padding: 3px 8px; position: relative;
  background: #fff; color: var(--ink); border: 2px solid var(--ink); border-radius: 999px;
  font-size: 13px;
}
.oh-seat.turn { background: var(--yellow); font-size: 15px; padding: 5px 10px; box-shadow: 2px 2px 0 var(--ink); }
.oh-seat.me { outline: 3px dashed var(--ink); outline-offset: 1px; }
.oh-seat .name { font-weight: 600; max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oh-seat .mini-back { font: 600 12px var(--font-head); display: inline-flex; align-items: center; gap: 1px; }
.oh-seat .catch { padding: 3px 8px; font-size: 13px; }
.oh-seat .arrow { position: absolute; left: calc(100% + 7px); transform: translateX(-50%); font: 800 14px var(--font-head); color: var(--text); pointer-events: none; }
.oh-seat.out { opacity: .55; }

/* แฟลชตอนถึงตาเรา: ขึ้นแป๊บเดียวแล้วหาย ไม่บังการกด */
.fx-turn {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; pointer-events: none;
  animation: fx-turn-bg 1.4s ease forwards;
}
.fx-turn span {
  font: 800 34px var(--font-head); padding: 16px 28px; border-radius: 24px;
  background: var(--orange); color: var(--ink); border: var(--bw) solid var(--ink); box-shadow: var(--shadow);
  animation: fx-turn 1.4s ease forwards;
}
@keyframes fx-turn-bg { 0% { background: rgba(255,216,77,.45); } 100% { background: rgba(255,216,77,0); } }
@keyframes fx-turn {
  0% { transform: scale(.4); opacity: 0; }
  20% { transform: scale(1.1); opacity: 1; }
  30%, 75% { transform: scale(1); opacity: 1; }
  100% { transform: scale(.9); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .oh-turnbar.mine .oh-dot { animation: none; }
  .oh-turnbar.mine { animation: none; box-shadow: 0 0 0 4px var(--yellow), var(--shadow); }
  .fx-turn, .fx-turn span { animation: fx-fade 1.4s forwards; }
}

.oh-colors { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.oh-color { min-height: 72px; font: 700 20px var(--font-head); color: var(--ink) !important; }
.oh-color.oc-r { background: var(--oh-r) !important; }
.oh-color.oc-y { background: var(--oh-y) !important; }
.oh-color.oc-g { background: var(--oh-g) !important; }
.oh-color.oc-b { background: var(--oh-b) !important; }

/* ===== น้ำเต้า ปู ปลา ===== */
.s-gourd { --s: var(--orange); }
.s-crab { --s: var(--red); }
.s-fish { --s: var(--blue); }
.s-chicken { --s: var(--yellow); }
.s-shrimp { --s: var(--pink); }
.s-tiger { --s: var(--green); }
.nt-icon { display: inline-flex; align-items: center; justify-content: center; font-size: 40px; line-height: 1; width: 1.15em; height: 1.15em; }
.nt-icon svg { width: 100%; height: 100%; }
.nt-icon.xs { font-size: 14px; vertical-align: -2px; }
.nt-chip { background: var(--s); }
.nt-mat { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.nt-cell-wrap { position: relative; display: flex; }
.nt-cell {
  position: relative; flex: 1; min-width: 0; min-height: 112px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 10px 4px 26px; background: var(--s); color: var(--ink);
  border: var(--bw) solid var(--ink); border-radius: 18px; box-shadow: var(--shadow-sm);
}
button.nt-cell { font: inherit; cursor: pointer; }
.nt-cell .nt-name { font: 700 16px var(--font-head); }
.nt-cell.mine { outline: 3px solid var(--ink); outline-offset: 2px; }
.nt-cell.miss { opacity: .45; filter: saturate(.4); }
.nt-cell.hit { box-shadow: 0 0 0 4px #fff, 0 0 0 6.5px var(--ink); }
.nt-stack {
  position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%);
  font: 700 13px var(--font-head); background: #fff; border: 2px solid var(--ink); border-radius: 99px; padding: 0 8px; white-space: nowrap;
}
.nt-others { position: absolute; top: 5px; left: 7px; font: 600 11px var(--font-head); }
.nt-hit {
  position: absolute; top: -10px; right: -8px; font: 700 15px var(--font-head);
  background: var(--ink); color: #fff; border-radius: 99px; padding: 1px 9px; transform: rotate(8deg);
}
.nt-minus {
  position: absolute; top: -9px; right: -7px; width: 30px; height: 30px; padding: 0;
  border-radius: 50%; font: 700 18px/1 var(--font-head); background: #fff; box-shadow: 2px 2px 0 var(--ink);
}
.nt-dice { display: flex; justify-content: center; gap: 14px; padding: 6px 0; }
.nt-die {
  width: 72px; height: 72px; display: flex; align-items: center; justify-content: center;
  background: #fff; border: var(--bw) solid var(--ink); border-radius: 16px; box-shadow: var(--shadow-sm);
}
.nt-die .nt-icon { font-size: 42px; }
.nt-hist-row .nt-die { width: 34px; height: 34px; border-radius: 9px; box-shadow: 2px 2px 0 var(--ink); }
.nt-hist-row .nt-die .nt-icon { font-size: 18px; }
.nt-history { display: flex; flex-direction: column; gap: 8px; }
.nt-hist-row { display: flex; align-items: center; gap: 8px; }
.nt-net { font: 700 44px/1.1 var(--font-head); }
.nt-die.rolling { animation: nt-tumble 1.1s calc(var(--d)) cubic-bezier(.3,.7,.4,1) both; }
.nt-die.rolling .nt-icon { animation: nt-show .2s calc(var(--d) + 1s) both; }
.nt-reveal .nt-after { animation: nt-fade .35s 1.5s both; }
@keyframes nt-tumble {
  0% { transform: translateY(-40px) rotate(-200deg) scale(.7); background: var(--lilac); }
  25% { transform: translateY(8px) rotate(90deg); }
  45% { transform: translateY(-14px) rotate(-60deg); }
  65% { transform: translateY(4px) rotate(30deg); }
  80% { transform: translateY(-4px) rotate(-10deg); background: var(--lilac); }
  100% { transform: none; background: #fff; }
}
@keyframes nt-show { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: none; } }
@keyframes nt-fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .nt-die.rolling, .nt-die.rolling .nt-icon, .nt-reveal .nt-after { animation: none; }
}

/* ===== โป๊กเกอร์ ===== */
.pk-felt {
  gap: 12px; padding: 14px; border-radius: 26px; color: var(--ink);
  background: radial-gradient(circle at 50% 40%, #6fd36a, #3fa65a);
  border: var(--bw) solid var(--ink); box-shadow: var(--shadow);
}
.pk-pot { font: 700 18px var(--font-head); background: #fff; border: var(--bw) solid var(--ink); border-radius: 99px; padding: 2px 12px; }
.pk-board { display: flex; justify-content: center; gap: 6px; }
.pk-hole { display: flex; justify-content: center; gap: 12px; }
.pk-card {
  flex: none; width: 52px; height: 74px; border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  background: #fff; color: var(--ink);
  border: var(--bw) solid var(--ink); box-shadow: 2px 2px 0 var(--ink);
  font: 800 22px/1 var(--font-head); user-select: none; -webkit-user-select: none;
}
.pk-card .s { font-size: 24px; line-height: 1; }
.pk-card.red { color: #d7261b; }
.pk-card.slot { background: rgba(255,255,255,.25); border-style: dashed; box-shadow: none; }
.pk-card.back { background: repeating-linear-gradient(45deg, var(--ink) 0 8px, #2b2540 8px 16px); }
.pk-card.big { width: 84px; height: 118px; font-size: 34px; border-radius: 14px; box-shadow: var(--shadow); }
.pk-card.big .s { font-size: 38px; }
.pk-card.xs { width: 30px; height: 42px; font-size: 13px; border-radius: 6px; border-width: 2px; box-shadow: none; }
.pk-card.xs .s { font-size: 14px; }
.pk-card.dim { opacity: .45; }
.pk-btn {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 2px solid var(--ink); font: 800 12px var(--font-head);
}
.pk-seat.pk-folded { opacity: .55; box-shadow: none; }
.pk-shown { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pk-bet { font: 700 14px var(--font-head); background: #fff; border: 2px solid var(--ink); border-radius: 99px; padding: 1px 8px; white-space: nowrap; }
.pk-up { color: var(--good); }
@media (max-width: 360px) {
  .pk-card { width: 46px; height: 66px; font-size: 19px; }
  .pk-card .s { font-size: 20px; }
}

/* ===== ไพ่แคง ===== */
.kg-table { display: flex; justify-content: center; align-items: flex-end; gap: 28px; }
.kg-pile { display: flex; gap: 0; }
.kg-pile .pk-card + .pk-card { margin-left: -26px; }
.kg-hand { display: flex; justify-content: center; gap: 5px; padding-top: 10px; width: 100%; }
.kg-hand .pk-card.big { width: min(58px, calc((100% - 25px) / 6)); height: auto; aspect-ratio: 58 / 84; font-size: 24px; border-radius: 12px; padding: 0; }
.kg-hand .pk-card.big .s { font-size: 26px; }
.kg-hand button.pk-card { cursor: pointer; transition: transform .12s; }
.kg-hand .pk-card.kg-on { transform: translateY(-10px); background: #fff6c2; box-shadow: 2px 6px 0 var(--ink); }
.kg-hand .pk-card.kg-new { outline: 3px dashed var(--ink); outline-offset: 2px; }
@media (max-width: 360px) {
  .kg-hand .pk-card.big { font-size: 20px; }
}

/* ===== ปลาระเบิด ===== */
.bf-sea {
  gap: 12px; padding: 14px; border-radius: 26px; color: var(--ink);
  background: radial-gradient(circle at 50% 30%, #7fd8ff, #2f8fd0);
  border: var(--bw) solid var(--ink); box-shadow: var(--shadow);
}
.bf-table { display: flex; justify-content: center; align-items: flex-end; gap: 28px; }
.bf-pile { display: flex; }
.bf-pile .bf-card + .bf-card { margin-left: -36px; }
.bf-card {
  flex: none; width: 62px; height: 84px; border-radius: 10px; padding: 4px 2px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: var(--c, #fff); color: var(--ink);
  border: var(--bw) solid var(--ink); box-shadow: 2px 2px 0 var(--ink);
  font: 600 11px/1.1 var(--font-head); text-align: center; user-select: none; -webkit-user-select: none;
}
.bf-card .e { width: 44px; height: 44px; flex: none; }
.bf-card .n { overflow-wrap: anywhere; }
.bf-card.sm { width: 48px; height: 64px; font-size: 9px; }
.bf-card.sm .e { width: 34px; height: 34px; }
.bf-card.slot { background: rgba(255,255,255,.25); border-style: dashed; box-shadow: none; }
.bf-card.back { background: #1d5f9a; padding: 0; overflow: hidden; }
.bf-card.back .e { width: 100%; height: 100%; }
.bf-art { display: block; overflow: visible; }
.bf-art.mini { display: inline-block; vertical-align: middle; width: 1.35em; height: 1.35em; flex: none; }
.bf-lbl { display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; }
button .bf-art.mini, .bf-lbl .bf-art.mini { margin: -2px 0; }
.bf-banner-art { display: flex; justify-content: center; gap: 4px; }
.bf-banner-art .bf-art { width: 64px; height: 64px; }
.bf-banner-art .bf-art.boom { animation: bf-boom .6s ease-out; }
@keyframes bf-boom { 0% { transform: scale(.4); } 60% { transform: scale(1.25); } 100% { transform: none; } }
.bf-card.new { outline: 3px dashed var(--ink); outline-offset: 2px; }
.bf-hand { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 8px; padding-top: 8px; justify-items: center; }
.bf-hand button.bf-card { cursor: pointer; transition: transform .12s; }
.bf-hand .bf-card.on { transform: translateY(-8px); box-shadow: 2px 6px 0 var(--ink); outline: 3px solid var(--ink); }
.bf-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.bf-chips button { padding: 6px 12px; font-size: 14px; box-shadow: 2px 2px 0 var(--ink); }
.bf-chips button.on { background: var(--ink); color: #fff; }
.bf-timer { width: 100%; height: 10px; border: 2px solid var(--ink); border-radius: 99px; background: #fff; overflow: hidden; }
.bf-timer-bar { height: 100%; width: 100%; background: var(--ink); transition: width .1s linear; }
.bf-nope { font-size: 20px; }
.bf-range { width: 100%; accent-color: var(--ink); border: 0; padding: 0; background: none; box-shadow: none; min-height: 0; }
.bf-boom { animation: bf-shake .5s; }
@keyframes bf-shake {
  0%, 100% { transform: none; }
  20% { transform: translateX(-6px) rotate(-2deg); }
  40% { transform: translateX(6px) rotate(2deg); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
@media (prefers-reduced-motion: reduce) { .bf-boom, .bf-banner-art .bf-art.boom { animation: none; } }
.bf-pop { max-width: min(360px, calc(100% - 32px)); }
.bf-pop-arts { display: flex; justify-content: center; gap: 6px; margin-bottom: 8px; }
.bf-pop-arts > .bf-art { width: 64px; height: 64px; }
.bf-pop .fx-text { justify-content: center; flex-wrap: wrap; }
.bf-pop-btns { justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.bf-pop-btns .fx-ok { margin-top: 0; }
.bf-card { position: relative; }
.bf-count { position: absolute; top: 4px; right: 4px; font: 800 12px var(--font-head); background: var(--ink); color: #fff; border-radius: 99px; padding: 1px 6px; }

/* ---------- Silent Mind ---------- */
.sm-status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: space-between; }
.sm-level { display: flex; align-items: baseline; gap: 4px; background: var(--ink); color: #fff; border-radius: 99px; padding: 4px 14px; }
.sm-level b { font: 800 24px var(--font-head); }
.sm-res { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.sm-ico { width: 26px; height: 26px; flex: none; }
.sm-ico.lg { width: 34px; height: 34px; }
.sm-ico.xl { width: 72px; height: 72px; }
.sm-broken { animation: sm-shake .5s ease 2; }
@keyframes sm-shake { 25% { transform: rotate(-10deg); } 75% { transform: rotate(10deg); } }
.sm-table { align-items: center; }
.sm-pile { display: grid; place-items: center; min-height: 150px; }
.sm-card {
  position: relative; display: grid; place-items: center; width: 64px; height: 90px; padding: 0;
  background: var(--paper); color: var(--ink); border: var(--bw) solid var(--ink); border-radius: 12px;
  box-shadow: 3px 3px 0 var(--ink); font-family: var(--font-head);
}
.sm-card .sm-num { font: 800 30px var(--font-head); }
.sm-card .sm-corner { position: absolute; top: 4px; left: 7px; font: 700 12px var(--font-head); }
.sm-card.big { width: 104px; height: 146px; border-radius: 16px; box-shadow: var(--shadow); }
.sm-card.big .sm-num { font-size: 52px; }
.sm-card.big .sm-corner { font-size: 15px; top: 6px; left: 10px; }
.sm-card.mini { width: 40px; height: 54px; border-radius: 9px; box-shadow: 2px 2px 0 var(--ink); }
.sm-card.mini .sm-num { font-size: 18px; }
.sm-card.mini .sm-corner { display: none; }
.sm-card.played { background: var(--yellow); animation: sm-land .35s ease both; }
.sm-card.empty { background: transparent; border-style: dashed; box-shadow: none; color: var(--muted); }
.sm-card.live { background: var(--green); cursor: pointer; animation: pulse 1.6s ease infinite; }
@keyframes sm-land { from { transform: translateY(-40px) rotate(-8deg) scale(1.15); opacity: 0; } }
.sm-trail { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.sm-trail span { font: 700 14px var(--font-head); border: 2px solid var(--ink); border-radius: 8px; padding: 0 6px; background: var(--paper); color: var(--ink); opacity: .75; }
.sm-hand { display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap; }
.sm-rest { display: flex; gap: 6px; flex-wrap: wrap; max-width: 260px; }
.sm-pop { max-width: min(360px, calc(100% - 32px)); text-align: center; }
.sm-pop .fx-text { justify-content: center; }
.sm-pop-arts { display: flex; justify-content: center; margin-bottom: 8px; }
.sm-pop-cards { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.sm-pop-card { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.sm-sum summary { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; cursor: pointer; }
.sm-sum summary b { font: 700 17px var(--font-head); }
.sm-sum.r-lost { background: var(--pink); }
.sm-steps { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; counter-reset: step; }
.sm-step {
  display: flex; align-items: baseline; gap: 10px; padding: 4px 10px; counter-increment: step;
  border: 2px solid var(--ink); border-radius: 10px; background: rgba(255,255,255,.6); color: var(--ink);
}
.sm-step::before { content: counter(step); min-width: 18px; font: 600 12px var(--font-head); opacity: .55; }
.sm-step b { min-width: 30px; font: 800 18px var(--font-head); }
.sm-step em { margin-left: auto; font: 600 13px var(--font-head); font-style: normal; }
.sm-step.t-early { background: var(--orange); }
.sm-step.t-miss { background: transparent; border-style: dashed; }
.sm-step.t-miss b { text-decoration: line-through; }
.sm-step.t-star { background: var(--yellow); }
.night .sm-step.t-miss { color: var(--text); border-color: var(--text); }
/* modal สรุปตอนจบ Level */
.sm-modal {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px;
  background: rgba(17, 17, 17, .45); animation: fx-fade-in .2s ease both;
}
.sm-modal.leaving { animation: fx-fade-in .2s ease reverse forwards; }
.sm-modal-box {
  width: min(420px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 10px; padding: 18px 18px 16px; text-align: center;
  background: var(--yellow); color: var(--ink); border: var(--bw) solid var(--ink); border-radius: 26px;
  box-shadow: var(--shadow); animation: fx-pop .35s ease both;
}
.sm-modal-box .fx-text { justify-content: center; }
.sm-modal-box .sm-steps { margin-top: 0; text-align: left; }
.sm-modal-box button { position: sticky; bottom: 0; margin-top: 4px; }
@keyframes fx-fade-in { from { opacity: 0; } }
/* เพื่อนร่วมทีมในการ์ดกองกลาง */
.sm-team { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; width: 100%; padding-top: 10px; border-top: 2px dashed rgba(17,17,17,.25); }
.sm-mate {
  display: flex; align-items: center; gap: 8px; padding: 4px 10px; border: 2px solid var(--ink); border-radius: 99px;
  background: var(--paper); color: var(--ink);
}
.sm-count {
  display: grid; place-items: center; min-width: 30px; height: 36px; padding: 0 6px;
  background: var(--blue); color: var(--ink); border: 2px solid var(--ink); border-radius: 7px;
  font: 800 18px var(--font-head);
}
.sm-mate-name { font: 600 14px var(--font-head); max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sm-mate.out { opacity: .5; border-style: dashed; }

/* ประวัติห้องในหน้าแรก */
.history-item { padding: 6px 6px 6px 12px; }
.history-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; padding: 4px 0; }
.history-code { font: 700 20px var(--font-head); letter-spacing: 2px; }
.history-meta { min-width: 0; display: flex; flex-direction: column; }
.history-meta .name { font-size: 16px; }
.history-meta .muted { color: rgba(0,0,0,.6); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-item button.icon-only { flex: none; color: var(--ink); padding: 8px; display: grid; place-items: center; }

/* ===== ชาบูชาบู ===== */
.sb-hotpot {
  gap: 10px; padding: 14px; border-radius: 26px; color: var(--ink);
  background: radial-gradient(circle at 50% 35%, #ffb36b, #e2392b);
  border: var(--bw) solid var(--ink); box-shadow: var(--shadow);
}
.sb-hotpot .sb-pot { width: 76px; height: 76px; }
.sb-hotpot button.ghost { background: rgba(255,255,255,.7); }
.sb-art { display: block; overflow: visible; }
.sb-art.mini { display: inline-block; vertical-align: middle; width: 1.35em; height: 1.35em; flex: none; }
.sb-lbl { display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; flex-wrap: wrap; }
button .sb-art.mini, .sb-lbl .sb-art.mini { margin: -2px 0; }
.sb-card {
  position: relative; flex: none; width: 66px; height: 90px; border-radius: 10px; padding: 12px 2px 4px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: var(--c, #fff); color: var(--ink);
  border: var(--bw) solid var(--ink); box-shadow: 2px 2px 0 var(--ink);
  font: 600 11px/1.1 var(--font-head); text-align: center; user-select: none; -webkit-user-select: none;
}
.sb-card .e { width: 48px; height: 48px; flex: none; }
.sb-card .n { overflow-wrap: anywhere; }
.sb-tag {
  position: absolute; top: 3px; left: 3px; min-width: 18px; padding: 0 4px; height: 16px; border-radius: 99px;
  background: var(--ink); color: #fff; font: 700 10px/16px var(--font-head); white-space: nowrap;
}
.sb-tag.k-mala { background: #e2392b; }
.sb-tag.k-dessert { background: #d94f9a; }
.sb-order {
  position: absolute; top: -9px; right: -9px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--ink); color: #fff; font: 700 13px/22px var(--font-head);
}
.sb-card.sm { width: 52px; height: 70px; font-size: 9px; padding-top: 10px; }
.sb-card.sm .e { width: 36px; height: 36px; }
.sb-card.sm .sb-tag { font-size: 8px; height: 13px; line-height: 13px; min-width: 14px; top: 2px; left: 2px; padding: 0 3px; }
.sb-card.xs { width: 38px; height: 46px; padding: 2px; border-width: 2px; box-shadow: 1px 1px 0 var(--ink); }
.sb-card.xs .e { width: 30px; height: 30px; }
.sb-card.xs .n, .sb-card.xs .sb-tag { display: none; }
.sb-card.kept { outline: 2px dashed var(--ink); outline-offset: 1px; }
.sb-card.back { background: #b8322a; padding: 0; overflow: hidden; }
.sb-card.back .e { width: 100%; height: 100%; }
.sb-card.dim { opacity: .45; }
.sb-card.boost { outline: 3px solid #e2392b; outline-offset: 1px; }
.sb-hand { display: grid; grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); gap: 10px 8px; padding-top: 8px; justify-items: center; }
.sb-hand button.sb-card { cursor: pointer; transition: transform .12s; }
.sb-hand .sb-card.on { transform: translateY(-8px); box-shadow: 2px 6px 0 var(--ink); outline: 3px solid var(--ink); }
.sb-desc { background: rgba(255,255,255,.6); border-radius: 12px; padding: 6px 10px; }
.sb-table { display: flex; flex-wrap: wrap; gap: 6px; }
.sb-stack { display: flex; }
.sb-stack .sb-card + .sb-card { margin-left: -22px; transform: rotate(6deg) translateY(-3px); }
.sb-card.sm + .sb-card.sm.top { margin-left: -30px; }
.sb-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.sb-pill {
  display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px 2px 4px; border-radius: 99px;
  background: #fff; border: 2px solid var(--ink); font: 600 12px var(--font-head); color: var(--ink);
}
.sb-seat { flex-direction: column; align-items: flex-start; gap: 8px; }
.sb-reveal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.sb-reveal-item { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.sb-who { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.sb-reveal.fresh .sb-reveal-item .sb-card { animation: sb-flip .5s ease-out both; animation-delay: calc(var(--i) * 90ms); }
@keyframes sb-flip { 0% { transform: rotateY(90deg) scale(.8); } 70% { transform: rotateY(0) scale(1.08); } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) { .sb-reveal.fresh .sb-reveal-item .sb-card { animation: none; } }
.sb-banner { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px; }
.sb-banner .sb-art { width: 56px; height: 56px; }
.sb-scroll { overflow-x: auto; }
.sb-score { width: 100%; border-collapse: collapse; font-size: 14px; }
.sb-score th, .sb-score td { padding: 6px 6px; text-align: center; border-bottom: 2px solid rgba(0,0,0,.12); white-space: nowrap; }
.sb-score th { font: 600 12px var(--font-head); }
.sb-score td:first-child { text-align: left; font-weight: 600; max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
.sb-score tr.me td { background: rgba(255,216,77,.45); }
