/* ═══════════════════════════════════════════════════════
   ลูกหนังไลฟ์ — FOOTBALL NEWS 24/7
   ธีมสปอร์ตโทนเข้ม ดีไซน์ใหม่ (ไม่ก็อปปี้เว็บใด)
   ═══════════════════════════════════════════════════════ */

:root {
  --bg: #060b16;
  --bg-2: #0a1322;
  --card: #0f1a2e;
  --card-2: #12213a;
  --line: rgba(148, 178, 255, 0.10);
  --txt: #e9effc;
  --muted: #a6b4cf;
  --green: #2ee27a;
  --green-2: #0fb8ff;
  --gold: #ffd34d;
  --red: #ff4d5e;
  --grad: linear-gradient(90deg, #2ee27a, #0fb8ff);
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --font-head: 'Prompt', 'Noto Sans Thai', sans-serif;
  --font-body: 'Noto Sans Thai', 'Prompt', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(46, 226, 122, 0.10), transparent 60%),
    radial-gradient(800px 500px at 10% 20%, rgba(15, 184, 255, 0.08), transparent 60%),
    var(--bg);
  color: var(--txt);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: var(--font-body); cursor: pointer; }
.container { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.hidden { display: none !important; }

/* ═══════ Topbar ═══════ */
.topbar {
  background: linear-gradient(90deg, #071b10, #0a1424 60%, #071b10);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
  position: relative;
  z-index: 60;
}
.topbar-inner { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 7px 20px; flex-wrap: wrap; }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.live-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--red); box-shadow: 0 0 0 0 rgba(255, 77, 94, 0.6);
  animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 77, 94, 0.55); }
  70% { box-shadow: 0 0 0 9px rgba(255, 77, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 77, 94, 0); }
}
.clock { color: var(--gold); font-weight: 700; font-variant-numeric: tabular-nums; }
.auto-label b { color: var(--green); }
.topbar-sep { opacity: 0.35; }
.next-update { color: var(--green-2); font-variant-numeric: tabular-nums; }
.icon-btn {
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  padding: 4px 12px; border-radius: 20px; font-size: 13px;
  transition: 0.2s;
}
.icon-btn:hover { border-color: var(--green); color: var(--green); }
.icon-btn.on { background: rgba(46, 226, 122, 0.12); border-color: var(--green); color: var(--green); }
.topbar-link { color: var(--muted); }
.topbar-link:hover { color: var(--txt); }
.line-pill {
  background: #04873f; color: #fff; font-weight: 700;
  padding: 4px 12px; border-radius: 20px; font-size: 12.5px;
}
.line-pill:hover { filter: brightness(1.12); }

/* ═══════ Header ═══════ */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(7, 12, 22, 0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 16px; padding: 12px 20px; flex-wrap: nowrap; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-ball { filter: drop-shadow(0 0 10px rgba(46, 226, 122, 0.45)); animation: float 4s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-family: var(--font-head); font-size: 22px; font-weight: 800; letter-spacing: 0.5px; }
.brand-name span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-sub { font-size: 10px; letter-spacing: 3px; color: var(--muted); font-weight: 600; }

.main-nav { display: flex; gap: 2px; margin-left: auto; flex-wrap: nowrap; }
.nav-link {
  padding: 8px 11px; border-radius: 10px; color: var(--muted);
  font-weight: 600; font-size: 14.5px; transition: 0.2s; position: relative; white-space: nowrap;
}
.nav-link:hover { color: var(--txt); background: rgba(255, 255, 255, 0.05); }
.nav-link.active { color: var(--txt); }
.nav-link.active::after {
  content: ''; position: absolute; left: 14px; right: 14px; bottom: 2px;
  height: 3px; border-radius: 3px; background: var(--grad);
}

.header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.search-box { position: relative; }
.search-box input {
  background: var(--card); border: 1px solid var(--line); color: var(--txt);
  padding: 9px 34px 9px 14px; border-radius: 24px; width: 170px; font-family: var(--font-body);
  font-size: 14px; transition: 0.25s;
}
.search-box input:focus { outline: none; border-color: var(--green); width: 210px; box-shadow: 0 0 0 3px rgba(46, 226, 122, 0.15); }
.search-icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 13px; opacity: 0.7; pointer-events: none; }

