/* สนามรบไร้ขอบเขต — ระบบดีไซน์ "TACTICAL" (แนว VALORANT)
   น้ำเงินเข้ม + แดงสัญญาณ + ครีม · มุมตัดเฉียง ไม่มีมุมมน · ตัวอักษรพิมพ์ใหญ่บีบแคบ
   ทุกอย่างคมและตรง — ไม่มีเงาฟุ้ง ไม่มีขอบมน */

:root {
  /* ── พื้น */
  --bg: #0f1923;          /* น้ำเงินเข้มเกือบดำ — สีตัวเกม */
  --bg2: #0b141c;
  --panel: #1b2733;
  --panel2: #23313f;
  --line: #2f3d4c;
  --line2: #46586b;

  /* ── ตัวอักษร */
  --text: #ece8e1;        /* ครีม ไม่ใช่ขาวจ้า */
  --dim: #8b978f;
  --dim2: #63706b;

  /* ── สีสัญญาณ */
  --red: #ff4655;         /* สีหลัก */
  --teal: #18e5c4;        /* สีรอง ใช้น้อย ๆ */
  --sand: #ece8e1;

  --accent: var(--red);
  --accent-dim: #8c2731;
  --gold: #f5c518;
  --silver: #c9d1d9;
  --bronze: #cd7f32;
  --win: var(--teal);
  --lose: var(--red);
  --warn: var(--gold);
  --info: var(--teal);

  --radius: 0px;          /* คมทุกมุม */
  --ease: cubic-bezier(.2, .8, .3, 1);
  --shadow: 0 20px 50px -30px #000;

  /* มุมตัดขวาล่าง = ลายเซ็นของธีมนี้ */
  --notch: polygon(0 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%);
  --notch-sm: polygon(0 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%);
  /* ลายทแยงสำหรับพื้นที่ว่าง */
  --hatch: repeating-linear-gradient(45deg, rgba(255,70,85,.09) 0 1px, transparent 1px 7px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--text);
  font-family: Kanit, "Noto Sans Thai", "Leelawadee UI", "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  overflow-x: hidden;
}

/* เส้นทแยงจาง ๆ ที่มุมบน + แถบไล่เข้มด้านล่าง */
body::before {
  content: '';
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    linear-gradient(135deg, rgba(255,70,85,.06) 0%, transparent 26%),
    linear-gradient(180deg, transparent 60%, rgba(0,0,0,.45) 100%);
}

.top, .wrap { position: relative; z-index: 1; }

a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
p { margin: 0 0 .6em; }

/* ตัวอักษรหัวข้อ: พิมพ์ใหญ่ บีบแคบ เว้นห่าง — บุคลิกหลักของธีม */
.hero h1, .lrow .nm > b, .stat .v, .war .score, .brand span:not(small) {
  font-family: Oswald, Kanit, "Noto Sans Thai", sans-serif;
}

/* ─────────────────────────────── เปลี่ยนหน้า */

@view-transition { navigation: auto; }
.top { view-transition-name: site-header; }
::view-transition-old(root) { animation: vt-out .14s ease-in both; }
::view-transition-new(root) { animation: vt-in .26s var(--ease) both; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateX(8px); } }

/* ─────────────────────────────── การเคลื่อนไหว */

@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes pulse { 50% { opacity: .45; } }
@keyframes slide { from { opacity: 0; transform: translateX(-14px); } }
@keyframes sweep { 100% { background-position: 200% 0; } }

.card, .war, .stat { animation: rise .34s var(--ease) both; }
.lrow { animation: slide .34s var(--ease) both; }
.ladder > *:nth-child(2)  { animation-delay: .04s; }
.ladder > *:nth-child(3)  { animation-delay: .08s; }
.ladder > *:nth-child(4)  { animation-delay: .12s; }
.ladder > *:nth-child(5)  { animation-delay: .16s; }
.ladder > *:nth-child(n+6){ animation-delay: .2s; }
.grid > *:nth-child(2) { animation-delay: .05s; }
.grid > *:nth-child(3) { animation-delay: .1s; }
.grid > *:nth-child(4) { animation-delay: .15s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}

/* ─────────────────────────────── layout */

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px 90px; }

