:root {
  --bg:#0f1117;
  --panel:#171a23;
  --panel2:#1f2430;
  --text:#e5e7eb;
  --muted:#9ca3af;
  --line:#2b3140;
  --blue:#5aa7ff;
  --green:#22c55e;
  --shadow:0 18px 50px rgba(0,0,0,.25);
}

body.light {
  --bg:#f3f5f8;
  --panel:#ffffff;
  --panel2:#f8fafc;
  --text:#111827;
  --muted:#6b7280;
  --line:#d9e0ea;
  --blue:#2563eb;
  --shadow:0 12px 32px rgba(15,23,42,.08);
}

* {
  box-sizing:border-box;
}

body {
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:Arial,Helvetica,sans-serif;
}

a {
  text-decoration:none;
  color:inherit;
}

button,
input {
  font-family:inherit;
}

.topbar {
  height:66px;
  background:var(--panel);
  border-bottom:1px solid var(--line);
  display:grid;
  grid-template-columns:52px 170px 1fr 52px;
  gap:12px;
  align-items:center;
  padding:0 14px;
  position:sticky;
  top:0;
  z-index:50;
}

.brand {
  font-size:25px;
  font-weight:900;
  color:var(--blue);
  cursor:pointer;
}

.brand span {
  display:block;
  font-size:11px;
  color:var(--muted);
  letter-spacing:3px;
}

.iconBtn,
.modeBtn {
  background:transparent;
  border:0;
  color:var(--text);
  font-size:25px;
  cursor:pointer;
}

.topSearch {
  display:grid;
  grid-template-columns:1fr 86px;
  gap:8px;
}

.topSearch input {
  background:var(--panel2);
  border:1px solid var(--line);
  border-radius:12px;
  color:var(--text);
  padding:11px 13px;
  outline:none;
}

.topSearch button,
.refreshBtn {
  background:var(--blue);
  color:white;
  border:0;
  border-radius:12px;
  font-weight:800;
  cursor:pointer;
}

.ticker {
  background:#101827;
  border-bottom:1px solid var(--line);
  color:#dbeafe;
  display:flex;
  gap:14px;
  padding:8px 18px;
  font-size:13px;
  overflow:hidden;
}

.ticker strong {
  color:#fff;
  background:#dc2626;
  padding:2px 7px;
  border-radius:5px;
}

#tickerText {
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.shell {
  max-width:1440px;
  margin:0 auto;
  padding:18px;
  display:grid;
  grid-template-columns:240px minmax(0,1fr) 270px;
  gap:18px;
}

.leftCol,
.rightCol {
  position:sticky;
  top:92px;
  height:max-content;
}

.panel {
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:18px;
  padding:14px;
  margin-bottom:14px;
  box-shadow:var(--shadow);
}

.panel h3 {
  margin:0 0 12px;
  font-size:16px;
}

.categoryList,
.sourceList,
.trendingList {
  display:flex;
  flex-direction:column;
  gap:7px;
}

.catItem,
.sourceItem,
.trendingList button,
.menuItem {
  background:var(--panel2);
  color:var(--text);
  border:1px solid var(--line);
  border-radius:12px;
  padding:9px 10px;
  text-align:left;
  cursor:pointer;
}

.catItem.active,
.catItem:hover,
.sourceItem:hover,
.trendingList button:hover {
  border-color:var(--blue);
  color:var(--blue);
}

.trendingList span {
  color:var(--muted);
}

.stats {
  display:grid;
  grid-template-columns:1fr;
  gap:8px;
}

.stats div {
  background:var(--panel2);
  border-radius:12px;
  padding:10px;
}

.stats b {
  display:block;
  font-size:20px;
  color:var(--blue);
}

.stats span {
  color:var(--muted);
  font-size:12px;
}

.heroGrid {
  display:grid;
  grid-template-columns:1.25fr 1fr 1fr;
  grid-template-rows:170px 170px;
  gap:12px;
  margin-bottom:16px;
}

.heroCard {
  position:relative;
  overflow:hidden;
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:18px;
  box-shadow:var(--shadow);
}

.heroCard.big {
  grid-row:span 2;
}

.heroCard img,
.fallback {
  width:100%;
  height:100%;
  object-fit:cover;
}

.fallback {
  display:grid;
  place-items:center;
  color:var(--muted);
  font-size:34px;
  font-weight:900;
}

.heroText {
  position:absolute;
  inset:auto 0 0 0;
  background:linear-gradient(to top,rgba(0,0,0,.86),transparent);
  padding:18px;
}

.heroText span {
  color:#dbeafe;
  font-size:12px;
}

.heroText h2 {
  margin:6px 0 0;
  color:white;
  font-size:19px;
  line-height:1.18;
}

