:root {
  --bg: #f5f8fb;
  --card: #ffffff;
  --ink: #152238;
  --muted: #5b6878;
  --line: #dbe3ee;
  --accent: #007a5a;
  --accent-soft: #e9f7f2;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top right, #eaf3ff 0%, var(--bg) 40%);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding: 20px 24px;
  background: linear-gradient(95deg, #ffffff 0%, #e8f6f1 100%);
  border-bottom: 1px solid var(--line);
}

.topbar h1 {
  margin: 0;
  font-size: 1.4rem;
}

.sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

.container {
  width: min(1140px, 96%);
  margin: 18px auto 30px;
}

.controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.feed-switch {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: #fff;
}

.btn-feed {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 600;
}

.btn-feed.active {
  background: var(--accent);
  color: #fff;
}

.actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.btn-refresh {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 600;
}

.auto-refresh-label {
  font-size: 0.9rem;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.error-box {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid #ffc5bc;
  border-radius: 8px;
  background: #fff0ee;
  color: #861d10;
}

.hidden {
  display: none;
}

.games-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(315px, 1fr));
  gap: 14px;
}

.games-list.feed-sections {
  display: block;
}

.feed-section {
  margin-bottom: 18px;
}

.feed-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding: 8px 2px;
}

.feed-section-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.feed-section-header span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.game-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(20, 45, 80, 0.06);
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #f8fbff;
}

.competition {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.competition img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.competition .text {
  min-width: 0;
}

.competition .name {
  font-weight: 700;
  font-size: 0.94rem;
  line-height: 1.2;
}

.competition .stage {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.2;
}

.status-pill {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  background: #eef2f7;
  color: #33465d;
  white-space: nowrap;
}

.status-live {
  background: #e9f7f2;
  color: #007a5a;
}

.status-finished {
  background: #f7efef;
  color: #7d3434;
}

.game-body {
  padding: 11px 12px 12px;
}

.teams {
  display: grid;
  gap: 9px;
}

.team-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.team-left {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.team-left img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.team-name {
  font-weight: 600;
  line-height: 1.2;
}

.team-score {
  font-size: 1.05rem;
  font-weight: 800;
  min-width: 20px;
  text-align: right;
}

.meta-line {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.83rem;
}

.channels {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.channel {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.78rem;
  color: #304763;
  background: #f8fbff;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.channel img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  border-radius: 50%;
  background: #fff;
}

.channel-badge {
  color: #6a7c94;
}

.link-line {
  margin-top: 10px;
}

.link-line a {
  color: #1068be;
  text-decoration: none;
  font-size: 0.8rem;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  color: var(--muted);
  background: #fff;
}

@media (max-width: 700px) {
  .topbar {
    padding: 16px;
    align-items: flex-start;
    flex-direction: column;
  }

  .meta {
    align-items: flex-start;
  }

  .container {
    width: min(100%, 97%);
    margin: 14px auto 24px;
  }

  .games-list {
    grid-template-columns: 1fr;
  }
}
