/* ============================================================
   WC26 — stadium night-match broadcast aesthetic
   ============================================================ */
:root {
  --pitch-black: #0b0f0c;
  --pitch-deep: #101511;
  --card: #161d18;
  --card-edge: #232d25;
  --chalk: #eef3ec;
  --chalk-dim: #9aa89c;
  --chalk-faint: #5d6a5f;
  --volt: #c8f03c;            /* electric chartreuse — kickoff times, accents */
  --volt-dim: rgba(200, 240, 60, .14);
  --host-green: #1f8a4c;      /* Mexico */
  --host-red: #e0263c;        /* Canada */
  --host-blue: #2d5be3;       /* USA */
  --live: #ff4d5e;
  --radius: 14px;
  --display: "Archivo Black", "Arial Black", sans-serif;
  --body: "Barlow", "Avenir Next", sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--chalk);
  background:
    radial-gradient(120vw 60vh at 50% -10%, rgba(45, 91, 227, .10), transparent 60%),
    radial-gradient(90vw 50vh at 100% 100%, rgba(31, 138, 76, .08), transparent 55%),
    var(--pitch-black);
  background-attachment: fixed;
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
}

/* chalk-line pitch texture */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    0deg, transparent 0 79px, rgba(238, 243, 236, .025) 79px 80px);
  z-index: 0;
}

/* host-nation tricolor ribbon */
.ribbon {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  height: 4px;
}
.ribbon span { flex: 1; }
.ribbon span:nth-child(1) { background: var(--host-green); }
.ribbon span:nth-child(2) { background: var(--host-red); }
.ribbon span:nth-child(3) { background: var(--host-blue); }

/* ---------- masthead ---------- */
.masthead {
  position: relative;
  z-index: 1;
  padding: 22px 16px 0;
  max-width: 1100px;
  margin: 0 auto;
}
.masthead-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.brand-title {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(32px, 7vw, 54px);
  line-height: 1.05;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.brand-title em {
  font-style: normal;
  color: var(--volt);
}
.brand-sub {
  margin: 6px 0 0;
  color: var(--chalk-dim);
  font-size: 13px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.brand-sub span { color: var(--volt); }

.btn-pick {
  flex-shrink: 0;
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 600 14px/1 var(--body);
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--pitch-black);
  background: var(--volt);
  border: none;
  border-radius: 999px;
  padding: 11px 16px;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(200, 240, 60, .25);
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn-pick:active { transform: scale(.96); }
.btn-pick-count {
  background: var(--pitch-black);
  color: var(--volt);
  font-weight: 700;
  border-radius: 999px;
  min-width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  padding: 0 5px;
}

/* ---------- controls ---------- */
.controls { margin-top: 22px; }

.seg {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: 999px;
  padding: 4px;
  max-width: 340px;
}
.seg-btn {
  position: relative;
  z-index: 1;
  background: none;
  border: none;
  font: 600 13px/1 var(--body);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--chalk-dim);
  padding: 10px 0;
  cursor: pointer;
  transition: color .2s ease;
}
.seg-btn[aria-selected="true"] { color: var(--pitch-black); }
.seg-thumb {
  position: absolute;
  top: 4px; bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  background: var(--volt);
  border-radius: 999px;
  transition: transform .25s cubic-bezier(.5, 1.5, .5, 1);
}
.seg[data-mode="all"] .seg-thumb { transform: translateX(100%); }

.fav-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 14px 0 4px;
  scrollbar-width: none;
}
.fav-strip::-webkit-scrollbar { display: none; }
.fav-chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 600 13px/1 var(--body);
  color: var(--chalk);
  background: var(--volt-dim);
  border: 1px solid rgba(200, 240, 60, .35);
  border-radius: 999px;
  padding: 7px 9px 7px 12px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .1s ease;
}
.fav-chip:hover { border-color: rgba(224, 38, 60, .6); background: rgba(224, 38, 60, .12); }
.fav-chip:active { transform: scale(.94); }
.fav-chip .chip-x {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(238, 243, 236, .12);
  color: var(--chalk-dim);
  font-size: 12px;
  line-height: 1;
}
.fav-chip:hover .chip-x { background: var(--host-red); color: var(--chalk); }
.fav-strip .hint {
  color: var(--chalk-faint);
  font-size: 13px;
  padding: 8px 2px;
  font-style: italic;
}

