/* ============ WC2026 companion — mobile-first dark theme ============ */
:root {
  --bg: #060a14;
  --surface: #0d1424;
  --surface-2: #131c30;
  --border: rgba(255, 255, 255, 0.09);
  --text: #f2f5fa;
  --muted: #8b96ab;
  --gold: #e8c15a;
  --gold-bright: #f5d26b;
  --live: #ff4d5e;
  --green: #2edb84;
  --radius: 14px;
  --nav-h: 64px;
}

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

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}

h1, h2, h3, .num { font-family: 'Archivo', 'Inter', sans-serif; }

img { display: block; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
a { color: var(--gold-bright); }

.hidden { display: none !important; }

/* ---------------- top bar ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(6, 10, 20, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 760px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 34px; height: 34px; color: var(--gold); flex: none; }
.brand h1 { font-size: 18px; font-weight: 800; letter-spacing: 0.02em; line-height: 1.1; }
.brand h1 span { color: var(--gold); }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }

.icon-btn {
  position: relative;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 12px;
  color: var(--gold);
  transition: background-color 0.2s;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 24px; height: 24px; }
.badge {
  position: absolute; top: 2px; right: 2px;
  min-width: 17px; height: 17px; padding: 0 4px;
  background: var(--live); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 17px;
  border-radius: 9px; text-align: center;
}

/* ---------------- layout ---------------- */
.view { max-width: 760px; margin: 0 auto; padding: 14px 14px 24px; }

.section-title {
  font-size: 13px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted);
  margin: 18px 2px 10px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

/* ---------------- date strip ---------------- */
.datestrip {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 2px 2px 10px; margin: 0 -2px;
  scrollbar-width: none;
}
.datestrip::-webkit-scrollbar { display: none; }
.date-chip {
  flex: none; min-width: 56px; min-height: 56px;
  padding: 7px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: center;
  transition: border-color 0.2s, background-color 0.2s;
}
.date-chip .dow { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.date-chip .dom { display: block; font-size: 17px; font-weight: 800; font-family: 'Archivo', sans-serif; }
.date-chip.active { background: var(--gold); border-color: var(--gold); color: #1a1405; }
.date-chip.active .dow { color: #5c4a14; }
.date-chip .dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--live); margin-top: 2px; }
.date-chip.active .dot { background: #1a1405; }

/* ---------------- match rows ---------------- */
.match-list { display: flex; flex-direction: column; gap: 10px; }

.match-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  text-align: left;
  transition: border-color 0.2s, background-color 0.2s;
}
.match-card:hover { border-color: rgba(232, 193, 90, 0.45); background: var(--surface-2); }
.match-card.followed { border-left: 3px solid var(--gold); }

.match-meta {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--muted); margin-bottom: 9px;
}
.match-meta .stage { font-weight: 600; letter-spacing: 0.03em; }
.live-pill {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--live); font-weight: 700; font-size: 12px;
}
.live-pill::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: var(--live);
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) {
  .live-pill::before { animation: none; }
}

