@font-face {
  font-family: 'Cairo';
  src: url('../assets/fonts/Cairo.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0a0a0a;
  --panel: #141414;
  --panel2: #1c1c1c;
  --gold: #d4a437;
  --green: #1ea672;
  --red: #e23b4e;
  --txt: #f0f0f0;
  --muted: #7a7a7a;
  --line: #2a2a2a;
}
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  font-family: 'Cairo', sans-serif;
  background: var(--bg);
  color: var(--txt);
  background-image: radial-gradient(circle at 80% -10%, rgba(212, 164, 55, 0.06), transparent 40%),
                    radial-gradient(circle at 0% 100%, rgba(30, 166, 114, 0.04), transparent 45%);
  min-height: 100vh;
  padding: 0 0 60px;
}
header {
  padding: 20px 20px 34px;
  text-align: center;
  border-bottom: 1px solid var(--line);
  position: relative;
  overflow: visible;
}
header::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(45deg, transparent, transparent 18px, rgba(255, 255, 255, 0.012) 18px, rgba(255, 255, 255, 0.012) 36px);
}
.kicker {
  font-family: 'Cairo', sans-serif;
  letter-spacing: 4px;
  color: var(--gold);
  font-size: 18px;
  position: relative;
}
h1 {
  font-size: clamp(30px, 6vw, 52px);
  font-weight: 900;
  margin: 26px 0 4px;
  position: relative;
}
.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
}
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 28px 0 8px;
}
.btn {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 9px 18px;
  border-radius: 999px;
  cursor: pointer;
  font-family: 'Cairo', sans-serif;
  font-size: 14px;
  font-weight: 600;
  transition: 0.18s;
}
.btn:hover {
  border-color: var(--gold);
  color: var(--txt);
}
.btn.active {
  background: var(--gold);
  color: #1a1205;
  border-color: var(--gold);
}
.btn.green.active {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.note {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin: 14px 0 26px;
}
.note b {
  color: var(--gold);
}

.day {
  margin-bottom: 26px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}
.day-head {
  padding: 14px 20px;
  background: var(--panel2);
  font-weight: 700;
  font-size: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.day-head .dd {
  color: var(--gold);
  font-size: 14px;
}
table {
  width: 100%;
  border-collapse: collapse;
}
tr {
  border-bottom: 1px solid var(--line);
  transition: 0.15s;
}
tr:last-child {
  border-bottom: none;
}
tr:hover {
  background: rgba(255, 255, 255, 0.02);
}
td {
  padding: 13px 16px;
  font-size: 15px;
  vertical-align: middle;
}
.grp {
  width: 46px;
}
.grp span {
  display: inline-block;
  width: 30px;
  height: 30px;
  line-height: 30px;
  text-align: center;
  background: var(--panel2);
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
}
.match {
  font-weight: 600;
}
.match .vs {
  color: var(--muted);
  font-weight: 400;
  margin: 0 6px;
  font-size: 13px;
}
.score {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0 8px;
  padding: 3px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  color: var(--txt);
  font-size: 13px;
  font-weight: 800;
  vertical-align: middle;
}
.score em {
  margin-inline-start: 4px;
  color: var(--muted);
  font-size: 9px;
  font-style: normal;
  font-weight: 900;
}
.score.live {
  border-color: rgba(226, 59, 78, 0.5);
}
.score.live em {
  color: var(--red);
}
.arab {
  color: var(--green);
  font-weight: 700;
}
.big {
  color: var(--gold);
  font-weight: 700;
}
.time {
  text-align: left;
  white-space: nowrap;
  color: var(--muted);
  font-size: 14px;
}
.time b {
  color: var(--txt);
  font-family: 'Cairo', sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
}
.city {
  color: var(--muted);
  font-size: 12.5px;
}
.tag {
  display: inline-block;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 5px;
  margin-inline-start: 6px;
  vertical-align: middle;
  font-weight: 700;
}
.tag.a {
  background: rgba(30, 166, 114, 0.15);
  color: var(--green);
}
.tag.b {
  background: rgba(212, 164, 55, 0.15);
  color: var(--gold);
}
.phase {
  font-family: 'Cairo', sans-serif;
  letter-spacing: 2px;
  font-size: 20px;
  font-weight: 900;
  color: var(--gold);
  margin: 38px 0 16px;
  padding-inline-start: 6px;
  border-inline-start: 4px solid var(--gold);
}
.hide {
  display: none;
}
.legend {
  display: flex;
  gap: 18px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 24px;
  color: var(--muted);
  font-size: 13px;
}
.legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}
.dot {
  width: 11px;
  height: 11px;
  border-radius: 3px;
}
.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px;
}
/* ── Search & Calendar ── */
.toolbar {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 20px 0 6px;
  flex-wrap: wrap;
}
.header-toolbar {
  position: relative;
  z-index: 2;
  max-width: 1100px;
  margin: 0 auto;
}
.search-wrap {
  flex: 1;
  min-width: 200px;
  position: relative;
}
.search-wrap input {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--txt);
  padding: 11px 16px 11px 42px;
  border-radius: 12px;
  font-family: 'Cairo', sans-serif;
  font-size: 14px;
  outline: none;
  transition: 0.18s;
}
.search-wrap input::placeholder {
  color: var(--muted);
}
.search-wrap input:focus {
  border-color: var(--gold);
}
.search-wrap .si {
  position: absolute;
  inset-inline-end: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.search-results {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  inset-inline-start: 0;
  inset-inline-end: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  z-index: 50;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}
.search-results.open {
  display: block;
}
.sr-item {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  transition: 0.12s;
}
.sr-item:last-child {
  border-bottom: none;
}
.sr-item:hover {
  background: var(--panel2);
}
.sr-item .sr-sub {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
  margin-top: 2px;
}

@media (max-width: 600px) {
  td {
    padding: 11px 10px;
    font-size: 13.5px;
  }
  .city {
    display: none;
  }
  .grp {
    width: 36px;
  }
}
.cal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-weight: 700;
  font-size: 14px;
}
.cal-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  min-width: 230px;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  text-align: center;
}
.cal-dow {
  font-size: 10px;
  color: var(--muted);
  padding: 2px 0;
  font-weight: 700;
}
.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  cursor: default;
  color: var(--muted);
}
.cal-day.has {
  background: var(--panel2);
  color: var(--txt);
  cursor: pointer;
  border: 1px solid var(--line);
}
.cal-day.has:hover {
  border-color: var(--gold);
  color: var(--gold);
}
.cal-day.selected {
  background: var(--gold);
  color: #1a1000;
  border-color: var(--gold);
}
.cal-day.today {
  border-color: var(--green) !important;
}
.cal-month-nav {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  padding: 0 6px;
  line-height: 1;
}
.cal-month-nav:hover {
  color: var(--gold);
}

