:root {
  --bg: #0b0f14;
  --card: #121922;
  --card-border: rgba(255, 255, 255, 0.08);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #f97316;
  --accent-2: #22d3ee;
  --accent-3: #60a5fa;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.bg-surface {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: -3;
}

.bg-wave {
  position: fixed;
  top: 220px;
  left: -20%;
  width: 140%;
  height: 320px;
  background: transparent;
  filter: none;
  z-index: -2;
}

.bg-noise {
  position: fixed;
  inset: 0;
  background-image: none;
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}

.settings-btn {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 8px);
  right: 12px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(15, 23, 42, 0.75);
  color: #e2e8f0;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 20;
}

.settings-icon {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.hero {
  padding: calc(env(safe-area-inset-top) + 24px) 18px 18px;
  max-width: 980px;
  margin: 0 auto;
}

.hero-top {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}

.select-wrap {
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--muted);
}

.select {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 1rem;
  font-family: inherit;
  box-shadow: var(--shadow);
  width: 100%;
  color: var(--text);
}

.count-chip,
.league-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  width: fit-content;
}

.hero-main h1 {
  font-family: 'Fraunces', serif;
  font-size: clamp(2.1rem, 8vw, 3rem);
  margin: 10px 0 10px;
}

.hero-main p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.hero-actions {
  margin-top: 18px;
  display: grid;
  gap: 14px;
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent), #fbbf24);
  border: none;
  color: #1d1208;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  width: 100%;
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.meta {
  display: grid;
  gap: 6px;
  font-size: 0.92rem;
  color: var(--muted);
}

.meta a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.25);
}

.meta-sep {
  display: none;
}

.content {
  max-width: 980px;
  margin: 0 auto;
  padding: 10px 18px 60px;
  display: grid;
  gap: 32px;
}

.favorites {
  background: rgba(18, 25, 34, 0.8);
  border-radius: 22px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
}

.day-block {
  display: grid;
  gap: 14px;
}

.day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.day-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.day-pill {
  background: rgba(34, 211, 238, 0.12);
  color: #67e8f9;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(34, 211, 238, 0.25);
  font-size: 0.72rem;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.card-grid {
  display: grid;
  gap: 14px;
}

.match-card {
  position: relative;
  display: grid;
  gap: 14px;
  padding: 18px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.match-card.is-favorite {
  border-color: rgba(249, 115, 22, 0.4);
  box-shadow: 0 16px 32px rgba(249, 115, 22, 0.12);
}

.team {
  display: flex;
  align-items: center;
  gap: 12px;
}

.team-logo {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.team-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.logo-fallback {
  font-weight: 600;
  color: var(--muted);
}

.team-info {
  display: grid;
  gap: 6px;
  justify-items: start;
}

.team-name {
  font-size: 1rem;
  font-weight: 600;
}

.fav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: rgba(34, 211, 238, 0.1);
  color: #67e8f9;
  border: 1px solid rgba(34, 211, 238, 0.3);
  border-radius: 999px;
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  justify-self: start;
}

.fav-btn.is-active {
  background: rgba(249, 115, 22, 0.2);
  border-color: rgba(249, 115, 22, 0.6);
  color: #fdba74;
}

.fav-icon {
  font-size: 0.95rem;
  line-height: 1;
}

.fav-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.match-center {
  text-align: left;
  display: grid;
  gap: 6px;
}

.fav-date {
  display: none;
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: capitalize;
}

.favorites .fav-date {
  display: block;
}

.time {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--accent-3);
}

.vs {
  font-size: 0.8rem;
  letter-spacing: 4px;
  color: var(--muted);
}

.venue {
  font-size: 0.9rem;
  color: var(--muted);
  display: grid;
  gap: 2px;
}

.venue-city {
  opacity: 0.8;
}

.detail-link {
  position: absolute;
  top: 16px;
  right: 18px;
  font-size: 0.8rem;
  color: #67e8f9;
  text-decoration: none;
  border-bottom: 1px solid rgba(103, 232, 249, 0.4);
}

@media (max-width: 700px) {
  .detail-link {
    position: static;
    margin-top: 6px;
  }
}

.empty {
  padding: 24px;
  border-radius: 20px;
  background: rgba(18, 25, 34, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.footer {
  text-align: center;
  padding: 20px 16px 40px;
  color: var(--muted);
  font-size: 0.92rem;
}

.toast {
  position: fixed;
  bottom: 18px;
  right: 18px;
  background: rgba(8, 10, 14, 0.95);
  color: #f8fafc;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 10;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  border-color: rgba(249, 115, 22, 0.6);
  color: #fde2d4;
}

.modal-open {
  overflow: hidden;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  place-items: center;
}

.modal.open {
  display: grid;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 12, 0.7);
  backdrop-filter: blur(6px);
}

.modal-card {
  position: relative;
  width: min(92vw, 420px);
  background: #0f1724;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  padding: 16px;
  z-index: 1;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.icon-btn {
  border: none;
  background: rgba(148, 163, 184, 0.12);
  color: var(--text);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 1.1rem;
  cursor: pointer;
}

.modal-body {
  display: grid;
  gap: 12px;
}

@media (min-width: 760px) {
  .hero-top {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .primary-btn {
    width: auto;
  }

  .hero-actions {
    grid-template-columns: auto 1fr;
    align-items: center;
  }

  .meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
  }

  .meta-sep {
    display: inline;
  }
}

@media (min-width: 900px) {
  .content {
    padding: 20px 24px 80px;
  }

  .match-card {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
  }

  .match-center {
    text-align: center;
  }
}