.btn {
  border: none; border-radius: 10px; padding: 10px 18px;
  font-weight: 700; font-size: 14px; transition: 0.2s; white-space: nowrap;
}
.btn-primary {
  background: var(--grad); color: #04120a;
  box-shadow: 0 4px 18px rgba(46, 226, 122, 0.35);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(46, 226, 122, 0.45); }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--txt); }
.btn-ghost:hover { border-color: var(--green); color: var(--green); }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-block { width: 100%; }
.burger { display: none; background: var(--card); border: 1px solid var(--line); color: var(--txt); font-size: 18px; border-radius: 10px; padding: 6px 12px; }

/* ═══════ Ticker ═══════ */
.ticker-wrap {
  display: flex; align-items: stretch; background: #141020;
  border-bottom: 1px solid var(--line); overflow: hidden;
}
.ticker-label {
  background: linear-gradient(90deg, #b3122b, #ff4d5e); color: #fff;
  font-family: var(--font-head); font-weight: 700; font-size: 14px;
  padding: 8px 24px 8px 16px; display: flex; align-items: center; gap: 6px; white-space: nowrap;
  border-radius: 0 16px 16px 0; z-index: 2;
}
.ticker { flex: 1; overflow: hidden; position: relative; display: flex; align-items: center; }
.ticker-track {
  display: flex; gap: 44px; white-space: nowrap; padding: 8px 0;
  animation: ticker-scroll 60s linear infinite; will-change: transform;
}
.ticker-wrap:hover .ticker-track { animation-play-state: paused; }
@keyframes ticker-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.ticker-item { font-size: 14px; color: var(--txt); display: inline-flex; align-items: center; gap: 8px; padding: 3px 0; }
.ticker-item .tag { font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 10px; }
.tag.th { background: rgba(46, 226, 122, 0.15); color: var(--green); }
.tag.en { background: rgba(15, 184, 255, 0.15); color: var(--green-2); }
.ticker-item:hover { color: var(--gold); }

/* ═══════ Hero ═══════ */
.hero { padding: 26px 0 6px; }
.hero-grid { display: grid; grid-template-columns: 1fr 330px; gap: 18px; }
.hero-carousel {
  position: relative; border-radius: var(--radius); overflow: hidden;
  background: var(--card); border: 1px solid var(--line);
  box-shadow: var(--shadow); min-height: 400px;
}
.hero-slides { position: relative; height: 400px; }
.hero-slide {
  position: absolute; inset: 0; opacity: 0; transition: opacity 0.7s ease;
  display: flex; align-items: flex-end;
}
.hero-slide.active { opacity: 1; }
.hero-slide img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-slide::after {
  content: ''; position: absolute; inset: 0;
  background:
    linear-gradient(to top, rgba(5, 9, 18, 0.98) 4%, rgba(5, 9, 18, 0.78) 34%, rgba(5, 9, 18, 0.28) 66%, rgba(5, 9, 18, 0.08)),
    linear-gradient(to right, rgba(5, 9, 18, 0.72), rgba(5, 9, 18, 0) 62%);
}
.hero-slide.art::after {
  background: linear-gradient(to top, rgba(5, 9, 18, 0.94) 12%, rgba(5, 9, 18, 0.55) 60%, rgba(5, 9, 18, 0.35));
}
.hero-content { position: relative; z-index: 2; padding: 26px 30px; max-width: 92%; }
.hero-tags { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.hero-content h2 {
  font-family: var(--font-head); font-size: clamp(20px, 2.6vw, 30px);
  font-weight: 700; line-height: 1.35; margin-bottom: 8px;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.9), 0 1px 3px rgba(0, 0, 0, 0.8);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.hero-content .hero-meta { font-size: 13px; color: #cfd8ea; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; text-shadow: 0 1px 8px rgba(0,0,0,.85); }
.hero-content .hero-meta a { color: var(--green); font-weight: 700; padding: 3px 0; display: inline-block; }
.hero-content .hero-meta a:hover { text-decoration: underline; }
.hero-dots { position: absolute; right: 18px; bottom: 14px; display: flex; gap: 7px; z-index: 3; }
.hero-dots .dot {
  width: 24px; height: 24px; border-radius: 50%; background: transparent; cursor: pointer;
  transition: 0.2s; position: relative; border: none; padding: 0;
}
.hero-dots .dot::after {
  content: ''; position: absolute; inset: 8px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.45); transition: 0.2s;
}
.hero-dots .dot.active { width: 34px; }
.hero-dots .dot.active::after { inset: 10px 4px; border-radius: 6px; background: var(--gold); }
.hero-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  background: rgba(8, 13, 24, 0.65); border: 1px solid var(--line); color: #fff;
  width: 42px; height: 42px; border-radius: 50%; font-size: 22px; line-height: 1;
  opacity: 0; transition: 0.25s;
}
.hero-carousel:hover .hero-arrow { opacity: 1; }
.hero-arrow.prev { left: 14px; }
.hero-arrow.next { right: 14px; }
.hero-arrow:hover { background: var(--green); color: #04120a; border-color: var(--green); }

.hero-side {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column;
  max-height: 400px; min-height: 400px;
}
.side-title {
  font-family: var(--font-head); font-size: 16px; font-weight: 700;
  padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--line);
}
.latest-list { list-style: none; overflow-y: auto; flex: 1; min-height: 220px; }
.latest-list li { padding: 9px 2px; border-bottom: 1px dashed var(--line); }
.latest-list li:last-child { border-bottom: none; }
.latest-list a { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.latest-list .num {
  font-family: var(--font-head); font-weight: 800; color: var(--gold);
  font-size: 15px; min-width: 22px;
}
.latest-list .t { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.latest-list a:hover .t { color: var(--green); }
.latest-list .time { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* ═══════ Status strip / league chips ═══════ */
.status-strip { background: var(--bg-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 12px 0; }
.strip-inner { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.league-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  background: var(--card); border: 1px solid var(--line); color: var(--muted);
  padding: 7px 16px; border-radius: 22px; font-size: 14px; font-weight: 600; transition: 0.2s;
}
.chip:hover { color: var(--txt); border-color: var(--green); }
.chip.active { background: var(--grad); color: #04120a; border-color: transparent; font-weight: 700; }
.refresh-zone { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.last-update { font-size: 13px; color: var(--muted); }

/* ═══════ Main grid ═══════ */
.main-grid {
  display: grid; grid-template-columns: 1fr 330px; gap: 20px;
  padding-top: 24px; padding-bottom: 10px;
}
.feed-col { min-width: 0; }
.feed-tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tab {
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  padding: 8px 20px; border-radius: 24px; font-size: 14.5px; font-weight: 700; transition: 0.2s;
}
.tab:hover { color: var(--txt); }
.tab.active { background: var(--card-2); color: var(--green); border-color: var(--green); }
.feed-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
.new-badge {
  background: var(--red); color: #fff; font-weight: 700;
  padding: 3px 12px; border-radius: 16px; animation: badge-pop 0.5s ease;
}
@keyframes badge-pop { from { transform: scale(0.6); } to { transform: scale(1); } }

.news-feed { display: flex; flex-direction: column; gap: 14px; }
.news-card {
  display: grid; grid-template-columns: 230px 1fr; gap: 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; transition: 0.25s; position: relative;
}
.news-card:hover { transform: translateY(-3px); border-color: rgba(46, 226, 122, 0.45); box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5); }
.news-card .thumb { position: relative; min-height: 150px; background: var(--card-2); }
.news-card .thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.news-card .lang-flag {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  background: rgba(6, 11, 22, 0.85); padding: 3px 10px; border-radius: 12px;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.5px;
}
.lang-flag.th { color: var(--green); border: 1px solid rgba(46, 226, 122, 0.4); }
.lang-flag.en { color: var(--green-2); border: 1px solid rgba(15, 184, 255, 0.4); }
.news-body { padding: 14px 16px 14px 4px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.news-source-line { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.src-badge { background: rgba(148, 178, 255, 0.10); padding: 2px 10px; border-radius: 10px; font-weight: 700; }
.news-card h3 {
  font-family: var(--font-head); font-size: 17.5px; font-weight: 600; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.news-card h3 a:hover { color: var(--green); }
.news-desc { font-size: 13.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.news-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.news-time { font-size: 12.5px; color: var(--muted); }
.read-more { font-size: 13px; font-weight: 700; color: var(--green); padding: 3px 0; display: inline-block; }
.read-more:hover { text-decoration: underline; }
.feed-footer-note { text-align: center; padding: 20px 0 6px; font-size: 12.5px; color: var(--muted); }

/* skeleton */
.skeleton {
  background: linear-gradient(100deg, var(--card) 40%, var(--card-2) 50%, var(--card) 60%);
  background-size: 200% 100%; animation: shimmer 1.3s infinite;
  border-radius: var(--radius); height: 170px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ═══════ Sidebar ═══════ */
.sidebar { display: flex; flex-direction: column; gap: 18px; }
.side-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  background: var(--card-2); border-radius: 12px; padding: 12px 8px; text-align: center;
  border: 1px solid var(--line);
}
.stat b { display: block; font-family: var(--font-head); font-size: 22px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat span { font-size: 12px; color: var(--muted); }
.trending { list-style: none; counter-reset: trend; }
.trending li { counter-increment: trend; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.trending li:last-child { border-bottom: none; }
.trending a { display: flex; gap: 10px; font-size: 14px; }
.trending a::before {
  content: counter(trend); font-family: var(--font-head); font-weight: 800;
  color: var(--gold); min-width: 24px; font-size: 15px;
}
.trending .t { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.trending a:hover .t { color: var(--green); }
.source-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.source-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13.5px; }
.source-list .src-name { font-weight: 700; }
.source-list .src-status { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.src-dot { width: 8px; height: 8px; border-radius: 50%; }
.src-dot.ok { background: var(--green); box-shadow: 0 0 8px var(--green); }
.src-dot.err { background: var(--red); }
.promo-card {
  background: linear-gradient(160deg, #0e2b1e, #0d1f33);
  border-color: rgba(46, 226, 122, 0.3);
}
.promo-card p { font-size: 13.5px; color: var(--muted); margin-bottom: 12px; }

/* ═══════ Section rows ═══════ */
.thai-section, .world-section { padding: 26px 0 8px; }
.section-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 16px; border-left: 4px solid; border-image: var(--grad) 1; padding-left: 14px;
}
.section-head h2 { font-family: var(--font-head); font-size: 22px; font-weight: 700; }
.see-all { color: var(--green); font-size: 14px; font-weight: 700; }
.see-all:hover { text-decoration: underline; }
.thai-row { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: thin; scrollbar-color: rgba(46,226,122,.4) transparent; }
.thai-row .news-card { min-width: 300px; grid-template-columns: 1fr; }
.thai-row .news-card .thumb { min-height: 160px; }
.world-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.world-grid .news-card { grid-template-columns: 1fr; }
.world-grid .news-card .thumb { min-height: 150px; }
.world-grid .news-body { padding: 14px 16px; }

/* ═══════ Footer ═══════ */
.site-footer { margin-top: 34px; background: var(--bg-2); border-top: 1px solid var(--line); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.2fr; gap: 30px; padding: 36px 20px 28px; }
.footer-brand p { font-size: 13.5px; color: var(--muted); margin-top: 12px; max-width: 320px; }
.footer-col h4 { font-family: var(--font-head); font-size: 15px; margin-bottom: 12px; color: var(--txt); }
.footer-col a { display: block; font-size: 13.5px; color: var(--muted); padding: 4px 0; }
.footer-col a:hover { color: var(--green); }
.footer-chip { display: inline-block !important; border: 1px solid var(--line); border-radius: 14px; padding: 3px 12px !important; margin: 2px 4px 2px 0; font-size: 12.5px !important; }
.footer-chip:hover { border-color: var(--green); }
.footer-bottom { border-top: 1px solid var(--line); padding: 16px 0; }
.footer-bottom-inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.footer-note { max-width: 620px; }

/* ═══════ Toast ═══════ */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(90px);
  background: var(--card-2); border: 1px solid var(--green); color: var(--txt);
  padding: 12px 22px; border-radius: 26px; font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow); z-index: 200; transition: transform 0.35s ease; max-width: 90vw; text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ═══════ Responsive ═══════ */
@media (max-width: 1400px) {
  #btnLogin { display: none; }
  .nav-link { padding: 8px 9px; font-size: 14px; }
}
@media (max-width: 1120px) {
  .search-box { display: none; }
}
@media (max-width: 1020px) {
  .main-grid, .hero-grid { grid-template-columns: 1fr; }
  .hero-side { max-height: 300px; min-height: 300px; }
  .world-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .main-nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    background: var(--bg-2); flex-direction: column; padding: 12px 20px; gap: 2px;
    border-bottom: 1px solid var(--line);
  }
  .main-nav.open { display: flex; }
  .burger { display: block; }
  .search-box input { width: 130px; }
  .search-box input:focus { width: 160px; }
  .btn-ghost, .btn-primary#btnRegister { display: none; }
  .news-card { grid-template-columns: 1fr; }
  .news-card .thumb { min-height: 180px; }
  .news-body { padding: 12px 16px 14px; }
  .hero-slides { height: 320px; }
  .hero-carousel { min-height: 320px; }
  .world-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .topbar-right .topbar-link { display: none; }
  .topbar-inner { padding: 6px 12px; gap: 6px; row-gap: 4px; }
  .auto-label, .topbar-sep { display: none; }
  .next-update { font-size: 11.5px; }
  .topbar { font-size: 12px; }
  .clock { font-size: 12px; }
  .icon-btn { padding: 3px 10px; font-size: 12px; }
  .line-pill { padding: 3px 10px; font-size: 11.5px; }
}

/* ═══════ ปุ่มกลับขึ้นด้านบน ═══════ */
.to-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 120;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--grad); color: #04120a; border: none;
  font-size: 20px; font-weight: 800; line-height: 1;
  box-shadow: 0 8px 24px rgba(46, 226, 122, 0.4);
  opacity: 0; visibility: hidden; transform: translateY(14px);
  transition: 0.28s;
}
.to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top:hover { transform: translateY(-3px); }

/* ═══════ Skeleton loading ═══════ */
.sk-card {
  display: grid; grid-template-columns: 230px 1fr; gap: 16px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 0; overflow: hidden; height: 170px;
}
.sk-thumb { background: linear-gradient(100deg, #0f1a2e 40%, #16263f 50%, #0f1a2e 60%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
.sk-body { padding: 18px 18px 18px 2px; display: flex; flex-direction: column; gap: 10px; }
.sk-line { height: 13px; border-radius: 6px; background: linear-gradient(100deg, #0f1a2e 40%, #16263f 50%, #0f1a2e 60%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
.sk-line.w60 { width: 60%; }
.sk-line.w40 { width: 40%; }
.sk-line.w90 { width: 90%; }

/* ═══════ Empty state ═══════ */
.empty-state {
  text-align: center; padding: 52px 24px;
  background: var(--card); border: 1px dashed var(--line);
  border-radius: var(--radius);
}
.empty-icon { font-size: 40px; margin-bottom: 10px; opacity: 0.8; }
.empty-state h4 { font-family: var(--font-head); font-size: 18px; margin-bottom: 6px; }
.empty-state p { color: var(--muted); font-size: 14px; margin-bottom: 16px; }

/* ═══════ ปุ่มโหลดข่าวเพิ่ม ═══════ */
.load-more-wrap { display: flex; justify-content: center; padding: 16px 0 4px; }
.load-more { padding: 11px 28px; border-radius: 24px; font-size: 14px; }
.load-more:hover { border-color: var(--green); color: var(--green); }

/* ═══════ เงาแสดงการเลื่อนแนวนอน ═══════ */
.thai-row {
  mask-image: linear-gradient(to right, #000 92%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, #000 92%, transparent 100%);
}

/* ═══════════════════════════════════════════════════════
   Reader modal — ดูรูปปก + รูปประกอบบทความ
   ═══════════════════════════════════════════════════════ */
.reader {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; opacity: 0; visibility: hidden; transition: 0.25s;
}
.reader.open { opacity: 1; visibility: visible; }
.reader-backdrop {
  position: absolute; inset: 0;
  background: rgba(3, 6, 12, 0.82); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.reader-panel {
  position: relative; z-index: 1; width: min(920px, 100%); max-height: 90vh;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65);
  transform: translateY(18px) scale(0.98); transition: 0.28s;
}
.reader.open .reader-panel { transform: translateY(0) scale(1); }
.reader-close {
  position: absolute; top: 12px; right: 12px; z-index: 5;
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(6, 11, 22, 0.72); border: 1px solid var(--line);
  color: var(--txt); font-size: 16px; line-height: 1;
}
.reader-close:hover { background: var(--red); border-color: var(--red); color: #fff; }
.reader-media {
  position: relative; background: var(--bg-2); flex: 0 0 auto;
  height: clamp(200px, 34vh, 340px);
}
.reader-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.reader-media::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(15, 26, 46, 0.95), rgba(15, 26, 46, 0) 55%);
  pointer-events: none;
}
.reader-media-badge {
  position: absolute; left: 16px; bottom: 14px; z-index: 2;
  background: rgba(6, 11, 22, 0.75); border: 1px solid rgba(46, 226, 122, 0.35);
  color: var(--green); font-size: 12px; font-weight: 700;
  padding: 4px 12px; border-radius: 14px;
}
.reader-skeleton {
  position: absolute; inset: 0;
  background: linear-gradient(100deg, #0f1a2e 40%, #16263f 50%, #0f1a2e 60%);
  background-size: 200% 100%; animation: shimmer 1.3s infinite;
}
.reader-body { padding: 20px 24px 22px; overflow-y: auto; }
.reader-meta {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  font-size: 12.5px; color: var(--muted); margin-bottom: 10px;
}
.reader-body h3 {
  font-family: var(--font-head); font-size: clamp(18px, 2.2vw, 24px);
  font-weight: 700; line-height: 1.45; margin-bottom: 10px;
}
.reader-desc { color: var(--muted); font-size: 14.5px; margin-bottom: 16px; }
.reader-gallery-title {
  font-family: var(--font-head); font-size: 15px; margin-bottom: 10px; color: var(--txt);
}
.reader-gallery-title span { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.reader-gallery {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px;
}
.reader-gallery figure {
  position: relative; border-radius: 10px; overflow: hidden;
  background: var(--bg-2); aspect-ratio: 16 / 10; cursor: zoom-in;
  border: 1px solid var(--line);
}
.reader-gallery img { width: 100%; height: 100%; object-fit: cover; transition: 0.3s; }
.reader-gallery figure:hover img { transform: scale(1.06); }
.reader-actions { display: flex; gap: 10px; flex-wrap: wrap; padding-top: 4px; }

/* badge บนการ์ดข่าว: กดดูรูป */
.thumb { cursor: zoom-in; }
.thumb::after {
  content: '🖼 ดูรูป'; position: absolute; right: 8px; bottom: 8px; z-index: 2;
  background: rgba(6, 11, 22, 0.78); border: 1px solid var(--line);
  color: var(--txt); font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: 12px; opacity: 0; transition: 0.22s;
}
.news-card:hover .thumb::after { opacity: 1; }

@media (max-width: 760px) {
  .reader { padding: 0; align-items: flex-end; }
  .reader-panel { max-height: 92vh; border-radius: 18px 18px 0 0; }
  .reader-gallery { grid-template-columns: repeat(2, 1fr); }
  .reader-body { padding: 16px 16px 20px; }
}

/* ═══════════════════════════════════════════════════════
   ข่าวฉบับเรียบเรียงอัตโนมัติ
   ═══════════════════════════════════════════════════════ */
.rewrite-section { padding: 30px 0 10px; }
.head-sub {
  font-size: 13px; font-weight: 600; color: var(--green);
  background: rgba(46, 226, 122, 0.12); border: 1px solid rgba(46, 226, 122, 0.3);
  padding: 2px 10px; border-radius: 12px; margin-left: 8px; vertical-align: middle;
}
.rewrite-count { font-size: 13px; color: var(--muted); font-weight: 700; }
.rewrite-note { font-size: 13px; color: var(--muted); margin: -6px 0 16px 18px; }
.rewrite-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.rw-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; transition: 0.25s; cursor: pointer;
}
.rw-card:hover { transform: translateY(-3px); border-color: rgba(46, 226, 122, 0.45); box-shadow: 0 14px 34px rgba(0,0,0,.5); }
.rw-card .rw-thumb { position: relative; aspect-ratio: 16 / 9; background: var(--card-2); }
.rw-card .rw-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rw-card .rw-flag {
  position: absolute; top: 10px; left: 10px;
  background: rgba(6, 11, 22, 0.82); border: 1px solid rgba(46, 226, 122, 0.35);
  color: var(--green); font-size: 11px; font-weight: 700;
  padding: 3px 10px; border-radius: 12px;
}
.rw-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.rw-body h3 {
  font-family: var(--font-head); font-size: 16.5px; font-weight: 700; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.rw-lead {
  font-size: 13.5px; color: var(--muted); line-height: 1.65;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.rw-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.rw-foot .rw-src { font-weight: 700; color: var(--txt); }

/* reader rewrite box */
.reader-rewrite {
  background: linear-gradient(160deg, rgba(14, 43, 30, 0.75), rgba(13, 31, 51, 0.55));
  border: 1px solid rgba(46, 226, 122, 0.28);
  border-radius: 14px; padding: 16px 18px; margin: 4px 0 16px;
}
.reader-rewrite-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.rw-badge {
  font-size: 12px; font-weight: 800; color: #04120a;
  background: var(--grad); padding: 3px 12px; border-radius: 12px;
}
.rw-source { font-size: 12px; color: var(--muted); }
.reader-rewrite h4 {
  font-family: var(--font-head); font-size: 17px; font-weight: 700;
  line-height: 1.5; margin-bottom: 10px;
}
.reader-rewrite p { font-size: 14.5px; line-height: 1.8; color: var(--txt); margin-bottom: 10px; }
.reader-rewrite .rw-note { font-size: 11.5px; color: var(--muted); margin-bottom: 0; }
.rw-loading { display: flex; align-items: center; gap: 8px; color: var(--green); font-size: 13px; font-weight: 600; }
.rw-loading::before {
  content: ''; width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid rgba(46, 226, 122, 0.3); border-top-color: var(--green);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* badge บนการ์ดข่าวที่เรียบเรียงแล้ว */
.rw-tag {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  background: linear-gradient(90deg, #2ee27a, #0fb8ff); color: #04120a;
  font-size: 10.5px; font-weight: 800; padding: 3px 9px; border-radius: 10px;
}

@media (max-width: 1400px) {
  #btnLogin { display: none; }
  .nav-link { padding: 8px 9px; font-size: 14px; }
}
@media (max-width: 1120px) {
  .search-box { display: none; }
}
@media (max-width: 1020px) { .rewrite-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) { .rewrite-grid { grid-template-columns: 1fr; } .rw-note { display: none; } }

/* ═══════ ป้ายโมเดล AI ═══════ */
.rw-model {
  font-size: 10.5px; font-weight: 700; color: var(--green-2);
  background: rgba(15, 184, 255, 0.12); border: 1px solid rgba(15, 184, 255, 0.3);
  padding: 1px 8px; border-radius: 9px; margin-left: 6px;
}

/* ═══════ หมวดข่าวใน footer ═══════ */
.footer-cats { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; border-top: 1px solid var(--line); padding-top: 16px; }
.footer-cats-label { font-size: 13px; font-weight: 700; color: var(--muted); }
.footer-cats a { font-size: 13px; color: var(--txt); padding: 4px 12px; border: 1px solid var(--line); border-radius: 14px; }
.footer-cats a:hover { border-color: var(--green); color: var(--green); }

/* ═══════ ป้ายตารางลงข่าว ═══════ */
.schedule-badge {
  font-size: 12px; font-weight: 700; color: var(--green);
  background: rgba(46, 226, 122, 0.10); border: 1px solid rgba(46, 226, 122, 0.3);
  padding: 3px 10px; border-radius: 12px; margin-left: 10px;
}
