/* ============================================================
   GameCommu Theme v2 — สไตล์เว็บจัดอันดับเซิฟเกมยุคคลาสสิค
   พื้นน้ำเงินเข้ม + พาเนลขาว + หัวพาเนลน้ำเงินขอบส้ม
   ============================================================ */
:root {
  --body-bg: #1487D6;
  --panel-head: #193847;
  --panel-head-accent: #FFA500;
  --row-bg: #FFFFFF;
  --row-border: #000000;
  --text-dark: #111111;
  --game-green: #006400;
  --vote-red: #B22222;
  --nav-bg: #222831;
  --footer-bg: #00202F;
  --link: #1E90FF;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Sarabun', 'Prompt', Tahoma, sans-serif;
  background-color: var(--body-bg);
  background-image: radial-gradient(ellipse at top, #2ea6f2 0%, #1487D6 55%);
  color: #eee;
  font-size: 15px;
  line-height: 1.55;
  overflow-anchor: none; /* กันหน้าเว็บเลื่อนเองตอน Live Feed แทรกแถวใหม่แบบ realtime (scroll anchoring) */
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; vertical-align: middle; }
.container { max-width: 1000px; margin: 0 auto; padding: 0 8px; }
.muted { color: #777; font-size: .9em; }
.text-center { text-align: center; }
.mt { margin-top: 14px; }
.hidden { display: none !important; }

/* ================= TOP HEADER (โลโก้ขาว 120px) ================= */
.topheader {
  background: #fff url('../img/header.png') right top no-repeat;
  background-size: auto 100%;
  height: 120px;
  left: 100;
  position: relative;
  overflow: hidden;
}
.topheader-inner { display: flex; align-items: center; height: 120px; gap: 18px; }
.site-logo { display: flex; align-items: center; gap: 12px; text-decoration: none !important; min-width: 0; }
.site-logo-icon {
  width: 74px; height: 74px; border-radius: 14px;
  box-shadow: 0 3px 8px rgba(0,0,0,.25);
  flex-shrink: 0; display: block;
}
.site-logo-text { line-height: 1.1; }
.site-logo-text b { font-size: 34px; color: #002D42; letter-spacing: 1px; }
.site-logo-text b span { color: #ff6a00; }
.site-logo-text small { display: block; color: #666; font-size: 12px; }
.online-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: #7CFC00; margin-right: 6px; animation: blink 1.5s infinite;
}
@keyframes blink { 0%,100% { opacity: 1 } 50% { opacity: .3 } }

/* แถบสถิติเว็บ มุมขวาล่าง — ออนไลน์ + ยอดผู้ชมวันนี้/เดือนนี้ */
#site-stats-widget {
  position: fixed; right: 12px; bottom: 12px; z-index: 850;
  display: flex; flex-direction: column; gap: 6px; align-items: flex-end;
}
#site-stats-widget .ss-item {
  background: rgba(0, 45, 66, .9); color: #fff; border-radius: 20px;
  padding: 4px 14px; font-size: 12.5px; box-shadow: 0 3px 10px rgba(0,0,0,.4);
  white-space: nowrap;
}
#site-stats-widget .ss-item b { color: #7CFC00; }
@media (max-width: 820px) { #site-stats-widget { display: none; } }

/* ================= NAVBAR ================= */
.navbar { background: var(--nav-bg); position: sticky; top: 0; z-index: 500; box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.navbar-inner { display: flex; align-items: stretch; height: 46px; }
.navbar a { color: #e8edf3; text-decoration: none !important; }
.nav-brand-sm { display: none; align-items: center; padding: 0 12px; font-weight: 700; letter-spacing: .5px; }
.nav-brand-sm span { color: #ffa500; }
.mainnav { display: flex; flex: 1; align-items: stretch; }
.mainnav > a, .mainnav .dropdown > a {
  display: flex; align-items: center; padding: 0 15px; font-size: 13.5px; font-weight: 500;
  border-right: 1px solid rgba(255,255,255,.06); white-space: nowrap; transition: background .15s, color .15s;
}
.mainnav > a:first-child { border-left: 1px solid rgba(255,255,255,.06); }
.mainnav > a:hover, .mainnav .dropdown:hover > a { background: #ffa500; color: #1a1a1a; }
.mainnav .caret { font-size: 10px; margin-left: 5px; opacity: .7; }
/* จุดแดงกระพริบหน้าเมนู Streamer Live (CSS ล้วน ไม่ใช้อิโมจิ) */
.nav-live::before {
  content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: #ff2d2d; margin-right: 7px; animation: blink 1.3s infinite;
}
.nav-promote { color: #ffd166 !important; font-weight: 700 !important; }
.nav-promote:hover { color: #1a1a1a !important; }
.topbar-user { display: flex; align-items: center; gap: 8px; padding: 0 8px; }
.userchip { color: #ffd166 !important; font-weight: 600; padding: 6px 10px; }

.dropdown { position: relative; display: flex; }
.dropdown-menu {
  display: none; position: absolute; top: 100%; left: 0; min-width: 240px;
  background: #2b333f; padding: 4px 0; z-index: 600; box-shadow: 0 8px 20px rgba(0,0,0,.5);
}
.dropdown-menu.right { left: auto; right: 0; }
.dropdown:hover .dropdown-menu { display: block; }
.dropdown-menu a { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 16px; font-size: 13.5px; }
.dropdown-menu a:hover { background: #ffa500; color: #222; }
.dropdown-menu .dm-votes { font-size: 11px; color: #e00b41; font-weight: 700; white-space: nowrap; }
.dropdown-menu a:hover .dm-votes { color: #7a1f2b; }

/* ================= BUTTONS ================= */
.btn {
  display: inline-block; padding: 8px 16px; border-radius: 4px; border: none;
  font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  text-align: center; text-decoration: none !important;
}
.btn-primary { background: #008CBA; color: #fff; }
.btn-primary:hover { background: #0078a0; }
.btn-outline { background: #f4f4f4; border: 1px solid #ccc; color: #333 !important; }
.btn-outline:hover { background: #e8e8e8; }
.btn-outline-lg {
  background: #f4f4f4; border: 1px solid #ccc; color: #555 !important;
  font-size: 18px; padding: 12px 36px; border-radius: 6px;
}
.btn-outline-lg:hover { background: #e8e8e8; }
.btn-vote {
  background: linear-gradient(180deg, #ff9d00, #f43f00); color: #fff;
  font-size: 18px; padding: 12px 36px; border-radius: 6px;
  box-shadow: 0 3px 0 #a32900; text-shadow: 0 1px 2px rgba(0,0,0,.3);
}
.btn-vote:hover { filter: brightness(1.1); }
.btn-danger { background: #d32f2f; color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }
.btn-block { display: block; width: 100%; }

/* ================= MAIN / ALERTS ================= */
.main-content { padding: 10px 8px 26px; min-height: 55vh; }
.alert { padding: 10px 14px; margin-bottom: 10px; font-weight: 500; border-radius: 3px; font-size: 14px; }
.alert-error { background: #f2dede; border: 1px solid #d9534f; color: #a94442; }
.alert-success { background: #dff0d8; border: 1px solid #5cb85c; color: #3c763d; }

/* ================= PANELS (สไตล์ต้นฉบับ) ================= */
.plsv-panel { margin-bottom: 10px; }
.plsv-panel-head {
  background: var(--panel-head); color: #fff;
  border-top: 4px solid var(--panel-head-accent);
  padding: 8px 12px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.plsv-panel-head h1, .plsv-panel-head h2 {
  font-size: 20px; font-weight: 700; color: #fff; flex: 0 0 auto;
}
.plsv-panel-head .more { font-size: 12px; color: #9fd8ff; }
.plsv-panel-head .spacer { flex: 1; }
/* หัวพาเนล 2 แถวสมมาตร: ซ้าย-ขวา ชิดขอบทั้งคู่ (เช่นหน้า Game/{slug}) */
.game-head-2row { flex-direction: column; align-items: stretch; gap: 6px; }
.game-head-2row .ghr { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.plsv-panel-body { background: #fff; color: var(--text-dark); }
.countdown-txt { font-size: 12px; color: #ddd; text-align: right; }
.countdown-txt b { color: #ffff00; font-weight: 700; }
.reset-notice { font-size: 11px; color: #ffb3b3; border-bottom: 1px dotted #ffb3b3; cursor: help; }

/* ---------- แท็บ Top Ranking / ชื่อเกม เหนือ panel (เพิ่มมิติ) ---------- */
.ranktabs { display: flex; gap: 2px; }
.ranktab {
  display: inline-block; padding: 8px 18px; font-size: 14px; font-weight: 400;
  color: #103246; background: #7ec8f5;
  border-radius: 8px 8px 0 0; text-decoration: none;
}
.ranktab.active { background: var(--panel-head); color: #fff; }
.ranktab:not(.active):hover { background: #93d2f9; }

/* ---------- หัวพาเนลแบบย่อ (Game/{slug}) ให้ตรงต้นฉบับ: หัวข้อใหญ่เด่น ชิดบน ส่วนรองลงมาธรรมดา ---------- */
.game-head-compact { padding: 8px 16px 12px; }
.game-head-compact .ghr:first-child { align-items: flex-start; }
.game-head-compact h1 { font-size: 32px; margin: 0; }
.game-head-compact .countdown-txt { font-size: 11px; margin-left: auto; padding-top: 4px; }
.game-subline { font-size: 12.5px; color: #cfe9ff; font-weight: 400; }
.more-btn {
  font-size: 12.5px; color: #cfe9ff; background: none; text-decoration: none; font-weight: 400;
}
.more-btn:hover { text-decoration: underline; }

/* ---------- Top Ranking rows (66px, สมมาตรกับ Fast Movers) ---------- */
.live-grid > .plsv-panel { display: flex; flex-direction: column; }
.live-grid > .plsv-panel > .plsv-panel-body { flex: 1; display: flex; flex-direction: column; }

.topserver-row {
  display: flex; align-items: center; background: var(--row-bg);
  border-bottom: 1px solid var(--row-border); flex: 0 0 auto; min-height: 66px;
  overflow: hidden; position: relative;
  transition: background-color .3s;
}
.topserver-row:hover { background: #fff8e1; }
.ts-rank {
  flex: 0 0 56px; text-align: center; font-size: 30px; font-weight: 700;
  color: #35576b; line-height: 1;
}
.ts-rank b { display: block; font-size: 12.5px; font-weight: 800; color: #35576b; margin-top: 2px; }
.medal-badge { display: inline-block; font-size: 28px; line-height: 1; filter: drop-shadow(0 2px 2px rgba(0,0,0,.3)); }
.medal-1 { animation: medal-glow 1.8s ease-in-out infinite; }
@keyframes medal-glow {
  0%, 100% { filter: drop-shadow(0 0 2px #ffd700) drop-shadow(0 2px 2px rgba(0,0,0,.3)); }
  50%      { filter: drop-shadow(0 0 9px #ffd700) drop-shadow(0 2px 2px rgba(0,0,0,.3)); }
}
/* 3 อันดับแรก: ดำเฉพาะแถบ ts-rank ซ้ายสุด ให้โดดเด่นแบบไม่ทึบทั้งแถว — สีขอบไล่ตามระดับเหรียญ */
.topserver-row.rank-1 .ts-rank, .newserver-row.rank-1 .ts-rank,
.topserver-row.rank-2 .ts-rank, .newserver-row.rank-2 .ts-rank,
.topserver-row.rank-3 .ts-rank, .newserver-row.rank-3 .ts-rank {
  background: linear-gradient(180deg, #14181c, #1d2329);
  align-self: stretch; display: flex; flex-direction: column; align-items: center; justify-content: center;
  flex-basis: 84px !important; gap: 4px;
}
.topserver-row.rank-1 .ts-rank, .newserver-row.rank-1 .ts-rank { border-left: 3px solid #FFD700; }
.topserver-row.rank-2 .ts-rank, .newserver-row.rank-2 .ts-rank { border-left: 3px solid #C0C0C0; }
.topserver-row.rank-3 .ts-rank, .newserver-row.rank-3 .ts-rank { border-left: 3px solid #CD7F32; }
.rank-label { font-size: 9.5px; font-weight: 800; letter-spacing: 1.8px; color: #8b96a0; }
.rank-combo { display: flex; align-items: center; justify-content: center; gap: 5px; }
.rank-combo b { font-size: 27px; font-weight: 800; color: #fff; line-height: 1; }
.ts-logo { flex: 0 0 66px; align-self: stretch; }
.ts-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ts-detail { flex: 1; min-width: 0; padding: 0 10px; }
.ts-name {
  display: block; font-size: 15.5px; font-weight: 700; color: #000; line-height: 1.15;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ts-name:hover { color: #e65100; text-decoration: none; }
.ts-game { display: block; font-size: 11px; line-height: 1.1; margin-top: 3px; }
.ts-game, .ts-game a { color: var(--game-green); }
.ts-votes { flex: 0 0 100px; text-align: right; padding-right: 8px; }
.ts-votes .short { display: block; font-size: 17px; font-weight: 700; color: #000; }
.ts-votes .count { display: block; font-size: 12px; color: #333; }
.ts-votes .heart { color: #e00b41; display: inline-block; }
.ts-arrow { flex: 0 0 30px; text-align: center; font-size: 15px; }
.arrow-up { color: #16a34a; } .arrow-down { color: #dc2626; } .arrow-eq { color: #94a3b8; }

.newserver-row .ts-rank {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 20px; line-height: 1.1; gap: 2px;
}
.newserver-row .ts-rank .arrow-up, .newserver-row .ts-rank .arrow-down, .newserver-row .ts-rank .arrow-eq {
  font-size: 13px;
}

/* ================= PAGE SELECTOR (Game/{slug}) ================= */
.pageselect-panel {
  display: flex; align-items: center; flex-wrap: wrap; gap: 5px;
  padding: 4px 12px; background: #f4f8fa; border-bottom: 1px solid #dde5ea; font-size: 12px;
  margin: 6px 0;
}
.pageselect-text { color: #666; margin-right: 4px; }
.pageselect-no, .pageselect-current {
  display: inline-block; min-width: 20px; text-align: center; padding: 2px 6px;
  font-weight: 600;
}
.pageselect-current { background: #e00b41; color: #fff; border-radius: 0; }
.pageselect-no { color: #103246; background: none; }
.pageselect-no:hover { color: #e00b41; text-decoration: underline; }
.pageselect-dot { color: #888; padding: 0 2px; }
.pageselect-next { margin-left: 6px; }
.pageselect-next a {
  background: #0b6aa8; color: #fff !important; padding: 3px 10px; border-radius: 4px; font-weight: 600;
}
.pageselect-next a:hover { background: #094e7a; text-decoration: none; }
.pageselect-search { flex: 0 0 auto; margin-left: auto; }
.pageselect-search input { width: 130px; padding: 3px 8px; }
.pageselect-search button { padding: 3px 9px; }

/* ================= MODAL POPUP (ใช้ร่วมกันทุกหน้า: vote popup, admin ban modal ฯลฯ) ================= */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; z-index: 9999; }
.modal-box { background: #fff; border-radius: 10px; padding: 20px; max-width: 340px; width: 90%; position: relative; max-height: 85vh; overflow-y: auto; }

/* โฟกัสกลางจอ — คอลัมน์แคบลงให้ดูสบายตา พรีเมี่ยม เหมือนเพจค้นหาเซิฟ (กว้างขึ้นให้พอดีกับข้อความโปรโมทยาวๆ) */
.game-focus { max-width: 920px; margin: 0 auto; }
.game-search-form { display: flex; flex: 0 1 240px; min-width: 140px; }
.game-search-form input {
  flex: 1; min-width: 0; border: none; border-radius: 4px 0 0 4px;
  padding: 6px 10px; font-size: 13px; outline: none;
}
.game-search-form button {
  background: #ff9d00; color: #103246; border: none; padding: 0 14px;
  border-radius: 0 4px 4px 0; cursor: pointer; font-size: 14px;
}
.game-search-form button:hover { background: #ffb733; }
.game-search-result {
  padding: 8px 14px; background: #fff8e1; border-bottom: 1px solid #f0e0b0; font-size: 13px; color: #555;
}
.game-search-result a { margin-left: 8px; color: #d9534f; }

/* เอฟเฟกต์ตอนมีโหวตเข้า: หัวใจเด้งอย่างเดียว ไม่เปลี่ยนสีพื้นหลังแถว */
.vote-flash { }
@keyframes heartbeat { 0%,100% { transform: scale(1) } 30% { transform: scale(1.6) } 60% { transform: scale(1.15) } }
.heart-beat { animation: heartbeat .7s ease-in-out; }

.votex-badge {
  background: linear-gradient(135deg, #f59e0b, #ef4444); color: #fff;
  font-size: 10px; padding: 1px 7px; border-radius: 12px; margin-left: 5px;
  vertical-align: 2px; font-weight: 700;
}
.new-badge {
  background: #e53935; color: #fff; font-size: 10px; padding: 1px 7px;
  border-radius: 3px; margin-left: 5px; vertical-align: 2px; font-weight: 700;
  animation: blink 1.2s infinite;
}

/* ---------- Fast Movers / New server rows (โลโก้ fix 160x160) ---------- */
.newserver-row {
  display: flex; align-items: center; background: var(--row-bg);
  border-bottom: 1px solid var(--row-border); flex: 1; min-height: 166px;
  position: relative;
  transition: background-color .3s;
}
.newserver-row:hover { background: #f0f9ff; }
.ns-logo { flex: 0 0 166px; padding: 0; align-self: stretch; position: relative; z-index: 1; }
.ns-logo img {
  width: 166px; height: 100%; object-fit: cover; display: block; border: none;
  transition: transform .35s ease; position: relative;
}
.ns-logo img:hover { transform: scale(1.25); z-index: 5; }
.ns-detail { flex: 1; min-width: 0; padding: 6px 10px; align-self: flex-start; }
.ns-name {
  display: block; font-size: 16px; font-weight: 700; color: #000; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 4px;
}
.ns-name:hover { color: #e65100; text-decoration: none; }
.ns-game { display: block; font-size: 11.5px; color: var(--game-green); }
.ns-game a { color: var(--game-green); }
.ns-promote {
  display: block; font-size: 12.5px; color: #555; line-height: 1.4; margin-top: 6px;
  max-height: 70px; overflow: hidden;
}
.ns-icons { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.ns-icon {
  font-size: 11px; color: #2e7d32; background: #e8f5e9; border: 1px solid #c8e6c9;
  border-radius: 10px; padding: 2px 8px; white-space: nowrap;
}
.ns-side { flex: 0 0 128px; text-align: right; padding: 8px 8px 8px 0; align-self: stretch;
  display: flex; flex-direction: column; justify-content: space-between; gap: 4px; }
.ns-age { font-size: 11.5px; color: red; display: block; }
.ns-votes { font-size: 16px; font-weight: 700; color: #000; display: block; margin-top: 4px; }
.ns-votes .heart { color: #e00b41; display: inline-block; }
.ns-comments { font-size: 11.5px; font-weight: 600; color: #666; display: block; margin-top: 2px; }
.ns-upvote { font-size: 11.5px; color: #16a34a; font-weight: 700; display: block; }
.ns-side .btn + .btn { margin-top: 4px; }

/* ---------- two-column live section ---------- */
.live-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 820px) { .live-grid { grid-template-columns: 1fr; } }

/* ================= BANNER ZONE (GIF แข่งกัน) ================= */
.banner-zone { background: #fff; padding: 8px; }
.banner-grid { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.banner-grid a { flex: 0 0 1178px; max-width: 100%; }
.banner-grid img { width: 1178px; max-width: 100%; height: 240px; object-fit: cover; display: block; border: 1px solid #999; }
.banner-grid a:hover img { outline: 2px solid #ff9d00; }

/* ================= GAME CATE LIST ================= */
.gamecate-body { padding: 8px; }
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; }
.game-cell {
  background: #f7f7f7; border: 1px solid #ddd; padding: 9px 10px;
  color: #133; font-weight: 700; font-size: 13.5px; text-decoration: none !important;
}
.game-cell:hover { background: #ffa500; color: #111; border-color: #e08c00; }
.game-cell .cnt { display: block; color: #777; font-weight: 400; font-size: 11.5px; }
.game-cell:hover .cnt { color: #333; }
.gc-new { color: #ff2d2d; font-weight: 700; font-size: 11.5px; margin-left: 4px; animation: blink 1.3s infinite; }

/* ================= LIVE FEED (แก้บัค: ข้อความไม่โดนบีบหาย) ================= */
.livefeed {
  /* max-height คุมเพดานไว้ (กันแถวเกิน 20 ดันความสูงหลุด) แต่ไม่บังคับ height คงที่ กันเหลือพื้นที่ว่างท้าย panel
     ตัวที่กันหน้าเว็บขยับ/กระตุกตอน realtime เติมแถวใหม่จริงๆ คือ overflow-anchor: none ด้านล่าง */
  max-height: 1300px; overflow-y: auto; overflow-x: hidden; background: #fff;
  scrollbar-width: none; -ms-overflow-style: none; scroll-behavior: smooth;
  overflow-anchor: none; /* กัน browser auto-scroll หน้าเว็บเวลาแทรกแถวใหม่ (scroll anchoring bug) */
}
.livefeed::-webkit-scrollbar { display: none; }
.livefeed-item {
  display: flex; gap: 8px; padding: 7px 10px; border-bottom: 1px dashed #ccc;
  font-size: 13px; align-items: center; color: #333; min-width: 0;
}
.livefeed-item img { flex: 0 0 34px; width: 34px; height: 34px; object-fit: cover; border: 1px solid #999; }
.livefeed-item .lf-body { flex: 1 1 auto; min-width: 0; overflow: hidden; }
.livefeed-item .lf-body a {
  display: block; font-weight: 700; color: #000;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.livefeed-item .lf-sub {
  font-size: 11px; color: #16a34a;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; text-overflow: ellipsis; white-space: normal; line-height: 1.35;
}
.livefeed-item .t { flex: 0 0 auto; color: #888; font-size: 11px; white-space: nowrap; }
.pulse {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  background: #7CFC00; margin-right: 6px; animation: blink 1.4s infinite;
}

/* ================= HOME GRID (Top Ranking กว้าง / คอลัมน์ขวาแคบ) ================= */
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 10px; align-items: stretch; }
.home-grid > .plsv-panel { display: flex; flex-direction: column; margin-bottom: 0; }
.home-grid > .plsv-panel > .plsv-panel-body { flex: 1; display: flex; flex-direction: column; }
.home-grid { margin-bottom: 10px; }
@media (max-width: 860px) { .home-grid { grid-template-columns: 1fr; } }

/* Streamer Live คอลัมน์ขวาหน้าแรก: 4 การ์ดแนวตั้ง (โลโก้ 160 ซ้าย + ข้อมูลขวา)
   4 x 166px ≈ สูงเท่า Top Ranking 10 แถว — สมมาตรพอดี */
.streamer-side-body { display: flex; flex-direction: column; }
.streamer-side-card {
  position: relative; display: flex; align-items: stretch; flex: 1; min-height: 166px;
  background: #fff; border-bottom: 1px solid var(--row-border);
  text-decoration: none !important; overflow: hidden; transition: background .2s;
}
.streamer-side-card:hover { background: #fff5f5; }
.streamer-side-card img { flex: 0 0 160px; width: 160px; height: 160px; object-fit: cover; align-self: center; margin: 3px; border: 1px solid #777; }
.streamer-side-card .ssc-info {
  flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center;
  gap: 5px; padding: 8px 10px;
}
.ssc-title { font-size: 13.5px; font-weight: 700; color: #111; line-height: 1.3; max-height: 54px; overflow: hidden; }
.ssc-time { font-size: 11.5px; color: #555; }
.ssc-time b { color: #d32f2f; }
.ssc-votes { font-size: 14px; font-weight: 700; color: #e00b41; }
.streamer-side-card.empty { background: #f6f8fa; }
.streamer-side-card.empty:hover { background: #eef6fb; }
.ssc-empty-box {
  flex: 0 0 160px; height: 160px; align-self: center; margin: 3px;
  border: 2px dashed #b8c4cf; border-radius: 4px; color: #9aa8b5;
  display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700;
}
.live-badge {
  position: absolute; top: 8px; left: 8px; z-index: 2; background: #e10600; color: #fff;
  font-size: 10px; font-weight: 700; padding: 1px 8px; border-radius: 3px;
  animation: blink 1.3s infinite; letter-spacing: .5px;
}
.live-dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  background: #ff2d2d; margin-right: 7px; animation: blink 1.3s infinite;
}

/* Live feed แบบกว้าง (ล่างสุดหน้าแรก) — 2 คอลัมน์ */
.livefeed-wide { max-height: 700px; }
@media (min-width: 700px) {
  .livefeed-wide { display: grid !important; grid-template-columns: 1fr 1fr; column-gap: 18px; align-content: start; }
  .livefeed-wide .livefeed-item { min-height: 48px; }
}

/* แถบ monitor Streamer Live มุมซ้ายล่าง — theme + โครงสร้างเดียวกับ Vote Monitor (แยกกล่องต่อรายการ) */
#streamer-monitor {
  position: fixed; left: 12px; bottom: 12px; z-index: 850;
  display: flex; flex-direction: column; width: 240px; font-size: 12.5px;
}
#streamer-monitor .sm-item {
  background: rgba(255,255,255,.97); border: 1px solid #444;
  border-radius: 10px; overflow: hidden; box-shadow: 0 3px 12px rgba(0,0,0,.45); margin-top: 6px;
  display: flex; align-items: center; gap: 0; color: #111; text-decoration: none !important;
  width: 100%;
}
#streamer-monitor .sm-item:hover { border-color: #ffa500; }
#streamer-monitor .sm-item .sm-logo {
  width: 44px; height: 44px; object-fit: cover; display: block; flex-shrink: 0;
}
#streamer-monitor .sm-item .sm-title {
  padding: 0 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-weight: 600;
}
#streamer-monitor .sm-item:hover .sm-title { color: #16a34a; }
#streamer-monitor .sm-close {
  background: rgba(0,0,0,.6); color: #fff; font-size: 10.5px; text-align: center;
  padding: 2px 8px; cursor: pointer; border-radius: 10px;
  display: inline-block; align-self: flex-start; margin-top: 6px;
}
@media (max-width: 820px) { #streamer-monitor { display: none; } }

/* ================= VOTE NOTIFY (มุมซ้ายบน ไหลลงแบบสมูท) ================= */
#votenotify-stack {
  position: fixed; left: 12px; top: 60px; z-index: 900;
  display: flex; flex-direction: column; width: auto; pointer-events: none;
}
.vote-notify-wrap {                       /* ผุดขึ้น/ผุดออก เร็วๆ (ยืดความสูง ไม่มี opacity) เหมือนข่าววิ่ง live TV */
  overflow: hidden; pointer-events: auto;
  max-height: 0;
  transition: max-height .2s ease;
}
.vote-notify-wrap.vn-show { max-height: 60px; }
.vote-notify-wrap.vn-hide { max-height: 0; }
.vote-notify-item {
  background: rgba(255,255,255,.97); border: none;
  border-radius: 10px; overflow: hidden; margin-bottom: 3px;
  display: flex; align-items: center; gap: 0; cursor: pointer; text-decoration: none !important;
  width: fit-content;
}
.vote-notify-item:hover { border-color: #ffa500; }
.vote-notify-item .vn-logo {
  width: 46px; height: 46px; object-fit: cover; display: block; flex-shrink: 0;
}
.vote-notify-item .vn-plus {
  position: relative; width: 38px; height: 35px; margin: 0 12px 0 10px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.vote-notify-item .vn-heart-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.vote-notify-item .vn-heart-svg path { fill: #e00b41; }
.vote-notify-item .vn-heart-num {
  position: relative; z-index: 1; color: #fff; font-weight: 800; font-size: 14px;
  margin-top: 3px; text-shadow: 0 1px 1px rgba(0,0,0,.4);
}
#votenotify-close {
  color: #fff; font-size: 15px; font-weight: 700; text-align: center;
  text-shadow: 0 1px 3px rgba(0,0,0,.5);
  padding: 2px 4px; cursor: pointer; pointer-events: auto;
  align-self: flex-start; margin-bottom: 4px; display: none;
}
#votenotify-stack.has-items #votenotify-close { display: inline-block; }
@media (max-width: 820px) { #votenotify-stack { display: none; } }

/* ================= LIVE VOTE TICKER (แถบข่าววิ่งแนวนอนใต้ navbar) ================= */
#vote-ticker-wrap {
  position: sticky; top: 0; z-index: 480;   /* ต่ำกว่า navbar (500) — JS ตั้ง top = ความสูง navbar ให้ติดใต้พอดี */
}
#vote-ticker {
  display: flex; align-items: stretch; gap: 0;
  height: 34px; overflow: hidden;
  background: linear-gradient(90deg, #0c1622, #122234);
  border-bottom: 1px solid #24384f;
}

/* ================= เชือกดึงม่านมุมขวาบน (ซ่อน/แสดง header ทั้งชุด) ================= */
.gc-hdr-anim { transition: height .55s cubic-bezier(.77, 0, .18, 1); }
#hdr-rope {
  position: fixed; top: 0; right: 30px; z-index: 620;
  width: 36px; height: 66px; padding: 0 8px;
  display: flex; flex-direction: column; align-items: center;
  background: none; border: none; cursor: pointer;
  transition: height .55s cubic-bezier(.77, 0, .18, 1);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .45));
}
#hdr-rope .rope-line {
  width: 4px; flex: 1; border-radius: 2px;
  background: repeating-linear-gradient(-38deg, #c99a55 0 3px, #8a5f2c 3px 6px);   /* ลายเชือกถัก */
}
#hdr-rope .rope-ring {
  width: 20px; height: 20px; margin-top: -1px; flex-shrink: 0;
  border: 4px solid #c89b58; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .35), transparent 60%);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .45);
  transition: transform .2s;
}
#hdr-rope:hover .rope-ring { transform: scale(1.15); }
#hdr-rope:hover .rope-line { filter: brightness(1.2); }
#hdr-rope.rope-closed { height: 44px; }     /* header ซ่อนอยู่ → เชือกหดสั้น รอดึงกลับ */
@keyframes rope-tug {
  0% { transform: translateY(0); }
  35% { transform: translateY(10px); }
  65% { transform: translateY(-3px); }
  100% { transform: translateY(0); }
}
#hdr-rope.rope-tug { animation: rope-tug .4s ease-out; }
#vote-ticker .vt-label {
  flex-shrink: 0; display: flex; align-items: center; gap: 6px;
  padding: 0 14px; font-weight: 800; font-size: 12px; letter-spacing: .5px;
  color: #fff; background: #c0122f; white-space: nowrap;
}
#vote-ticker .vt-viewport {
  flex: 1; overflow: hidden; position: relative;
  /* แยกโลก layout/paint ของ ticker ออกจากหน้า — item ถูกแทรก/ลบถี่ๆ จะได้ไม่ dirty layout ทั้งหน้า
     (ต้นเหตุ scroll กระตุก: ทุกเฟรมของ ticker เคย force reflow ทั้งเอกสาร) */
  contain: layout paint;
  /* ขอบสองข้างเฟดจาง ให้ item โผล่เข้า-ออกนุ่มๆ ไม่โดนตัดขาดทื่อๆ */
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%);
}
#vote-ticker-track {
  display: inline-flex; align-items: center; height: 100%;
  white-space: nowrap; will-change: transform;
}
#vote-ticker .vt-item {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0 22px 0 0; height: 100%; text-decoration: none !important;
  flex-shrink: 0;
}
#vote-ticker .vt-item img { width: 34px; height: 34px; border-radius: 0; object-fit: cover; flex-shrink: 0; display: block; }
#vote-ticker .vt-item { opacity: .92; transition: opacity .15s; }
#vote-ticker .vt-item:hover { opacity: 1; }
#vote-ticker .vt-item:hover .vt-name { color: #fff; text-decoration: underline; }
#vote-ticker .vt-name { color: #dce8f5; font-size: 13px; font-weight: 600; }
#vote-ticker .vt-plus { color: #ff5c7a; font-size: 13px; font-weight: 800; }
@media (prefers-reduced-motion: reduce) { #vote-ticker-track { will-change: auto; } }
@media (max-width: 560px) { #vote-ticker .vt-label span { display: none; } }

/* ================= POPUP BANNER ================= */
#popup-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.75); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
}
.popup-box { position: relative; max-width: 92vw; text-align: center; }
.popup-box .popup-label { color: #bbb; font-size: 11px; margin-bottom: 4px; }
.popup-box img.popup-banner {
  width: 468px; max-width: 92vw; transform: scale(1.4); transform-origin: center;
  border: 3px solid #ffa500; box-shadow: 0 0 40px rgba(255,157,0,.5); display: block;
  margin: 40px auto;
}
@media (max-width: 700px) { .popup-box img.popup-banner { transform: none; margin: 8px auto; } }
.popup-close {
  position: absolute; top: -6px; right: -6px; z-index: 2;
  background: #ff3c00; color: #fff; border: 2px solid #fff; border-radius: 50%;
  width: 34px; height: 34px; font-size: 17px; font-weight: 700; cursor: pointer; line-height: 1;
}

/* ================= STREAMER LIVE (หน้าเต็ม 10 การ์ด) ================= */
.streamer-body { padding: 10px; }
.streamer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
@media (max-width: 680px) { .streamer-grid { grid-template-columns: 1fr; } }
.streamer-card {
  position: relative; background: #10202d; border: 1px solid #26425a; border-radius: 10px;
  overflow: hidden; min-height: 340px; display: flex; flex-direction: column;
}
.streamer-card .slot-no {
  position: absolute; top: 6px; right: 8px; z-index: 2; color: #7f97ab;
  font-size: 12px; font-weight: 700;
}
/* การ์ดว่าง */
.streamer-card.empty {
  align-items: center; justify-content: center; text-align: center; color: #8ba0b3;
  text-decoration: none !important; border-style: dashed; cursor: pointer; padding: 20px;
  transition: .15s;
}
.streamer-card.empty:hover { border-color: #ffa500; background: #13293a; color: #cfe0ee; }
.streamer-card.empty .empty-icon { font-size: 60px; opacity: .6; }
.streamer-card.empty .empty-txt { font-size: 18px; font-weight: 700; margin: 8px 0 4px; }
.streamer-card.empty .empty-sub { font-size: 12.5px; line-height: 1.4; }
/* การ์ดไลฟ์ — โลโก้ 4x160=320 กว้างเต็ม */
.streamer-card.live .streamer-img { display: block; }
.streamer-card.live .streamer-img img { width: 100%; aspect-ratio: 1/1; object-fit: cover; display: block; }
.streamer-info { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.streamer-title { color: #fff; font-weight: 700; font-size: 15px; line-height: 1.3; }
.streamer-timer { color: #9fd8ff; font-size: 12.5px; }
.streamer-timer b { color: #ffd166; }
.streamer-voterow { display: flex; align-items: center; justify-content: space-between; margin-top: 2px; }
.streamer-votes { color: #ff4d6d; font-weight: 700; font-size: 16px; }
.streamer-votes b { color: #ff4d6d; }
.js-st-votebtn { font-size: 13px; padding: 6px 16px; box-shadow: 0 2px 0 #a32900; }
.js-st-votebtn:disabled { opacity: .55; cursor: not-allowed; filter: grayscale(.3); }

/* ================= VOTE BOT (10 การ์ดแนวตั้ง) ================= */
.bot-list { display: flex; flex-direction: column; gap: 8px; }
.bot-card {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px;
  background: #fff; border: 1px solid #ccd6de; border-left: 5px solid #94a3b8;
  border-radius: 8px; text-decoration: none !important; color: #222; transition: .15s;
}
.bot-card.empty { border-left-color: #9ca3af; cursor: pointer; }
.bot-card.empty:hover { border-left-color: #008CBA; background: #f2fbff; }
.bot-card.working { border-left-color: #16a34a; background: #f5fff8; }
.bot-icon { font-size: 34px; flex: 0 0 auto; }
.bot-body { flex: 1; min-width: 0; }
.bot-head { display: flex; align-items: center; gap: 10px; margin-bottom: 3px; }
.bot-slot { font-weight: 700; color: #103246; font-size: 15px; }
.bot-status { font-size: 12px; font-weight: 700; }
.bot-status.working { color: #16a34a; animation: blink 1.5s infinite; }
.bot-status.available { color: #64748b; }
.bot-target { font-size: 13.5px; color: #333; }
.bot-meta { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: #555; margin-top: 3px; }
.bot-meta b { color: #103246; }
.bot-sample { font-size: 12px; margin-top: 3px; }
.bot-timer { flex: 0 0 auto; text-align: right; font-size: 12px; color: #64748b; }
.bot-timer b { display: block; color: #d32f2f; font-size: 16px; font-weight: 700; }
.bot-price-box {
  margin-top: 16px; background: #eef6fb; border: 1px solid #cfe3ef; border-radius: 6px;
  padding: 12px 14px; font-size: 15px; color: #103246;
}
.bot-price-box b { color: #d32f2f; font-size: 20px; }
.bot-price-box .muted { display: block; font-size: 12px; margin-top: 3px; line-height: 1.6; }
.bot-price-box .muted b.bot-est-votes { color: #16a34a; font-size: 13px; font-weight: 700; }
.bot-fair-note { display: block; color: #888; font-style: italic; font-size: 11px; margin-top: 2px; }

/* ================= THREAD (หน้ากระทู้เซิฟ) ================= */
.stat-row-top { margin: 4px 0 12px; }
.stat-row-top .stat-box {
  background: linear-gradient(160deg, #0e2a38, #143b4d);
  border-top: 1px solid #d4af37; border-radius: 6px; padding: 14px 10px;
  box-shadow: 0 3px 10px rgba(0,0,0,.25);
}
.stat-box.hot { background: linear-gradient(160deg, #7a1f2b, #b22222); border-top-color: #ffd166; }
.stat-box.hot .v { color: #ffe08a; }
.thread-counters { margin-top: 8px; display: flex; gap: 16px; font-size: 14px; }
.thread-counters .tc-vote b { color: #e00b41; }
.thread-counters .tc-comment b { color: #0b6aa8; }
.comment-list { max-height: 460px; overflow-y: auto; }
@media (max-width: 700px) { .thread-votebtn { width: 100%; margin-top: 10px; } }

/* ================= CARDS (หน้า member / ทั่วไป) ================= */
.card {
  background: #fff; color: var(--text-dark); border: 1px solid #0b2531;
  border-top: 4px solid var(--panel-head-accent);
  padding: 16px; margin-bottom: 12px;
}
.card h1, .card h2 { color: #103246; margin-bottom: 10px; }
.card a { color: #0b6aa8; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.section-head h1, .section-head h2 { font-size: 20px; }
.section-head .more { font-size: 13px; }

/* ================= RANK TABLE (หน้า Game/...) ================= */
.rank-table { width: 100%; border-collapse: collapse; background: #fff; color: #111; }
.rank-table th {
  text-align: left; padding: 7px 10px; background: var(--panel-head); color: #fff;
  font-size: 12.5px; font-weight: 600;
}
.rank-table td { padding: 6px 10px; border-bottom: 1px solid #000; vertical-align: middle; }
.rank-table tr:hover td { background: #fff8e1; }
.rank-num { font-size: 24px; font-weight: 700; color: #35576b; width: 46px; text-align: center; }
.rank-1 .rank-num { color: #d4a017; } .rank-2 .rank-num { color: #8c9bab; } .rank-3 .rank-num { color: #b26a00; }
.sv-logo { width: 48px; height: 48px; object-fit: cover; background: #eee; border: 1px solid #999; }
.sv-name { font-weight: 700; color: #000; display: block; font-size: 15px; }
.sv-name:hover { color: #e65100; text-decoration: none; }
.sv-game { font-size: 11px; color: var(--game-green); }
.sv-game a { color: var(--game-green); text-decoration: underline; }
.sv-game a:hover { color: #ff9d00; }
.sv-promote { font-size: 12px; color: #555; display: block; max-width: 460px; }
.sv-votes { text-align: right; font-weight: 700; color: #000; font-size: 15px; white-space: nowrap; }
.sv-votes small { display: block; color: #555; font-weight: 400; }

/* ================= FORMS ================= */
.form-box { max-width: 520px; margin: 0 auto; }
.form-wide { max-width: 760px; margin: 0 auto; }
label { display: block; margin: 12px 0 4px; font-weight: 600; color: #103246; }
label small { color: #777; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=tel], select, textarea {
  width: 100%; padding: 8px 12px; font-family: inherit; font-size: 14.5px;
  background: #fff; border: 1px solid #999; color: #111; border-radius: 3px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #ffa500; border-color: #ffa500; }
textarea { min-height: 130px; resize: vertical; }
.form-actions { margin-top: 18px; display: flex; gap: 8px; flex-wrap: wrap; }
.captcha-row { display: flex; gap: 10px; align-items: center; }
.captcha-row img { border: 1px solid #999; cursor: pointer; }
.checkbox-row { display: flex; gap: 8px; align-items: flex-start; margin-top: 12px; }
.checkbox-row input { margin-top: 4px; }

.icon-picker { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.icon-pick {
  display: flex; align-items: center; gap: 6px; margin: 0; padding: 7px 14px;
  border: 1px solid #ddd; border-radius: 20px; font-weight: 400; font-size: 13.5px;
  cursor: pointer; background: #fafafa; transition: all .15s;
}
.icon-pick:has(input:checked) { background: #e8f5e9; border-color: #66bb6a; color: #2e7d32; }
.icon-pick:has(input:disabled:not(:checked)) { opacity: .4; cursor: not-allowed; }
.icon-pick input { margin: 0; }
.icon-pick-emoji { font-size: 15px; }

/* ================= SERVER DETAIL ================= */
.sv-head { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.sv-head .sv-logo-lg {
  width: 120px; height: 120px; object-fit: cover; border-radius: 8px;
  border: 3px solid #d4af37; box-shadow: 0 6px 18px rgba(0,0,0,.35);
}
.sv-head h1 { font-size: 26px; line-height: 1.3; letter-spacing: .3px; }
.stat-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.stat-box {
  flex: 1; min-width: 130px; background: var(--panel-head); color: #fff;
  border-top: 3px solid var(--panel-head-accent); padding: 10px; text-align: center;
}
.stat-box .v { font-size: 22px; font-weight: 700; color: #ffd166; letter-spacing: .4px; }
.stat-box .l {
  color: #cde3ee; font-size: 10.5px; margin-top: 3px; text-transform: uppercase;
  letter-spacing: 1.1px; opacity: .85;
}
.sv-detail-text { word-break: break-word; color: #222; line-height: 1.7; }
.sv-detail-text a { color: #0b6aa8; text-decoration: underline; }
.sv-detail-text a:hover { color: #ff9d00; }
.sv-links a { margin-right: 14px; font-weight: 600; }
.sv-links-block {
  background: #f7fafc; border: 1px solid #dde5ea; border-radius: 6px; padding: 10px 14px;
}
.sv-link-item { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; padding: 4px 0; }
.sv-link-item .sv-link-label { flex: 0 0 100px; font-weight: 700; color: #103246; font-size: 13px; }
.sv-link-item a { color: #0b6aa8; font-size: 13px; word-break: break-all; }
.sv-link-item a:hover { color: #ff9d00; }
.sv-banner { width: 100%; margin: 12px 0; border: 1px solid #999; }
.sv-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.sv-tag {
  background: #eef5fa; border: 1px solid #cfe0ea; color: #0b6aa8;
  font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 20px;
}

/* ================= COMMENTS ================= */
.comment { border-bottom: 1px dashed #bbb; padding: 10px 0; color: #222; }
.comment .who { font-weight: 700; color: #0b6aa8; }
.comment .when { color: #888; font-size: 11.5px; margin-left: 8px; }

/* ================= MEMBER MENU ================= */
.member-layout { display: grid; grid-template-columns: 230px 1fr; gap: 10px; }
@media (max-width: 800px) { .member-layout { grid-template-columns: 1fr; } }
.member-menu {
  background: #fff; border: 1px solid #0b2531; border-top: 4px solid var(--panel-head-accent);
  padding: 0 0 8px; align-self: start;
}
.member-menu h4 {
  padding: 10px 14px; color: #fff; background: var(--panel-head); margin-bottom: 6px; font-size: 15px;
}
.member-menu a { display: block; padding: 8px 14px; color: #24455c; font-size: 13.5px; text-decoration: none !important; }
.member-menu a:hover, .member-menu a.active { background: #ffa500; color: #111; }

.mysv-item { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid #ccc; flex-wrap: wrap; }
.mysv-item .info { flex: 1; min-width: 220px; }
.mysv-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ================= VOTE PAGE ================= */
.vote-box { max-width: 560px; margin: 0 auto; text-align: center; }
.vote-box .sv-logo-lg { width: 100px; height: 100px; margin: 0 auto 8px; border: 2px solid #193847; }
.vote-captcha { margin: 18px auto; display: inline-block; text-align: left; }

/* ================= FOOTER ================= */
.gamefinder { background: #012A3D; border-top: 1px solid #0a4d6e; padding: 18px 0; }
.gamefinder h4 { margin-bottom: 10px; color: var(--panel-head-accent); font-size: 16px; }
.game-tags { display: flex; flex-wrap: wrap; gap: 0; }
.game-tag {
  display: inline-block; width: 200px; color: #fff; font-size: 13px; padding: 2px 0;
  text-decoration: none;
}
.game-tag:hover { color: #ffa500; }
.footer { background: var(--footer-bg); border-top: 3px solid var(--panel-head-accent); padding: 22px 0 0; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 22px; padding-bottom: 18px; }
@media (max-width: 700px) { .footer-grid { grid-template-columns: 1fr; } }
.footer h3 { color: var(--panel-head-accent); margin-bottom: 6px; }
.footer h4 { margin-bottom: 8px; color: #ffa500; font-size: 15px; }
.footer p { font-size: 13px; color: #b9cfdb; }
.footer a { display: block; color: #d7e7f0; padding: 2px 0; font-size: 13px; }
.footer a:hover { color: #ffa500; }
.copyright { border-top: 1px solid #0a4d6e; padding: 12px 8px; color: #9fb8c6; font-size: 12px; text-align: center; }
.footer-stats { font-size: 12px; color: #9fb8c6; margin-top: 6px; }
.footer-stats b { color: #7CFC00; }

/* ================= MISC ================= */
.upload-preview { max-height: 110px; border: 1px solid #999; margin-top: 6px; display: block; }
table.data { width: 100%; border-collapse: collapse; background: #fff; color: #111; }
table.data th, table.data td { padding: 6px 9px; border-bottom: 1px solid #ccc; text-align: left; font-size: 13px; }
table.data th { background: #eef4f7; color: #103246; font-weight: 700; }

/* responsive header */
@media (max-width: 820px) {
  .topheader { display: none; }
  .nav-brand-sm { display: flex; }
  .ts-arrow { display: none; }
}

/* ================= ชุมชน (COMMUNITY) ================= */
.cm-hero {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: linear-gradient(120deg, #0a4a6e, #08334b);
  border: 1px solid #1d5f85; border-radius: 10px;
  padding: 18px 20px; margin-bottom: 14px; flex-wrap: wrap;
}
.cm-hero h1 { font-family: 'Prompt', sans-serif; font-size: 1.35em; color: #fff; }
.cm-hero p { color: #bcd9ea; font-size: .92em; margin-top: 4px; max-width: 620px; }

.cm-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.cm-tab {
  background: #113850; color: #cfe6f5 !important; border: 1px solid #1d5f85;
  border-radius: 20px; padding: 5px 13px; font-size: .88em;
  text-decoration: none !important; transition: .15s;
}
.cm-tab:hover { background: #1d5f85; }
.cm-tab.active { background: var(--panel-head-accent); border-color: var(--panel-head-accent); color: #222 !important; font-weight: 700; }
.cm-tab .cm-count { opacity: .75; font-size: .85em; }
.cm-cat-desc { color: #bcd9ea; font-size: .9em; margin: 2px 0 10px; }

.cm-item {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--row-bg); color: var(--text-dark) !important;
  border-bottom: 1px solid #e2e6ea; padding: 12px 14px;
  text-decoration: none !important; transition: background .12s;
}
.cm-item:hover { background: #f2f8fd; }
.cm-thumb {
  width: 84px; height: 62px; border-radius: 6px; overflow: hidden; flex-shrink: 0;
  background: #e8eef3; display: flex; align-items: center; justify-content: center; font-size: 26px;
}
.cm-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cm-item-main { flex: 1; min-width: 0; }
.cm-item-title { font-weight: 700; color: #103246; font-size: 1.02em; overflow: hidden; text-overflow: ellipsis; }
.cm-item-meta { font-size: .8em; color: #789; margin: 3px 0; }
.cm-item-excerpt { font-size: .85em; color: #556; }
.cm-item-stats { display: flex; flex-direction: column; gap: 4px; font-size: .8em; color: #789; text-align: right; flex-shrink: 0; }
.cm-badge {
  display: inline-block; background: #eaf3fa; border: 1px solid #cfe0ee;
  border-radius: 12px; padding: 0 8px; font-size: .95em; color: #2b6c96; margin-right: 4px;
}
.cm-empty { text-align: center; padding: 34px 10px; background: var(--row-bg); color: #667; }
.cm-empty p { margin-bottom: 12px; }

.cm-pager { display: flex; gap: 5px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.cm-pager a {
  background: #113850; color: #cfe6f5; border: 1px solid #1d5f85;
  min-width: 32px; text-align: center; padding: 4px 8px; border-radius: 6px; text-decoration: none !important;
}
.cm-pager a.active { background: var(--panel-head-accent); border-color: var(--panel-head-accent); color: #222; font-weight: 700; }

.cm-why { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; padding: 16px; background: var(--row-bg); color: #345; font-size: .9em; }

/* หน้าอ่านโพสต์ */
.cm-breadcrumb { font-size: .85em; color: #9fc3da; margin-bottom: 8px; }
.cm-breadcrumb a { color: #cfe6f5; }
.cm-post-title { font-family: 'Prompt', sans-serif; font-size: 1.45em; color: #103246; line-height: 1.3; }
.cm-post-meta { font-size: .84em; color: #789; margin: 6px 0 12px; }
.cm-cover { width: 100%; border-radius: 8px; margin-bottom: 14px; }
.cm-post-body { color: #333; line-height: 1.75; word-wrap: break-word; }
.post-inline-img { display: block; max-width: 100%; border-radius: 8px; margin: 10px 0; }
.cm-owner-btn {
  background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.35); color: #fff !important;
  border-radius: 5px; padding: 2px 10px; font-size: 12px; cursor: pointer; text-decoration: none !important; margin-left: 5px;
}
.cm-owner-btn.danger { background: rgba(200,40,40,.4); }
.cm-related { display: block; padding: 7px 4px; border-bottom: 1px dashed #dde; text-decoration: none !important; }
.cm-related-title { display: block; color: #1E90FF; font-size: .92em; }
.cm-related-meta { display: block; color: #99a; font-size: .78em; }

/* ฟอร์มเขียนโพสต์ */
.cm-form-tip {
  background: #fff8e6; border: 1px solid #f2d98c; color: #7a5b12;
  border-radius: 8px; padding: 10px 14px; font-size: .88em; margin-bottom: 14px;
}
.cm-imgtool { display: flex; align-items: center; gap: 10px; margin: 8px 0 4px; }
@media (max-width: 640px) {
  .cm-thumb { display: none; }
  .cm-item-stats { display: none; }
}

/* ================= CHATBOX ชุมชน ================= */
.cm-chatpanel { margin-bottom: 14px; }
.cm-chat-tabs { display: flex; gap: 4px; margin-left: 12px; }
.cm-chat-tab {
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.3);
  color: #cfe6f5; border-radius: 14px; padding: 2px 12px; font-size: 12px; cursor: pointer;
}
.cm-chat-tab.active { background: var(--panel-head-accent); border-color: var(--panel-head-accent); color: #222; font-weight: 700; }
.cm-chat-wrap { display: flex; background: var(--row-bg); }
.cm-chat-side {
  width: 190px; flex-shrink: 0; border-right: 1px solid #e2e6ea;
  padding: 8px; max-height: 360px; overflow-y: auto;
}
.cm-chat-side input { width: 100%; font-size: .85em; padding: 5px 8px; margin-bottom: 6px; }
.cm-chat-side-label { font-size: .75em; color: #99a; margin: 8px 0 4px; text-transform: uppercase; }
.cm-partner {
  display: flex; align-items: center; gap: 7px; padding: 5px 6px;
  border-radius: 6px; cursor: pointer; color: #234; font-size: .88em;
}
.cm-partner:hover { background: #eef5fb; }
.cm-partner.active { background: #dcedfa; font-weight: 700; }
.cm-partner img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.cm-chat-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cm-chat-msgs {
  height: 300px; overflow-y: auto; padding: 10px 12px;
  scrollbar-width: none; -ms-overflow-style: none;
}
.cm-chat-msgs::-webkit-scrollbar { display: none; }
.cm-chat-empty { text-align: center; padding: 30px 10px !important; }
.cm-msg { display: flex; gap: 8px; margin-bottom: 9px; }
.cm-msg-av { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.cm-msg-main { min-width: 0; max-width: 80%; }
.cm-msg-head { display: flex; gap: 8px; align-items: baseline; }
.cm-msg-name { font-weight: 700; font-size: .82em; color: #2b6c96; }
.cm-msg-name.can-whisper { cursor: pointer; }
.cm-msg-name.can-whisper:hover { text-decoration: underline; color: #0a5c8c; }
.cm-msg-ago { font-size: .72em; color: #aab; }
.cm-msg-body {
  background: #f0f4f8; color: #223; border-radius: 4px 12px 12px 12px;
  padding: 6px 11px; font-size: .92em; word-wrap: break-word; white-space: pre-wrap;
}
.cm-msg.mine { flex-direction: row-reverse; }
.cm-msg.mine .cm-msg-main { text-align: right; }
.cm-msg.mine .cm-msg-head { justify-content: flex-end; }
.cm-msg.mine .cm-msg-body { background: #d7ecff; border-radius: 12px 4px 12px 12px; text-align: left; }
.cm-chat-input {
  display: flex; gap: 6px; align-items: center; position: relative;
  border-top: 1px solid #e2e6ea; padding: 8px 10px;
}
.cm-chat-input input[type=text] { flex: 1; margin: 0; }
.cm-emoji-btn { background: none; border: none; font-size: 20px; cursor: pointer; padding: 0 2px; }
.cm-emoji-panel {
  position: absolute; bottom: 46px; left: 6px; z-index: 30;
  background: #fff; border: 1px solid #cdd; border-radius: 10px;
  box-shadow: 0 6px 18px rgba(0,0,0,.18); padding: 10px;
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; width: 320px;
  max-height: 240px; overflow-y: auto;
}
.cm-emoji-panel button {
  background: none; border: none; font-size: 22px; cursor: pointer; border-radius: 6px;
  padding: 6px; width: 100%; aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
}
.cm-emoji-panel button:hover { background: #eef3f8; }
.cm-chat-login { flex: 1; text-align: center; color: #667; font-size: .9em; padding: 4px; }
@media (max-width: 640px) { .cm-chat-side { width: 140px; } }

/* ================= CHAT OVERLAY มุมขวาบน ================= */
#chat-overlay-stack {
  position: fixed; top: 56px; right: 12px; z-index: 900;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
  pointer-events: none;
}
#chat-overlay-stack > * { pointer-events: auto; }
#chat-overlay-close {
  font-size: 11px; color: #9fc3da; cursor: pointer;
  background: rgba(0,45,66,.85); border-radius: 12px; padding: 2px 10px;
  opacity: 0; transition: opacity .2s;
}
#chat-overlay-stack:hover #chat-overlay-close { opacity: 1; }
.chat-toast {
  display: flex; gap: 9px; align-items: center; max-width: 300px;
  background: rgba(8, 40, 58, .96); border: 1px solid #1d5f85; border-left: 3px solid var(--panel-head-accent);
  border-radius: 10px; padding: 8px 12px; box-shadow: 0 6px 16px rgba(0,0,0,.4);
  text-decoration: none !important; color: #dfe9f2;
  transform: translateX(120%); opacity: 0; transition: transform .35s, opacity .35s;
}
.chat-toast.show { transform: translateX(0); opacity: 1; }
.chat-toast img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.chat-toast b { display: block; font-size: .8em; color: #ffd27a; }
.chat-toast span { display: block; font-size: .84em; color: #cfe0ec; word-break: break-word; }
@media (max-width: 640px) { #chat-overlay-stack { display: none; } }

/* ================= โปรไฟล์: avatar ================= */
.profile-avatar-row { display: flex; gap: 18px; align-items: flex-start; margin: 12px 0 16px; flex-wrap: wrap; }
.profile-avatar { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; border: 3px solid #dfe8f0; flex-shrink: 0; }
.userchip-av { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; margin-right: 3px; }

/* ================= CHATBOX v2: โทนสบายตา + POPUP CARD สไตล์ XAT ================= */
.cm-chatpanel { position: relative; }
.cm-chat-msgs {
  /* โทนกระดาษอุ่นๆ จ้องนานไม่ล้าตา */
  background: linear-gradient(180deg, #f7f5ef 0%, #f2efe7 100%);
}
.cm-msg-body { background: #ffffff; border: 1px solid #e7e2d6; color: #3a3a34; }
.cm-msg.mine .cm-msg-body { background: #e4efdd; border-color: #cfe0c4; }
.cm-msg-av { cursor: pointer; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.cm-msg-av:hover { box-shadow: 0 0 0 2px var(--panel-head-accent); }
.cm-msg-ago { color: #b0a996; }
.cm-chat-side { background: #faf8f3; border-right-color: #e7e2d6; }
.cm-chat-input { background: #faf8f3; border-top-color: #e7e2d6; }
.cm-chat-status { font-size: .78em; color: #b0722a; white-space: nowrap; }
#chat-send { min-width: 64px; text-align: center; }
#chat-send:disabled { opacity: .75; font-weight: 700; font-size: 1.05em; }

/* บังคับอัพรูปโปรไฟล์ก่อนพิมพ์ */
.cm-avatar-gate {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 10px;
  flex-wrap: wrap; color: #6b5d3f; font-size: .9em; padding: 4px;
}

/* POPUP CARD INFO */
.cm-card {
  position: absolute; z-index: 60; top: 60px; left: 50%; transform: translateX(-50%);
  width: 270px; background: #fffdf8; border: 1px solid #d8d0bd; border-radius: 14px;
  box-shadow: 0 14px 40px rgba(0,0,0,.35); padding: 18px 16px 14px; text-align: center;
}
.cm-card-close {
  position: absolute; top: 8px; right: 10px; background: none; border: none;
  font-size: 15px; color: #998; cursor: pointer;
}
.cm-card-close:hover { color: #333; }
.cm-card-av {
  width: 110px; height: 110px; border-radius: 50%; object-fit: cover;
  border: 4px solid #fff; box-shadow: 0 3px 12px rgba(0,0,0,.22);
}
.cm-card-av.editable { cursor: pointer; }
.cm-card-av.editable:hover { box-shadow: 0 0 0 3px var(--panel-head-accent); }
.cm-card-name { font-family: 'Prompt', sans-serif; font-weight: 700; font-size: 1.15em; margin-top: 8px; word-break: break-word; }
.cm-card-uid { font-size: .74em; color: #a89; letter-spacing: .5px; }
.cm-card-bio {
  background: #f4f0e6; border-radius: 8px; padding: 8px 10px; margin: 10px 0 6px;
  font-size: .84em; color: #565043; min-height: 34px; white-space: pre-wrap; word-break: break-word;
}
.cm-card-joined { font-size: .72em; color: #b0a996; margin-bottom: 8px; }
.cm-card-actions { display: flex; gap: 6px; justify-content: center; margin-top: 4px; }
#card-editform input[type=text], #card-editform textarea {
  width: 100%; margin: 8px 0 0; font-size: .9em; padding: 7px 10px;
}
#card-editform textarea { min-height: 64px; resize: vertical; }
.cm-color-row { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; justify-content: center; margin-top: 8px; }
.cm-color-label { font-size: .78em; color: #887; margin-right: 2px; }
.cm-color-dot {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff;
  box-shadow: 0 0 0 1px #ccc; cursor: pointer; padding: 0; font-size: 10px; line-height: 1; color: #666;
}
.cm-color-dot:hover { transform: scale(1.15); }
.cm-color-dot.active { box-shadow: 0 0 0 2px #222; }
.cm-color-dot.none { background: #eee; }

/* ================= CHATBOX v3: Global Chat สไตล์ XAT ================= */
/* ข้อความชิดซ้ายฝั่งเดียว ไม่มีกล่องครอบ รูปโปรไฟล์กลมใหญ่ ช่องแชทสูงขึ้น */
.cm-chat-msgs { height: 430px; padding: 12px 14px; }
.cm-msg { gap: 10px; margin-bottom: 12px; align-items: flex-start; }
.cm-msg.mine { flex-direction: row; }                     /* ยกเลิกการสลับฝั่งของข้อความตัวเอง */
.cm-msg.mine .cm-msg-main { text-align: left; }
.cm-msg.mine .cm-msg-head { justify-content: flex-start; }
.cm-msg-av {
  width: 48px; height: 48px; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.18);
}
.cm-msg-main { max-width: none; flex: 1; min-width: 0; }
.cm-msg-name { font-size: .92em; }
.cm-msg-body, .cm-msg.mine .cm-msg-body {
  background: none; border: none; border-radius: 0;
  padding: 1px 0 0; font-size: .95em; color: #3d3a32; text-align: left;
}
.cm-chat-inputrow { display: flex; gap: 6px; align-items: center; flex: 1; position: relative; }
.cm-chat-inputrow .cm-emoji-panel { bottom: 40px; left: 0; }

/* ================= หน้าแชทและฟังเพลง: XAT Dark Theme ================= */
.xchat {
  position: relative;
  background: #151a24;
  border: 1px solid #2b3547;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 10px 34px rgba(0,0,0,.45);
}
.xchat-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: linear-gradient(120deg, #1d2534, #171e2b);
  border-bottom: 1px solid #2b3547;
  padding: 12px 16px;
}
.xchat-head h1 { font-family: 'Prompt', sans-serif; font-size: 1.1em; color: #eaf0fa; }
.xchat-note { font-size: 11px; color: #6f7d95; }
.xchat .cm-chat-tab { background: #232c3d; border-color: #37435a; color: #aebad0; }
.xchat .cm-chat-tab.active { background: var(--panel-head-accent); border-color: var(--panel-head-accent); color: #1a1a1a; }

.xchat-grid { display: flex; align-items: stretch; }
.xchat-left { flex: 1; min-width: 0; display: flex; }
.xchat-left .cm-chat-wrap { flex: 1; background: transparent; }
.xchat-right {
  width: 250px; flex-shrink: 0;
  border-left: 1px solid #2b3547;
  background: #131822;
  display: flex; flex-direction: column;
}
.xchat-panel { padding: 12px; border-bottom: 1px solid #232c3d; }
.xchat-panel-title {
  font-size: .82em; font-weight: 700; color: #8fa2c0;
  letter-spacing: .4px; margin-bottom: 8px;
}
.xchat-online-num {
  background: #1f6f43; color: #b7f4cf; border-radius: 10px;
  padding: 0 8px; font-size: .9em; margin-left: 4px;
}
.xchat-online-list { max-height: 300px; overflow-y: auto; }
.xchat-online-empty { padding: 8px !important; }
.xchat-online-user {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 10px; cursor: pointer;
  color: #d5deec; font-size: .88em; transition: background .12s;
}
.xchat-online-user:hover { background: #1e2635; }
.xchat-online-user img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; border: 2px solid #2b3547; }
.xchat-online-user span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xchat-dot { width: 8px; height: 8px; border-radius: 50%; background: #37d67a; flex-shrink: 0; box-shadow: 0 0 6px #37d67a; }

/* เพลง */
#music-select {
  width: 100%; background: #1b2231; color: #d5deec; border: 1px solid #37435a;
  border-radius: 10px; padding: 7px 8px; font-size: .85em; margin-bottom: 8px;
}
.xchat-music-frame { border-radius: 12px; overflow: hidden; background: #0e1219; }
.xchat-music-frame iframe { width: 100%; height: 140px; display: block; border: 0; }
.xchat-music-idle { padding: 22px 8px; text-align: center; color: #55627a; font-size: .82em; line-height: 1.6; }

/* override โซนแชทให้เป็น dark */
.xchat .cm-chat-msgs {
  background: #10151f;
  height: 480px;
}
.xchat .cm-msg-body, .xchat .cm-msg.mine .cm-msg-body { color: #cfd8e6; }
.xchat .cm-msg-name { color: #7ec3ff; }
.xchat .cm-msg-ago { color: #4d5a72; }
.xchat .cm-msg-av { border-color: #2b3547; box-shadow: 0 2px 8px rgba(0,0,0,.5); }
.xchat .cm-msg-av:hover { box-shadow: 0 0 0 2px var(--panel-head-accent); }
.xchat .cm-chat-empty { color: #55627a; }
.xchat .cm-chat-input { background: #171e2b; border-top-color: #2b3547; }
.xchat .cm-chat-input input[type=text] {
  background: #0f141d; color: #e2e8f2; border: 1px solid #2b3547; border-radius: 20px;
  padding: 8px 15px;
}
.xchat .cm-chat-input input[type=text]::placeholder { color: #55627a; }
.xchat .cm-chat-status { color: #e0a55a; }
.xchat .cm-chat-login { color: #8fa2c0; }
.xchat .cm-avatar-gate { color: #cbb277; }
.xchat .cm-chat-side { background: #131822; border-right-color: #2b3547; }
.xchat .cm-chat-side input { background: #0f141d; color: #e2e8f2; border: 1px solid #2b3547; border-radius: 14px; }
.xchat .cm-chat-side-label { color: #55627a; }
.xchat .cm-partner { color: #c4cfdf; border-radius: 10px; }
.xchat .cm-partner:hover { background: #1e2635; }
.xchat .cm-partner.active { background: #24405c; }
.xchat .cm-emoji-panel { background: #1b2231; border-color: #37435a; }
.xchat .cm-emoji-panel button:hover { background: #27324a; }
.xchat .cm-card { top: 70px; }

@media (max-width: 760px) {
  .xchat-grid { flex-direction: column; }
  .xchat-right { width: 100%; border-left: none; border-top: 1px solid #2b3547; flex-direction: row; }
  .xchat-right .xchat-panel { flex: 1; border-bottom: none; }
  .xchat .cm-chat-msgs { height: 380px; }
}

/* แบนเนอร์ชวนเข้าห้องแชท (หน้าชุมชน) */
.cm-chat-banner {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(120deg, #1d2534, #12202e);
  border: 1px solid #2b3547; border-radius: 14px;
  padding: 12px 18px; margin-bottom: 14px;
  color: #cfe0f2 !important; text-decoration: none !important;
  transition: border-color .15s, transform .15s;
}
.cm-chat-banner:hover { border-color: var(--panel-head-accent); transform: translateY(-1px); }
.cm-chat-banner-icon { font-size: 26px; }
.cm-chat-banner-text { flex: 1; font-size: .92em; }
.cm-chat-banner-text b { color: #ffd27a; }
.cm-chat-banner-go { color: var(--panel-head-accent); font-weight: 700; font-size: .9em; white-space: nowrap; }

/* ============================================================
   LEGACY WEBBOARD — สไตล์ bbs.pramool ยุค 90s เป๊ะๆ
   พื้นขาว ลิงก์น้ำเงินขีดเส้นใต้ แถบหมวดน้ำเงิน หัวตารางส้ม NEW!/HOT! กระพริบ
   ============================================================ */
.bbs {
  background: #fff;
  color: #000;
  font-family: "MS Sans Serif", Tahoma, "Microsoft Sans Serif", sans-serif;
  font-size: 13px;
  line-height: 1.45;
  padding: 6px 8px 14px;
  border: 1px solid #999;
}
.bbs a { color: #0000EE; text-decoration: underline; }
.bbs a:visited { color: #551A8B; }
.bbs a:hover { color: #EE0000; }
.bbs .bbs-red, .bbs a.bbs-red { color: #EE0000; }
.bbs .bbs-blue, .bbs a.bbs-blue { color: #0000CC; }
.bbs .bbs-yellow { color: #b58900; }

/* โลโก้ + แถบเมนูบนแบบ pramool */
.bbs-mast { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 4px 2px 6px; border-bottom: 2px solid #FF6600; }
.bbs-logo { font-family: 'Times New Roman', serif; font-weight: bold; font-size: 26px; color: #FF6600; letter-spacing: 1px; }
.bbs-logo span { color: #003399; }
.bbs-mastnav { font-size: 12px; color: #333; }
.bbs-mastnav a { color: #003399; font-weight: bold; }

/* ประกาศบน */
.bbs-notice { text-align: center; padding: 6px 4px; font-size: 13px; }
.bbs-notice .bbs-red { font-weight: bold; }

/* แถบหมวดน้ำเงิน */
.bbs-secbar {
  background: #0000CC;
  color: #fff;
  text-align: center;
  font-weight: bold;
  font-size: 13px;
  padding: 2px 4px;
  margin-top: 8px;
}
.bbs-secnote { font-weight: normal; font-size: 11px; }

/* ตารางบอร์ด 3 คอลัมน์ */
.bbs-boards { width: 100%; border-collapse: collapse; }
.bbs-boards td { width: 33.33%; padding: 4px 10px; vertical-align: top; }
.bbs-boardrow { padding: 1.5px 0; }

/* NEW! / HOT! กระพริบแบบ gif ยุคเก่า */
@keyframes bbs-blink { 0%,49% { opacity: 1 } 50%,100% { opacity: .25 } }
.bbs-newgif, .bbs-hotgif {
  display: inline-block; font-family: Arial, sans-serif; font-weight: bold; font-style: italic;
  font-size: 10px; padding: 0 2px; animation: bbs-blink 1s steps(1) infinite;
}
.bbs-newgif { color: #fff; background: #FF3300; border-radius: 2px; }
.bbs-hotgif { color: #FF0000; text-shadow: 1px 1px 0 #FFCC00; }

/* แถว Post your Topic + เลขหน้า */
.bbs-postline { padding: 5px 2px; font-size: 13px; }
.bbs-postline a { margin: 0 1px; }

/* ตารางรายการกระทู้ — หัวส้มไล่สี */
.bbs-topics { width: 100%; border-collapse: collapse; font-size: 13px; }
.bbs-topics td { padding: 2.5px 6px; }
.bbs-thead td {
  background: linear-gradient(180deg, #FFB444 0%, #FF8400 45%, #FF6A00 100%);
  color: #fff; font-weight: bold; border: 1px solid #d96a00;
}
.bbs-thead td:first-child { color: #003399; }
.bbs-row-a td { background: #EFEFEF; }
.bbs-row-b td { background: #FFFFFF; }
/* คลาสสิคแท้: ไม่มี hover effect ในตารางกระทู้ */
.bbs-oldcell { color: #555; font-weight: bold; white-space: nowrap; }
.bbs-btag { color: #777; font-size: 12px; }
.bbs-by b { color: #0000AA; font-size: 12px; }
.bbs-when { color: #333; font-size: 11px; white-space: nowrap; }
.bbs-smiley { width: 15px; height: 15px; vertical-align: -3px; margin-right: 2px; }

/* หัวกระทู้ด้านใน */
.bbs-topichead {
  background: linear-gradient(180deg, #FFB444, #FF6A00);
  color: #fff; font-weight: bold; font-size: 14px;
  padding: 4px 8px; border: 1px solid #d96a00; margin-top: 6px;
}

/* ตารางกระทู้ด้านใน: คอลัมน์ซ้ายชื่อคนโพสต์ */
.bbs-thread { width: 100%; border-collapse: collapse; margin-top: 2px; }
.bbs-thread td { border: 1px solid #999; vertical-align: top; }
.bbs-poster {
  width: 130px; background: #F5F5EF; padding: 6px 8px; font-size: 12px;
  word-wrap: break-word;
}
.bbs-postnum { font-weight: bold; color: #0000AA; }
.bbs-postnum.bbs-red { color: #EE0000; }
.bbs-nonmember { color: #777; font-size: 11px; }
.bbs-msg { padding: 5px 10px 10px; }
.bbs-msghead { font-size: 11px; color: #333; border-bottom: 1px dotted #bbb; padding-bottom: 3px; margin-bottom: 6px; }
.bbs-warn { color: #EE0000; font-size: 10.5px; margin-left: 8px; }
.bbs-msgbody { font-size: 13.5px; word-wrap: break-word; }
.bbs-msgbody a { word-break: break-all; }

/* ฟอร์มยุคเก่า */
.bbs-replybox { margin-top: 12px; }
.bbs-form { padding: 8px 6px; border: 1px solid #999; border-top: none; background: #FBFBF5; }
.bbs-form label { display: block; margin: 6px 0 2px; font-size: 12.5px; font-weight: bold; color: #222; }
.bbs-form input[type=text], .bbs-form textarea {
  width: 100%; max-width: 640px; border: 1px solid #7F9DB9; background: #fff; color: #000;
  font-family: Tahoma, sans-serif; font-size: 13px; padding: 3px 5px; border-radius: 0; margin: 0;
}
.bbs-form textarea { display: block; }
.bbs-btn {
  font-family: Tahoma, sans-serif; font-size: 13px; padding: 2px 14px; margin: 8px 6px 0 0;
  background: linear-gradient(180deg, #fdfdfd, #d7d7d7); border: 1px solid #888;
  border-radius: 0; cursor: pointer; color: #000;
}
.bbs-btn:active { background: #ccc; }
.bbs-iconpick { display: flex; gap: 4px; flex-wrap: wrap; padding: 4px 0; }
.bbs-iconopt { display: inline-flex; align-items: center; gap: 2px; border: 1px solid #ccc; padding: 2px 5px; background: #fff; cursor: pointer; }
.bbs-iconopt input { margin: 0; }
.bbs-footline { text-align: center; font-size: 12px; color: #333; padding-top: 12px; }
@media (max-width: 640px) {
  .bbs-boards td { display: block; width: 100%; }
  .bbs-poster { width: 90px; }
}

/* ===== LEGACY WEBBOARD v2 — เก็บดีเทลให้เหมือนต้นฉบับ ===== */
/* หัวตารางส้ม: แถบโค้งมนชิ้นเดียว + เล็กลง (ต้อง separate ไม่งั้น radius ไม่ทำงาน) */
.bbs-topics { border-collapse: separate; border-spacing: 0; }
.bbs-thead td {
  border: none;
  font-size: 11px;
  font-weight: bold;
  padding: 1px 8px;
  background: linear-gradient(180deg, #FFC96B 0%, #FF8C1A 40%, #FF7000 100%);
}
.bbs-thead td:first-child { border-radius: 10px 0 0 10px; }
.bbs-thead td:last-child  { border-radius: 0 10px 10px 0; }

/* คอลัมน์ "โดย" — ฟอนต์ serif หนาแบบต้นฉบับ */
.bbs-by b {
  font-family: 'Times New Roman', Times, Georgia, serif;
  font-size: 12.5px;
  color: #1a1aa6;
  letter-spacing: .2px;
}

/* NEW! / HOT! — ป้ายนิ่งๆ แบบยุคเก่า (ไม่กระพริบ) */
.bbs-newgif, .bbs-hotgif { animation: none; }
.bbs-newgif {
  color: #FF0000; background: none; font-family: 'Times New Roman', serif;
  font-size: 11px; text-shadow: 1px 1px 0 #FFD700;
}
.bbs-hotgif {
  color: #FF2400; font-family: Arial, sans-serif; font-size: 10px;
  text-shadow: 1px 1px 0 #FFC800;
}

/* แถว [ Post your Topic! ] [1] [2]... — ชิดขวาแบบต้นฉบับ */
.bbs-postline { text-align: right; }

/* รูปที่แทรกในกระทู้ */
.bbs-img { display: block; max-width: 520px; width: auto; max-height: 600px; margin: 6px 0; border: 1px solid #bbb; }
.bbs-imgtool { margin: 6px 0 2px; font-size: 12px; color: #666; }
.bbs-imgtool #bbs-img-status { margin-left: 8px; color: #b06000; }
@media (max-width: 640px) { .bbs-img { max-width: 100%; } }

/* ===== LEGACY WEBBOARD v3 ===== */

/* เว็ปบอร์ดกว้างเต็มจอ (breakout ออกจาก container 1000px ของธีมหลัก) */
.bbs {
  width: calc(100vw - 36px);
  max-width: none;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}
@media (max-width: 1040px) { .bbs { width: 100%; left: auto; transform: none; } }

/* ===== LEGACY WEBBOARD v4 ===== */
/* แถบหัวฟอร์มตอบ/ตั้งกระทู้ — สีส้มแบบหัวตาราง (ไม่ใช่น้ำเงิน) */
.bbs-secbar.bbs-secbar-orange {
  background: linear-gradient(180deg, #FFB444 0%, #FF8400 45%, #FF6A00 100%);
  border: 1px solid #d96a00;
}

/* เนื้อหาโพส/คอมเมนต์: ชิดซ้ายแบบเดิมตามต้นฉบับ — กล่องฟอร์มตอบ/ตั้งกระทู้ต่างหากที่จัดกลาง */
.bbs-msgbody { font-size: 14px; line-height: 1.7; }
.bbs-replybox, .bbs-postform { max-width: 760px; margin-left: auto; margin-right: auto; }
.bbs-form > div:last-of-type { text-align: center; }

/* ป้าย PIC ท้ายหัวข้อกระทู้ที่มีรูป — ฟอนต์ดำ GLOW เขียว ตามต้นฉบับ */
.bbs-pic {
  color: #000;
  font-family: Arial, sans-serif;
  font-weight: bold;
  font-style: italic;
  font-size: 10px;
  margin: 0 2px;
  text-shadow: 0 0 2px #00E000, 0 0 4px #00FF00, 0 0 6px #7CFC00;
}

/* พื้นหลังหน้า Legacy Board ขาวล้วนทั้งจอ — ไม่เห็นพื้นน้ำเงินของ main page เลย */
body:has(.bbs) {
  background: #fff !important;
  background-image: none !important;
}
body:has(.bbs) .main-content { margin-bottom: 0; }

/* คอลัมน์แรก: new (เขียว) / old — บรรทัดเดียวเสมอ + หัวตารางไม่ตัดบรรทัด */
.bbs-thead td { white-space: nowrap; font-size: 12px; }
.bbs-newtag { color: #009900; font-weight: bold; font-family: 'Times New Roman', serif; font-size: 12px; }

/* Vote Monitor: ตัวเลขใหญ่ขึ้น + อยู่กลางหัวใจพอดี */
.vote-notify-item .vn-plus { width: 46px; height: 42px; }
.vote-notify-item .vn-heart-num {
  font-size: 17px;
  margin-top: 0;
  line-height: 1;
  transform: translateY(-1px);
}

/* Popup Login สไตล์ SWAL */
#bbs-login-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .18s;
}
#bbs-login-overlay.show { opacity: 1; }
.bbs-login-modal {
  background: #fff; color: #222; width: 330px; max-width: calc(100vw - 30px);
  border-radius: 12px; padding: 22px 24px 16px; position: relative;
  box-shadow: 0 18px 50px rgba(0,0,0,.45);
  transform: translateY(12px); transition: transform .18s;
  font-family: Tahoma, sans-serif; font-size: 13.5px;
}
#bbs-login-overlay.show .bbs-login-modal { transform: translateY(0); }
.blm-close { position: absolute; top: 10px; right: 12px; background: none; border: none; font-size: 15px; color: #999; cursor: pointer; }
.blm-close:hover { color: #333; }
.blm-title { font-family: 'Prompt', Tahoma, sans-serif; font-weight: 700; font-size: 1.25em; text-align: center; color: #103246; }
.blm-sub { text-align: center; color: #778; font-size: .85em; margin: 3px 0 10px; }
.bbs-login-modal label { display: block; font-size: .85em; font-weight: 700; color: #345; margin: 8px 0 3px; }
.bbs-login-modal input[type=email], .bbs-login-modal input[type=password], .bbs-login-modal input[type=text] {
  width: 100%; border: 1px solid #b8c4d0; border-radius: 7px; padding: 7px 10px;
  font-family: Tahoma, sans-serif; font-size: 13.5px; margin: 0;
}
.blm-captcha { display: flex; gap: 8px; align-items: center; }
.blm-captcha img { height: 34px; border: 1px solid #ccc; border-radius: 5px; cursor: pointer; }
.blm-captcha input { max-width: 120px; }
.blm-submit {
  width: 100%; margin-top: 14px; padding: 9px;
  background: linear-gradient(180deg, #FFB444, #FF6A00); color: #fff;
  border: none; border-radius: 8px; font-weight: 700; font-size: 14px; cursor: pointer;
}
.blm-submit:hover { filter: brightness(1.06); }
.blm-foot { text-align: center; font-size: .82em; color: #778; margin-top: 10px; }
/* พื้นหลังขาวหน้าเว็ปบอร์ด (class จาก PHP — ชัวร์กว่า :has ทุก browser) */
body.bbs-page { background: #fff !important; background-image: none !important; }
body.bbs-page .main-content { margin-bottom: 0; padding-bottom: 0; }
body.bbs-page .bbs { border: none; }

/* ปุ่มแจ้งลบเนื้อหา 🚩 */
.report-btn { font-size: .85em; color: #c0392b !important; text-decoration: none; opacity: .75; }
.report-btn:hover { opacity: 1; text-decoration: underline; }

/* กระดิ่งแจ้งเตือน 🔔 */
.notify-bell > a { position: relative; font-size: 18px; text-decoration: none; padding: 4px 6px; }
.notify-badge {
  position: absolute; top: -4px; right: -6px;
  background: #e53935; color: #fff; font-size: 10px; font-weight: 700;
  border-radius: 10px; padding: 1px 5px; line-height: 1.4;
}
.notify-menu { min-width: 280px; max-width: 340px; max-height: 380px; overflow-y: auto; }
.notify-menu a { white-space: normal; line-height: 1.35; }
.notify-menu .nf-unread { font-weight: 600; background: rgba(20,135,214,.07); }
.notify-menu .nf-read { opacity: .7; }
.notify-menu .nf-empty { display: block; padding: 14px; text-align: center; color: #888; font-size: .9em; }
.notify-readall { padding: 4px 8px; text-align: right; border-bottom: 1px solid rgba(128,128,128,.2); }
.notify-readall button { background: none; border: none; color: #1487D6; cursor: pointer; font-size: .85em; }

/* Admin Dashboard */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.dash-stat { border: 1px solid rgba(128,128,128,.25); border-radius: 8px; padding: 10px 12px; }
.dash-stat small { display: block; color: #888; font-size: .78em; }
.dash-stat b { display: block; font-size: 1.5em; margin: 2px 0; }
.dash-stat .muted { font-size: .78em; }
.dash-chart { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 16px; }
.dash-bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.dash-bar { width: 100%; max-width: 34px; background: linear-gradient(180deg, #1487D6, #0d5c94); border-radius: 4px 4px 0 0; }
.dash-bar-val { font-size: .68em; color: #888; }
.dash-bar-wrap small { font-size: .68em; color: #888; margin-top: 3px; white-space: nowrap; }
.dash-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 760px) { .dash-2col { grid-template-columns: 1fr; } }

/* ================= MOBILE FIXES ================= */
@media (max-width: 820px) {
  /* เมนูหลักเลื่อนแนวนอนได้ ไม่ดันของหลุดจอ */
  .navbar-inner { height: auto; flex-wrap: wrap; }
  .mainnav { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .mainnav::-webkit-scrollbar { display: none; }
  .mainnav > a, .mainnav .dropdown > a { padding: 10px 12px; }
  .topbar-user { padding: 6px 10px; }
}
@media (max-width: 640px) {
  /* เว็ปบอร์ด: ตารางกว้างเลื่อนในกรอบตัวเอง ไม่ดันทั้งหน้า */
  .bbs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .bbs-topics { min-width: 560px; }
  .bbs-mastnav { font-size: 11px; }
  .bbs-warn { display: none; }           /* ข้อความเตือนยาวๆ ซ่อนบนจอเล็ก เหลือปุ่มสำคัญ */
  /* member menu เป็นแถบชิดกันอ่านง่าย */
  .member-menu a { padding: 10px 12px; }
  /* dropdown แจ้งเตือนไม่ล้นขอบจอ */
  .notify-menu { max-width: calc(100vw - 20px); }
}

/* Ticket modal ถึงเว็บมาสเตอร์ */
#ticket-overlay {
  position: fixed; inset: 0; z-index: 3000; display: flex;
  align-items: center; justify-content: center; background: rgba(0,0,0,.55); padding: 14px;
}
.ticket-box {
  background: #fff; color: #222; border-radius: 12px; padding: 18px 20px;
  width: 100%; max-width: 440px; position: relative; box-shadow: 0 10px 40px rgba(0,0,0,.4);
  font-family: Sarabun, Tahoma, sans-serif;
}
.ticket-box h3 { margin: 0 0 4px; color: #002D42; }
.ticket-hint { font-size: .82em; color: #777; margin: 0 0 10px; }
.ticket-box label { display: block; font-size: .85em; font-weight: 600; margin: 8px 0 3px; }
.ticket-box select, .ticket-box textarea {
  width: 100%; border: 1px solid #bbb; border-radius: 7px; padding: 7px 9px;
  font: inherit; font-size: .92em; background: #fff; color: #222;
}
.ticket-close {
  position: absolute; top: 10px; right: 12px; background: none; border: none;
  font-size: 16px; cursor: pointer; color: #999;
}
.ticket-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.ticket-send {
  background: linear-gradient(135deg, #ff9d00, #ff3c00); color: #fff; border: none;
  border-radius: 8px; padding: 9px 18px; font: inherit; font-weight: 700; cursor: pointer;
}
.ticket-send:disabled { opacity: .6; }
.ticket-mybox { font-size: .82em; }
.bbs-marketrow { padding-left: 34px; font-size: 12px; }

/* NEW! v2 — ตัวตั้ง (ไม่เอียง) สีดำ ขอบ glow เหลือง ตามต้นฉบับ */
.bbs-newgif {
  font-style: normal;
  color: #000;
  font-family: Arial, sans-serif;
  font-size: 10px;
  text-shadow: -1px -1px 0 #FFD700, 1px -1px 0 #FFD700, -1px 1px 0 #FFD700, 1px 1px 0 #FFD700,
               0 0 3px #FFE45C;
}

/* ===== หน้าเลือกหมวดบอร์ด: font อังกฤษ serif แบบต้นฉบับ 2005 ===== */
.bbs-boards .bbs-boardrow,
.bbs-boards .bbs-boardrow a {
  font-family: 'Times New Roman', Times, serif;
  font-size: 15px;
}
.bbs-marketrow, .bbs-boards .bbs-marketrow a { font-size: 14px; }

/* NEW! v3 — ตรงต้นฉบับ: ตัวดำหนา ตั้งตรง ขนาดจิ๋ว มี glow เหลืองฟุ้งรอบตัวอักษร */
.bbs-newgif {
  font-style: normal;
  font-weight: 700;
  color: #000;
  font-family: Verdana, Arial, sans-serif;
  font-size: 8.5px;
  letter-spacing: 0;
  text-shadow:
    -1px 0 0 #FFE000, 1px 0 0 #FFE000, 0 -1px 0 #FFE000, 0 1px 0 #FFE000,
    -1px -1px 0 #FFE000, 1px -1px 0 #FFE000, -1px 1px 0 #FFE000, 1px 1px 0 #FFE000,
    0 0 4px #FFD000;
}

/* ================= THEME: กลางคืน / อ่านหนังสือ ================= */
#theme-toggle {
  background: none; border: 1px solid rgba(255,255,255,.25); border-radius: 8px;
  font-size: 15px; line-height: 1; padding: 5px 8px; cursor: pointer;
  transition: background .15s;
}
#theme-toggle:hover { background: rgba(255,255,255,.12); }

/* --- โหมดกลางคืน: invert ทั้งหน้าแล้วคืนค่าสีให้รูป/วิดีโอ/โลโก้ (ภาพยังสีปกติ) --- */
html[data-theme="night"] {
  /* สีนี้จะถูก invert เป็นโทนมืด (พื้นที่ overscroll นอก body) */
  filter: invert(.92) hue-rotate(180deg);
  background: #dfe6ee;
}
html[data-theme="night"] img,
html[data-theme="night"] video,
html[data-theme="night"] iframe,
html[data-theme="night"] .site-logo-icon,
html[data-theme="night"] .medal-badge {
  filter: invert(1.087) hue-rotate(180deg);
}
/* สิ่งที่วางด้วย position:fixed ต้องยกเว้น — filter บน html ทำให้ fixed เพี้ยนตำแหน่งใน browser บางตัว
   (ยอมให้ widget เหล่านี้สีเดิม ดีกว่าตำแหน่งหลุด) */

/* --- โหมดอ่านหนังสือ: พื้นครีมถนอมสายตา ลดสีจัด ตัวอักษรใหญ่ขึ้น อ่านสบาย --- */
html[data-theme="read"] {
  filter: saturate(.35) contrast(.96);
  background: #f4ecd8;
}
html[data-theme="read"] body { background: #f4ecd8; }
html[data-theme="read"] .main-content,
html[data-theme="read"] .bbs {
  font-size: 1.07em;
  line-height: 1.75;
}
html[data-theme="read"] .bbs { font-size: 15px; }
html[data-theme="read"] img { filter: saturate(1.2); }

/* ================= กัน layout shift ระหว่างเปลี่ยนหน้า =================
   หน้าสั้น (ไม่มี scrollbar) กับหน้ายาว (มี scrollbar) กว้างต่างกัน ~17px
   ทำให้เนื้อหากึ่งกลางขยับซ้าย-ขวาตอนคลิกลิงก์ — จองพื้นที่ scrollbar ไว้เสมอ */
html { overflow-y: scroll; scrollbar-gutter: stable; }
