/* ═══════════════════════════════════════════════════════════════
   myClover: CORE7 — Design System
   โทนเดียวกับบ้าน myclover.com: Deep Emerald · Warm Cream · Antique Gold
   Mobile-first · Touch target ≥ 44px · รองรับ Reduced Motion
   ═══════════════════════════════════════════════════════════════ */
:root {
  --ink: 18 40 28;
  --paper: 248 246 240;
  --green: 27 106 66;
  --deep: 10 40 24;
  --felt: 14 62 38;
  --gold: 190 148 66;
  --gold-l: 227 197 126;
  --muted: 96 108 100;
  --line: 18 40 28;
  /* สีเกม */
  --c-red: 200 68 44;   --c-red-deep: 143 43 26;
  --c-green: 46 125 79; --c-green-deep: 27 82 51;
  --c-blue: 44 107 168; --c-blue-deep: 27 68 112;
  --c-silver: 110 115 120;--c-silver-deep: 67 71 76;
  --radius: 14px;
  --shadow: 0 18px 40px -22px rgb(10 40 24 / .5);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "Anuphan", sans-serif;
  background: rgb(var(--paper));
  color: rgb(var(--ink));
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
}
.disp { font-family: "Bai Jamjuree", sans-serif; letter-spacing: -.015em; }
a { color: inherit; text-decoration: none; }
img, svg { max-width: 100%; }
/* การ์ดทุกใบวาดเป็น SVG ที่ติดทั้ง width และ height มาจากโค้ด พอกล่องแคบกว่านั้น
   max-width บีบเฉพาะความกว้าง ส่วนความสูงยังค้างค่าเดิม ภาพเลยยืดเกินกล่องแล้วโดน
   overflow:hidden ตัดขอบล่างหายไปนิดหนึ่ง — เห็นชัดสุดบนไพ่กลางโต๊ะตอนมือถือ
   ที่ตั้ง height ไว้เองอยู่แล้ว (เช่น .print-card) specificity สูงกว่า ไม่โดนกระทบ */