.top {
  position: sticky; top: 0; z-index: 40;
  background: var(--bg2);
  border-bottom: 1px solid var(--line);
}
/* แถบแดงบางบนสุด = ลายเซ็น */
.top::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--red) 0%, var(--red) 22%, transparent 22%, transparent 100%);
}
.top-in {
  max-width: 1180px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; gap: 14px;
}

.brand { display: flex; align-items: center; gap: 11px; white-space: nowrap; }
.brand .mark {
  width: 30px; height: 30px; display: grid; place-items: center; font-size: 14px;
  color: var(--sand); background: var(--red);
  clip-path: polygon(0 0, 100% 0, 100% 72%, 72% 100%, 0 100%);
  transition: transform .3s var(--ease);
}
.brand:hover .mark { transform: scale(1.12); }
.brand > span {
  font-size: 17px; font-weight: 600; letter-spacing: 1.4px; text-transform: uppercase;
}
.brand small {
  display: block; line-height: 1; margin-top: 2px;
  font-family: Kanit, sans-serif; font-size: 9px; font-weight: 400;
  letter-spacing: 3px; color: var(--red); text-transform: uppercase;
}

/* เส้นคั่นระหว่างโลโก้กับเมนู — เมนูชิดซ้ายแบบเว็บเกม ไม่ลอยไปขวา */
.top-div { width: 1px; align-self: stretch; background: var(--line); margin: -2px 4px -2px 2px; }

/* min-width:0 จำเป็น — flex item ไม่ยอมหดต่ำกว่าความกว้างเนื้อหาโดยปริยาย
   ถ้าไม่ใส่ พอเมนูยาวขึ้น (ตอนนี้ 8 อัน + ปุ่มห้องควบคุม) มันจะดันทั้งหน้าให้เลื่อนแนวนอน
   แทนที่จะเลื่อนอยู่ในแถบเมนูของตัวเอง */
.nav { display: flex; gap: 0; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  position: relative; padding: 9px 14px;
  color: var(--dim); font-size: 12px; white-space: nowrap;
  text-transform: uppercase; letter-spacing: 1.4px; font-weight: 500;
  transition: color .18s var(--ease), background .18s var(--ease);
}
.nav a::after {
  content: ''; position: absolute; left: 14px; right: 14px; bottom: 4px; height: 2px;
  background: var(--red); transform: scaleX(0); transform-origin: left;
  transition: transform .22s var(--ease);
}
.nav a:hover { color: var(--text); background: rgba(255,255,255,.04); }
.nav a:hover::after { transform: scaleX(1); }
.nav a.on { color: var(--text); }
.nav a.on::after { transform: scaleX(1); }
/* ห้องควบคุม = ปุ่มแดงมุมขวาสุด แบบปุ่ม PLAY ของเว็บเกม */
.nav a.admin-link {
  margin-left: auto; background: var(--red); color: var(--sand); font-weight: 600;
  clip-path: var(--notch-sm); padding: 9px 16px;
}
.nav a.admin-link:hover { background: var(--sand); color: var(--red); }
.nav a.admin-link::after { display: none; }

/* หัวเรื่องหน้า — ป้ายเล็กพิมพ์ใหญ่ + ตัวใหญ่บีบแคบ + เส้นคั่นมีหัวแดง */
.hero { padding: 32px 0 18px; animation: fade .4s var(--ease) both; position: relative; }
.hero .eyebrow {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
  font-size: 10px; letter-spacing: 3.4px; text-transform: uppercase;
  color: var(--red); font-weight: 500;
}
.hero .eyebrow::before { content: ''; width: 24px; height: 2px; background: var(--red); flex: 0 0 24px; }
.hero::after {
  content: ''; display: block; margin-top: 18px; height: 1px;
  background: linear-gradient(90deg, var(--red) 0 70px, var(--line) 70px);
}
.hero h1 {
  font-size: clamp(30px, 6vw, 54px); line-height: .98; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1px; color: var(--sand);
}
.hero .sub {
  color: var(--dim); font-size: 13px; margin-top: 10px;
  letter-spacing: .3px;
}

/* ─────────────────────────────── แผง */