.big .heroText h2 {
  font-size:28px;
}

.sectionHead {
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:18px;
  padding:14px 16px;
  margin-bottom:12px;
  display:flex;
  justify-content:space-between;
  align-items:center;
}

.sectionHead h2 {
  margin:0;
  font-size:22px;
}

.sectionHead span {
  color:var(--muted);
  font-size:13px;
}

.refreshBtn {
  padding:10px 14px;
}

.newsArea {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
}

.newsCard {
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:18px;
  padding:12px;
  display:grid;
  grid-template-columns:120px 1fr;
  gap:12px;
  min-height:150px;
  transition:.18s ease;
  box-shadow:0 8px 24px rgba(0,0,0,.12);
}

.newsCard:hover {
  transform:translateY(-3px);
  border-color:var(--blue);
  box-shadow:var(--shadow);
}

.thumb {
  width:120px;
  height:92px;
  border-radius:13px;
  overflow:hidden;
  background:var(--panel2);
}

.thumb img {
  width:120px;
  height:92px;
  object-fit:cover;
}

.newsText {
  min-width:0;
}

.meta {
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  align-items:center;
  margin-bottom:6px;
}

.meta b,
.meta span,
.meta time {
  font-size:11px;
  background:var(--panel2);
  color:var(--blue);
  border:1px solid var(--line);
  padding:3px 7px;
  border-radius:999px;
}

.meta time {
  color:var(--muted);
}

.newsText h3 {
  margin:0 0 7px;
  font-size:17px;
  line-height:1.25;
}

.summary {
  margin:0;
  color:var(--muted);
  font-size:13px;
  line-height:1.4;
  display:-webkit-box;
  -webkit-line-clamp:2;
  line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}

.aiBox {
  margin-top:9px;
  background:rgba(90,167,255,.08);
  border:1px solid rgba(90,167,255,.2);
  border-radius:12px;
  padding:8px;
  color:var(--text);
  font-size:12px;
  line-height:1.35;
}

.relatedRow {
  margin-top:8px;
  display:flex;
  flex-wrap:wrap;
  gap:5px;
}

.relatedRow strong,
.relatedRow span {
  font-size:11px;
  background:var(--panel2);
  color:var(--muted);
  border-radius:999px;
  padding:3px 7px;
}

.relatedRow strong {
  color:var(--green);
}

.loadingMore {
  display:none;
  text-align:center;
  color:var(--muted);
  padding:18px;
}

.emptyState {
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:18px;
  text-align:center;
  padding:30px;
}

.emptyState button {
  background:var(--blue);
  border:0;
  color:white;
  border-radius:12px;
  padding:10px 16px;
}

.footer {
  color:var(--muted);
  text-align:center;
  padding:24px;
  font-size:13px;
}

.menuOverlay {
  display:none;
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.55);
  z-index:80;
}

.menuOverlay.show {
  display:block;
}

.sideMenu {
  position:fixed;
  top:0;
  bottom:0;
  left:0;
  width:min(82vw,360px);
  background:var(--panel);
  z-index:90;
  transform:translateX(-105%);
  transition:.2s;
  padding:20px;
  overflow:auto;
}

.sideMenu.open {
  transform:translateX(0);
}

.menuTitle {
  font-size:28px;
  color:var(--blue);
  font-weight:900;
  margin-bottom:16px;
}

.menuSearch {
  width:100%;
  background:var(--panel2);
  border:1px solid var(--line);
  color:var(--text);
  border-radius:12px;
  padding:12px;
}

.menuAction {
  width:100%;
  margin:10px 0;
  background:var(--blue);
  border:0;
  color:white;
  border-radius:12px;
  padding:11px;
}

.mobileCategories {
  display:flex;
  flex-direction:column;
  gap:7px;
}

@media(max-width:1180px) {
  .shell {
    grid-template-columns:210px minmax(0,1fr);
  }

  .rightCol {
    display:none;
  }

  .newsArea {
    grid-template-columns:1fr;
  }
}

@media(max-width:820px) {
  .topbar {
    grid-template-columns:48px 120px 1fr 48px;
  }

  .leftCol {
    display:none;
  }

  .shell {
    grid-template-columns:1fr;
    padding:10px;
  }

  .heroGrid {
    grid-template-columns:1fr;
    grid-template-rows:auto;
  }

  .heroCard,
  .heroCard.big {
    height:190px;
    grid-row:auto;
  }

  .big .heroText h2,
  .heroText h2 {
    font-size:18px;
  }
}

