/* Mundial 2026 — modern UI, no third-party images (Rubik: OFL license) */
@import url("https://fonts.googleapis.com/css2?family=Rubik:wght@400;500;600;700;800&display=swap");

:root {
  --font: "Rubik", "Segoe UI", system-ui, sans-serif;
  --bg-deep: #0c1222;
  --bg-mid: #141d33;
  --surface: #ffffff;
  --surface-2: #f6f8fc;
  --text: #0f172a;
  --text-soft: #64748b;
  --line: rgba(15, 23, 42, 0.08);
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --green: #059669;
  --gold: #d97706;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 8px 30px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.12);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-deep);
  -webkit-font-smoothing: antialiased;
}

.demo-banner {
  padding: 10px 20px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 500;
  color: #fff;
  background: linear-gradient(90deg, #b45309, #d97706);
  border-bottom: 2px solid rgba(0, 0, 0, 0.15);
}

.demo-banner a {
  color: #fff;
  font-weight: 700;
  margin-right: 8px;
  text-decoration: underline;
}

/* Ambient mesh — CSS only */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 90% 60% at 85% -10%, rgba(37, 99, 235, 0.35), transparent 55%),
    radial-gradient(ellipse 70% 50% at 10% 20%, rgba(5, 150, 105, 0.28), transparent 50%),
    radial-gradient(ellipse 60% 40% at 50% 100%, rgba(217, 119, 6, 0.15), transparent 45%),
    linear-gradient(165deg, var(--bg-deep) 0%, var(--bg-mid) 45%, #1a2744 100%);
  pointer-events: none;
}

.site-header {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 24px 32px;
  overflow: hidden;
}

.site-header::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.6;
  pointer-events: none;
}

.header-text {
  position: relative;
  z-index: 1;
}

.site-header h1 {
  margin: 0;
  font-size: clamp(1.6rem, 5vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #fff;
}

.subtitle {
  margin: 6px 0 0;
  font-size: 0.88rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.72);
}

.header-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: #fff;
  color: var(--blue-dark);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.btn-primary:hover {
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(8px);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

.btn-small {
  padding: 8px 14px;
  font-size: 0.78rem;
  background: var(--surface-2);
  color: var(--blue-dark);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.btn-small:hover {
  background: #fff;
  border-color: rgba(37, 99, 235, 0.25);
  box-shadow: var(--shadow-sm);
}

.filters-sticky {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 0 12px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  background: var(--surface);
  transition: box-shadow 0.25s var(--ease);
}

.filters-sticky.is-compact {
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.14);
}

.filters-compact-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.filters-compact-summary {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.filters-toggle-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid rgba(37, 99, 235, 0.25);
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.08);
  color: var(--blue-dark);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s;
}

.filters-toggle-btn:hover {
  background: rgba(37, 99, 235, 0.14);
}

.filters-toggle-btn::after {
  content: "▾";
  font-size: 0.75rem;
  transition: transform 0.25s var(--ease);
}

.filters-sticky.is-filters-open .filters-toggle-btn::after {
  transform: rotate(180deg);
}

.time-tabs {
  display: flex;
  gap: 6px;
  padding: 10px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

.time-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 8px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-soft);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.25;
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s, box-shadow 0.2s;
}

.time-tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.7);
}

.time-tab.is-active {
  color: #fff;
  background: var(--blue);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.time-tab.is-active[data-tab="today"] {
  background: var(--green);
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35);
}

.time-tab.is-active[data-tab="past"] {
  background: #475569;
  box-shadow: 0 4px 14px rgba(71, 85, 105, 0.35);
}

.tab-count {
  display: inline-block;
  min-width: 1.35rem;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  background: rgba(15, 23, 42, 0.06);
  color: inherit;
}

.time-tab.is-active .tab-count {
  background: rgba(255, 255, 255, 0.22);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(150px, 1.5fr) minmax(100px, 1fr) minmax(120px, 1fr) minmax(7rem, auto);
  align-items: end;
  gap: 12px;
  padding: 16px;
  background: var(--surface);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field .label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-soft);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.field input,
.field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 500;
  color: var(--text);
  background: var(--surface-2);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.4);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.match-count-box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--blue-dark);
  background: linear-gradient(135deg, #eff6ff, #ecfdf5);
  border: 1px solid rgba(37, 99, 235, 0.12);
}