.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  clip-path: var(--notch);
  transition: border-color .2s var(--ease), background .2s var(--ease), transform .2s var(--ease);
}
/* ขีดมุมขวาบน — ของประดับประจำกรอบแบบเกม */
.card::before {
  content: ''; position: absolute; top: 0; right: 0;
  border-top: 9px solid var(--line2); border-left: 9px solid transparent;
  transition: border-top-color .2s var(--ease);
}
.card:hover { border-color: var(--line2); }
.card:hover::before { border-top-color: var(--red); }
.card + .card { margin-top: 12px; }
.card h2 {
  font-size: 13px; display: flex; align-items: center; gap: 9px;
  text-transform: uppercase; letter-spacing: 1.6px; font-weight: 600;
}
.card h2::before {
  content: ''; width: 3px; height: 14px; background: var(--red); flex: 0 0 3px;
}
.card h2 .n {
  color: var(--dim); font-weight: 400; font-size: 11px; letter-spacing: .6px;
  text-transform: none;
}

.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.right { margin-left: auto; }
.muted { color: var(--dim); }
.tiny { font-size: 12px; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .4px; }

/* หัวข้อหมวด — ตัวใหญ่พิมพ์ใหญ่ มีแท่งแดงนำ แล้วลากเส้นยาวไปจนสุดขอบ */
.sec-title {
  font-family: Oswald, Kanit, "Noto Sans Thai", sans-serif;
  font-size: 19px; color: var(--sand); text-transform: uppercase; letter-spacing: 2.2px;
  margin: 34px 0 14px; display: flex; align-items: center; gap: 12px; font-weight: 500;
}
.sec-title::before { content: ''; width: 4px; height: 21px; background: var(--red); flex: 0 0 4px; }
.sec-title::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* ─────────────────────────────── ปุ่ม / ฟิลด์ */

.btn {
  appearance: none; cursor: pointer; font: inherit; font-size: 12px;
  padding: 10px 18px; border-radius: 0;
  text-transform: uppercase; letter-spacing: 1.4px; font-weight: 500;
  background: transparent; color: var(--text);
  border: 1px solid var(--line2);
  clip-path: var(--notch-sm);
  transition: background .16s var(--ease), color .16s var(--ease),
              border-color .16s var(--ease), transform .1s var(--ease);
}
.btn:hover:not(:disabled) { background: var(--sand); color: var(--bg); border-color: var(--sand); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .35; cursor: not-allowed; }

.btn.primary { background: var(--red); border-color: var(--red); color: var(--sand); font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: var(--sand); color: var(--red); border-color: var(--sand); }
.btn.ghost { border-color: var(--line); color: var(--dim); }
.btn.ghost:hover:not(:disabled) { color: var(--bg); }
.btn.ok { border-color: var(--teal); color: var(--teal); }
.btn.ok:hover:not(:disabled) { background: var(--teal); color: var(--bg); }
.btn.danger { border-color: var(--red); color: var(--red); }
.btn.danger:hover:not(:disabled) { background: var(--red); color: var(--sand); }
.btn.sm { padding: 6px 12px; font-size: 11px; letter-spacing: 1px; }
.btn.block { width: 100%; justify-content: center; }

input, select, textarea {
  font: inherit; font-size: 14px; width: 100%;
  background: var(--bg2); color: var(--text);
  border: 1px solid var(--line); border-radius: 0; padding: 10px 12px;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
input:hover, select:hover, textarea:hover { border-color: var(--line2); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--red);
  box-shadow: inset 3px 0 0 var(--red);
}
label {
  display: block; font-size: 10px; color: var(--dim); margin: 0 0 6px;
  text-transform: uppercase; letter-spacing: 2px; font-weight: 500;
}
.field { margin-bottom: 12px; }
fieldset { border: 1px solid var(--line); padding: 10px; margin: 0 0 10px; }
legend { font-size: 11px; color: var(--red); padding: 0 6px; text-transform: uppercase; letter-spacing: 1.5px; }

/* ตัวนับ +/− */
.step { display: inline-flex; align-items: center; }
.step button {
  appearance: none; cursor: pointer; font: inherit; font-size: 16px; line-height: 1;
  width: 32px; height: 36px; display: grid; place-items: center;
  background: var(--bg2); color: var(--text); border: 1px solid var(--line);
  transition: background .14s var(--ease), color .14s var(--ease);
}
.step button:hover { background: var(--red); color: var(--sand); border-color: var(--red); }
.step button:active { transform: scale(.9); }
.step input {
  width: 50px; text-align: center; border-left: 0; border-right: 0;
  padding: 10px 2px; font-variant-numeric: tabular-nums; -moz-appearance: textfield;
  font-family: Oswald, Kanit, sans-serif; font-size: 15px;
}
.step input::-webkit-outer-spin-button, .step input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.step.k button:hover { background: var(--teal); color: var(--bg); border-color: var(--teal); }
.step.d button:hover { background: var(--red); }
.step.a button:hover { background: var(--gold); color: var(--bg); border-color: var(--gold); }