/* ---------- next-up hero ---------- */
.next-up {
  max-width: 1100px;
  margin: 22px auto 0;
  padding: 0 16px;
}
.next-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid rgba(200, 240, 60, .4);
  background: linear-gradient(135deg, rgba(200, 240, 60, .14), rgba(200, 240, 60, .03) 55%), var(--card);
  padding: 18px 18px 16px;
  animation: rise .5s ease both;
}
.next-tag {
  font: 600 11px/1 var(--body);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--volt);
}
.next-teams {
  font-family: var(--display);
  font-size: clamp(18px, 4.5vw, 30px);
  line-height: 1.25;
  text-transform: uppercase;
  letter-spacing: .01em;
  margin: 10px 0 6px;
}
.next-meta { color: var(--chalk-dim); font-size: 14px; }
.next-count {
  position: absolute;
  right: 18px;
  top: 16px;
  text-align: right;
  font-family: var(--display);
  font-size: 17px;
  color: var(--volt);
}
.next-count small {
  display: block;
  font-family: var(--body);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .14em;
  color: var(--chalk-dim);
}

/* ---------- schedule ---------- */
.schedule {
  max-width: 1100px;
  margin: 0 auto;
  padding: 8px 16px 40px;
}

.stage-rail {
  margin: 30px 0 6px;
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.stage-rail h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--chalk);
}
.stage-rail .rule { flex: 1; height: 1px; background: var(--card-edge); }
.stage-rail .dates { color: var(--chalk-faint); font-size: 13px; white-space: nowrap; }

.day-head {
  position: sticky;
  top: 4px;
  z-index: 10;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  margin: 20px 0 10px;
  background: var(--pitch-deep);
  border: 1px solid var(--card-edge);
  border-left: 3px solid var(--volt);
  border-radius: 8px;
  padding: 8px 14px 7px;
  backdrop-filter: blur(6px);
}
.day-head .dow {
  font-family: var(--display);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.day-head .date { color: var(--chalk-dim); font-size: 13px; }

.day-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

/* ---------- match card ---------- */
.match {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 16px;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: var(--radius);
  padding: 16px 18px;
  animation: rise .4s ease both;
  transition: border-color .2s ease, transform .2s ease;
}
.match:hover { border-color: rgba(200, 240, 60, .35); transform: translateY(-1px); }
.match.is-fav { border-left: 3px solid var(--volt); }
.match.is-done { opacity: .82; }

.match-teams { display: grid; gap: 9px; min-width: 0; }
.team-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.team-row .flag { font-size: 19px; line-height: 1; flex-shrink: 0; }
.team-row .name {
  font-weight: 600;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.team-row .abbr {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--chalk-faint);
}
.team-row.fav .name { color: var(--volt); }
.team-row .score {
  margin-left: auto;
  font-family: var(--display);
  font-size: 15px;
  color: var(--chalk);
}
.team-row.tbd .name { color: var(--chalk-faint); font-style: italic; }

.match-when { text-align: right; }
.match-when .ko {
  font-family: var(--display);
  font-size: 21px;
  letter-spacing: .02em;
  color: var(--volt);
}
.match.is-done .ko { color: var(--chalk-dim); font-size: 14px; }
.match-when .status {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--chalk-faint);
}
.match-when .status.live {
  color: var(--live);
  animation: pulse 1.4s ease-in-out infinite;
}

.match-venue {
  grid-column: 1 / -1;
  border-top: 1px dashed var(--card-edge);
  padding-top: 10px;
  font-size: 12.5px;
  color: var(--chalk-faint);
  letter-spacing: .03em;
}