.match-list {
  flex: 1;
  padding: 8px 12px 32px;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

.date-heading {
  margin: 24px 0 12px;
  padding: 0 4px;
  font-size: 0.8rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.date-heading:first-child {
  margin-top: 8px;
}

.match-card {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 12px 16px;
  padding: 16px;
  margin-bottom: 10px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.match-card::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 4px;
  background: var(--accent, var(--blue));
  border-radius: 0 4px 4px 0;
}

.match-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.match-card.is-final {
  background: linear-gradient(135deg, #fffbeb 0%, #fff 40%);
  border-color: rgba(217, 119, 6, 0.2);
}

.match-card.is-final::before {
  background: linear-gradient(180deg, var(--gold), #f59e0b);
  width: 5px;
}

.match-aside {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 3.25rem;
}

.match-num {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}

.match-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.match-time {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  background: linear-gradient(135deg, #e8f0fe, #f5f9ff);
  padding: 2px 6px;
  border-radius: 6px;
}

.match-time-kickoff {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-soft);
  background: transparent;
  padding: 0;
}

.match-live-clock {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #fff;
  background: linear-gradient(135deg, #dc2626, #ef4444);
  box-shadow: 0 2px 10px rgba(220, 38, 38, 0.35);
}

.match-live-clock.match-ft {
  background: linear-gradient(135deg, #64748b, #94a3b8);
  box-shadow: none;
  font-size: 0.75rem;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  animation: live-pulse 1.4s ease-in-out infinite;
}

@keyframes live-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(0.85);
  }
}

.match-card.is-live {
  border-color: rgba(220, 38, 38, 0.25);
  box-shadow: var(--shadow), 0 0 0 1px rgba(220, 38, 38, 0.08);
}

.match-card.is-live::before {
  background: linear-gradient(180deg, #ef4444, #dc2626);
}

.match-card.is-live .score-live {
  color: var(--text);
  background: linear-gradient(135deg, #fef2f2, #fff7ed);
}

.match-stage {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-soft);
  text-align: center;
  max-width: 4.5rem;
  line-height: 1.2;
}

.match-main {
  flex: 1 1 12rem;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 12px 16px;
  min-width: 0;
}

.team-side {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
}

.team-home {
  justify-content: flex-end;
}

.team-away {
  justify-content: flex-start;
}

.team-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 100%;
}

.team-home .team-block {
  align-items: flex-end;
}

.team-away .team-block {
  align-items: flex-start;
}

.team-role {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-soft);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.team-row {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
}

.team-home .team-row {
  flex-direction: row-reverse;
}

.team-flag.fi {
  flex-shrink: 0;
  width: 2rem;
  height: 1.5rem;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
  outline: 1px solid rgba(15, 23, 42, 0.06);
}

.team-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
  background: linear-gradient(145deg, var(--badge-a, #64748b), var(--badge-b, #475569));
  box-shadow:
    0 2px 8px rgba(15, 23, 42, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.team-badge-tbd {
  background: linear-gradient(145deg, #94a3b8, #64748b);
  font-size: 0.55rem;
  box-shadow: none;
}

.team-name {
  font-weight: 700;
  font-size: 0.92rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 9rem;
}

.score-live {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 14px;
  background: var(--surface-2);
  font-size: 1.75rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: #cbd5e1;
}

.score-live .score-sep {
  font-size: 1.1rem;
  font-weight: 600;
  opacity: 0.5;
}

.match-card.is-played .score-live {
  color: var(--text);
  background: linear-gradient(135deg, #eff6ff, #f0fdf4);
}

.match-footer {
  flex: 1 1 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 12px;
  margin-top: 4px;
  border-top: 1px solid var(--line);
}

.match-city {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-soft);
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: rgba(255, 255, 255, 0.65);
  font-weight: 500;
}

.site-footer {
  margin: 0 12px 16px;
  padding: 20px 20px 24px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  text-align: center;
  font-size: 0.76rem;
  color: var(--text-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: none;
  box-shadow: var(--shadow);
}

.site-footer p {
  margin: 6px 0;
  line-height: 1.55;
}

.site-footer .credit {
  color: var(--text);
  font-weight: 700;
  font-size: 0.82rem;
}

.site-footer .legal {
  font-size: 0.72rem;
  color: var(--text-soft);
  max-width: 36rem;
  margin-inline: auto;
}

.site-footer .zafronix a {
  color: var(--blue);
  font-weight: 600;
  text-decoration: none;
}

.site-footer .zafronix a:hover {
  text-decoration: underline;
}

@media (max-width: 640px) {
  .filters-sticky {
    margin: 0 8px;
    border-radius: var(--radius) var(--radius) 0 0;
    top: env(safe-area-inset-top, 0);
  }

  .toolbar {
    grid-template-columns: 1fr 1fr;
    transition:
      max-height 0.35s var(--ease),
      opacity 0.28s var(--ease),
      padding 0.35s var(--ease);
  }

  .field:first-child {
    grid-column: 1 / -1;
  }

  /* Collapse filters while scrolling — tabs + compact bar stay sticky */
  .filters-sticky.is-compact .filters-compact-bar {
    display: flex;
  }

  .filters-sticky.is-compact .time-tabs {
    padding: 6px 8px;
  }

  .filters-sticky.is-compact .time-tab {
    padding: 8px 5px;
    font-size: 0.7rem;
    gap: 4px;
  }

  .filters-sticky.is-compact .toolbar {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    border-top: none;
  }

  .filters-sticky.is-compact.is-filters-open .toolbar {
    max-height: 22rem;
    padding: 12px;
    opacity: 1;
    pointer-events: auto;
    border-top: 1px solid var(--line);
  }

  .site-footer {
    margin: 0 8px 12px;
  }
}

@media (max-width: 560px) {
  .site-header {
    padding: 20px 16px 24px;
  }

  .score-live {
    font-size: 1.45rem;
    padding: 6px 10px;
  }

  .team-name {
    font-size: 0.84rem;
    max-width: 6.5rem;
  }

  .team-badge {
    width: 36px;
    height: 36px;
    font-size: 0.58rem;
  }

  .match-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-calendar {
    text-align: center;
  }

  .header-actions {
    width: 100%;
  }

  .header-actions .btn {
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .match-card,
  .btn,
  .time-tab,
  .toolbar,
  .filters-toggle-btn::after {
    transition: none;
  }

  .match-card:hover {
    transform: none;
  }

  .live-dot {
    animation: none;
  }
}