#searchMatchView {
  display: none;
}
#searchMatchView .phase {
  margin-top: 0;
}

@media (max-width: 600px) {
  .toolbar {
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
  }
  .search-wrap {
    flex: 1 1 auto;
    min-width: 0;
  }
  .search-wrap input {
    min-height: 44px;
    padding: 10px 14px 10px 36px;
    font-size: 13px;
  }
  .search-wrap .si {
    inset-inline-end: 12px;
  }
  .toolbar > div:not(.search-wrap) {
    flex: 0 0 auto;
  }
  #calToggle {
    min-height: 44px !important;
    padding: 10px 12px !important;
    font-size: 13px !important;
    gap: 6px !important;
  }
  #calDropdown {
    max-width: calc(100vw - 32px);
  }
  .cal-wrap {
    min-width: unset;
    width: 100%;
  }
}

/* ───── STADIUMS GRID & CARDS ───── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 16px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  border-color: var(--gold);
}
.img-wrap {
  position: relative;
  height: 200px;
  overflow: hidden;
  background: #121212;
}
.placeholder-box {
  position: absolute;
  inset: 0;
  background: #121212;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  text-align: center;
  user-select: none;
}
.placeholder-icon {
  font-size: 36px;
  opacity: 0.55;
  filter: grayscale(1);
}
.placeholder-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
}
.img-wrap img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s, opacity 0.4s ease;
  opacity: 0;
  z-index: 1;
}
.img-wrap img.loaded {
  opacity: 1;
}
.card:hover .img-wrap img {
  transform: scale(1.05);
}
.country-badge {
  position: absolute;
  top: 12px;
  inset-inline-end: 12px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  font-family: 'Cairo', sans-serif;
  letter-spacing: 1px;
  z-index: 2;
}
.badge-us {
  background: rgba(26, 52, 102, 0.85);
  color: #7ba7e8;
  border: 1px solid rgba(123, 167, 232, 0.3);
}
.badge-mx {
  background: rgba(26, 58, 34, 0.85);
  color: #6ecf8a;
  border: 1px solid rgba(110, 207, 138, 0.3);
}
.badge-ca {
  background: rgba(58, 26, 26, 0.85);
  color: #e87a7a;
  border: 1px solid rgba(232, 122, 122, 0.3);
}
.final-badge {
  position: absolute;
  bottom: 10px;
  inset-inline-start: 10px;
  background: var(--gold);
  color: #1a0e00;
  padding: 4px 10px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
  z-index: 2;
}
.card .body {
  padding: 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.card .name {
  font-size: 19px;
  font-weight: 900;
  line-height: 1.2;
}
.city-row {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}
.city-row svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  stroke: var(--muted);
}
.badges-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}
.badge {
  display: inline-block;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 6px;
  font-weight: 700;
}
.b-final {
  background: rgba(212, 164, 55, 0.15);
  color: var(--gold);
}
.b-semi {
  background: rgba(56, 217, 217, 0.12);
  color: #38d9d9;
}
.b-qf {
  background: rgba(122, 143, 163, 0.12);
  color: #a0b3c8;
}
.b-open {
  background: rgba(226, 59, 78, 0.13);
  color: var(--red);
}
.b-group {
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}
.divider {
  border: none;
  border-top: 1px solid var(--line);
  margin: 6px 0;
}
.meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.m-item {
  background: var(--panel2);
  border-radius: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
}
.m-item .lbl {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 2px;
}
.m-item .val {
  font-size: 15px;
  font-weight: 700;
}
.desc {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.65;
}
.matches-count {
  font-family: 'Cairo', sans-serif;
  font-size: 28px;
  font-weight: 900;
  color: var(--gold);
  line-height: 1;
}
.ctrl {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  padding: 10px 16px 20px;
}
.fc {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 8px 18px;
  border-radius: 999px;
  cursor: pointer;
  font-family: 'Cairo';
  font-size: 13px;
  font-weight: 700;
  transition: 0.18s;
}
.fc:hover {
  border-color: var(--gold);
  color: var(--txt);
}
.fc.active {
  background: var(--gold);
  color: #1a1000;
  border-color: var(--gold);
}
.no-results {
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
  font-size: 16px;
  grid-column: 1 / -1;
}
.stadium-tag {
  display: inline-block;
  font-size: 12px;
  color: var(--gold);
  text-decoration: underline;
  cursor: pointer;
  margin-inline-start: 8px;
}
.stadium-tag:hover {
  color: #fff;
}

/* ───── LIVE INDICATOR ───── */
.live-ind {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  margin: 6px 0 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: color .3s;
}
.live-ind--on  { color: var(--green); }
.live-ind--off { color: var(--muted); }
.ind-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.live-dot   { background: var(--green); box-shadow: 0 0 6px var(--green); }
.static-dot { background: var(--muted); }

