/* ============ World Cup 26 tracker — stadium broadcast theme ============ */
:root {
  --bg: #0a0e0b;
  --panel: #11171280;
  --panel-solid: #121814;
  --line: #1f2a22;
  --line-bright: #2e4033;
  --text: #e9f1e9;
  --dim: #7e9183;
  --faint: #54655a;
  --lime: #b6f34a;
  --lime-dark: #82b62a;
  --amber: #f5b942;
  --red: #ef5a5a;
  --can: #e23d3d;
  --mex: #2f9e60;
  --usa: #5b8ff0;
  --mono: 'IBM Plex Mono', monospace;
  --disp: 'Saira Condensed', sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--disp);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
/* mown-grass stripes */
.pitch-stripes {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(1200px 500px at 50% -200px, rgba(182,243,74,.07), transparent 70%),
    repeating-linear-gradient(90deg, transparent 0 90px, rgba(255,255,255,.014) 90px 180px);
}
.app { position: relative; z-index: 1; max-width: 1100px; margin: 0 auto; padding: 28px 16px 60px; }

/* ---------- masthead ---------- */
.masthead { text-align: center; margin-bottom: 22px; position: relative; }
.home-link {
  position: absolute; left: 0; top: 0;
  font-family: var(--mono); font-size: 10px; letter-spacing: 2px;
  color: var(--dim); text-decoration: none; border: 1px solid var(--line);
  padding: 4px 9px; background: var(--panel-solid);
}
.home-link:hover { color: var(--lime); border-color: var(--line-bright); }
.host-line { font-size: 11px; letter-spacing: 5px; font-weight: 700; color: var(--dim); }
.host-line .dot { margin: 0 10px; color: var(--faint); }
.host.can { color: var(--can); } .host.mex { color: var(--mex); } .host.usa { color: var(--usa); }
.masthead h1 {
  font-size: clamp(44px, 9vw, 76px); font-weight: 900; font-style: italic;
  letter-spacing: 1px; line-height: 1; margin: 6px 0 2px;
}
.masthead h1 .year { color: var(--lime); }
.stat-strip {
  display: flex; justify-content: center; gap: 26px; margin-top: 12px;
  font-family: var(--mono); font-size: 12px; color: var(--dim);
}
.stat-strip b { color: var(--text); font-size: 16px; display: block; text-align: center; }