.match-teams { display: flex; align-items: center; gap: 10px; }
.mteam { flex: 1; display: flex; align-items: center; gap: 9px; min-width: 0; }
.mteam.right { flex-direction: row-reverse; text-align: right; }
.mteam img { width: 28px; height: 28px; object-fit: contain; flex: none; }
.mteam .tname { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mteam .tname.tbd { color: var(--muted); font-weight: 500; }

.match-mid { flex: none; text-align: center; min-width: 64px; }
.match-mid .score { font-family: 'Archivo', sans-serif; font-size: 22px; font-weight: 800; letter-spacing: 0.04em; }
.match-mid .score.live { color: var(--live); }
.match-mid .ko { font-size: 17px; font-weight: 800; font-family: 'Archivo', sans-serif; }
.match-mid .sub { font-size: 11px; color: var(--muted); }
.match-mid .pens { font-size: 11px; color: var(--gold); }

.empty-note { color: var(--muted); text-align: center; padding: 36px 16px; font-size: 14px; }

/* ---------------- group tables ---------------- */
.group-card { margin-bottom: 14px; }
.group-card h3 {
  padding: 11px 14px; font-size: 14px; font-weight: 800;
  letter-spacing: 0.05em; color: var(--gold);
  border-bottom: 1px solid var(--border);
}
.gtable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.gtable th {
  font-size: 11px; color: var(--muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  padding: 7px 6px; text-align: center;
}
.gtable th.tcol { text-align: left; padding-left: 14px; }
.gtable td { padding: 8px 6px; text-align: center; border-top: 1px solid var(--border); }
.gtable td.tcol { text-align: left; padding-left: 14px; }
.gtable .teamcell { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.gtable .teamcell img { width: 20px; height: 20px; object-fit: contain; }
.gtable .pts { font-weight: 800; font-family: 'Archivo', sans-serif; }
.gtable tr.q1 td:first-child { box-shadow: inset 3px 0 0 var(--green); }
.gtable tr.q3 td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin: 10px 4px 0; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.legend .lg-green i { background: var(--green); }
.legend .lg-gold i { background: var(--gold); }

/* ---------------- bracket ---------------- */
.bracket-scroll { overflow-x: auto; margin: 0 -14px; padding: 0 14px 8px; }
.bracket { display: flex; gap: 14px; min-width: max-content; align-items: stretch; }
.b-round { width: 230px; flex: none; display: flex; flex-direction: column; }
.b-round h3 {
  font-size: 12px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--gold); text-align: center;
  margin-bottom: 10px;
}
.b-matches { display: flex; flex-direction: column; gap: 10px; flex: 1; justify-content: space-around; }
.b-match {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 10px; width: 100%; text-align: left;
  transition: border-color 0.2s;
}
.b-match:hover { border-color: rgba(232, 193, 90, 0.45); }
.b-row { display: flex; align-items: center; gap: 7px; padding: 3px 0; }
.b-row img { width: 18px; height: 18px; object-fit: contain; }
.b-row .bn { flex: 1; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-row .bn.tbd { color: var(--muted); font-weight: 500; }
.b-row .bs { font-family: 'Archivo', sans-serif; font-weight: 800; font-size: 14px; }
.b-row.loser { opacity: 0.45; }
.b-when { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* ---------------- teams grid ---------------- */
.search-box {
  width: 100%; padding: 12px 14px; margin-bottom: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; color: var(--text); font-size: 16px;
}
.search-box:focus { outline: 2px solid var(--gold); outline-offset: -1px; }
.teams-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.team-tile {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 11px 12px; text-align: left;
  transition: border-color 0.2s, background-color 0.2s;
}
.team-tile:hover { border-color: rgba(232, 193, 90, 0.45); background: var(--surface-2); }
.team-tile img { width: 28px; height: 28px; object-fit: contain; flex: none; }
.team-tile .tt-name { font-weight: 600; font-size: 14px; line-height: 1.25; }
.team-tile .tt-group { font-size: 11px; color: var(--muted); }
.team-tile .tt-star { margin-left: auto; color: var(--gold); width: 16px; height: 16px; flex: none; }

/* ---------------- news ---------------- */
.news-list { display: flex; flex-direction: column; gap: 12px; }
.news-card { display: block; text-decoration: none; color: var(--text); }
.news-card img { width: 100%; aspect-ratio: 16/8.5; object-fit: cover; background: var(--surface-2); }
.news-body { padding: 12px 14px 14px; }
.news-body h3 { font-size: 16px; font-weight: 700; line-height: 1.35; margin-bottom: 6px; font-family: 'Inter', sans-serif; }
.news-body p { font-size: 13.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.news-time { font-size: 11.5px; color: var(--gold); margin-top: 8px; display: block; }

/* ---------------- bottom nav ---------------- */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex;
  background: rgba(9, 13, 24, 0.94);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
.nav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--muted); font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.03em; min-height: 44px;
  transition: color 0.2s;
}
.nav-btn svg { width: 22px; height: 22px; }
.nav-btn.active { color: var(--gold); }
.nav-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; border-radius: 8px; }

/* ---------------- overlay (match detail / team / my-teams) ---------------- */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: var(--bg);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.ov-head {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  background: rgba(6, 10, 20, 0.92); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
}
.ov-head .ov-title { font-weight: 700; font-size: 15px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-body { max-width: 760px; margin: 0 auto; padding: 16px 14px 40px; }

.back-btn {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  border-radius: 12px; color: var(--text);
  transition: background-color 0.2s;
}
.back-btn:hover { background: var(--surface-2); }
.back-btn svg { width: 22px; height: 22px; }

/* match detail hero */
.md-hero { text-align: center; padding: 18px 10px 14px; }
.md-stage { font-size: 12px; color: var(--gold); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.md-row { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; }
.md-team { flex: 1; max-width: 130px; }
.md-team img { width: 56px; height: 56px; object-fit: contain; margin: 0 auto 8px; }
.md-team .nm { font-weight: 700; font-size: 14px; line-height: 1.25; }
.md-score { font-family: 'Archivo', sans-serif; font-size: 40px; font-weight: 900; letter-spacing: 0.03em; min-width: 110px; }
.md-score.live { color: var(--live); }
.md-status { margin-top: 8px; font-size: 13px; color: var(--muted); }
.md-status .live-pill { font-size: 13px; }
.md-venue { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.md-follow { margin-top: 12px; }

.chip-btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--border); border-radius: 999px;
  padding: 9px 16px; font-size: 13.5px; font-weight: 600;
  color: var(--text); background: var(--surface);
  transition: border-color 0.2s, background-color 0.2s, color 0.2s;
  min-height: 44px;
}
.chip-btn:hover { border-color: var(--gold); }
.chip-btn.on { background: var(--gold); border-color: var(--gold); color: #1a1405; }
.chip-btn svg { width: 16px; height: 16px; }

/* sub tabs inside detail */
.subtabs { display: flex; gap: 8px; margin: 16px 0 14px; }
.subtab {
  flex: 1; padding: 10px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 13px; font-weight: 700; color: var(--muted);
  transition: color 0.2s, border-color 0.2s; min-height: 44px;
}
.subtab.active { color: var(--gold); border-color: rgba(232, 193, 90, 0.5); }

/* events timeline */
.timeline { display: flex; flex-direction: column; gap: 2px; }
.tl-item { display: flex; align-items: flex-start; gap: 10px; padding: 9px 12px; }
.tl-item:nth-child(odd) { background: rgba(255, 255, 255, 0.025); border-radius: 8px; }
.tl-min { font-family: 'Archivo', sans-serif; font-weight: 800; font-size: 13px; min-width: 44px; color: var(--gold); }
.tl-icon { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.tl-text { font-size: 13.5px; flex: 1; }
.tl-text .who { font-weight: 600; }
.tl-text .sub { color: var(--muted); font-size: 12px; }

/* lineups */
.lineup-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lineup-team h4 { display: flex; align-items: center; gap: 8px; font-size: 13.5px; margin-bottom: 8px; }
.lineup-team h4 img { width: 20px; height: 20px; }
.lineup-team .formation { color: var(--muted); font-weight: 500; font-size: 12px; }
.lu-player { display: flex; gap: 8px; padding: 6px 8px; font-size: 13px; align-items: baseline; }
.lu-player:nth-child(odd) { background: rgba(255, 255, 255, 0.025); border-radius: 6px; }
.lu-player .jersey { font-family: 'Archivo', sans-serif; font-weight: 800; color: var(--gold); min-width: 22px; font-size: 12px; }
.lu-player .pos { color: var(--muted); font-size: 11px; margin-left: auto; }
.lu-subhead { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin: 12px 0 6px; font-weight: 700; }

/* stats bars */
.stat-row { margin-bottom: 12px; }
.stat-vals { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.stat-vals .lbl { color: var(--muted); font-weight: 500; font-size: 12px; }
.stat-bar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--surface-2); }
.stat-bar .l { background: var(--gold); }
.stat-bar .r { background: #4a90d9; }

/* squad view */
.squad-pos-head { font-size: 12px; color: var(--gold); font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; margin: 16px 2px 6px; }
.squad-row { display: flex; align-items: baseline; gap: 10px; padding: 9px 12px; font-size: 14px; }
.squad-row:nth-child(even) { background: rgba(255, 255, 255, 0.025); border-radius: 8px; }
.squad-row .jersey { font-family: 'Archivo', sans-serif; font-weight: 800; color: var(--gold); min-width: 26px; }
.squad-row .meta { margin-left: auto; color: var(--muted); font-size: 12px; text-align: right; }

/* my teams picker */
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 9px; }
.pick-tile {
  display: flex; align-items: center; gap: 9px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 12px; padding: 10px 11px; text-align: left;
  transition: border-color 0.2s, background-color 0.2s;
  min-height: 50px;
}
.pick-tile img { width: 24px; height: 24px; object-fit: contain; }
.pick-tile span { font-size: 13px; font-weight: 600; }
.pick-tile.on { border-color: var(--gold); background: rgba(232, 193, 90, 0.1); }

.loading { display: flex; justify-content: center; padding: 48px 0; }
.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--surface-2); border-top-color: var(--gold);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2s; }
}

.error-note {
  background: rgba(255, 77, 94, 0.1); border: 1px solid rgba(255, 77, 94, 0.3);
  color: #ffb3ba; padding: 12px 14px; border-radius: 10px; font-size: 13.5px;
  margin: 14px 0;
}

.footer-note { text-align: center; color: var(--muted); font-size: 11.5px; padding: 26px 16px 8px; }
.footer-note a { color: var(--muted); }

.site-disclaimer {
  max-width: 760px; margin: 0 auto;
  text-align: center; color: rgba(139, 150, 171, 0.6);
  font-size: 10.5px; line-height: 1.6;
  padding: 4px 20px 18px;
}

@media (min-width: 700px) {
  .match-mid .score { font-size: 26px; }
  .lineup-cols { gap: 24px; }
}
@media (max-width: 420px) {
  .lineup-cols { grid-template-columns: 1fr; }
}
