:root {
  --bg: #0b0d12;
  --panel: #12151c;
  --panel-2: #171b24;
  --border: #212633;
  --text: #e8ebf3;
  --muted: #8890a3;
  --accent: #4f7cff;
  --accent-2: #22c55e;
  --danger: #f0546a;
  --live: #ef233c;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Topbar */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 5;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

.badge {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--muted);
  text-transform: capitalize;
  white-space: nowrap;
}

.badge.hd {
  background: rgba(34, 197, 94, 0.15);
  color: var(--accent-2);
  border-color: rgba(34, 197, 94, 0.3);
}

main {
  max-width: 860px;
  margin: 0 auto;
  padding: 12px 16px 32px;
}

/* Search */

.search-row { margin: 8px 0 12px; }

.search-row input {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
  color: var(--text);
  font-size: 14px;
}

/* Chip row (sports / sources) */

.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 12px;
  scrollbar-width: none;
}

.chip-row::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
}

.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Status tabs */

.tab-row {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}

.status-tab {
  flex: 1;
  padding: 9px 4px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.status-tab.active {
  background: var(--panel-2);
  border-color: var(--accent);
  color: var(--text);
}

.status-tab .count {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--border);
  color: var(--muted);
}

.status-tab.active .count {
  background: var(--accent);
  color: #fff;
}

/* Messages */

.error {
  color: var(--danger);
  font-size: 13px;
  margin: 10px 0;
}

.empty {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  margin: 32px 0;
}

/* Match grid */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.match-card {
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  color: var(--text);
  font: inherit;
  display: flex;
  flex-direction: column;
}

.thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, #1b2030, #0b0d12);
  overflow: hidden;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.thumb-fallback .team-badge {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.thumb-fallback .vs {
  font-size: 11px;
  color: var(--muted);
}

.thumb-fallback .sport-icon {
  font-size: 32px;
}

.time-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: var(--text);
}

.time-badge.live {
  background: var(--live);
  color: #fff;
  animation: pulse 1.6s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  padding: 8px 10px 2px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  font-size: 11px;
  color: var(--muted);
  padding: 0 10px 10px;
}

/* Advanced (manual resolve) */

.advanced {
  margin-top: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 12px 14px;
}

.advanced summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
}

.advanced .tabs {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}

.advanced .tab {
  flex: 1;
  padding: 8px 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}

.advanced .tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.tab-panel { display: none; flex-direction: column; gap: 10px; }
.tab-panel.active { display: flex; }

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
}

input, select {
  background: #0b0d12;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  color: var(--text);
  font-size: 14px;
}

button[type='submit'] {
  margin-top: 4px;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

/* Player screen */

.back-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 14px;
  padding: 8px 0 12px;
  cursor: pointer;
}

.match-header { margin-bottom: 12px; }

.teams-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 8px 0;
}

.team-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  max-width: 110px;
  text-align: center;
}

.team-block img { width: 48px; height: 48px; object-fit: contain; }

.vs-lg { color: var(--muted); font-size: 13px; }

.match-title {
  font-size: 15px;
  text-align: center;
  margin: 4px 0 0;
}

.stream-list {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stream-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
}

.stream-item.loading { color: var(--muted); }

.stream-item .lang { flex: 1; }
.stream-item .viewers { color: var(--muted); font-size: 12px; }

.stream-item button {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  background: var(--accent-2);
  color: #06210f;
  font-weight: 600;
  cursor: pointer;
}

video {
  width: 100%;
  border-radius: 8px;
  background: #000;
  aspect-ratio: 16 / 9;
}

.now-playing {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
}
