/* AMBFANTASY คือ design contract v2 (3 ก.ย. 2026)
   โลกของแบรนด์: สนามฟุตบอลกลางคืน ไฟสปอตไลต์ตัดหมอก หญ้าเปียก เส้นสนามสีไลม์
   ground เขียวเข้มแยกตัวจาก AMBTHAI (ดำ-ทอง) แต่เก็บทองไว้เป็นสีรางวัล
   register = instrument: หน้าแรกต้องเห็น "สิ่งที่มาทำ" ก่อนเลื่อน */
:root {
  --pitch-950: #060e0a;
  --pitch-900: #08130d;
  --pitch-800: #0c1c14;
  --pitch-700: #10261a;      /* การ์ด */
  --pitch-600: #16311f;
  --line: rgba(200,245,93,.14);
  --line-solid: #1e3a28;
  --lime: #c8f55d;
  --lime-2: #9fe04a;
  --lime-dim: rgba(200,245,93,.13);
  --gold: #ffc742;
  --ink: #f0f5ec;
  --ink-2: #b9c9b6;
  --ink-3: #7f9481;
  --bad: #ff6b6b;
  --r-lg: 20px;
  --r-md: 14px;
  --r-pill: 999px;
  --tap: 44px;
  --nav-h: 64px;
  --shadow: 0 10px 30px rgba(0,0,0,.45);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--pitch-950);
  color: var(--ink);
  font-family: 'Sarabun', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px; line-height: 1.5;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 14px);
  overflow-x: hidden;
}
a { color: var(--lime); text-decoration: none; }
img { max-width: 100%; display: block; }
.wrap { max-width: 560px; margin: 0 auto; padding: 0 15px; }

/* ---------- หัวเว็บลอย ---------- */
.top {
  position: sticky; top: 0; z-index: 30;
  background: linear-gradient(180deg, rgba(6,14,10,.96) 70%, rgba(6,14,10,0));
  backdrop-filter: blur(10px);
  padding: 12px 15px 10px; display: flex; align-items: center; gap: 10px;
}
.logo { font-weight: 800; letter-spacing: .12em; font-size: 15px; }
.logo b { color: var(--lime); }
.who {
  margin-left: auto; font-size: 12px; font-weight: 700; color: var(--ink-2);
  border: 1px solid var(--line-solid); border-radius: var(--r-pill);
  padding: 0 14px; min-height: 44px; display: inline-flex; align-items: center; gap: 6px;
  background: var(--pitch-800);
}
.who.on { color: var(--lime); border-color: var(--lime-dim); }

/* ---------- hero: สนามกลางคืน + สิ่งที่ต้องทำตอนนี้ ---------- */
.hero {
  position: relative; border-radius: var(--r-lg); overflow: hidden;
  margin-top: 4px; box-shadow: var(--shadow); isolation: isolate;
}
.hero img { width: 100%; height: 300px; object-fit: cover; object-position: center 38%; }
.hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(6,14,10,.1) 0%, rgba(6,14,10,.62) 48%, rgba(6,14,10,.95) 100%);
}
.hero-in { position: absolute; inset: auto 0 0 0; padding: 26px 15px 15px; z-index: 2; }
.hero h1 { margin: 0 0 4px; font-size: 22px; line-height: 1.22; font-weight: 800;
           text-shadow: 0 2px 12px rgba(0,0,0,.6); }
.hero h1 span { color: var(--lime); }
.hero p { margin: 0 0 12px; font-size: 13px; color: var(--ink-2); }
.hero-cta { display: flex; gap: 8px; align-items: center; }

/* นับถอยหลังปิดรับทีม = ข้อมูลที่คนมาหา จึงอยู่บนสุดและอ่านง่ายที่สุด */
.countdown {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(6,14,10,.72); border: 1px solid var(--line);
  border-radius: var(--r-pill); padding: 5px 12px; font-size: 12px; font-weight: 700;
}
.countdown b { color: var(--lime); font-variant-numeric: tabular-nums; }

h2 { font-size: 16px; margin: 20px 0 9px; display: flex; align-items: center; gap: 7px; }
h2 svg { width: 17px; height: 17px; color: var(--lime); flex: none; }
h2 .sub { margin-left: auto; font-size: 11px; font-weight: 400; color: var(--ink-3); }

