/* mundial.illanes00.cl — World Cup 2026 companion site.
   Dark sporty aesthetic: near-black canvas, gold accent, red live, green positive.
   Tufte-minded: minimal chartjunk, strong type hierarchy, data-dense tables.
   Built to read on a phone AND on a TV from the couch (large type, high contrast). */

:root {
  /* core palette (task spec) */
  --bg: #0b0d10;            /* near-black canvas */
  --bg-2: #11151b;          /* slightly raised */
  --card: #161b22;          /* card surface */
  --card-2: #1d2530;        /* raised card / gradients */
  --line: #2a3340;          /* hairline borders */
  --line-soft: #20272f;

  --txt: #eef2f7;           /* primary text */
  --muted: #93a0b3;         /* secondary text */
  --muted-2: #6b7688;       /* tertiary / labels */

  --gold: #ebb92d;          /* primary accent */
  --gold-dim: #c79b1f;
  --live: #e63b3b;          /* live / red card / danger */
  --green: #36c46a;         /* positive / winner / qualified */
  --blue: #4a9eed;          /* neutral category accent */

  --radius: 12px;
  --radius-lg: 18px;
  --wrap: 1180px;

  /* fluid type scale: comfortable on phone, bold on a couch-distance TV */
  --fs-hero-score: clamp(3rem, 9vw, 5.5rem);
  --fs-countdown: clamp(2.2rem, 7vw, 4rem);
  --fs-page-title: clamp(1.7rem, 4vw, 2.6rem);

  font-synthesis: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1100px 540px at 82% -12%, rgba(235, 185, 45, .10), transparent 60%),
    radial-gradient(820px 480px at -8% 6%, rgba(74, 158, 237, .06), transparent 58%),
    var(--bg);
  color: var(--txt);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 18px; }
.main { padding-bottom: 72px; }
.muted { color: var(--muted); font-size: .85rem; margin: 6px 2px 0; }
.empty {
  color: var(--muted);
  padding: 20px;
  background: var(--bg-2);
  border-radius: var(--radius);
  border: 1px dashed var(--line);
}