/* ───── TEAMS / STANDINGS VIEW ───── */
.teams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(460px, 1fr));
  gap: 20px;
}
.group-block {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.group-header {
  padding: 11px 16px;
  background: var(--panel2);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
}
.grp-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--gold);
  color: #1a1000;
  border-radius: 8px;
  font-family: 'Cairo', sans-serif;
  font-size: 16px;
  font-weight: 900;
  flex-shrink: 0;
}
.grp-title {
  font-weight: 700;
  font-size: 15px;
}

/* Standings table */
.std-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.std-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 440px;
}
.std-table thead tr {
  background: var(--panel2);
  border-bottom: 1px solid var(--line);
}
.std-table th {
  padding: 7px 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}
.std-pos {
  width: 28px;
  text-align: center;
  padding: 8px 6px !important;
  color: var(--muted);
  font-size: 13px;
}
.std-team-h {
  text-align: right;
  min-width: 130px;
}
.std-team {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 8px !important;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.std-flag {
  font-size: 18px;
  line-height: 1;
}
.std-num {
  text-align: center;
  padding: 8px 6px !important;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.std-pts {
  font-weight: 800;
  font-size: 14px !important;
}

/* Group matches within teams view */
.group-matches {
  border-top: 1px solid var(--line);
}
.group-matches table {
  width: 100%;
  border-collapse: collapse;
}

@media (max-width: 600px) {
  .teams-grid {
    grid-template-columns: 1fr;
  }
  .std-table {
    min-width: 380px;
  }
}