/* knockout placeholder */
.tbd-block {
  border: 1px dashed var(--card-edge);
  border-radius: var(--radius);
  padding: 16px;
  color: var(--chalk-faint);
  font-size: 14px;
  margin-top: 12px;
}
.tbd-block strong { color: var(--chalk-dim); }

/* ---------- empty state ---------- */
.empty {
  max-width: 1100px;
  margin: 0 auto;
  padding: 60px 16px;
  text-align: center;
}
.empty-kick {
  font-family: var(--display);
  font-size: clamp(22px, 5vw, 34px);
  text-transform: uppercase;
  color: var(--chalk-faint);
  margin: 0 0 8px;
}
.empty-note { color: var(--chalk-dim); margin: 0; }

/* ---------- footer ---------- */
.foot {
  text-align: center;
  color: var(--chalk-faint);
  font-size: 12px;
  padding: 12px 16px calc(24px + env(safe-area-inset-bottom));
}

/* ---------- bottom sheet ---------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 6, .6);
  backdrop-filter: blur(3px);
  z-index: 90;
  animation: fade .2s ease both;
}
.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 100;
  height: 82dvh;
  display: flex;
  flex-direction: column;
  background: var(--pitch-deep);
  border: 1px solid var(--card-edge);
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
  animation: slide-up .3s cubic-bezier(.3, 1.2, .4, 1) both;
}
.sheet-grab {
  width: 42px;
  height: 4px;
  border-radius: 4px;
  background: var(--card-edge);
  margin: 0 auto 10px;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.sheet-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 17px;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.sheet-done {
  font: 700 13px/1 var(--body);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--pitch-black);
  background: var(--volt);
  border: none;
  border-radius: 999px;
  padding: 9px 18px;
  cursor: pointer;
}
.team-search {
  width: 100%;
  font: 500 15px/1 var(--body);
  color: var(--chalk);
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: 10px;
  padding: 11px 14px;
  margin-bottom: 12px;
  outline: none;
}
.team-search:focus { border-color: rgba(200, 240, 60, .5); }
.team-search::placeholder { color: var(--chalk-faint); }

.team-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  grid-auto-rows: max-content;
  align-content: start;
  gap: 10px;
  padding-bottom: 6px;
  overscroll-behavior: contain;
}
.team-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: 10px;
  padding: 12px 14px;
  font: 500 14px/1.35 var(--body);
  color: var(--chalk);
  cursor: pointer;
  text-align: left;
  transition: border-color .15s ease, background .15s ease, transform .1s ease;
}
.team-opt:active { transform: scale(.97); }
.team-opt .flag { font-size: 18px; }
.team-opt .check {
  margin-left: auto;
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--chalk-faint);
  flex-shrink: 0;
  transition: all .15s ease;
}
.team-opt[aria-pressed="true"] {
  background: var(--volt-dim);
  border-color: rgba(200, 240, 60, .55);
}
.team-opt[aria-pressed="true"] .check {
  background: var(--volt);
  border-color: var(--volt);
  box-shadow: inset 0 0 0 3px var(--pitch-deep);
}

/* ---------- animations ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } }
@keyframes slide-up { from { transform: translateY(100%); } }
@keyframes pulse { 50% { opacity: .4; } }

/* ---------- responsive ---------- */
@media (min-width: 720px) {
  .day-grid { grid-template-columns: repeat(2, 1fr); }
  .masthead, .schedule, .next-up { padding-left: 24px; padding-right: 24px; }
  .sheet {
    left: 50%;
    right: auto;
    bottom: auto;
    top: 8dvh;
    transform: translateX(-50%);
    width: min(680px, 92vw);
    height: 78dvh;
    border-radius: 20px;
    border-bottom: 1px solid var(--card-edge);
    animation: fade .2s ease both;
  }
  .sheet-grab { display: none; }
}
@media (min-width: 1024px) {
  .day-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