.card {
  background: var(--pitch-700); border: 1px solid var(--line-solid);
  border-radius: var(--r-md); padding: 13px; margin-bottom: 9px;
}
.muted { color: var(--ink-3); font-size: 12px; }
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--lime-dim); color: var(--lime);
  border-radius: var(--r-pill); padding: 3px 10px; font-size: 11px; font-weight: 700;
}
.pill.gold { background: rgba(255,199,66,.15); color: var(--gold); }

button, .btn {
  font-family: inherit; font-size: 14px; font-weight: 700;
  min-height: var(--tap); padding: 0 17px; border-radius: var(--r-md);
  border: 1px solid var(--line-solid); background: var(--pitch-800); color: var(--ink);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
}
button.primary, .btn.primary {
  background: linear-gradient(135deg, var(--lime), var(--lime-2));
  color: #08130d; border-color: transparent; box-shadow: 0 6px 18px rgba(200,245,93,.22);
}
button:disabled { opacity: .45; cursor: not-allowed; }
button svg, .btn svg { width: 16px; height: 16px; }

/* ---------- แถวเลื่อนแนวนอน: ใบถัดไปโผล่ + ขอบจาง ---------- */
.railwrap { position: relative; margin: 0 -15px; }
.railwrap::after {
  content: ""; position: absolute; top: 0; right: 0; bottom: 6px; width: 34px;
  background: linear-gradient(90deg, transparent, var(--pitch-950));
  pointer-events: none;
}
.rail { display: flex; gap: 9px; overflow-x: auto; padding: 2px 15px 7px;
        scroll-snap-type: x mandatory; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.rail > * { scroll-snap-align: start; flex: 0 0 auto; }

/* การ์ดนัดแข่ง: ตราทีมเป็นอักษรย่อในวงกลมสีทีม ไม่ใช้โลโก้จริง (ลิขสิทธิ์) */
.fixture {
  width: 158px; background: var(--pitch-700); border: 1px solid var(--line-solid);
  border-radius: var(--r-md); padding: 12px;
}
.fx-row { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.crest {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  font-size: 11px; font-weight: 800; color: #08130d; flex: none; letter-spacing: 0;
}
.fx-name { font-size: 13px; font-weight: 700; line-height: 1.2;
           overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-when { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line);
           font-size: 11px; color: var(--ink-3); display: flex; align-items: center; gap: 5px; }

/* แบนเนอร์ข่าว */
.news {
  width: 268px; border-radius: var(--r-md); overflow: hidden; position: relative;
  border: 1px solid var(--line-solid); background: var(--pitch-700);
}
.news img { width: 100%; height: 132px; object-fit: cover;
            filter: saturate(.82) contrast(1.04); }
.news-in { padding: 10px 11px 12px; }
.news h3 { margin: 0 0 5px; font-size: 13px; line-height: 1.32; font-weight: 700;
           color: var(--ink); }
.news .src { font-size: 10.5px; color: var(--ink-3); display: flex; align-items: center; gap: 5px; }
.news .src i { width: 5px; height: 5px; border-radius: 50%; background: var(--lime); display: inline-block; }

/* การ์ดนักเตะ */
.prow {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px;
  background: var(--pitch-800); border: 1px solid var(--line-solid); border-radius: 12px;
  min-height: var(--tap); text-align: left; width: 100%;
}
.prow.picked { border-color: var(--lime); background: rgba(200,245,93,.09); }
.prow .nm { font-weight: 700; font-size: 13px; }
.prow .meta { font-size: 11px; color: var(--ink-3); }
.prow .pr { margin-left: auto; font-weight: 800; font-size: 13px; color: var(--gold); }
.plist { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }

.rank-badge {
  width: 26px; height: 26px; border-radius: 9px; display: grid; place-items: center;
  font-size: 12px; font-weight: 800; background: var(--pitch-600); color: var(--ink-2); flex: none;
}
.rank-badge.g1 { background: linear-gradient(135deg, #ffd76a, #e0a316); color: #2a1c00; }
.rank-badge.g2 { background: linear-gradient(135deg, #dfe6e9, #a7b3b8); color: #1c2226; }
.rank-badge.g3 { background: linear-gradient(135deg, #e3a06a, #b9713c); color: #23130a; }

.slotbar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 9px; }
.slot { font-size: 11px; padding: 4px 10px; border-radius: var(--r-pill);
        border: 1px solid var(--line-solid); color: var(--ink-3); font-weight: 600; }
.slot.full { border-color: var(--lime); color: var(--lime); background: var(--lime-dim); }

.bar { height: 6px; border-radius: 4px; background: var(--pitch-600); overflow: hidden; margin-top: 7px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--lime), var(--lime-2)); }

.lb { width: 100%; border-collapse: collapse; }
.lb th, .lb td { padding: 9px 5px; text-align: left; border-bottom: 1px solid var(--line);
                 font-size: 13px; vertical-align: middle; }
.lb th { color: var(--ink-3); font-weight: 600; font-size: 11px; }
.lb tr:last-child td { border-bottom: none; }
.lb tr.me td { color: var(--lime); }
.lb td.pts { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }

.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tabs button { flex: 1; min-height: 44px; padding: 0 8px; font-size: 13px; }
.tabs button.on { background: var(--lime); color: #08130d; border-color: var(--lime); }

/* แถบเมนูล่าง */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(8,19,13,.95); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line-solid); display: flex;
}
.nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; font-size: 10px; color: var(--ink-3); font-weight: 700;
}
.nav a.on { color: var(--lime); }
.nav a.on .ico { background: var(--lime-dim); }
.ico { width: 30px; height: 22px; border-radius: 8px; display: grid; place-items: center; }
.nav svg { width: 19px; height: 19px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 18px);
  background: var(--pitch-600); border: 1px solid var(--lime); color: var(--ink);
  padding: 10px 16px; border-radius: 12px; font-size: 13px; z-index: 50;
  max-width: 90vw; text-align: center; box-shadow: var(--shadow);
}
.hide { display: none !important; }
.skel { background: linear-gradient(90deg, var(--pitch-700), var(--pitch-600), var(--pitch-700));
        background-size: 200% 100%; animation: sh 1.15s infinite; border-radius: 12px; }
@keyframes sh { to { background-position: -200% 0; } }
.empty { border: 1px dashed var(--line-solid); border-radius: var(--r-md);
         padding: 18px 14px; text-align: center; color: var(--ink-3); font-size: 12.5px; }

/* แถบแจ้งสถานะเหนือรายชื่อนักเตะ คือ บอกให้รู้ก่อนเลือกจนครบว่าติดเงื่อนไขอะไร */
.note {
  border: 1px solid var(--line-solid); background: var(--pitch-800);
  border-radius: 12px; padding: 10px 12px; font-size: 12.5px; color: var(--ink-2);
  margin-bottom: 10px;
}
.note.warn { border-color: rgba(255,199,66,.4); color: var(--gold); }
.note button { background: var(--lime); color: #08130d; border-color: transparent; font-size: 13px; }

/* podium นักเตะฟอร์มดี: 3 ใบเรียงแนวนอน แทนลิสต์ 5 แถวที่เหมือนกันหมด */
.podium-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.podium { display: block; text-align: center; padding: 13px 8px; min-height: 44px;
          background: var(--pitch-700); border: 1px solid var(--line-solid); border-radius: var(--r-md); }
.podium .big { display: block; font-size: 22px; font-weight: 800; color: var(--lime); line-height: 1.1; }
.podium .nm { display: block; font-size: 12.5px; font-weight: 700; margin-top: 5px;
              overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── สนามในแท็บจัดทีม ─────────────────────────────────────────────
   หน้าเลือกทีมเดิมอ่านเหมือนสเปรดชีต ทั้งที่นี่คือเกมฟุตบอล สนามทำให้
   ผู้เล่นเห็นทีมของตัวเองเป็นภาพเดียวและรู้ทันทีว่าตำแหน่งไหนยังว่าง */
.pitch {
  scroll-margin-top: 64px; /* เด้งกลับขึ้นสนามแล้วไม่โดนหัวเว็บลอยบัง */
  border-radius: 16px; padding: 14px 8px; display: grid; gap: 10px;
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(255,255,255,.05), transparent 60%),
    repeating-linear-gradient(180deg, #164a2444 0 54px, #0f3418 54px 108px), #10381b;
  min-height: 430px; grid-template-rows: repeat(4, 1fr); align-items: center;
  border: 1px solid rgba(255,255,255,.10);
  position: relative; overflow: hidden;
}
.pitch::before {  /* เส้นแบ่งครึ่งสนาม */
  content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 2px;
  background: rgba(255,255,255,.10); pointer-events: none;
}
.pbox, .pcircle {
  position: absolute; border: 2px solid rgba(255,255,255,.10);
  pointer-events: none; z-index: 0;
}
.pbox { left: 23%; width: 54%; height: 46px; }
.pbox.t { top: 0; border-top: 0; }
.pbox.b { bottom: 0; border-bottom: 0; }
.pcircle {
  width: 44%; aspect-ratio: 1; border-radius: 50%;
  left: 50%; top: 50%; transform: translate(-50%, -50%);
}
.prow-pitch {
  display: flex; justify-content: center; flex-wrap: wrap; gap: 8px;
  position: relative; z-index: 1;
}
.pp {
  background: none; border: 0; padding: 2px; min-height: 44px; width: 66px;
  display: block; text-align: center; cursor: pointer;
}
.shirt {
  transition: box-shadow .2s ease;
  display: flex; align-items: center; justify-content: center; position: relative;
  width: 44px; height: 44px; margin: 0 auto; border-radius: 50%;
  background: var(--c, #2f6f47); color: #fff; font-size: 11px; font-weight: 700;
  box-shadow: 0 3px 8px rgba(0,0,0,.35); border: 2px solid rgba(255,255,255,.22);
}
.shirt.blank {
  background: rgba(255,255,255,.06); border: 2px dashed rgba(255,255,255,.35);
  color: rgba(255,255,255,.7); font-size: 19px;
}
.shirt.cap { box-shadow: 0 0 0 2px var(--gold), 0 3px 10px rgba(0,0,0,.4); }
.capt {
  position: absolute; right: -4px; top: -4px; width: 19px; height: 19px;
  border-radius: 50%; background: var(--gold); color: #1a1200;
  font-size: 11px; font-style: normal; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.ppn {
  display: block; margin-top: 4px; font-size: 11px; color: #eaf3ec;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 1px 3px rgba(0,0,0,.6);
}
.ppp { display: block; font-size: 10.5px; color: var(--gold); }

/* แผ่นตัวเลือกเมื่อแตะนักเตะบนสนาม: บอกทางเลือกเป็นคำ ปุ่มเต็มนิ้ว */
#sheet {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 40;
  display: none; align-items: flex-end;
}
#sheet.on { display: flex; }
.sheetin {
  width: 100%; background: var(--pitch-900); border-radius: 20px 20px 0 0;
  padding: 16px 15px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line-solid); display: grid; gap: 8px;
}
.sheetin h3 { margin: 0 0 4px; font-size: 16px; }
.sheetin h3 .muted { font-size: 12px; font-weight: 400; display: block; margin-top: 2px; }
.sheetin button { width: 100%; min-height: 46px; justify-content: center; }
.sheetin button[disabled] { opacity: .55; }
.sheetin .ghost { background: none; border-color: transparent; color: var(--ink-3); }

/* ปุ่มบวกท้ายแถวรายชื่อ: บอกว่าแถวนี้แตะเพื่อ "เพิ่มลงทีม" ได้ */
.add {
  width: 28px; height: 28px; border-radius: 50%; flex: 0 0 28px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(198,255,110,.45); color: var(--lime);
  font-size: 15px; line-height: 1;
}
.add.on { background: var(--lime); color: #0d1a05; border-color: var(--lime); }

/* ช่องกรอกและ dropdown ใช้หน้าตาเดียวกันทุกที่ */
.field {
  min-height: 44px; border-radius: 12px; border: 1px solid var(--line-solid);
  background: var(--pitch-800); color: var(--ink); padding: 0 12px;
  font-family: inherit; font-size: 14px;
}

.meta.dim { color: rgba(226,240,228,.52); font-size: 11.5px; }

/* คะแนนรวมใต้สนาม คือ ตัวเลขที่คนกลับมาดูหลังบันทึกทีมแล้ว */
.pscore {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  margin-top: 4px; padding: 10px 12px; border-radius: 13px;
  background: rgba(6,14,10,.55); border: 1px solid var(--line-solid);
  position: relative; z-index: 1; font-size: 12.5px;
}
.pscore b { font-size: 19px; color: var(--lime); }
.pscore .muted { margin-left: 2px; }
.pscore .pill.warn { background: rgba(255,190,90,.14); color: #ffd08a; border-color: rgba(255,190,90,.3); }

/* นาฬิกาปิดรับ ต้องเห็นตอนกำลังเลือกตัว ไม่ใช่เห็นแค่บนหน้าแรก */
.cdbar {
  position: sticky; top: 0; z-index: 12; margin: 10px 0 0;
  padding: 9px 13px; border-radius: 12px; font-size: 12.5px;
  background: rgba(9,20,13,.92); border: 1px solid var(--line-solid);
  backdrop-filter: blur(8px);
}
.cdbar b { color: var(--lime); }

/* แถวที่เลือกไม่ได้ บอกเหตุผลไว้ในแถวเลย ดีกว่าให้กดแล้วเด้ง toast */
.prow { min-width: 0; }
.prow.off { opacity: .5; }
.prow.off .add { border-color: var(--line-solid); color: var(--ink-3); }
.prow .meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* จุดสถานะบนตรา: เจ็บหรือย้ายทีมแล้วต้องเห็นก่อนเลือก */
.crestwrap { position: relative; flex: none; display: block; }
.dot {
  position: absolute; right: -2px; bottom: -2px; width: 11px; height: 11px;
  border-radius: 50%; border: 2px solid var(--pitch-800); display: block;
}
.dot.bad { background: #f0525b; }
.dot.warn { background: var(--gold); }
.shirt .dot { right: -1px; bottom: -1px; border-color: rgba(0,0,0,.35); }

/* ตารางคะแนน คนใหม่ถามเป็นคำถามแรกเสมอว่ายิงประตูได้กี่คะแนน */
.scoretab { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.scoretab td { padding: 7px 0; border-bottom: 1px solid var(--line); }
.scoretab td:last-child { text-align: right; font-weight: 700; color: var(--lime); white-space: nowrap; }
.scoretab tr:last-child td { border-bottom: 0; }

details.more { margin-top: 10px; }
details.more summary {
  cursor: pointer; font-size: 12.5px; color: var(--lime);
  min-height: 44px; display: flex; align-items: center; gap: 6px;
  list-style: none; border-top: 1px solid var(--line); margin-top: 4px;
}
details.more summary::-webkit-details-marker { display: none; }
details.more summary::after {
  content: '▾'; margin-left: auto; font-size: 12px;
  transition: transform .18s ease;
}
details.more[open] summary::after { transform: rotate(180deg); }

/* การตอบสนองตอนแตะ คือ สิ่งที่แยกเกมออกจากเอกสาร */
button, .btn, .prow, .pp, .news, .fixture, .podium, .nav a, .tabs button {
  transition: transform .12s ease, background-color .15s ease,
              border-color .15s ease, box-shadow .15s ease;
}
button:active, .btn:active, .prow:active, .pp:active, .podium:active { transform: scale(.97); }
.prow.picked { animation: pop .22s ease; }
@keyframes pop { 50% { transform: scale(1.025); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ข่าวเป็นแบนเนอร์ประกอบ ไม่ควรสว่างกว่าปุ่มเริ่มเล่นซึ่งเป็นเป้าหมายจริง */
.news img { filter: saturate(.78) brightness(.74) contrast(1.04); }
.news::after {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 132px;
  background: linear-gradient(180deg, rgba(6,14,10,.12), rgba(6,14,10,.5));
  pointer-events: none;
}
.news h3 {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; min-height: 2.7em;
}

.fx-vs {
  display: flex; align-items: center; gap: 7px; margin: 3px 0;
  font-size: 10px; color: var(--ink-3);
}
.fx-vs::before, .fx-vs::after {
  content: ''; flex: 1; height: 1px; background: var(--line);
}

/* ---------- รูปหน้านักเตะ ----------
   ตัวย่อสโมสรอยู่ใต้รูปเสมอ ถ้ารูปโหลดไม่ได้ ตัวย่อจะโผล่แทนโดยไม่ต้องจัดใหม่ */
.face {
  position: relative; flex: none; display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: 50%; overflow: hidden;
  background: var(--c, #2f6f47); color: #fff;
  font-size: 11px; font-weight: 700;
}
.face img {
  position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%;
  object-fit: cover; object-position: center top;
}
/* ภาพเสื้อเป็นทรงยาว ถ้า cover จะโดนตัดคอเสื้อทิ้ง ใช้ contain แทน */
.face img[src*="shirt-"], .shirt img[src*="shirt-"] {
  object-fit: contain; object-position: center; padding: 3px;
  background: var(--c, #2f6f47);
}
.face b { position: relative; z-index: 0; font-weight: 700; }
.face.big { width: 62px; height: 62px; font-size: 13px; }

/* บนสนามใช้กติกาเดียวกัน ตัวย่ออยู่หลังรูป */
.shirt img {
  position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%;
  object-fit: cover; object-position: center top; border-radius: 50%;
}
.shirt b { position: relative; z-index: 0; font-weight: 700; }
.shirt .capt, .shirt .dot { z-index: 2; }

.sheethead { display: grid; grid-template-columns: auto 1fr; gap: 11px; align-items: start; }
.sheethead h3 { grid-column: 2; margin: 0 0 4px; }
.sheethead p { grid-column: 2; }

/* แถวโหมดสลับตัว: ทีมครบแล้วแต่ยังเปลี่ยนตัวได้ ต้องไม่ดูเหมือนแถวที่กดไม่ได้ */
.prow.swap .add { border-color: rgba(255,255,255,.28); color: var(--ink-2); }

/* แถวอันดับที่กดดูทีมได้ */
tr.clickable { cursor: pointer; }
tr.clickable:active td { background: rgba(200,245,93,.07); }

/* รายชื่อ 11 คนในแผ่นดูทีมคนอื่น */
.mlist { display: grid; gap: 6px; max-height: 52vh; overflow-y: auto; margin-bottom: 4px; }
.mrow {
  display: flex; align-items: center; gap: 10px; padding: 7px 9px;
  background: var(--pitch-800); border: 1px solid var(--line-solid); border-radius: 11px;
}
.mrow .nm { font-weight: 700; font-size: 13px; }
.mrow .meta { font-size: 11px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mrow .pr { margin-left: auto; font-weight: 800; font-size: 12.5px; color: var(--gold); }
.capt.inline {
  position: static; display: inline-flex; width: 16px; height: 16px;
  vertical-align: middle; font-size: 10px;
}

/* แถบรางวัลบนหน้าแรก: ตัวเลขต้องเป็นสิ่งแรกที่ตาไปหยุด */
.prizecard { margin-top: 12px; border-color: rgba(255,209,102,.28); }
.pz-head { display: flex; align-items: center; gap: 8px; margin-bottom: 11px; flex-wrap: wrap; }
.pz-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.pz-grid > div {
  padding: 11px 6px; border-radius: 13px;
  background: linear-gradient(180deg, rgba(255,209,102,.12), rgba(255,209,102,.04));
  border: 1px solid rgba(255,209,102,.2);
}
.pz-grid b { display: block; font-size: 19px; color: var(--gold); line-height: 1.15; }
.pz-grid span { display: block; margin-top: 3px; font-size: 11px; color: var(--ink-3); }

/* ป้ายกำกับแถวที่ไม่ใช่ผู้เล่นจริง */
.tag {
  display: inline-block; padding: 1px 7px; border-radius: 999px;
  font-size: 10px; font-weight: 700; vertical-align: middle;
  background: rgba(255,255,255,.09); color: var(--ink-2);
  border: 1px solid var(--line-solid);
}

.rules { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 6px; }
.rules li { font-size: 12px; color: var(--ink-2); line-height: 1.45; }

/* ตัวนับจริงใต้แถบรางวัล */
.counters {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin-top: 11px; padding-top: 11px; border-top: 1px solid var(--line);
  text-align: center;
}
.counters b { display: block; font-size: 15px; color: var(--lime); }
.counters span { display: block; margin-top: 2px; font-size: 10.5px; color: var(--ink-3); line-height: 1.3; }

.firstcall {
  grid-column: 1 / -1; text-align: center; font-size: 12px; color: var(--ink-3);
}
.firstcall b { display: block; margin-top: 3px; font-size: 13.5px; color: var(--lime); }

/* ช่องว่างถัดไปหลังเลือกคนเสร็จ — กะพริบบอกว่ากดตรงนี้ต่อ */
.pp.empty.next .shirt.blank {
  animation: nextslot .65s ease-in-out 4;
  box-shadow: 0 0 0 3px var(--lime), 0 0 18px var(--lime);
}
@keyframes nextslot { 50% { transform: scale(1.12); } }

/* แถบงบจัดทีม ลอยใต้หัวเว็บ (66px) ให้เห็นทั้งตอนดูสนามและตอนเลือกตัวในรายชื่อ */
.budgetbox {
  position: sticky; top: 66px; z-index: 11;
  display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center;
  margin: 8px 0 0; padding: 9px 13px 12px; border-radius: 12px; font-size: 13px;
  background: rgba(9,20,13,.96); border: 1px solid var(--line-solid);
  color: var(--ink-2);
}
.budgetbox b { color: var(--lime); font-size: 15px; }
.budgetbox .left { margin-left: auto; }
.budgetbox .bbar { display: block; width: 100%; height: 4px; border-radius: 4px; background: rgba(255,255,255,.1); overflow: hidden; }
.budgetbox .bbar i { display: block; height: 100%; background: var(--lime); transition: width .25s; }
.budgetbox.warn { border-color: #f0724a; }
.budgetbox.warn .left b, .budgetbox.warn .left { color: #ff9a7a; }
.budgetbox.warn .bbar i { background: #f0724a; }

/* กล่องฟิลเตอร์ลอยตามลงมาต่อใต้แถบงบ (เจ้าของสั่ง 8 ก.ย. 2026) เปลี่ยนตำแหน่ง/เรียงได้โดยไม่ต้องไถขึ้น */
.filterbox {
  position: sticky; top: calc(66px + var(--budget-h, 54px) + 6px); z-index: 10;
  margin: 11px -4px 9px; padding: 8px 4px 9px; border-radius: 12px;
  background: rgba(9,20,13,.96); border: 1px solid var(--line-solid);
}
/* กลุ่มสโมสร (accordion) ยุบก่อน กดหัวกลุ่มเพื่อขยาย */
.tgroup { border: 1px solid var(--line-solid); border-radius: 12px; background: var(--pitch-800); }
.tgroup summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 9px;
  padding: 9px 11px; min-height: var(--tap); font-weight: 700; font-size: 13px;
}
.tgroup summary::-webkit-details-marker { display: none; }
.tgroup .tname { flex: 1 1 auto; min-width: 0; }
.tgroup .tmeta { font-size: 11px; font-weight: 600; color: var(--ink-3); white-space: nowrap; }
.tgroup .tmeta.full { color: var(--lime); }
.tgroup .chev { width: 8px; height: 8px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: rotate(45deg); margin: 0 4px 3px; transition: transform .2s; }
.tgroup[open] .chev { transform: rotate(-135deg); margin-bottom: -3px; }
.tgroup[open] summary { border-bottom: 1px solid var(--line-solid); }
.tgroup .trows { display: grid; gap: 6px; padding: 6px; }
.tgroup .trows .prow { border-radius: 10px; }

/* ข่าวบอลวันนี้ (TDED SOCCER) + footer เว็บในเครือ — 23 ก.ย. 2026 */
h2 .sub.tded { color: var(--lime); font-weight: 700; text-align: right; }
.news .ph {
  height: 132px; padding: 12px 11px; display: flex; flex-direction: column; gap: 6px;
  background: linear-gradient(135deg, var(--pitch-700), var(--lime-dim));
}
.news .ph b { color: var(--lime); font-size: 10.5px; letter-spacing: .08em; }
.news .ph span {
  color: var(--ink-3); font-size: 11.5px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden;
}
.news.more { display: flex; align-items: center; border-color: var(--lime-dim); }
.news.more h3 { color: var(--lime); min-height: 0; }
.news.more p { margin: 0; }
.news.noimg::after, .news.more::after { display: none; }
.foot {
  margin: 26px 0 4px; padding: 16px 0 0; border-top: 1px solid var(--line-solid);
  font-size: 12px; color: var(--ink-3); line-height: 1.5;
}
.foot p { margin: 0 0 9px; }
.foot a { color: var(--lime); font-weight: 700; }
