*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f4f4f6;
  --bg-card: #ffffff;
  --bg-header: rgba(255, 255, 255, 0.85);
  --text: #1a1a2e;
  --text-secondary: #6b6b80;
  --text-muted: #9a9ab0;
  --border: #e4e4ec;
  --border-hover: #c8c8d8;
  --accent: #2563eb;
  --accent-light: #eff3ff;
  --live: #dc2626;
  --live-bg: #fef2f2;
  --finished-bg: #f8f8fa;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.08);
  --radius: 10px;
  --radius-sm: 6px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html { font-size: 16px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Header */
.header {
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  padding-bottom: 10px;
}
.header__logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 700;
  flex-shrink: 0;
}
.header__logo:hover { color: var(--text); }
.header__logo-icon {
  width: 26px;
  height: 26px;
  color: var(--accent);
  flex-shrink: 0;
}
.header__logo-text span { color: var(--accent); }

.header__nav {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.header__nav::-webkit-scrollbar { display: none; }

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.nav-btn:hover {
  color: var(--text);
  background: var(--accent-light);
}
.nav-btn.is-active {
  color: var(--accent);
  background: var(--accent-light);
  font-weight: 600;
}
.nav-btn__icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* Hero */
.hero {
  padding: 36px 0 24px;
  text-align: center;
}
.hero__title {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 6px;
}
.hero__subtitle {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* Search */
.search {
  position: relative;
  max-width: 360px;
  margin: 20px auto 0;
}
.search__input {
  width: 100%;
  padding: 10px 14px 10px 36px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.15s;
}
.search__input::placeholder { color: var(--text-muted); }
.search__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}
.search__icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* Loading */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 0;
}
.loading__spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading__text { color: var(--text-secondary); font-size: 0.85rem; }

/* Error */
.error { text-align: center; padding: 32px 0; }
.error p { color: var(--text-secondary); margin-bottom: 12px; font-size: 0.9rem; }

.btn {
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 20px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}
.btn--primary {
  background: var(--accent);
  color: #fff;
}
.btn--primary:hover {
  opacity: 0.9;
}

/* League Group */
.league-group {
  margin-bottom: 28px;
}
.league-group:last-child { margin-bottom: 0; }

.league-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.league-header__emblem {
  width: 24px;
  height: 24px;
  object-fit: contain;
}
.league-header__name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

/* Date Separator */
.date-separator {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 0 4px;
  margin-top: 14px;
}
.date-separator:first-child { margin-top: 0; }

/* Match Card */
.match-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 6px;
  transition: all 0.15s;
}
.match-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-hover);
}
.match-card--live {
  background: var(--live-bg);
  border-color: #fca5a5;
}

.match-card__status {
  flex-shrink: 0;
  width: 56px;
  text-align: center;
}
.match-card__status-time {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}
.match-card__status-date {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.match-card__status-live {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--live);
  background: #fef2f2;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid #fca5a5;
}
.match-card__status-finished {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
}

.match-card__team {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.match-card__team--home { justify-content: flex-start; }
.match-card__team--away { justify-content: flex-end; }
.match-card__crest {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex-shrink: 0;
}
.match-card__team-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.match-card__score {
  flex-shrink: 0;
  min-width: 44px;
  text-align: center;
}
.match-card__score-value {
  font-size: 1.1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.match-card__score-sep {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin: 0 2px;
}
.match-card__score--live .match-card__score-value { color: var(--live); }
.match-card__score--finished .match-card__score-value { color: var(--text); }
.match-card__score--scheduled .match-card__score-value {
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 500;
}

/* Footer */
.footer {
  margin-top: 40px;
  padding: 20px 0;
  border-top: 1px solid var(--border);
}
.footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.footer__text { font-size: 0.78rem; color: var(--text-muted); }

/* Ad Container */
.ad-container {
  display: flex;
  justify-content: center;
  padding: 20px 0;
  margin-top: 28px;
  border-top: 1px solid var(--border);
}

/* Utility */
[hidden] { display: none !important; }

/* Responsive */
@media (max-width: 600px) {
  .header__inner {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .header__logo { justify-content: center; font-size: 1rem; }
  .header__nav { justify-content: flex-start; }
  .hero__title { font-size: 1.3rem; }
  .match-card { padding: 8px 10px; gap: 6px; }
  .match-card__status { width: 48px; }
  .match-card__team { gap: 6px; }
  .match-card__crest { width: 18px; height: 18px; }
  .match-card__team-name { font-size: 0.8rem; }
  .match-card__score { min-width: 36px; }
  .match-card__score-value { font-size: 1rem; }
  .footer__inner { flex-direction: column; text-align: center; }
}

@media (max-width: 480px) {
  .nav-btn { font-size: 0.75rem; padding: 4px 10px; }
  .match-card { flex-wrap: wrap; }
  .match-card__team--home { order: 1; }
  .match-card__score { order: 2; }
  .match-card__team--away { order: 3; }
  .match-card__status {
    order: 4;
    width: 100%;
    text-align: center;
    padding-top: 6px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
  }
}