@media(max-width:560px) {
  .topbar {
    height:auto;
    grid-template-columns:42px 1fr 42px;
    padding:10px;
  }

  .topSearch {
    grid-column:1 / -1;
    grid-template-columns:1fr 70px;
  }

  .modeBtn {
    grid-column:3;
    grid-row:1;
  }

  .newsCard {
    grid-template-columns:92px 1fr;
    min-height:110px;
    padding:10px;
  }

  .thumb {
    width:92px;
    height:70px;
  }

  .thumb img {
    width:92px;
    height:70px;
  }

  .summary,
  .aiBox {
    display:none;
  }

  .newsText h3 {
    font-size:15px;
  }
}

/* RELATED NEWS MODAL - SAFE ADDON */
.relatedBtn,
.oneSource {
  font-size:11px;
  background:var(--panel2);
  color:var(--green);
  border:1px solid var(--line);
  border-radius:999px;
  padding:3px 8px;
  cursor:pointer;
}

.relatedBtn:hover {
  border-color:var(--green);
}

.relatedModal {
  display:none;
  position:fixed;
  inset:0;
  z-index:200;
  background:rgba(0,0,0,.68);
  padding:24px;
}

.relatedModal.show {
  display:grid;
  place-items:center;
}

.relatedBox {
  width:min(760px, 96vw);
  max-height:82vh;
  overflow:auto;
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:22px;
  padding:18px;
  box-shadow:var(--shadow);
  position:relative;
}

.relatedBox h3 {
  margin:0 44px 14px 0;
  font-size:20px;
  line-height:1.25;
}

.relatedClose {
  position:absolute;
  top:12px;
  right:12px;
  width:34px;
  height:34px;
  border-radius:50%;
  border:1px solid var(--line);
  background:var(--panel2);
  color:var(--text);
  cursor:pointer;
  font-size:22px;
}

.relatedLink {
  display:grid;
  gap:4px;
  padding:12px;
  border:1px solid var(--line);
  border-radius:14px;
  background:var(--panel2);
  margin-bottom:9px;
}

.relatedLink:hover {
  border-color:var(--blue);
}

.relatedLink b {
  color:var(--blue);
  font-size:13px;
}

.relatedLink span {
  font-size:15px;
  line-height:1.3;
}

.relatedLink small {
  color:var(--muted);
}

/* UNIFIED NEWS CARD LOOK */
.newsCard {
  grid-template-columns:120px minmax(0,1fr) !important;
  min-height:190px;
  height:190px;
  overflow:hidden;
}

.newsCard .thumb {
  width:120px;
  height:92px;
  min-width:120px;
  display:block;
}

.newsCard .thumb img {
  width:120px;
  height:92px;
  object-fit:cover;
}

.newsCard.noThumb::before {
  content:"VG";
  width:120px;
  height:92px;
  border-radius:13px;
  background:var(--panel2);
  color:var(--muted);
  display:grid;
  place-items:center;
  font-weight:900;
  font-size:24px;
}

.newsText h3 {
  min-height:42px;
  max-height:42px;
  overflow:hidden;
  display:-webkit-box;
  -webkit-line-clamp:2;
  line-clamp:2;
  -webkit-box-orient:vertical;
}

.summary {
  min-height:36px;
  max-height:36px;
  -webkit-line-clamp:2;
  line-clamp:2;
}

.aiBox {
  min-height:48px;
  max-height:48px;
  overflow:hidden;
  display:-webkit-box;
  -webkit-line-clamp:2;
  line-clamp:2;
  -webkit-box-orient:vertical;
}

.relatedRow {
  max-height:24px;
  overflow:hidden;
}

.heroCard {
  cursor:pointer;
}

.newsCard {
  cursor:pointer;
}

@media(max-width:560px) {
  .newsCard {
    min-height:118px;
    height:118px;
    grid-template-columns:92px minmax(0,1fr) !important;
  }

  .newsCard .thumb {
    width:92px;
    height:70px;
    min-width:92px;
  }

  .newsCard .thumb img {
    width:92px;
    height:70px;
  }

  .newsCard.noThumb::before {
    width:92px;
    height:70px;
    font-size:20px;
  }

  .newsText h3 {
    min-height:38px;
    max-height:38px;
  }

  .meta {
    max-height:24px;
    overflow:hidden;
  }

  .relatedRow {
    display:none;
  }
}

.loadMoreBtn {
  display:none;
  margin:18px auto 8px;
  padding:13px 22px;
  border:1px solid var(--line);
  border-radius:999px;
  background:var(--blue);
  color:white;
  font-weight:900;
  cursor:pointer;
  box-shadow:var(--shadow);
}

.loadMoreBtn:hover {
  filter:brightness(1.08);
}

.footer a {
  color:var(--blue);
  font-weight:800;
}

.footer a:hover {
  text-decoration:underline;
}