/* ---------- tabs ---------- */
.tabs {
  display: flex; justify-content: center; gap: 6px; margin: 18px 0 26px;
  position: sticky; top: 0; z-index: 10; padding: 10px 0;
  background: linear-gradient(180deg, var(--bg) 75%, transparent);
}
.tabs a {
  font-family: var(--disp); font-weight: 800; font-style: italic; font-size: 17px;
  letter-spacing: 2px; text-transform: uppercase; text-decoration: none;
  color: var(--dim); padding: 8px 22px; border: 1px solid var(--line);
  background: var(--panel-solid); transition: all .15s;
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
}
.tabs a:hover { color: var(--text); border-color: var(--line-bright); }
.tabs a.active { color: #0c1208; background: var(--lime); border-color: var(--lime); }

.view { display: none; }
.view.active { display: block; animation: rise .25s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.section-h {
  font-size: 13px; font-weight: 800; letter-spacing: 4px; text-transform: uppercase;
  color: var(--lime); margin: 30px 0 12px; display: flex; align-items: center; gap: 12px;
}
.section-h::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* ---------- groups ---------- */
.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.group-card { background: var(--panel-solid); border: 1px solid var(--line); }
.group-card .gc-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 10px 14px 8px; border-bottom: 1px solid var(--line);
}
.group-card .gc-head .gname { font-size: 22px; font-weight: 900; font-style: italic; letter-spacing: 1px; }
.group-card .gc-head .gname span { color: var(--lime); }
.group-card .gc-head .gstate { font-family: var(--mono); font-size: 10px; color: var(--faint); letter-spacing: 1px; }
table.standings { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 13px; }
table.standings th {
  font-size: 9px; color: var(--faint); font-weight: 600; letter-spacing: 1px;
  padding: 7px 4px 5px; text-align: center; border-bottom: 1px solid var(--line);
}
table.standings th.t { text-align: left; padding-left: 10px; }
table.standings td { padding: 7px 4px; text-align: center; color: var(--dim); border-bottom: 1px solid #161e18; }
table.standings tr:last-child td { border-bottom: none; }
table.standings td.t { text-align: left; padding-left: 10px; color: var(--text); font-weight: 500; white-space: nowrap; }
table.standings td.t .flag { margin-right: 7px; }
table.standings td.pts { color: var(--text); font-weight: 700; }
table.standings td.pos { color: var(--faint); }
tr.q1 td.pos, tr.q2 td.pos { color: var(--lime); font-weight: 700; }
tr.q1, tr.q2 { box-shadow: inset 3px 0 0 var(--lime-dark); }
tr.q3in  { box-shadow: inset 3px 0 0 var(--amber); }
tr.q3in td.pos { color: var(--amber); font-weight: 700; }
tr.out td { opacity: .75; }

/* thirds race */
.thirds-card { background: var(--panel-solid); border: 1px solid var(--line); margin-top: 26px; }
.thirds-card .tc-head { padding: 12px 16px; border-bottom: 1px solid var(--line); display:flex; justify-content: space-between; align-items: baseline; }
.thirds-card .tc-head .tn { font-size: 19px; font-weight: 900; font-style: italic; }
.thirds-card .tc-head .tn span { color: var(--amber); }
.thirds-card .tc-sub { font-family: var(--mono); font-size: 10px; color: var(--faint); }
table.thirds { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 13px; }
table.thirds td, table.thirds th { padding: 6px 6px; text-align: center; }
table.thirds th { font-size: 9px; color: var(--faint); letter-spacing: 1px; border-bottom: 1px solid var(--line); }
table.thirds th.t { text-align: left; padding-left: 12px; }
table.thirds td { color: var(--dim); border-bottom: 1px solid #161e18; }
table.thirds td.t { text-align: left; padding-left: 12px; color: var(--text); white-space: nowrap; }
table.thirds td.t .flag { margin-right: 7px; }
table.thirds td.gcol { color: var(--amber); font-weight: 700; }
table.thirds tr.in td.rk { color: var(--amber); font-weight: 700; }
table.thirds tr.in { box-shadow: inset 3px 0 0 var(--amber); }
table.thirds tr.cut td { border-bottom: 2px dashed #4a3c1c; }
table.thirds tr.outt td { opacity: .55; }

/* ---------- schedule ---------- */
.sched-controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 4px; }
.sched-controls select {
  font-family: var(--mono); font-size: 12px; color: var(--text);
  background: var(--panel-solid); border: 1px solid var(--line); padding: 8px 12px; outline: none;
}
.sched-controls select:focus { border-color: var(--lime-dark); }
.sched-controls .tz-note { font-family: var(--mono); font-size: 10px; color: var(--faint); letter-spacing: .5px; }
.day-h {
  font-size: 16px; font-weight: 800; font-style: italic; letter-spacing: 2px; text-transform: uppercase;
  margin: 26px 0 8px; color: var(--text); display: flex; align-items: center; gap: 10px;
}
.day-h .today-chip {
  font-style: normal; font-family: var(--mono); font-size: 9px; letter-spacing: 2px;
  background: var(--lime); color: #0c1208; padding: 2px 8px; font-weight: 700;
}
.day-h::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.match-row {
  display: grid; grid-template-columns: 44px 1fr auto 1fr 110px; gap: 8px; align-items: center;
  background: var(--panel-solid); border: 1px solid var(--line); padding: 10px 12px; margin-bottom: 5px;
}
.match-row .mnum { font-family: var(--mono); font-size: 10px; color: var(--faint); }
.match-row .side { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 16px; font-weight: 700; }
.match-row .side.home { justify-content: flex-end; text-align: right; }
.match-row .side .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match-row .side .ph { color: var(--faint); font-weight: 500; font-size: 14px; font-style: italic; }
.match-row .mid { font-family: var(--mono); font-weight: 700; font-size: 15px; min-width: 64px; text-align: center; }
.match-row .mid .sc { color: var(--lime); }
.match-row .mid .ko { color: var(--dim); font-size: 12px; font-weight: 500; }
.match-row .mid .pens { display: block; font-size: 9px; color: var(--amber); font-weight: 600; }
.match-row .meta { font-family: var(--mono); font-size: 10px; color: var(--faint); text-align: right; line-height: 1.5; }
.match-row .meta .chip {
  display: inline-block; border: 1px solid var(--line-bright); padding: 0 6px;
  color: var(--dim); letter-spacing: 1px; margin-bottom: 2px;
}
.match-row.knock .meta .chip { border-color: #4a3c1c; color: var(--amber); }
.match-row .win { color: var(--lime); }
.match-row.clickable { cursor: pointer; }
.match-row.clickable:hover { border-color: var(--line-bright); }
.match-row.open { margin-bottom: 0; border-bottom-color: transparent; }
.match-row .exp { color: var(--faint); margin-right: 4px; }
.match-detail {
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px 26px;
  background: #0d130f; border: 1px solid var(--line); border-top: 1px dashed var(--line);
  margin: 0 0 5px; padding: 9px 16px;
  font-family: var(--mono); font-size: 11.5px; color: var(--dim);
}
.match-detail .evcol.home { text-align: right; }
.match-detail .ev { padding: 2px 0; }
.match-detail .ev-min { color: var(--faint); }
.match-detail .ev-empty { color: var(--faint); }
.match-detail .ev-status { grid-column: 1 / -1; text-align: center; color: var(--faint); font-style: italic; }

/* ---------- bracket ---------- */
.bracket-note { font-family: var(--mono); font-size: 11px; color: var(--dim); margin-bottom: 14px; line-height: 1.6; }
.bracket-note .proj-key { color: var(--amber); }
.bracket-scroll { overflow-x: auto; padding-bottom: 14px; }
.bracket { display: grid; grid-template-columns: 215px 26px 215px 26px 215px 26px 215px 26px 230px; min-width: 1200px; }
.bcol { display: grid; grid-template-rows: repeat(32, 42px); }
.bcol-h { font-size: 12px; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; color: var(--dim); text-align: center; margin-bottom: 8px; }
.bhead-row { display: grid; grid-template-columns: 215px 26px 215px 26px 215px 26px 215px 26px 230px; min-width: 1200px; }
.bm {
  align-self: center; width: 100%;
  background: var(--panel-solid); border: 1px solid var(--line);
}
.bm .bm-top { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 8.5px; color: var(--faint); padding: 3px 8px 0; letter-spacing: .5px; }
.bm .trow { display: flex; align-items: center; gap: 6px; padding: 3px 8px; font-size: 14px; font-weight: 700; }
.bm .trow .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bm .trow .sc { font-family: var(--mono); font-size: 13px; color: var(--dim); }
.bm .trow.w .sc, .bm .trow.w .nm { color: var(--lime); }
.bm .trow.l .nm { color: var(--dim); }
.bm .trow .ph { color: var(--faint); font-weight: 500; font-size: 11.5px; font-style: italic; }
.bm .trow .orig { color: var(--faint); font-family: var(--mono); font-size: 9.5px; font-weight: 500; }
.bm .trow.w .orig { color: var(--lime-dark); }
.bm.proj { border-style: dashed; border-color: #4a3c1c; }
.bm.proj .trow .nm { color: #cfae62; }
.bm .proj-tag { color: var(--amber); }
/* connectors */
.bconn .elbow {
  width: 100%; box-sizing: border-box;
  border: 1px solid var(--line-bright); border-left: none;
}
/* final column */
.fin-col { display: flex; flex-direction: column; justify-content: center; gap: 26px; }
.champ { text-align: center; }
.champ .c-label { font-size: 11px; letter-spacing: 4px; color: var(--dim); font-weight: 700; }
.champ .c-team { font-size: 30px; font-weight: 900; font-style: italic; color: var(--lime); line-height: 1.1; }
.champ .c-tbd { color: var(--faint); font-style: italic; font-size: 18px; }
.fin-card-label { font-family: var(--mono); font-size: 9px; letter-spacing: 2px; color: var(--amber); text-align: center; margin-bottom: 4px; }
.bm.final-card { border-color: #4a3c1c; }
.bm.bronze-card { opacity: .85; }

/* ---------- footer ---------- */
.foot { margin-top: 50px; border-top: 1px solid var(--line); padding-top: 14px; }
.foot-note { font-family: var(--mono); font-size: 11px; color: var(--dim); margin-bottom: 8px; }
.foot-rules { font-family: var(--mono); font-size: 10px; color: var(--faint); line-height: 1.7; }

.flag { font-size: 1.15em; }

/* ---------- simulator ---------- */
.sim-bar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.sim-btn {
  font-family: var(--disp); font-weight: 800; font-style: italic; letter-spacing: 1px;
  text-transform: uppercase; font-size: 13px; background: var(--panel-solid);
  color: var(--amber); border: 1px solid #4a3c1c; padding: 8px 14px; cursor: pointer;
}
.sim-btn:hover { background: #1a1610; }
.group-card.sim .gstate { color: var(--amber); }
td.mv { white-space: nowrap; width: 44px; }
.mvb {
  background: #0e1410; border: 1px solid var(--line); color: var(--dim);
  font-size: 8px; width: 19px; height: 18px; cursor: pointer; padding: 0;
}
.mvb:hover:not(:disabled) { color: var(--lime); border-color: var(--line-bright); }
.mvb:disabled { opacity: .2; cursor: default; }
.sim-in {
  width: 40px; background: #0e1410; border: 1px solid var(--line); color: var(--text);
  font-family: var(--mono); font-size: 12px; text-align: center; padding: 3px 1px;
}
.sim-in:focus { border-color: var(--lime-dark); outline: none; }

/* ---------- live ---------- */
@keyframes livepulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.livemin { color: var(--red) !important; font-weight: 700; animation: livepulse 1.6s ease-in-out infinite; }
.sc.islive { color: var(--red) !important; }
.live-cell b { color: var(--red); animation: livepulse 1.6s ease-in-out infinite; }

/* mobile: standings show 3-letter codes instead of full names */
.nm-code { display: none; }

@media (max-width: 640px) {
  .app { padding: 18px 10px 50px; }
  .host-line { font-size: 9px; letter-spacing: 2px; }
  .host-line .dot { margin: 0 5px; }
  .tabs { flex-wrap: wrap; gap: 5px; }
  .tabs a { padding: 7px 12px; font-size: 13px; letter-spacing: 1px; }
  .match-row { grid-template-columns: 14px 1fr auto 1fr; gap: 6px; padding: 10px 8px; }
  .match-row .meta { display: none; }
  .match-row .mnum { font-size: 0; }
  .match-row .mnum .exp { font-size: 13px; }
  .match-row .side { font-size: 14px; }
  .stat-strip { gap: 14px; }
  .nm-full { display: none; }
  .nm-code { display: inline; }
  table.standings { font-size: 11.5px; }
  table.standings td, table.standings th { padding: 6px 3px; }
  table.standings td.t, table.standings th.t { padding-left: 7px; }
  table.thirds { font-size: 11.5px; }
  table.thirds td, table.thirds th { padding: 5px 3px; }
  td.mv { width: 40px; }
  .mvb { width: 18px; }
  .sim-in { width: 34px; }
}