/* ---------- topbar / nav ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11, 13, 16, .86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; min-height: 60px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 9px; font-size: 1.18rem; letter-spacing: .3px; font-weight: 700; }
.brand-ball { font-size: 1.4rem; filter: drop-shadow(0 0 7px rgba(235, 185, 45, .55)); }
.brand-text strong { color: var(--gold); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-link {
  padding: 8px 14px; border-radius: 999px; color: var(--muted);
  font-weight: 600; font-size: .92rem; transition: color .15s, background .15s;
}
.nav-link:hover { color: var(--txt); background: var(--card); }
.nav-link:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.nav-link.active { color: #16110a; background: var(--gold); }

/* ---------- headings / sections ---------- */
.page-head { padding: 28px 0 14px; }
.page-title { font-size: var(--fs-page-title); margin: 0 0 4px; font-weight: 800; letter-spacing: -.5px; line-height: 1.08; }
.page-sub { color: var(--muted); margin: 0; font-size: .95rem; }
.back-link { color: var(--gold); font-size: .88rem; display: inline-block; margin-bottom: 8px; font-weight: 600; }
.back-link:hover { color: #fff; }

.block { margin: 28px 0; }
.block-title {
  font-size: 1.18rem; font-weight: 700; margin: 0 0 14px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.block-sub { font-size: .8rem; color: var(--muted); font-weight: 500; }
.more-link { display: inline-block; margin-top: 12px; color: var(--gold); font-weight: 600; font-size: .9rem; }
.more-link:hover { color: #fff; }

/* ---------- hero ---------- */
.hero {
  margin: 22px 0;
  padding: 28px 26px;
  border-radius: var(--radius-lg);
  background: linear-gradient(150deg, var(--card-2), var(--card));
  border: 1px solid var(--line);
  position: relative; overflow: hidden;
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(520px 250px at 50% -42%, rgba(235, 185, 45, .14), transparent 70%);
  pointer-events: none;
}
.hero > * { position: relative; }
.hero-label {
  text-transform: uppercase; letter-spacing: 1.6px; font-size: .72rem;
  color: var(--gold); font-weight: 800; margin-bottom: 18px;
}
.hero-match { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px; }
.hero-team { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.hero-team-name { font-size: clamp(1.05rem, 2.4vw, 1.5rem); font-weight: 800; text-align: center; }
.hero-center { text-align: center; }
.hero-vs { font-size: clamp(1.8rem, 5vw, 3rem); font-weight: 900; color: var(--muted-2); letter-spacing: 3px; }
.hero-scoreline { font-size: var(--fs-hero-score); font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.hero-scoreline span { color: var(--muted-2); padding: 0 .15em; }
.hero-meta { color: var(--muted); font-size: .9rem; margin-top: 10px; line-height: 1.5; }
.hero-cta { display: inline-block; margin-top: 20px; color: var(--gold); font-weight: 700; }
.hero-cta:hover { color: #fff; }
.hero-empty { font-size: 1.2rem; color: var(--muted); }

/* ---------- countdown ---------- */
.countdown { display: flex; gap: 12px; margin-top: 24px; justify-content: center; flex-wrap: wrap; }
.cd-cell {
  min-width: 92px; text-align: center; padding: 14px 10px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px;
}
.cd-num {
  display: block; font-size: var(--fs-countdown); font-weight: 900; color: var(--gold);
  font-variant-numeric: tabular-nums; line-height: 1; letter-spacing: -1px;
}
.cd-unit {
  display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: 1.4px;
  color: var(--muted-2); margin-top: 6px;
}

/* ---------- kpis ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 18px 0; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 14px; text-align: center; }
.kpi-num { display: block; font-size: clamp(1.7rem, 4vw, 2.4rem); font-weight: 900; color: var(--gold); font-variant-numeric: tabular-nums; line-height: 1; }
.kpi-label { display: block; font-size: .74rem; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted-2); margin-top: 6px; }

/* ---------- match list ---------- */
.match-list { display: flex; flex-direction: column; gap: 8px; }
.match {
  display: grid; grid-template-columns: 78px 1fr auto; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 15px; transition: border-color .15s, transform .12s, background .15s;
}
.match:hover { border-color: var(--gold); transform: translateX(2px); background: var(--card-2); }
.match:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.match.is-live { border-color: var(--live); box-shadow: inset 0 0 0 1px rgba(230, 59, 59, .28); }
.match.is-finished { opacity: .92; }
.match-time { display: flex; align-items: center; }
.match-hh { font-weight: 800; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.match-teams { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.team { display: flex; align-items: center; gap: 10px; min-width: 0; }
.team-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team.winner .team-name { color: var(--green); font-weight: 700; }
.match-score { display: flex; flex-direction: column; gap: 6px; align-items: center; font-variant-numeric: tabular-nums; }
.score { font-weight: 800; font-size: 1.15rem; line-height: 1.15; transition: color .2s; }
.score.win { color: var(--green); }
.score-vs { color: var(--muted-2); font-weight: 700; }
.match-meta { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }

/* flash highlight when a score updates live */
.score.flash { animation: scoreFlash 1.2s ease; }
@keyframes scoreFlash {
  0% { color: var(--gold); text-shadow: 0 0 12px rgba(235, 185, 45, .8); }
  100% { color: inherit; text-shadow: none; }
}

/* ---------- flags / team chips ---------- */
.flag { display: block; border-radius: 3px; border: 1px solid rgba(255, 255, 255, .14); image-rendering: pixelated; flex: none; }
.flag-xs { width: 22px; height: 15px; }
.flag-sm { width: 30px; height: 21px; }
.flag-lg { width: 78px; height: 54px; box-shadow: 0 2px 10px rgba(0, 0, 0, .4); }
/* TBD knockout slots: no <img> (would 404) — render a neutral placeholder. */
.flag-tbd {
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .05); border: 1px dashed rgba(255, 255, 255, .25);
  color: rgba(255, 255, 255, .4); font-size: .68rem; font-weight: 700; line-height: 1;
}
.flag-lg.flag-tbd { font-size: 1.3rem; box-shadow: none; }

/* ---------- chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px;
  font-size: .72rem; font-weight: 700; background: var(--card-2); color: var(--muted);
  letter-spacing: .5px; white-space: nowrap;
}
.chip-ghost { background: transparent; border: 1px solid var(--line); }
.chip-cat { background: var(--blue); color: #04101c; }
.chip-live { background: var(--live); color: #fff; animation: pulse 1.6s infinite; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.dot-live { width: 10px; height: 10px; border-radius: 50%; background: var(--live); box-shadow: 0 0 9px var(--live); animation: pulse 1.4s infinite; flex: none; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

/* ---------- day blocks (fixture) ---------- */
.day-block { margin: 22px 0; }
.day-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 12px; }
.day-label { font-size: 1.05rem; font-weight: 700; text-transform: capitalize; }
.day-count { color: var(--muted); font-size: .8rem; white-space: nowrap; }

/* ---------- groups (data-dense, Tufte tables) ---------- */
.groups-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.groups-condensed { grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); }
.group-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.group-name { font-size: 1rem; margin: 0 0 10px; font-weight: 800; letter-spacing: .3px; }
.group-table { width: 100%; border-collapse: collapse; font-size: .88rem; font-variant-numeric: tabular-nums; }
.group-table th {
  color: var(--muted-2); font-weight: 600; font-size: .7rem; text-transform: uppercase;
  letter-spacing: .6px; padding: 4px 6px; text-align: center; border-bottom: 1px solid var(--line);
}
.group-table td { padding: 7px 6px; text-align: center; border-top: 1px solid var(--line-soft); }
.group-table tbody tr:first-child td { border-top: none; }
.group-table .ta-l { text-align: left; }
.group-table .team-cell { display: flex; align-items: center; gap: 8px; }
.group-table .team-cell .team-name { font-weight: 600; }
.group-table .pos { color: var(--muted); font-weight: 700; }
.group-table .pts { font-weight: 800; color: var(--gold); }
.group-table .qual { background: rgba(54, 196, 106, .08); }
.group-table .qual td:first-child,
.group-table .qual .pos { color: var(--green); font-weight: 800; box-shadow: inset 3px 0 0 var(--green); }
.group-table-full { font-size: .92rem; }
.group-table-full td { padding: 9px 6px; }

/* ---------- facts / detail meta ---------- */
.facts, .detail-meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.fact { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 15px; }
.fact-k { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: 1.1px; color: var(--muted-2); margin-bottom: 4px; }
.fact-v { font-weight: 600; }

/* ---------- match detail ---------- */
.detail-card {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px;
  background: linear-gradient(150deg, var(--card-2), var(--card));
  border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 30px 28px; margin: 14px 0;
}
.detail-card.is-live { border-color: var(--live); box-shadow: 0 0 0 1px rgba(230, 59, 59, .25); }
.detail-team { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.detail-team-name { font-size: clamp(1.1rem, 2.6vw, 1.6rem); font-weight: 800; text-align: center; }
.detail-tla { color: var(--muted-2); font-size: .8rem; letter-spacing: 3px; font-weight: 700; }
.detail-center { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.detail-vs { font-size: clamp(2rem, 5vw, 3rem); font-weight: 900; color: var(--muted-2); letter-spacing: 2px; }
.detail-scoreline { font-size: var(--fs-hero-score); font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.detail-scoreline span { color: var(--muted-2); padding: 0 .12em; }
.detail-kick { color: var(--muted); margin-top: 4px; font-weight: 600; }
.detail-meta { margin: 18px 0; }

/* ---------- timeline (match events) ---------- */
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.tl-event {
  display: grid; grid-template-columns: 48px 24px auto 1fr auto; align-items: center; gap: 10px;
  padding: 9px 13px; background: var(--card); border: 1px solid var(--line); border-radius: 8px;
}
.tl-event.tl-goal, .tl-event.tl-pen { border-left: 3px solid var(--green); }
.tl-event.tl-red { border-left: 3px solid var(--live); }
.tl-event.tl-yellow { border-left: 3px solid var(--gold); }
.tl-min { font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; }
.tl-icon { text-align: center; }
.tl-goal .tl-icon, .tl-pen .tl-icon { color: var(--green); }
.tl-yellow .tl-icon { color: var(--gold); }
.tl-red .tl-icon { color: var(--live); }
.tl-label { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.tl-player { font-weight: 600; }
.tl-team { color: var(--muted-2); font-size: .8rem; letter-spacing: 1px; text-align: right; }

/* ---------- panel gallery ---------- */
.live-frame { display: flex; justify-content: center; padding: 16px; background: #000; border: 1px solid var(--line); border-radius: var(--radius); }
.panel-frame { image-rendering: pixelated; max-width: 100%; height: auto; border-radius: 4px; }
.panel-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.scene-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.scene-preview { background: #000; display: flex; justify-content: center; align-items: center; padding: 10px; min-height: 72px; }
.scene-noprev { color: var(--muted-2); font-size: .8rem; padding: 20px; }
.scene-info { padding: 13px 15px; }
.scene-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.scene-title { font-size: 1rem; margin: 0; font-weight: 700; }
.scene-subtitle { color: var(--gold); font-size: .82rem; margin: 4px 0 0; }
.scene-desc { color: var(--muted); font-size: .82rem; margin: 6px 0 0; }
.scene-id { display: inline-block; margin-top: 8px; font-size: .72rem; background: var(--bg-2); padding: 2px 8px; border-radius: 5px; color: var(--gold); font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; }

/* ---------- rotation flow (panel) ---------- */
.flow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.flow-step { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 15px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
.flow-name { font-weight: 700; }
.flow-dwell { font-size: .72rem; color: var(--muted); }
.flow-arrow { color: var(--muted-2); }
.flow-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; border: 1px solid var(--line); background: var(--bg-2); }
.flow-seg { background: var(--gold); border-right: 1px solid var(--bg); }
.flow-seg:nth-child(even) { background: var(--blue); }
.flow-seg:nth-child(3n) { background: var(--green); }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line); padding: 22px 0; color: var(--muted-2); font-size: .8rem; text-align: center; }

/* ---------- responsive: phone ---------- */
@media (max-width: 640px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .hero-match, .detail-card { grid-template-columns: 1fr; gap: 16px; }
  .match { grid-template-columns: 60px 1fr auto; gap: 10px; padding: 10px 12px; }
  .nav-link { padding: 7px 11px; font-size: .85rem; }
  .tl-event { grid-template-columns: 42px 22px 1fr auto; }
  .tl-label { display: none; }
  .cd-cell { min-width: 70px; padding: 12px 8px; }
}

/* ---------- TV / large viewport: bump density-friendly type for couch reading ---------- */
@media (min-width: 1400px) {
  :root { --wrap: 1320px; }
  body { font-size: 1.06rem; }
  .group-table { font-size: .95rem; }
  .match-hh, .score { font-size: 1.25rem; }
}

/* respect reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .chip-live, .dot-live, .score.flash, .match { animation: none; transition: none; }
}
