:root {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1e222b;
  --line: #262b36;
  --text: #e8eaf0;
  --muted: #8b93a7;
  --accent: #22c55e;
  --accent-soft: rgba(34, 197, 94, 0.14);
  --danger: #ef4444;
  --warn: #f59e0b;
  --star: #fbbf24;
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
:root[data-theme="light"] {
  --bg: #f4f5f8;
  --surface: #ffffff;
  --surface-2: #f0f2f6;
  --line: #e2e5ec;
  --text: #15181f;
  --muted: #666d80;
  --accent: #16a34a;
  --accent-soft: rgba(22, 163, 74, 0.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); }
body { padding-bottom: 60px; -webkit-font-smoothing: antialiased; }
button, input { font-family: inherit; color: inherit; }
.hidden { display: none !important; }

.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--bg); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; letter-spacing: -0.2px; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.icon-btn { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; width: 36px; height: 36px; cursor: pointer; font-size: 16px; }
.icon-btn:hover { background: var(--surface-2); }

.banner {
  margin: 12px 16px 0; padding: 10px 14px; border-radius: 10px; font-size: 13px;
  background: rgba(245, 158, 11, 0.12); border: 1px solid rgba(245, 158, 11, 0.4); color: var(--warn);
}
.banner code { background: rgba(0,0,0,0.25); padding: 1px 5px; border-radius: 4px; color: var(--text); }

.tabs { display: flex; gap: 6px; padding: 12px 16px 4px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; font-size: 14px; font-weight: 600; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.tab.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.tab .live-pill { color: var(--accent); font-size: 10px; }
.tab.active .live-pill { color: var(--accent); }
.tab .count { font-size: 12px; opacity: 0.75; }
.tab-date { padding: 4px 8px; }
.tab-date input { background: transparent; border: 0; font-size: 14px; font-weight: 600; color: inherit; width: 130px; }
.tab-date input::-webkit-calendar-picker-indicator { filter: invert(0.6); }

.toolbar { display: flex; gap: 8px; padding: 8px 16px 12px; }
.toolbar input {
  flex: 1; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); font-size: 14px; outline: none;
}
.toolbar input:focus { border-color: var(--muted); }
.chip {
  padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  font-size: 13px; cursor: pointer; white-space: nowrap;
}
.chip.active { color: var(--star); border-color: var(--star); }

.list { padding: 0 16px; display: flex; flex-direction: column; gap: 12px; max-width: 760px; margin: 0 auto; }

.league { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.league-head {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--surface-2); font-size: 13px; font-weight: 600; cursor: pointer; user-select: none;
}
.league-head img { width: 18px; height: 18px; object-fit: contain; border-radius: 3px; }
.league-head .country { color: var(--muted); font-weight: 500; }
.league-head .star { margin-left: auto; background: none; border: 0; cursor: pointer; font-size: 16px; color: var(--muted); padding: 0 4px; }
.league-head .star.on { color: var(--star); }
.league-head .caret { color: var(--muted); font-size: 11px; }
.league.collapsed .match { display: none; }