svg { height: auto; }
button { font: inherit; cursor: pointer; }
.sfx-toggle { border: 1px solid rgb(255 255 255 / .24); border-radius: 9px; background: transparent; color: inherit; min-width: 40px; min-height: 40px; }
[hidden] { display: none !important; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 18px; }
.wrap-slim { max-width: 760px; margin: 0 auto; padding: 0 18px; }
:focus-visible { outline: 3px solid rgb(var(--gold)); outline-offset: 3px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Nav ── */
.c7nav {
  position: sticky; top: 0; z-index: 100;
  background: rgb(var(--deep));
  color: #fff;
  border-bottom: 1px solid rgb(var(--gold) / .35);
}
.c7nav .bar { display: flex; align-items: center; gap: 12px; height: 60px; }
.c7nav .logo { display: flex; align-items: center; gap: 9px; font-family: "Bai Jamjuree"; font-weight: 700; font-size: 17px; }
.c7nav .logo em { font-style: normal; color: rgb(var(--gold-l)); }
.c7nav .links { margin-left: auto; display: flex; gap: 4px; align-items: center; font-size: 14px; font-weight: 600; }
.c7nav .links a { color: rgb(255 255 255 / .78); padding: 10px 12px; border-radius: 10px; min-height: 44px; display: inline-flex; align-items: center; }
.c7nav .links a:hover, .c7nav .links a[aria-current="page"] { color: #fff; background: rgb(255 255 255 / .1); }
.c7nav .links .play { background: rgb(var(--gold)); color: rgb(var(--deep)); padding: 10px 18px; }
.c7nav .links .play:hover { background: rgb(var(--gold-l)); color: rgb(var(--deep)); }
@media (max-width: 720px) { .c7nav .links a:not(.play):not(.keep) { display: none; } }

/* ── ปุ่ม ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  border-radius: 13px; padding: 14px 26px; min-height: 48px;
  font-weight: 700; font-size: 15.5px; font-family: "Bai Jamjuree";
  border: 1px solid rgb(var(--line) / .14); background: #fff; color: rgb(var(--ink));
  transition: transform .18s, box-shadow .18s, filter .18s;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }
.btn-gold { background: rgb(var(--gold)); color: rgb(var(--deep)); border-color: transparent; }
.btn-green { background: rgb(var(--green)); color: #fff; border-color: transparent; }
.btn-dark { background: rgb(var(--deep)); color: #fff; border-color: transparent; }
.btn-ghost { background: transparent; border-color: rgb(255 255 255 / .35); color: #fff; }
.btn-lg { padding: 17px 34px; font-size: 17px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-block { width: 100%; }

/* ── การ์ด UI ── */
.panel {
  background: #fff; border: 1px solid rgb(var(--line) / .1);
  border-radius: var(--radius); padding: 22px; box-shadow: 0 10px 30px -24px rgb(10 40 24 / .4);
}
.panel-dark { background: rgb(var(--felt)); color: #fff; border-color: rgb(var(--gold) / .3); }

/* ── ชิปสี (Generic) ── */
.chip {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; color: #fff; flex: none;
  border: 2px solid rgb(255 255 255 / .7); box-shadow: 0 3px 8px rgb(0 0 0 / .25);
}
.chip-red { background: rgb(var(--c-red)); }
.chip-green { background: rgb(var(--c-green)); }
.chip-blue { background: rgb(var(--c-blue)); }
.chip-silver { background: rgb(var(--c-silver)); }

/* ── หน้าเกม (Match) ── */
.match-shell {
  min-height: 100dvh; display: flex; flex-direction: column;
  background:
    radial-gradient(900px 520px at 50% -10%, rgb(27 106 66 / .55), transparent 65%),
    rgb(var(--deep));
  color: #fff;
}
.match-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px calc(6px); gap: 10px; font-size: 13.5px;
}
.match-top .pl { display: flex; align-items: center; gap: 9px; min-width: 0; }
.match-top .pl .nm { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32vw; }
.match-top .avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  background: rgb(var(--gold)); color: rgb(var(--deep));
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-family: "Bai Jamjuree";
}
.match-top .meta { font-size: 12px; color: rgb(255 255 255 / .72); display: flex; gap: 8px; }
.pips { display: inline-flex; gap: 3px; }
.pips i { width: 9px; height: 9px; border-radius: 50%; background: rgb(255 255 255 / .25); }
.pips i.on { background: rgb(var(--gold-l)); box-shadow: 0 0 6px rgb(var(--gold-l)); }
.conn { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; flex: none; }
.conn.off { background: #f87171; }

.public-counts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 14px 7px; }
.public-count-side { display: flex; align-items: center; gap: 7px; min-width: 0; font: 700 12px "Bai Jamjuree"; color: rgb(255 255 255 / .9); }
.public-count-side.opp { justify-content: flex-end; text-align: right; }
.public-count-label { color: rgb(var(--gold-l)); font-size: 10px; letter-spacing: .04em; white-space: nowrap; }
.public-count-side span { white-space: nowrap; }

.match-stage {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 8px 14px; position: relative; min-height: 0;
}
.match-board { flex: 1; display: flex; min-height: 0; }
.rule-line { position: absolute; bottom: 8px; display: flex; gap: 14px; align-items: center; justify-content: center; border: 1px solid rgb(var(--gold-l) / .28); background: rgb(3 24 14 / .5); border-radius: 999px; padding: 5px 13px; color: rgb(255 255 255 / .72); font: 700 11px "Bai Jamjuree"; letter-spacing: .03em; pointer-events: none; }
.stage-cards { display: flex; gap: 18px; align-items: center; justify-content: center; }
.stage-cards, .round-result, .round-discard { position: relative; z-index: 1; }
.stage-slot { width: min(31vw, 150px); aspect-ratio: 300/420; perspective: 900px; }
.stage-slot .flip { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform .45s; }
.stage-slot.revealed .flip { transform: rotateY(180deg); }
.stage-slot .face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 10px; overflow: hidden; }
.stage-slot .front { transform: rotateY(180deg); }
.stage-vs { font-family: "Bai Jamjuree"; font-weight: 700; font-size: 15px; color: rgb(var(--gold-l)); text-align: center; }
.round-result {
  margin-top: 12px; text-align: center; font-family: "Bai Jamjuree"; font-weight: 700;
  font-size: clamp(17px, 4.5vw, 22px); min-height: 32px;
}
.round-result .sub { display: block; font-family: "Anuphan"; font-weight: 400; font-size: 13.5px; color: rgb(255 255 255 / .75); }
/* คำผลรายรอบ — ใหญ่กว่าข้อความอธิบาย แต่เล็กกว่า end-overlay ตอนจบเกม */
.round-result .rr-word { display: block; font-family: "Bai Jamjuree"; font-weight: 700; font-size: clamp(26px, 8vw, 38px); letter-spacing: .06em; line-height: 1.15; }
.rr-word.win { color: rgb(var(--gold-l)); text-shadow: 0 0 22px rgb(190 148 66 / .5); }
.rr-word.lose { color: #fca5a5; }
.rr-word.draw { color: #d7dbd7; }
.round-discard { min-height: 38px; margin-top: 8px; display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; font: 700 12px "Bai Jamjuree"; color: rgb(255 255 255 / .8); }
.round-discard:empty { display: none; }

.match-hand {
  padding: 8px 10px calc(12px + env(safe-area-inset-bottom));
  background: rgb(0 0 0 / .25); border-top: 1px solid rgb(var(--gold) / .3);
}
/* ไพ่เจ็ดใบต้องอยู่แถวเดียวเสมอ — เดิม flex-wrap ทำให้ใบสุดท้ายตกไปบรรทัดสอง
   บนมือถือ (7×58 + 6×8 = 454px แต่จอ 390px มีที่ราว 370px)
   ตอนนี้ไม่ตัดบรรทัด แต่ให้ไพ่เบียดซ้อนกันแทน เหมือนถือไพ่จริง
   ระยะซ้อนคำนวณจากความกว้างที่มีจริง จอกว้างพอก็กลับไปเว้น 8px เหมือนเดิม */
.hand-row { display: flex; gap: 0; justify-content: center; flex-wrap: nowrap; margin-bottom: 10px; }
.hand-card + .hand-card { margin-left: clamp(-20px, calc((100% - 7 * 58px) / 6), 8px); }
.hand-card.sel, .hand-card:hover, .hand-card:focus-visible { z-index: 4; }
.hand-card {
  width: 58px; height: 81px; border-radius: 8px; border: 3px solid var(--hand-color, rgb(255 255 255 / .7));
  display: flex; flex-direction: column; align-items: stretch; justify-content: flex-end;
  color: #fff; font-family: "Bai Jamjuree"; font-weight: 700; font-size: 9px;
  transition: transform .15s, border-color .15s, box-shadow .15s;
  padding: 0; position: relative; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none;
  background-color: var(--hand-color, rgb(var(--deep)));
  background-image: linear-gradient(to top, rgb(4 16 10 / .94) 0%, rgb(4 16 10 / .08) 64%), var(--hand-art);
  background-size: cover; background-position: center;
}
.hand-card svg { pointer-events: none; }
.hand-card-name { display: block; padding: 14px 3px 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; text-shadow: 0 1px 3px #000; }
/* --slide คือระยะที่ใบข้าง ๆ ต้องหลบตอนลากสลับตำแหน่ง ใบที่ไม่ได้ลากทุกใบ
   จึงต้องมี translateX ติดตัวไว้ ไม่งั้น .sel จะทับ transform กันเอง */
.hand-card { transform: translate(var(--slide, 0px), 0); }
.hand-card.sel { border-color: rgb(var(--gold-l)); transform: translate(var(--slide, 0px), -8px); box-shadow: 0 8px 18px rgb(0 0 0 / .4), 0 0 0 3px rgb(var(--gold) / .5); }
.hand-card.dragging { transform: translate(var(--fling-x, 0), var(--fling-y, 0)) scale(1.04); transition: none; z-index: 5; box-shadow: 0 14px 28px rgb(0 0 0 / .48); }
/* ลากขึ้นพ้นขอบแถวมือแล้ว — ปล่อยนิ้วตรงนี้คือลงการ์ด บอกด้วยขอบทอง
   จะได้ไม่ต้องเดาว่าต้องลากสูงแค่ไหน */
.hand-card.dragging.will-play { border-color: rgb(var(--gold-l)); box-shadow: 0 18px 34px rgb(0 0 0 / .5), 0 0 0 3px rgb(var(--gold) / .55); }
.hand-card.sorting { transform: translate(var(--fling-x, 0), -10px) scale(1.06); transition: none; z-index: 6; box-shadow: 0 14px 28px rgb(0 0 0 / .48); }
.hand-card.fling-out { transform: translateY(-180px) scale(.82) rotate(-5deg); opacity: 0; transition: transform .28s ease-out, opacity .24s ease-out; }
.hand-card:disabled { opacity: .35; }
.match-actions { display: flex; gap: 10px; justify-content: center; align-items: center; }
.match-msg { text-align: center; font-size: 13.5px; color: rgb(255 255 255 / .85); min-height: 22px; margin-bottom: 6px; }

/* ── History drawer ── */
.drawer-toggle {
  position: absolute; top: 6px; right: 10px; z-index: 5;
  background: rgb(0 0 0 / .35); color: #fff; border: 1px solid rgb(255 255 255 / .25);
  border-radius: 10px; padding: 8px 13px; font-size: 12.5px; font-weight: 600; min-height: 44px;
}
.rules-toggle {
  position: absolute; top: 6px; left: 10px; z-index: 7;
  background: rgb(0 0 0 / .35); color: #fff; border: 1px solid rgb(255 255 255 / .25);
  border-radius: 10px; padding: 8px 13px; font-size: 12.5px; font-weight: 600; min-height: 44px;
}
.match-rules-popover {
  position: absolute; top: 58px; left: 10px; z-index: 12; width: min(390px, calc(100% - 20px));
  max-height: min(76vh, 650px); overflow: auto; padding: 12px; color: #fff;
  background: rgb(7 29 18 / .97); border: 1px solid rgb(var(--gold-l) / .55); border-radius: 14px;
  box-shadow: 0 18px 48px rgb(0 0 0 / .48);
}
.match-rules-popover[hidden] { display: none; }
.match-rules-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.match-rules-head button { width: 38px; height: 38px; border: 1px solid rgb(255 255 255 / .25); border-radius: 10px; background: rgb(255 255 255 / .08); color: #fff; }
.match-rules-popover img { display: block; width: 100%; height: auto; border: 0; }
.match-rules-popover p { margin: 10px 2px 6px; font-size: 12.5px; line-height: 1.65; color: rgb(255 255 255 / .84); }
.match-rules-popover a { color: rgb(var(--gold-l)); font-size: 12.5px; font-weight: 700; }
.drawer {
  position: fixed; inset: 0; z-index: 300; background: rgb(10 40 24 / .96);
  color: #fff; overflow-y: auto; padding: 18px 16px calc(24px + env(safe-area-inset-bottom));
}
.drawer h2 { font-family: "Bai Jamjuree"; margin-bottom: 14px; }
.history-rail { display: none; }
.history-empty { color: rgb(255 255 255 / .65); font-size: 13px; padding: 18px 0; text-align: center; }
/* Discard แบบแบ่งครึ่ง: คุณซ้าย · เส้นกลาง · คู่แข่งขวา */
.hist2 { position: relative; margin-top: 6px; }
.hist2::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: rgb(var(--gold) / .45); }
.hhead { display: grid; grid-template-columns: 1fr 1fr; font-family: "Bai Jamjuree"; font-weight: 700; font-size: 14.5px; padding-bottom: 10px; border-bottom: 1px solid rgb(255 255 255 / .18); margin-bottom: 4px; }
.hhead span:first-child { text-align: left; padding-right: 14px; color: rgb(var(--gold-l)); }
.hhead span:last-child { text-align: right; padding-left: 14px; }
.hround { position: relative; text-align: center; margin: 12px 0 6px; }
.rpill { display: inline-block; position: relative; background: rgb(var(--deep)); border: 1px solid rgb(255 255 255 / .25); border-radius: 999px; padding: 3px 14px; font-family: "Bai Jamjuree"; font-weight: 700; font-size: 12.5px; }
.rpill.win { color: #8fe6b0; border-color: rgb(143 230 176 / .5); }
.rpill.lose { color: #fca5a5; border-color: rgb(252 165 165 / .5); }
.rpill.tie { color: rgb(255 255 255 / .75); }
.hcells { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 6px; }
.hc { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; min-height: 4px; }
.hc.l { justify-content: flex-end; padding-right: 14px; }
.hc.r { justify-content: flex-start; padding-left: 14px; }
.hchip { display: inline-flex; align-items: center; gap: 7px; border-radius: 10px; padding: 4px 10px 4px 4px; color: #fff; font-family: "Bai Jamjuree"; font-weight: 600; font-size: 13px; border: 2px solid rgb(255 255 255 / .85); box-shadow: 0 2px 8px rgb(0 0 0 / .35); white-space: nowrap; }
/* ภาพจริงของการ์ดที่ออกไปแล้ว — ใบเล็กแต่จำได้ว่าเป็นใบไหน */
.hchip-art { width: 26px; height: 36px; flex: none; border-radius: 6px; background: center/cover no-repeat rgb(0 0 0 / .25); box-shadow: inset 0 0 0 1px rgb(255 255 255 / .35); }
.hchip.discard { border-style: dashed; opacity: .88; }
/* ใบที่ถูกทิ้งบอกด้วยเส้นประรอบภาพด้วย จะได้อ่านออกแม้ชิปเล็กลงบนจอแคบ */
.hchip.discard .hchip-art { box-shadow: inset 0 0 0 2px rgb(255 255 255 / .5); filter: grayscale(.35) brightness(.82); }
.discard-row { padding-bottom: 3px; }

/* จอกว้างเปิด/ซ่อน Discard rail ได้; เมื่อซ่อน โต๊ะกลับมากึ่งกลาง */
@media (min-width: 960px) and (min-height: 600px) {
  .match-shell.discard-open .match-board { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 430px); }
  .match-stage { width: 100%; }
  .match-shell.discard-open .history-rail {
    display: block; overflow-y: auto; padding: 20px 18px 28px;
    background: rgb(0 0 0 / .2); border-left: 1px solid rgb(var(--gold) / .3);
  }
  .history-rail h2 { font-size: 20px; margin-bottom: 12px; }
  .history-rail .hchip { font-size: 12px; padding: 3px 8px 3px 3px; }
  .history-rail .hchip-art { width: 22px; height: 31px; }
}

@media (max-width: 600px) {
  .public-counts { padding-inline: 8px; gap: 4px; }
  .public-count-side { gap: 4px; font-size: 11px; }
  .public-count-label { font-size: 8.5px; }
  .rule-line { gap: 8px; padding: 4px 9px; font-size: 9.5px; }
}

/* ผลใหญ่กลางจอเมื่อจบ Match */
.end-overlay { position: fixed; inset: 0; z-index: 260; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: rgb(10 40 24 / .88); backdrop-filter: blur(3px); text-align: center; padding: 20px; }
.end-overlay b { font-size: clamp(54px, 16vw, 112px); line-height: 1; letter-spacing: .04em; }
.end-overlay span { font-size: clamp(16px, 4.5vw, 21px); color: rgb(255 255 255 / .88); font-weight: 600; }
.end-discard { display: flex; align-items: center; justify-content: center; gap: 9px; flex-wrap: wrap; margin-top: 8px; }
.end-discard small { width: 100%; font: 700 12px "Bai Jamjuree"; letter-spacing: .06em; color: rgb(255 255 255 / .72); }
.end-overlay.win b { color: rgb(var(--gold-l)); text-shadow: 0 0 44px rgb(190 148 66 / .65); }
.end-overlay.lose b { color: #fca5a5; }
.end-overlay.draw b { color: #d7dbd7; }

/* ── Hand builder ── */
.hb-counter { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid rgb(var(--line) / .08); }
.hb-counter .cinfo { flex: 1; min-width: 0; }
.hb-counter .cname { font-weight: 700; font-family: "Bai Jamjuree"; }
.hb-counter .csub { font-size: 12.5px; color: rgb(var(--muted)); }
.hb-counter .num { font-family: "Bai Jamjuree"; font-weight: 700; font-size: 22px; width: 34px; text-align: center; }
.hb-btn {
  width: 46px; height: 46px; border-radius: 12px; border: 1px solid rgb(var(--line) / .15);
  background: #fff; font-size: 22px; font-weight: 700; font-family: "Bai Jamjuree";
  display: flex; align-items: center; justify-content: center;
}
.hb-btn:disabled { opacity: .3; }
.hb-total {
  position: sticky; bottom: 0; background: rgb(var(--deep)); color: #fff;
  border-radius: var(--radius); padding: 14px 18px; margin-top: 18px;
  display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow);
}
.hb-total .t { font-family: "Bai Jamjuree"; font-weight: 700; font-size: 19px; }

/* ── Card grid (Collection) ── */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.card-cell { position: relative; border-radius: 12px; transition: transform .18s; }
.card-cell:hover { transform: translateY(-4px); }
.card-cell svg { width: 100%; height: auto; display: block; border-radius: 10px; }
.card-cell .fav {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  background: rgb(0 0 0 / .4); border: 0; border-radius: 50%;
  width: 34px; height: 34px; color: #fff; font-size: 16px;
}
.card-cell .fav.on { color: rgb(var(--gold-l)); }

/* ── Section หัวข้อ ── */
.sec { padding: clamp(48px, 8vw, 90px) 0; }
.sec h2 { font-family: "Bai Jamjuree"; font-size: clamp(24px, 4.6vw, 34px); line-height: 1.25; margin-bottom: 14px; }
.sec .lead { color: rgb(var(--ink) / .75); max-width: 60ch; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-family: "Bai Jamjuree";
  font-weight: 700; font-size: 12.5px; letter-spacing: .14em; color: rgb(var(--green));
  text-transform: uppercase; margin-bottom: 10px;
}
.eyebrow::before { content: ""; width: 22px; height: 2px; background: rgb(var(--gold)); }

/* ── ตาราง / รายการ ── */
.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.stat { background: #fff; border: 1px solid rgb(var(--line) / .09); border-radius: 12px; padding: 14px 16px; }
.stat b { font-family: "Bai Jamjuree"; font-size: 24px; display: block; line-height: 1.2; }
.stat span { font-size: 12.5px; color: rgb(var(--muted)); }

/* ── Toast ── */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px); opacity: 0; z-index: 500;
  background: rgb(var(--deep)); color: #fff; border: 1px solid rgb(var(--gold) / .5);
  border-radius: 12px; padding: 12px 20px; font-size: 14px; pointer-events: none;
  transition: opacity .25s, transform .25s; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Modal ── */
.modal-back { position: fixed; inset: 0; z-index: 400; background: rgb(0 0 0 / .55); display: flex; align-items: center; justify-content: center; padding: 18px; }
.modal { background: rgb(var(--paper)); color: rgb(var(--ink)); border-radius: 16px; padding: 24px; max-width: 440px; width: 100%; max-height: 86dvh; overflow-y: auto; }
.modal h3 { font-family: "Bai Jamjuree"; margin-bottom: 10px; }

/* ── ฟอร์ม ── */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.field input, .field select {
  width: 100%; border: 1px solid rgb(var(--line) / .2); border-radius: 12px;
  padding: 13px 16px; font: inherit; background: #fff; min-height: 48px;
}
.field input:focus { border-color: rgb(var(--gold)); outline: none; }
.field .hint { font-size: 12.5px; color: rgb(var(--muted)); margin-top: 5px; }

/* ── Footer ── */
.c7foot {
  background: rgb(var(--deep)); color: rgb(255 255 255 / .75);
  padding: 36px 0 calc(40px + env(safe-area-inset-bottom)); font-size: 13.5px; margin-top: 40px;
}
.c7foot a { color: rgb(var(--gold-l)); }
.c7foot .cols { display: flex; gap: 28px; flex-wrap: wrap; justify-content: space-between; align-items: center; }

/* ── Badge / Tag ── */
.tag {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 999px;
  padding: 4px 12px; font-size: 12px; font-weight: 700; font-family: "Bai Jamjuree";
  background: rgb(var(--green) / .1); color: rgb(var(--green));
}
.tag-gold { background: rgb(var(--gold) / .16); color: #8a6a2c; }
.tag-soon { background: rgb(var(--muted) / .14); color: rgb(var(--muted)); }

/* ── Reveal animations ── */
@keyframes popIn { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes riseIn { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.anim-pop { animation: popIn .35s cubic-bezier(.2, 1.4, .4, 1); }
.anim-rise { animation: riseIn .4s ease; }
.cyc-node { transition: transform .2s; transform-box: fill-box; transform-origin: center; }
.cyc-node.pulse { transform: scale(1.12); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .stage-slot .flip { transition: none; }
}

/* ── Print (ใช้ในหน้า /core7/print/) ── */
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .print-sheet { width: 210mm; margin: 0; }
}
.print-sheet { display: grid; grid-template-columns: repeat(3, 63mm); gap: 0; justify-content: center; }
.print-card { width: 63mm; height: 88mm; overflow: hidden; outline: .3mm dashed #bbb; }
.print-card svg { width: 63mm; height: 88mm; }

/* ── ปุ่มสลับภาษาในแถบบน ── */
.lang-sw { display: inline-flex; padding: 3px; border-radius: 999px; background: rgb(255 255 255 / .1); border: 1px solid rgb(255 255 255 / .18); }
.lang-sw button { min-width: 40px; min-height: 34px; padding: 5px 11px; border: 0; border-radius: 999px; background: transparent; color: rgb(255 255 255 / .68); font-family: "Bai Jamjuree"; font-weight: 700; font-size: 12.5px; cursor: pointer; transition: background .15s, color .15s; }
.lang-sw button[aria-pressed="true"] { background: rgb(var(--cream, 248 246 240)); color: rgb(var(--deep)); }
.lang-sw button:focus-visible { outline: 2px solid rgb(var(--gold-l)); outline-offset: 2px; }
@media (max-width: 620px) { .lang-sw button { min-width: 34px; padding: 5px 8px; font-size: 12px; } }