.kda {
  font-family: Oswald, ui-monospace, Consolas, monospace; font-size: 12px;
  padding: 1px 7px; color: var(--sand);
  background: var(--bg2); border: 1px solid var(--line);
  letter-spacing: .6px;
}
.kda i { color: var(--red); font-style: normal; margin: 0 2px; }

/* ─────────────────────────────── ป้าย */

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 0; font-size: 10px;
  border: 1px solid var(--line2); background: transparent; color: var(--dim);
  white-space: nowrap; text-transform: uppercase; letter-spacing: 1.2px; font-weight: 500;
  transition: border-color .18s var(--ease), color .18s var(--ease), background .18s var(--ease);
}
.pill.on { color: var(--text); }
.pill.red { border-color: var(--red); background: rgba(255,70,85,.14); color: #ff8f99; }
.pill.gold { border-color: var(--gold); background: rgba(245,197,24,.13); color: #ffdd6b; }
.pill.green { border-color: var(--teal); background: rgba(24,229,196,.12); color: #7ff0de; }
.pill.blue { border-color: var(--line2); background: rgba(255,255,255,.05); color: #b9c6cf; }
.pill.grey { opacity: .72; }

.emblem {
  width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; font-size: 16px;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 0;
  clip-path: polygon(0 0, 100% 0, 100% 78%, 78% 100%, 0 100%);
  transition: transform .2s var(--ease), border-color .2s var(--ease);
}
a:hover > .emblem, .lrow:hover .emblem { border-color: var(--red); transform: scale(1.06); }

/* ─────────────────────────────── ตารางอันดับ */

.ladder { display: grid; gap: 4px; }
.lrow {
  position: relative;
  display: grid; grid-template-columns: 62px 34px 1fr auto; gap: 14px; align-items: center;
  padding: 0 16px 0 0; min-height: 62px;
  background: var(--panel);
  border: 1px solid transparent; border-left: 0;
  transition: background .18s var(--ease), transform .18s var(--ease), border-color .18s var(--ease);
}
/* เลขอันดับอยู่ในบล็อกทึบ ชิดซ้ายสุด */
.lrow .pos {
  align-self: stretch;
  display: grid; place-items: center;
  font-family: Oswald, Kanit, sans-serif;
  font-size: 26px; font-weight: 600; color: var(--dim);
  background: var(--bg2); font-variant-numeric: tabular-nums;
  border-right: 1px solid var(--line);
  transition: background .18s var(--ease), color .18s var(--ease);
}
.lrow:hover { background: var(--panel2); transform: translateX(4px); border-color: var(--line2); }
.lrow:hover .pos { background: var(--red); color: var(--sand); border-color: var(--red); }

.lrow .nm { min-width: 0; }
.lrow .nm > b, .lrow .nm { font-weight: 500; }
.lrow .nm .sub {
  font-size: 10px; color: var(--dim); display: flex; gap: 8px; flex-wrap: wrap;
  text-transform: uppercase; letter-spacing: 1.1px; margin-top: 2px;
}
.lrow .stats { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

/* 3 อันดับแรก — แถบสีทับบล็อกเลข */
.lrow.r1 { background: linear-gradient(90deg, rgba(245,197,24,.13), var(--panel) 40%); }
.lrow.r1 .pos { background: var(--gold); color: #1a1405; }
.lrow.r2 { background: linear-gradient(90deg, rgba(201,209,217,.09), var(--panel) 40%); }
.lrow.r2 .pos { background: var(--silver); color: #12181d; }
.lrow.r3 { background: linear-gradient(90deg, rgba(205,127,50,.1), var(--panel) 40%); }
.lrow.r3 .pos { background: var(--bronze); color: #1a1005; }
.lrow.danger { box-shadow: inset 0 0 0 1px rgba(255,70,85,.4); }
.lrow.danger .pos { color: var(--red); }

.meter { height: 4px; background: var(--bg2); overflow: hidden; min-width: 52px; border-radius: 0; }
.meter i {
  display: block; height: 100%; background: var(--teal); transform-origin: left;
  animation: grow .6s var(--ease) both; transition: width .5s var(--ease);
}
.meter i.low { background: var(--gold); }
.meter i.none { background: var(--red); }

/* ─────────────────────────────── ตาราง */

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font-weight: 600; font-size: 10px; color: var(--dim);
  text-transform: uppercase; letter-spacing: 2px;
  padding: 11px 10px; border-bottom: 1px solid var(--line2); white-space: nowrap;
  position: sticky; top: 0; background: var(--bg2); z-index: 1;
}
td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .16s var(--ease); }
tbody tr:hover { background: var(--panel2); }
.scroll { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ─────────────────────────────── ผลศึก */

.war {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: center;
  padding: 15px; background: var(--panel); border: 1px solid var(--line);
  clip-path: var(--notch);
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.war:hover { border-color: var(--line2); background: var(--panel2); }
.war .side { display: flex; align-items: center; gap: 10px; min-width: 0; }
.war .side.b { flex-direction: row-reverse; text-align: right; }
.war .side .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.war .score {
  font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap;
  letter-spacing: 1px;
}
.war .score .w { color: var(--teal); }
.war .score .l { color: var(--dim2); }
.war .meta {
  grid-column: 1 / -1; display: flex; gap: 7px; flex-wrap: wrap; align-items: center;
  padding-top: 10px; margin-top: 4px; border-top: 1px solid var(--line);
}

/* ─────────────────────────────── สายแข่ง */

.bracket { display: flex; gap: 18px; overflow-x: auto; padding-bottom: 12px; }
.bround { display: flex; flex-direction: column; justify-content: space-around; gap: 12px; min-width: 205px; }
.bround h4 { font-size: 10px; color: var(--red); text-transform: uppercase; letter-spacing: 2.4px; }
.bmatch {
  border: 1px solid var(--line); background: var(--panel);
  transition: border-color .2s var(--ease);
}
.bmatch:hover { border-color: var(--line2); }
.bslot {
  display: flex; align-items: center; gap: 8px; padding: 9px 11px; font-size: 13px;
  border-bottom: 1px solid var(--line); transition: background .16s var(--ease);
}
.bmatch .bslot:last-child { border-bottom: 0; }
.bslot:hover { background: var(--panel2); }
.bslot.won { background: rgba(24,229,196,.1); color: #7ff0de; box-shadow: inset 3px 0 0 var(--teal); }
.bslot.bye { color: var(--dim2); font-style: italic; }
.bslot .cl { font-size: 9px; color: var(--dim); text-transform: uppercase; letter-spacing: 1px; }

/* ─────────────────────────────── ปุ่มเข้าเซิร์ฟ */

.servers { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.server-btn {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 12px; padding: 16px 18px;
  background: var(--panel); border: 1px solid var(--line);
  clip-path: var(--notch);
  transition: background .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.server-btn::after {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--red);
  transition: width .2s var(--ease);
}
.server-btn:hover { background: var(--panel2); border-color: var(--red); transform: translateY(-2px); }
.server-btn:hover::after { width: 5px; }
.server-btn .ico { font-size: 20px; margin-left: 6px; }
.server-btn .nm { font-weight: 600; text-transform: uppercase; letter-spacing: 1.2px; font-size: 14px; }
.server-btn .sub { font-size: 10px; color: var(--dim); display: block; text-transform: uppercase; letter-spacing: 1.2px; }

/* ─────────────────────────────── สถานะ */

.empty {
  text-align: center; color: var(--dim); padding: 32px 12px; font-size: 12px;
  text-transform: uppercase; letter-spacing: 2px;
  background: var(--hatch);
}
.empty::after {
  content: ''; display: inline-block; width: 5px; height: 5px; margin-left: 8px;
  background: var(--red); animation: pulse 1.1s ease-in-out infinite; vertical-align: middle;
}

.note {
  border-left: 3px solid var(--teal); background: var(--bg2);
  padding: 12px 14px; font-size: 13px; color: #cfe9e4;
}
.note.warn { border-color: var(--gold); color: #f2e0ac; }
.note.bad { border-color: var(--red); color: #ffc4c9; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(150%);
  background: var(--panel); border: 1px solid var(--line2); border-left: 3px solid var(--red);
  box-shadow: var(--shadow);
  padding: 13px 20px; z-index: 90; font-size: 13px; max-width: min(560px, 92vw);
  letter-spacing: 1px;
  /* ข้อความบางอันมีหลายบรรทัด (เช่นรายชื่อ Roblox ที่ใกล้เคียง) — ต้องขึ้นบรรทัดจริง
     และห้าม uppercase ไม่งั้นชื่อผู้ใช้ที่ต้องพิมพ์ตามจะเพี้ยนหมด */
  white-space: pre-line;
  transition: transform .3s var(--ease), opacity .22s var(--ease); opacity: 0;
}
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
#toast.bad { border-left-color: var(--red); }
#toast.good { border-left-color: var(--teal); }

.modal-bg {
  position: fixed; inset: 0; background: rgba(6,10,14,.86); z-index: 80;
  display: grid; place-items: center; padding: 16px;
  animation: fade .16s var(--ease) both;
}
.modal {
  background: var(--panel); border: 1px solid var(--line2);
  clip-path: var(--notch);
  padding: 20px; width: min(540px, 100%); max-height: 88vh; overflow: auto;
  box-shadow: var(--shadow); animation: rise .26s var(--ease) both;
}
.modal h3 {
  font-size: 15px; margin-bottom: 14px; text-transform: uppercase; letter-spacing: 2px;
  padding-left: 11px; border-left: 3px solid var(--red);
}
[hidden] { display: none !important; }

/* ─────────────────────────────── แท็บ */

/* ตัดบรรทัดแทนการเลื่อนแนวนอน — แท็บมี 16 อัน ยังไงก็ไม่พอบรรทัดเดียว
   ถ้าใช้ overflow scroll แท็บท้าย ๆ จะหายไปเฉย ๆ โดยไม่มีอะไรบอกว่ามีต่อ */
.tabs {
  display: flex; gap: 0; flex-wrap: wrap; margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  appearance: none; background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--dim); font: inherit; font-size: 11px; padding: 11px 15px; cursor: pointer; white-space: nowrap;
  text-transform: uppercase; letter-spacing: 1.6px; font-weight: 500;
  transition: color .18s var(--ease), border-color .18s var(--ease), background .18s var(--ease);
}
.tabs button:hover { color: var(--text); background: rgba(255,255,255,.04); }
.tabs button.on { color: var(--sand); border-bottom-color: var(--red); background: rgba(255,70,85,.08); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13px; }
.kv dt { color: var(--dim); }
.kv dd { margin: 0; }

/* แผ่นตัวเลข — เลขใหญ่ ป้ายเล็กพิมพ์ใหญ่ มุมแดง */
.stat {
  position: relative;
  background: var(--panel); border: 1px solid var(--line); padding: 16px 16px 14px;
  clip-path: var(--notch);
  transition: border-color .2s var(--ease), background .2s var(--ease), transform .2s var(--ease);
}
.stat::before {
  content: ''; position: absolute; left: 0; top: 0; width: 3px; height: 26px; background: var(--red);
}
.stat:hover { border-color: var(--line2); background: var(--panel2); transform: translateY(-2px); }
.stat .v {
  font-size: 32px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1;
  letter-spacing: .5px; color: var(--sand);
}
.stat .k {
  font-size: 9px; color: var(--dim); text-transform: uppercase; letter-spacing: 2px; margin-top: 7px;
}

.code {
  font-family: ui-monospace, Consolas, monospace; font-size: 13px; letter-spacing: 1.4px;
  color: var(--sand); background: var(--bg2); border: 1px solid var(--line);
  padding: 6px 12px; display: inline-block;
  transition: border-color .18s var(--ease), color .18s var(--ease);
}
.code:hover { border-color: var(--red); color: var(--red); }

@media (max-width: 640px) {
  .hero::before { left: -16px; top: 32px; height: 34px; }
  .lrow { grid-template-columns: 48px 30px 1fr; gap: 10px; min-height: 54px; padding-right: 12px; }
  .lrow .stats { grid-column: 1 / -1; justify-content: flex-start; padding: 0 0 10px 12px; }
  .lrow:hover { transform: none; }
  .lrow .pos { font-size: 21px; }
  .war { font-size: 13px; padding: 13px; }
  .war .score { font-size: 21px; }
  .top-in { flex-wrap: wrap; padding: 10px 14px; }
  .nav { width: 100%; margin-left: 0; }
  .stat .v { font-size: 26px; }
}

/* ═══════════════════════════════════════════════ สเปกรอบ 2-4 */

/* ── ELO */
.elo { font-family: Oswald, Kanit, sans-serif; font-variant-numeric: tabular-nums; letter-spacing: .5px; }
.elo b { font-size: 15px; }
.elo .delta { font-size: 11px; margin-left: 4px; opacity: .85; }
.elo .delta.up { color: var(--teal); }
.elo .delta.down { color: var(--red); }
.tier-legend  { color: #ffd166; }
.tier-master  { color: var(--red); }
.tier-veteran { color: var(--teal); }
.tier-mid     { color: var(--sand); }
.tier-rookie, .tier-fresh { color: var(--dim); }

.elite-badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
  background: var(--red); color: var(--sand); font-size: 10px; font-weight: 600;
  letter-spacing: 2px; text-transform: uppercase; clip-path: var(--notch-sm);
}

/* ── รูปประจำแก๊ง */
.emblem.img { padding: 0; overflow: hidden; }
.emblem.img img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ── ฟีดโพสหาสมาชิก */
.feed { display: grid; gap: 12px; }
.post { position: relative; background: var(--panel); border: 1px solid var(--line); padding: 14px; clip-path: var(--notch); }
.post:hover { border-color: var(--line2); }
.post .head { display: flex; align-items: center; gap: 10px; }
.post .head .nm { font-weight: 500; }
.post .body { margin-top: 10px; white-space: pre-wrap; line-height: 1.6; font-size: 14px; }
.post .foot { margin-top: 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.post img.shot { margin-top: 10px; max-width: 100%; border: 1px solid var(--line); }

/* ── การ์ดแก๊งในทำเนียบ */
.clangrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.clancard { position: relative; background: var(--panel); border: 1px solid var(--line); padding: 14px; clip-path: var(--notch); }
.clancard:hover { border-color: var(--red); }
.clancard .top { display: flex; align-items: center; gap: 10px; }
.clancard .nm { font-weight: 500; font-size: 15px; }
.clancard .rows { margin-top: 12px; display: grid; gap: 5px; font-size: 12px; color: var(--dim); }
.clancard .rows b { color: var(--sand); font-family: Oswald, Kanit, sans-serif; }

/* ── กระดานลงโทษ: ใบเหลือง | คนโดนแบน คนละคอลัมน์ */
.discipline { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
@media (max-width: 820px) { .discipline { grid-template-columns: 1fr; } }
.disc-col.cards h2 { color: #f5c518; }
.disc-col.bans  h2 { color: var(--red); }
.disc-row {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.disc-row:last-child { border-bottom: 0; }
.disc-row .who { flex: 1; min-width: 0; }
.disc-row .who b { display: block; }
.disc-row .why { font-size: 12px; color: var(--dim); margin-top: 3px; word-break: break-word; }
.disc-row .dc { font-family: ui-monospace, monospace; font-size: 11px; color: var(--teal); }

/* ── หน้าสปอนเซอร์ */
.sponsor-hero {
  position: relative; overflow: hidden; min-height: 340px;
  display: flex; align-items: center; border: 1px solid var(--line); clip-path: var(--notch-lg);
}
.sponsor-hero .bg {
  position: absolute; inset: -6%; background-size: cover; background-position: center;
  /* ซูมเข้าช้า ๆ แล้วถอยกลับ (Ken Burns) — ทำให้ภาพนิ่งดูมีชีวิตโดยไม่กวนสายตา */
  animation: kenburns 28s ease-in-out infinite alternate;
}
.sponsor-hero::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(15,25,35,.94) 0%, rgba(15,25,35,.78) 45%, rgba(15,25,35,.35) 100%);
}
.sponsor-hero .inner { position: relative; z-index: 2; padding: 34px; max-width: 620px; }
.sponsor-hero h1 { font-size: clamp(28px, 5vw, 50px); }
.sponsor-hero .mascot {
  position: absolute; right: 2%; bottom: 0; z-index: 3; max-height: 96%; max-width: 42%;
  filter: drop-shadow(-14px 10px 26px rgba(0, 0, 0, .55));
  animation: bob 5s ease-in-out infinite;
}
@keyframes kenburns { from { transform: scale(1) translate(0, 0); } to { transform: scale(1.16) translate(-1.5%, -1.5%); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@media (prefers-reduced-motion: reduce) {
  .sponsor-hero .bg, .sponsor-hero .mascot { animation: none; }
}
@media (max-width: 700px) { .sponsor-hero .mascot { display: none; } }

.pkg { position: relative; background: var(--panel); border: 1px solid var(--line); padding: 18px; clip-path: var(--notch); }
.pkg.hot { border-color: var(--red); }
.pkg .price { font-family: Oswald, Kanit, sans-serif; font-size: 34px; color: var(--sand); line-height: 1; }
.pkg .price small { font-size: 13px; color: var(--dim); letter-spacing: 1px; }
.pkg ul { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 7px; font-size: 13px; }
.pkg li::before { content: '\25AA  '; color: var(--red); }

.sponsor-wall { display: flex; flex-wrap: wrap; gap: 12px; }
.sponsor-wall a {
  display: flex; align-items: center; gap: 9px; padding: 10px 14px;
  border: 1px solid var(--line); background: var(--panel); clip-path: var(--notch-sm);
}
.sponsor-wall a:hover { border-color: var(--red); }
.sponsor-wall img { height: 26px; width: auto; }

/* ── ป๊อปอัปโฆษณา */
.admodal {
  position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center;
  background: rgba(4, 8, 12, .74); padding: 18px; animation: fade .25s var(--ease) both;
}
.adbox {
  position: relative; width: min(420px, 100%); background: var(--panel);
  border: 1px solid var(--line2); clip-path: var(--notch-lg);
  animation: rise .3s var(--ease) both;
}
.adx {
  position: absolute; top: 8px; right: 8px; z-index: 2; width: 30px; height: 30px;
  background: rgba(0, 0, 0, .55); color: var(--sand); border: 0; cursor: pointer; font-size: 14px;
}
.adx:hover { background: var(--red); }
.adtag {
  position: absolute; top: 8px; left: 8px; z-index: 2; font-size: 9px; letter-spacing: 2px;
  text-transform: uppercase; background: rgba(0, 0, 0, .6); color: var(--dim); padding: 4px 8px;
}
.adimg { width: 100%; display: block; max-height: 220px; object-fit: cover; }
.adbody { padding: 16px; }
.adbody h3 { font-size: 18px; }
.adbody p { color: var(--dim); font-size: 13px; margin: 7px 0 14px; }

/* ── แดชบอร์ดสถิติ */
.flagbox { border-left: 3px solid var(--line2); background: var(--panel); padding: 12px 14px; margin-bottom: 9px; }
.flagbox.bad  { border-left-color: var(--red); }
.flagbox.warn { border-left-color: #f5c518; }
.flagbox.good { border-left-color: var(--teal); }
.flagbox.info { border-left-color: var(--dim); }
.flagbox b { display: block; margin-bottom: 3px; }
.flagbox .detail { font-size: 13px; color: var(--sand); }
.flagbox .action { font-size: 12px; color: var(--dim); margin-top: 6px; }

.bars { display: flex; align-items: flex-end; gap: 3px; height: 90px; margin: 10px 0 24px; }
.bars .bar { flex: 1; background: var(--line2); position: relative; min-height: 2px; }
.bars .bar.peak { background: var(--red); }
.bars .bar span {
  position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%);
  font-size: 9px; color: var(--dim);
}

/* ── ขั้นตอนผูก Roblox */
.steps { counter-reset: step; display: grid; gap: 12px; padding: 0; margin: 0; }
.steps li { counter-increment: step; list-style: none; display: flex; gap: 12px; align-items: flex-start; }
.steps li::before {
  content: counter(step, decimal-leading-zero);
  font-family: Oswald, Kanit, sans-serif; font-size: 15px; color: var(--red);
  background: var(--panel2); border: 1px solid var(--line); padding: 3px 9px; flex: 0 0 auto;
}