.match {
  display: grid; grid-template-columns: 48px 1fr auto; gap: 10px; align-items: center;
  padding: 10px 14px; border-top: 1px solid var(--line); cursor: pointer; transition: background .12s;
}
.match:hover { background: var(--surface-2); }
.match .time { font-size: 12px; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.match.live .time { color: var(--accent); font-weight: 700; }
.match.live .time::after { content: ""; display: block; width: 4px; height: 4px; margin: 3px auto 0; border-radius: 50%; background: var(--accent); animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: 0.2; } }
.match .teams { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.match .team { display: flex; align-items: center; gap: 8px; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.match .team img { width: 18px; height: 18px; object-fit: contain; flex: 0 0 18px; }
.match .team .logo-ph { width: 18px; height: 18px; border-radius: 50%; background: var(--line); flex: 0 0 18px; font-size: 9px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.match .team.winner { font-weight: 700; }
.match .score { display: flex; flex-direction: column; gap: 5px; align-items: flex-end; font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 700; min-width: 28px; }
.match.live .score { color: var(--accent); }
.match .score .ht { font-size: 11px; color: var(--muted); font-weight: 500; }
.match.scheduled .score { color: var(--muted); font-weight: 500; }
.match.other .time { color: var(--warn); }

.empty { text-align: center; color: var(--muted); padding: 48px 16px; font-size: 14px; }
.error { text-align: center; color: var(--danger); padding: 24px 16px; font-size: 13px; }
.skeleton { height: 64px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

.foot { position: fixed; bottom: 0; left: 0; right: 0; padding: 8px 16px; font-size: 11px; color: var(--muted); text-align: center; background: var(--bg); border-top: 1px solid var(--line); }

/* Detay */
.detail { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,0.55); display: flex; justify-content: center; align-items: flex-end; }
.detail-inner {
  width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; background: var(--bg);
  border-radius: 18px 18px 0 0; padding: 16px; position: relative; animation: up .18s ease-out;
}
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
@media (min-width: 700px) {
  .detail { align-items: center; }
  .detail-inner { border-radius: 18px; }
}
.close { position: absolute; top: 12px; right: 12px; }
.d-league { font-size: 12px; color: var(--muted); text-align: center; margin: 4px 0 12px; }
.d-score { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 8px 0 16px; }
.d-team { text-align: center; font-weight: 600; font-size: 15px; }
.d-team img, .d-team .logo-ph { width: 48px; height: 48px; object-fit: contain; display: block; margin: 0 auto 8px; border-radius: 50%; }
.d-team .logo-ph { background: var(--surface-2); }
.d-num { font-size: 36px; font-weight: 800; font-variant-numeric: tabular-nums; text-align: center; letter-spacing: 1px; }
.d-num.live { color: var(--accent); }
.d-clock { font-size: 12px; text-align: center; color: var(--muted); margin-top: 4px; }
.d-clock.live { color: var(--accent); font-weight: 700; }
.d-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.d-tabs button { background: none; border: 0; padding: 10px 12px; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.d-tabs button.active { color: var(--text); border-bottom-color: var(--accent); }

.ev { display: grid; grid-template-columns: 1fr 56px 1fr; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.ev .l { text-align: right; } .ev .r { text-align: left; }
.ev .m { text-align: center; color: var(--muted); font-size: 12px; }
.ev .ic { display: inline-block; margin: 0 4px; }
.ev .sub { color: var(--muted); font-size: 12px; display: block; }
.card { display: inline-block; width: 9px; height: 13px; border-radius: 2px; vertical-align: middle; }
.card.y { background: var(--star); } .card.r { background: var(--danger); }

.stat { display: grid; grid-template-columns: 40px 1fr 40px; gap: 10px; align-items: center; padding: 6px 0; font-size: 13px; }
.stat .bar { height: 6px; border-radius: 3px; background: var(--line); display: flex; overflow: hidden; }
.stat .bar i { display: block; height: 100%; }
.stat .bar .h { background: var(--accent); } .stat .bar .a { background: var(--muted); }
.stat .lbl { text-align: center; font-size: 11px; color: var(--muted); margin-top: 2px; }
.stat .n { font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .n.r { text-align: right; }

.lineups { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; font-size: 13px; }
.lineups h4 { margin: 6px 0; font-size: 13px; color: var(--muted); }
.lineups li { list-style: none; padding: 4px 0; border-bottom: 1px solid var(--line); display: flex; gap: 8px; }
.lineups ul { margin: 0; padding: 0; }
.lineups .no { color: var(--muted); width: 22px; font-variant-numeric: tabular-nums; }
.d-info { font-size: 13px; color: var(--muted); line-height: 1.7; }

.tv-group { margin-bottom: 14px; }
.tv-group h4 { margin: 0 0 6px; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.tv-group h4 img { width: 18px; height: 13px; object-fit: cover; border-radius: 2px; }
.tv-group ul { list-style: none; margin: 0; padding: 0; }
.tv-group li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.tv-group li img { width: 22px; height: 22px; object-fit: contain; border-radius: 4px; background: #fff; }
.tv-group li .logo-ph { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; }
.tv-group li a { color: var(--text); text-decoration: none; }
.tv-group li a:hover { color: var(--accent); text-decoration: underline; }
.tv-group li small { margin-left: auto; color: var(--muted); font-size: 11px; }
