:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1f232c;
  --text: #e8eaf0;
  --muted: #8a90a0;
  --accent: #4f8cff;
  --border: #2a2f3a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

input, select, button {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
}
button { cursor: pointer; }
button { background: var(--accent); border-color: var(--accent); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.brand { color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 600; }
.brand b { color: #3ddc97; font-weight: 700; }
.source { display: flex; gap: 8px; flex-wrap: wrap; }
.source input[type="url"] { width: 280px; }

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 360px;
  min-height: 0;
}

.player { padding: 16px; overflow: auto; }
.video-wrap {
  position: relative;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
}
video { width: 100%; height: 100%; display: block; background: #000; }
#yt { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
video[hidden], #yt[hidden] { display: none; }
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.6);
  pointer-events: none;
}
.overlay[hidden] { display: none; }

.now { display: flex; gap: 12px; align-items: center; margin-top: 12px; }
.now img { width: 56px; height: 56px; object-fit: contain; background: var(--panel-2); border-radius: 8px; }
.now-name { font-size: 18px; font-weight: 600; }
.now-group { color: var(--muted); }

.sidebar {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--border);
  min-height: 0;
}
.filters { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; border-bottom: 1px solid var(--border); }
.filters input[type="search"] { flex: 1 1 100%; }
.filters select { flex: 1; min-width: 0; }
.fav-toggle { display: flex; align-items: center; gap: 4px; color: var(--muted); }
.status { padding: 8px 12px; color: var(--muted); font-size: 12px; }

.list { list-style: none; margin: 0; padding: 0 6px 12px; overflow-y: auto; flex: 1; }
.item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.item:hover { background: var(--panel-2); }
.item.active { background: var(--accent); }
.item img { width: 32px; height: 32px; object-fit: contain; flex: none; }
.item .logo-ph { width: 32px; height: 32px; border-radius: 4px; background: var(--panel-2); flex: none; }
.item .meta { flex: 1; min-width: 0; }
.item .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .grp { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item.active .grp { color: #dfe7ff; }
.star { background: none; border: none; padding: 4px; color: var(--muted); font-size: 16px; }
.star.on { color: #ffc940; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; margin-right: auto; margin-left: 16px; }
.tabs a {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-weight: 500;
}
.tabs a:hover { color: var(--text); background: var(--panel-2); }
.tabs a.active { color: var(--text); background: var(--panel-2); box-shadow: inset 0 -2px 0 #3ddc97; }
.view[hidden], .source[hidden] { display: none; }

/* ---------- Cricket & schedule pages ---------- */
.page { flex: 1; overflow-y: auto; padding: 20px 16px 32px; }
.page > * { max-width: 1100px; margin-left: auto; margin-right: auto; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page h1 { font-size: 24px; margin: 0; }
.page h2 { font-size: 16px; margin: 24px auto 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.page h3.day { grid-column: 1 / -1; font-size: 14px; margin: 12px 0 0; color: var(--text); }
.muted { color: var(--muted); }
.small { font-size: 12px; margin-top: 16px; }
.check { display: flex; align-items: center; gap: 6px; color: var(--muted); cursor: pointer; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.card.is-live { border-color: #f42a41; }
.card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--panel-2); color: var(--muted); }
.badge.live, .card.is-live .state { color: #fff; background: #f42a41; }
.state { font-size: 12px; color: var(--muted); padding: 2px 8px; border-radius: 999px; }
.match-name { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.team { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.team img, .flag-ph { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; background: var(--panel-2); flex: none; }
.team-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.runs { font-weight: 700; font-variant-numeric: tabular-nums; }
.overs { font-weight: 400; color: var(--muted); font-size: 12px; }
.status { margin-top: 8px; font-size: 13px; color: #3ddc97; }
.venue { margin-top: 2px; font-size: 12px; color: var(--muted); }
.faq h3 { font-size: 15px; margin: 18px 0 4px; }
.faq p { margin: 0; line-height: 1.6; color: var(--muted); }
.faq a, .page .muted a { color: var(--accent); }
h3.match-name { font-weight: 400; margin: 0 0 8px; }
a.chip { color: var(--text); text-decoration: none; border: 1px solid var(--border); }
.card .more { display: inline-block; margin-top: 8px; font-size: 12px; color: var(--accent); text-decoration: none; }
.card .more:hover, .page p a:hover { text-decoration: underline; }
.page p a { color: var(--accent); text-decoration: none; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { background: var(--panel-2); border-color: var(--border); padding: 4px 12px; border-radius: 999px; }
.chip.on { background: var(--accent); border-color: var(--accent); }

.schedule { list-style: none; padding: 0; margin: 16px auto 0; }
.schedule li {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
}
.schedule li.on-now { background: var(--panel); border-left: 3px solid #f42a41; }
.schedule .time { font-variant-numeric: tabular-nums; font-weight: 700; width: 48px; flex: none; }
.schedule .prog { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.schedule .watch { padding: 4px 12px; }

.footer {
  padding: 8px 16px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  background: var(--panel);
  border-top: 1px solid var(--border);
}
.footer a { color: var(--text); text-decoration: none; }
.footer-links { display: flex; justify-content: center; gap: 16px; margin-bottom: 4px; }
.footer-links a { color: var(--muted); }

/* ---------- Support button & static pages ---------- */
.support-btn {
  color: #fff; background: #f42a41; text-decoration: none; font-weight: 600;
  padding: 6px 12px; border-radius: 6px; white-space: nowrap;
}
.support-btn:hover { filter: brightness(1.1); }
.doc > * { max-width: 760px; }
.doc h1 { font-size: 28px; margin: 0 auto 12px; }
.doc h2 { text-transform: none; letter-spacing: 0; font-size: 18px; color: var(--text); margin-top: 28px; }
.doc p, .doc li { line-height: 1.65; }
.doc a { color: var(--accent); }
.donate { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 16px; }
.donate-card h2 { margin: 0 0 4px; }
.donate-card .number { font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 10px; font-variant-numeric: tabular-nums; }
.copy { font-size: 12px; padding: 3px 10px; }
.button { display: inline-block; background: var(--accent); color: #fff !important; text-decoration: none; padding: 8px 14px; border-radius: 6px; font-weight: 600; }
.footer a:hover { color: #3ddc97; text-decoration: underline; }

@media (max-width: 800px) {
  .tabs { order: 3; width: 100%; margin: 0; overflow-x: auto; }
  body { height: auto; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { border-left: none; border-top: 1px solid var(--border); }
  .list { max-height: 60vh; }
  .source input[type="url"] { width: 100%; }
}
