/* VM 2026 – mörkt USA-tema (navy, rött, vitt) */
:root {
  --usa-navy: #0a1628;
  --usa-navy-mid: #12243d;
  --usa-red: #c41e3a;
  --usa-blue: #3d6db5;
  --bg: #080f1a;
  --bg-soft: #0e1a2c;
  --card: #122238;
  --ink: #f0f4f9;
  --ink-soft: #a8bdd4;
  --line: #243a5c;
  --line-strong: #325578;
  /* Rött = accenter (kanter, fyllda knappar). Text på blått = vitt/grått. */
  --accent: var(--usa-red);
  --focus: var(--usa-blue);
  --adv: #2db87a;
  --adv-bg: #0f2e24;
  --third-q: #e8b84a;
  --third-q-bg: #3a2e14;
  --third-o: #5e7085;
  --gold: #e0b23a;
  --live: #e8264a;
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 8px 22px rgba(0,0,0,.4);
  --shadow-lg: 0 12px 44px rgba(0,0,0,.55);
  --radius: 16px;
  --radius-sm: 10px;
  --maxw: 1320px;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f6f8;
    --bg-soft: #eef1f5;
    --card: #ffffff;
    --ink: #16202c;
    --ink-soft: #5c6b7a;
    --line: #e3e8ee;
    --line-strong: #d2dae3;
    --accent: #b91c3c;
    --adv: #18a06b;
    --adv-bg: #e7f6ee;
    --third-q: #e0a200;
    --third-q-bg: #fdf4dd;
    --third-o: #9aa7b4;
    --gold: #d9a400;
    --live: #e23b3b;
    --shadow: 0 1px 2px rgba(20,32,44,.06), 0 6px 20px rgba(20,32,44,.06);
    --shadow-lg: 0 10px 40px rgba(20,32,44,.18);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); }
/* Reservera alltid plats för rullningslisten så att layouten inte hoppar
   sidledes när man växlar mellan vyer (t.ex. Slutspel som saknar scroll). */
html { scrollbar-gutter: stable; overflow-y: scroll; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink); line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  /* Ambient USA-glöd: röd från höger, blå från vänster */
  background-image:
    radial-gradient(1100px 540px at 88% -8%, rgba(196, 30, 58, .13), transparent 62%),
    radial-gradient(1000px 520px at 2% -4%, rgba(61, 109, 181, .16), transparent 60%),
    radial-gradient(900px 700px at 50% 115%, rgba(18, 36, 61, .8), transparent 70%);
  background-attachment: fixed;
}

/* ---------- Hero-header (banner + navbar i ett) ----------
   Hela headern är sticky med negativ top-offset (sätts av JS):
   bilden/rubriken scrollar undan, navraden längst ned fastnar
   som en vanlig navbar högst upp i fönstret. */
.hero-header {
  position: sticky;
  top: -170px; /* fallback – exakt värde sätts av JS */
  z-index: 40;
  background: #060b14;
  box-shadow: 0 4px 24px rgba(0,0,0,.3);
}
.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 88%;
}
.hero-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(6, 11, 20, .5) 0%, transparent 46%),
    linear-gradient(180deg, rgba(6, 11, 20, .3) 0%, transparent 35%, rgba(6, 11, 20, .55) 100%);
}

/* Bannerdelen: kicker + sajtnamn */
.hero-head {
  position: relative;
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: clamp(58px, 7.5vw, 96px);
  padding: 10px 20px 4px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.hero-head h1 {
  flex: 1;
  display: flex;
  align-items: center;
  margin: 0;
  font-size: clamp(24px, 3.2vw, 36px);
  font-weight: 900;
  letter-spacing: -.8px;
  line-height: 1.05;
  color: #f7fafd;
  text-shadow: 0 2px 20px rgba(0, 0, 0, .9), 0 1px 3px rgba(0, 0, 0, .8);
}
.hero-kicker {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  color: #ffd9df;
  padding: 4px 11px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--usa-red) 55%, rgba(10, 18, 32, .6));
  border: 1px solid color-mix(in srgb, var(--usa-red) 70%, transparent);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
  margin-bottom: 4px;
}

/* Navraden längst ned i headern – transparent, ligger direkt på bannerbilden */
.topbar {
  position: relative;
}
/* Stars & stripes-accent under navraden */
.topbar::after {
  content: "";
  display: block;
  height: 3px;
  background: linear-gradient(90deg,
    var(--usa-red) 0%, var(--usa-red) 26%,
    #e8edf5 42%, #e8edf5 58%,
    var(--usa-blue) 74%, var(--usa-blue) 100%);
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 6px 20px 7px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.nav { display: inline-flex; background: rgba(10, 22, 40, .72); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 2px; }
.seg {
  border: 0; background: transparent; color: #b9c9dd; font: inherit; font-weight: 600; font-size: 14px;
  padding: 8px 14px; border-radius: 9px; cursor: pointer; transition: .15s;
}
.seg:hover { color: #fff; }
.seg.active {
  background: linear-gradient(180deg, color-mix(in srgb, #122238 90%, var(--usa-red) 10%), #122238);
  color: #f0f4f9; box-shadow: var(--shadow), inset 0 -2px 0 var(--usa-red);
}
/* sök */
.search { position: relative; flex: 1 1 200px; max-width: 280px; min-width: 150px; }
#teamSearch {
  width: 100%; font: inherit; font-size: 14px; padding: 9px 14px; border-radius: 11px;
  border: 1px solid #325578; background: rgba(10, 22, 40, .72); color: #f0f4f9;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
#teamSearch::placeholder { color: #8fa5bf; }
#teamSearch:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 28%, transparent); }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 50;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg);
  overflow: hidden; max-height: 360px; overflow-y: auto;
}
.sr-item {
  display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent;
  padding: 10px 12px; cursor: pointer; font: inherit; color: var(--ink); text-align: left;
  border-bottom: 1px solid var(--line);
}
.sr-item:last-child { border-bottom: 0; }
.sr-item:hover { background: var(--bg-soft); }
.sr-name { flex: 1; font-weight: 600; }
.sr-grp { font-size: 12px; color: var(--ink-soft); }
.sr-empty { padding: 12px; color: var(--ink-soft); font-size: 13px; }

.controls { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 0 rgba(226,59,59,.5); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(226,59,59,.5);} 70% { box-shadow: 0 0 0 6px rgba(226,59,59,0);} 100% { box-shadow: 0 0 0 0 rgba(226,59,59,0);} }
.reset {
  border: 1px solid var(--line-strong); background: var(--card); color: var(--ink-soft);
  font: inherit; font-size: 13px; font-weight: 600; padding: 8px 12px; border-radius: 10px; cursor: pointer; transition: .15s;
}
.reset:hover { color: #c0392b; border-color: #e3a79f; }

/* ---------- Layout ---------- */
.container { max-width: var(--maxw); margin: 0 auto; padding: 26px 20px 10px; background: transparent; }
.page-intro {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px 20px;
  margin: 4px 0 22px;
}
.page-intro-main { flex: 1 1 260px; min-width: 0; max-width: 72ch; }
.page-intro h2,
.groups-layout > .page-intro-main h2 { margin: 0 0 6px; font-size: 24px; letter-spacing: -.4px; }
.page-intro p,
.groups-layout > .page-intro-main p { margin: 0; color: var(--ink-soft); max-width: 78ch; }
.page-intro .hint { margin-top: 8px; color: var(--third-q); font-weight: 600; }

.groups-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "panels"
    "groups";
  gap: 16px;
  align-items: start;
  margin: 4px 0 22px;
}
.groups-layout > .next-matches-row { grid-area: panels; }
.groups-layout > .groups-grid { grid-area: groups; }

.next-matches-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
  width: 100%;
}
.next-matches-row .next-matches {
  width: 100%;
  min-width: 0;
}
.next-matches {
  flex: none;
  background: linear-gradient(180deg, color-mix(in srgb, var(--usa-navy-mid) 55%, var(--card)), var(--card) 84px);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 12px 16px;
  border-top: 2px solid var(--usa-red);
}
.next-matches-row .nm-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 8px;
  margin-bottom: 8px;
}
.next-matches-row .nm-title { flex: 1 1 auto; min-width: 0; }
.next-matches-row .nm-timer,
.next-matches-row .nm-live { flex: none; margin-left: auto; }
.next-matches-row .nm-val { font-size: 15px; }
.next-matches-row .nm-unit { min-width: 22px; }
.next-matches-row .nm-timer { gap: 3px; }
.next-matches.teams-spotlight { border-top-color: #006aa7; }
.next-matches.teams-spotlight .nm-title .flag + .flag { margin-left: 2px; }
.next-matches.teams-spotlight .nm-head { margin-bottom: 6px; }
.nm-spot-list { display: flex; flex-direction: column; gap: 0; }
.nm-spot-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "when when"
    "teams tv";
  gap: 2px 10px;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.nm-spot-row:last-child { border-bottom: 0; padding-bottom: 0; }
.nm-spot-row:first-child { padding-top: 4px; }
.nm-spot-when {
  grid-area: when;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  line-height: 1.3;
}
.nm-spot-row.is-live .nm-spot-when { color: var(--live); }
.nm-spot-teams {
  grid-area: teams;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  min-width: 0;
}
.teams-spotlight .nm-tv,
.teams-spotlight .cal-tv { grid-area: tv; justify-self: end; align-self: center; flex: none; }
.nm-teams.nm-muted { color: var(--ink-soft); font-size: 12px; font-weight: 500; }
.next-matches.empty { color: var(--ink-soft); }
.next-matches.is-live { border-color: color-mix(in srgb, var(--live) 45%, var(--line)); }
.nm-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.nm-title { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-soft); }
.nm-title .flag { width: 16px; height: 11px; margin-right: 5px; vertical-align: -1px; }
.nm-kickoff {
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
}
.nm-timer { display: flex; gap: 6px; font-variant-numeric: tabular-nums; }
.nm-unit { display: flex; flex-direction: column; align-items: center; min-width: 28px; }
.nm-val { font-size: 18px; font-weight: 800; line-height: 1.1; color: var(--ink); }
.nm-lbl { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--ink-soft); }
.nm-live { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 800; color: var(--live); white-space: nowrap; }
.nm-list { display: flex; flex-direction: column; gap: 6px; }
.nm-item { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "meta ch" "teams ch"; gap: 2px 8px; align-items: center; }
.nm-meta { grid-area: meta; font-size: 10.5px; font-weight: 700; color: var(--ink-soft); line-height: 1.3; }
.nm-teams { grid-area: teams; font-size: 12.5px; font-weight: 600; line-height: 1.25; }
.nm-item .cal-tv { grid-area: ch; justify-self: end; }
.nm-empty { margin: 6px 0 0; font-size: 12.5px; }

.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; }
.lg { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-soft); }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.dot.adv { background: var(--adv); }
.dot.third-q { background: var(--third-q); }
.dot.third-o { background: var(--third-o); }
.card {
  background: linear-gradient(180deg, color-mix(in srgb, var(--usa-navy-mid) 55%, var(--card)), var(--card) 92px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* ---------- Grupp-grid ---------- */
.groups-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr));
  align-items: stretch;
}
@media (min-width: 1180px) {
  .groups-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 781px) and (max-width: 1179px) {
  .groups-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.group-card {
  position: relative;
  overflow: visible;
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.group-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: 0 6px 16px rgba(0,0,0,.4), 0 14px 38px rgba(0,0,0,.45);
}
/* Röd→blå accentlinje i kortets överkant */
.group-card::before,
.thirds-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, var(--usa-red), color-mix(in srgb, var(--usa-red) 30%, var(--usa-blue)) 55%, var(--usa-blue));
  opacity: .85;
  pointer-events: none;
  z-index: 1;
}
.thirds-card { position: relative; }
.group-card .standings { flex: 1 1 auto; }
.group-card.is-open { z-index: 5; }
.group-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; }
.group-head h3 {
  margin: 0; font-size: 16px; letter-spacing: -.2px;
  display: inline-flex; align-items: center; gap: 9px;
}
.group-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(145deg, var(--usa-red), color-mix(in srgb, var(--usa-red) 55%, var(--usa-navy)));
  box-shadow: 0 2px 8px rgba(196, 30, 58, .35), inset 0 1px 0 rgba(255, 255, 255, .22);
  flex: none;
}
.host-tag {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  color: #fff; background: linear-gradient(90deg, var(--usa-red), color-mix(in srgb, var(--usa-red) 70%, var(--usa-navy))); padding: 3px 8px; border-radius: 999px;
}
.host-tag.info { color: var(--third-q); background: var(--third-q-bg); }

/* ---------- Tabeller ---------- */
.standings { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.standings th {
  text-align: center; font-weight: 600; color: var(--ink-soft); font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .3px; padding: 6px 4px; border-bottom: 1px solid var(--line);
}
.standings td { text-align: center; padding: 7px 4px; border-bottom: 1px solid var(--line); }
.standings tbody tr:last-child td { border-bottom: 0; }
.standings tbody tr[data-team] { cursor: pointer; }
.standings tbody tr[data-team]:hover td { background: color-mix(in srgb, var(--usa-blue) 12%, transparent); }

button.team-open {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 0;
  text-align: inherit;
}
button.team-open:hover { opacity: .88; }
button.team-open:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--gold) 55%, transparent);
  outline-offset: 2px;
  border-radius: 4px;
}
.side .side-team {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  text-align: left;
}
button.nm-spot-row {
  width: 100%;
  text-align: left;
  border-radius: 8px;
}
button.nm-spot-row:hover { background: color-mix(in srgb, var(--usa-blue) 10%, transparent); }
.champ-slot .champ-open {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.c-pos { width: 1.75rem; color: var(--ink-soft); }
.c-team { text-align: left !important; padding-left: 12px !important; }
.c-pts { font-weight: 800; width: 1.85rem; }
.c-goals { color: var(--ink-soft); font-variant-numeric: tabular-nums; width: 2.6rem; }
.c-grp { font-weight: 700; color: var(--ink-soft); width: 1.85rem; }
.c-stat { width: 1.85rem; }
.c-status { width: 1.85rem; }

/* Enhetlig tabell – grupper och tredjeplats-ranking */
.group-card .standings,
.thirds-card .standings {
  table-layout: fixed;
  width: 100%;
}
.group-card .standings .c-team,
.thirds-card .standings .c-team {
  overflow: hidden;
  padding-right: 8px !important;
}
.group-card .standings .team,
.thirds-card .standings .team {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}
.group-card .standings .t-name,
.thirds-card .standings .t-name {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team { display: inline-flex; align-items: center; gap: 9px; }
.t-name { white-space: nowrap; }
.flag { width: 22px; height: 15px; object-fit: cover; border-radius: 3px; box-shadow: 0 0 0 1px rgba(0,0,0,.08); flex: none; }

.r-adv td { background: var(--adv-bg); }
.r-adv .c-pos { color: var(--adv); font-weight: 800; }
.r-third-q td { background: var(--third-q-bg); }
.r-third-q .c-pos { color: var(--third-q); font-weight: 800; }
.r-third-o .c-pos { color: var(--third-o); }
.r-highlight td { outline: 2px solid var(--usa-red); outline-offset: -2px; }
.r-highlight-grp .c-grp {
  outline: 2px solid var(--usa-red);
  outline-offset: -2px;
  border-radius: 3px;
}
.qbadge { color: var(--adv); font-weight: 800; }
.xbadge { color: var(--third-o); font-weight: 800; }
.thirds-table tr.cut-line td { border-bottom: 2px solid var(--usa-red); }
.fp-mark {
  font-size: 9px; font-weight: 800; letter-spacing: .3px;
  color: var(--usa-red); cursor: help; vertical-align: super;
  margin-left: 3px;
}
.r-contested .c-grp { position: relative; }

/* ---------- Gruppmatcher / inmatning ---------- */
.matches-toggle {
  width: 100%; border: 0; border-top: 1px solid var(--line); background: transparent;
  color: var(--ink-soft); font: inherit; font-weight: 600; font-size: 13px; padding: 9px; cursor: pointer;
  box-shadow: inset 3px 0 0 transparent; transition: .15s;
}
.matches-toggle:hover { color: var(--ink); background: var(--bg-soft); box-shadow: inset 3px 0 0 var(--usa-red); }
.fixtures {
  position: absolute; left: 0; right: 0; top: 100%;
  padding: 6px 14px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow);
  z-index: 1;
}
.md-label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-soft); margin: 12px 0 6px; font-weight: 700; }
.md-win { color: var(--ink); text-transform: none; letter-spacing: 0; }
.fixture { padding: 8px 0 6px; border-bottom: 1px solid var(--line); }
.fixtures .fixture:last-child { border-bottom: 0; }
.fx-date { text-align: center; font-size: 10.5px; color: var(--ink-soft); margin-bottom: 6px; }
.fx-match { display: flex; align-items: center; justify-content: center; gap: 10px; }
.fx-team { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 13.5px; min-width: 0; overflow: hidden; }
.fx-team.home { justify-content: flex-end; text-align: right; }
.fx-team.away { justify-content: flex-start; }
.fixtures .fx-team .t-name { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-score { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 90px; }
.dash { color: var(--ink-soft); }

.score {
  width: 38px; height: 34px; text-align: center; font: inherit; font-weight: 700;
  border: 1px solid var(--line-strong); border-radius: 9px; background: var(--bg-soft); color: var(--ink); -moz-appearance: textfield;
}
.score::-webkit-outer-spin-button, .score::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.score:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 28%, transparent); }
.score:disabled { opacity: .4; cursor: not-allowed; }

.groups-grid > .thirds-card { grid-column: 1 / -1; }
.thirds-card {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.thirds-card .standings { flex: 1 1 auto; }
.thirds-card .note {
  margin: 0;
  padding: 10px 16px 14px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.45;
}

/* ====================================================================
   SLUTSPELSTRÄD (tvåsidigt)
==================================================================== */
html.view-bracket,
html.view-bracket body {
  background-color: var(--bg);
  /* Samma ambient röd/blå-glöd som övriga sidor (se body) ligger överst, så
     slutspelsvyn får samma färgsignatur som resten av sajten. Pokalbilden
     ligger kvar längst ned men mörkas ner kraftigt så den bara anas. */
  background-image:
    radial-gradient(1100px 540px at 88% -8%, rgba(196, 30, 58, .13), transparent 62%),
    radial-gradient(1000px 520px at 2% -4%, rgba(61, 109, 181, .16), transparent 60%),
    linear-gradient(180deg, rgba(8,15,26,.95) 0%, rgba(8,15,26,.90) 48%, rgba(8,15,26,.97) 100%),
    url("bracket-bg.png");
  background-position: center, center, center center, center top;
  background-size: auto, auto, auto, auto 110%;
  background-repeat: no-repeat;
  background-attachment: fixed;
}
html.view-bracket {
  height: 100%;
  overflow: hidden;
}
html.view-bracket body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
}
/* Slutspel: ingen sid-scroll – bannern krymper via .hero-collapsed (JS). */
html.view-bracket .hero-header {
  flex: none;
  position: relative;
  top: 0 !important;
  transition: box-shadow .2s;
}
html.view-bracket .hero-header.hero-collapsed .hero-head,
html.view-bracket .hero-header.hero-collapsed .hero-bg,
html.view-bracket .hero-header.hero-collapsed .hero-shade {
  display: none;
}
html.view-bracket main.container {
  flex: 1 1 0;
  min-height: 0;
  height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  padding: 26px 20px 0;
}
html.view-bracket .page-intro { margin: 4px 0 22px; }
html.view-bracket .bracket-shell {
  flex: 1 1 0;
  min-height: 0;
  height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
}
html.view-bracket .foot {
  flex: none;
  margin-top: 0;
  padding: 10px 20px 14px;
  font-size: 11px;
}
/* Vyrubriken "Slutspel" + underrubrik följer samma stil som Gruppspel/Kalender
   (se .page-intro h2 / p ovan) – bakgrunden är nu lika mörk på alla vyer. */
html.view-bracket .round-title {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: .7px;
  padding: 6px 0 10px;
  opacity: 1;
  text-shadow: 0 1px 12px rgba(0,0,0,.7);
}
html.view-bracket .round-title.final-label { font-size: 17px; font-weight: 900; letter-spacing: .9px; }

.bracket .round-title.bracket-jump {
  display: block;
  width: 100%;
  cursor: pointer;
  border: none;
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  font-weight: 900;
  text-transform: inherit;
  letter-spacing: inherit;
  text-align: center;
  transition: color .15s, opacity .15s;
}
.bracket .round-title.bracket-jump:hover { opacity: .82; }
html.view-bracket .bracket .round-title.bracket-jump:hover { color: color-mix(in srgb, var(--ink) 55%, var(--gold)); }
html.view-bracket .bracket .round-title.bracket-jump.final-label:hover { color: color-mix(in srgb, var(--gold) 75%, #fff); }
html.view-bracket .bracket .round-title.bracket-jump.bronze-title:hover {
  color: color-mix(in srgb, var(--gold) 75%, #fff);
}


.bracket-scroll {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0;
  padding: 8px 4px 4px 12px;
  background: transparent;
}
html.view-bracket .bracket-scroll {
  flex: 1 1 0;
  min-height: 0;
  height: 0;
  width: 100%;
  overflow: auto;
  overscroll-behavior: auto;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--ink-soft) 50%, var(--line)) transparent;
}
html.view-bracket .bracket-scroll::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
html.view-bracket .bracket-scroll::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--ink-soft) 45%, transparent);
  border-radius: 999px;
}
html.view-bracket .bracket-scroll::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--ink-soft) 65%, transparent);
}
.bracket-wrap {
  position: relative;
  display: inline-block;
  min-width: min-content;
}
.bracket-lines {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 3;
  overflow: visible;
  color: var(--line-strong);
}
.bracket-lines path { stroke: currentColor; stroke-width: 1.5; opacity: .58; }
/* OBS: inget z-index här – fasrubrikerna (sticky) ska kunna lägga sig ovanpå linjerna. */
.bracket.two-sided { position: relative; }
html.view-bracket .bracket-lines { color: rgba(120, 152, 185, .88); }
.bracket .match {
  box-shadow: 0 4px 18px rgba(0,0,0,.45);
  background: color-mix(in srgb, var(--card) 96%, var(--usa-navy));
  width: 100%;
  align-self: center;
}
.bracket.two-sided {
  display: grid;
  grid-template-columns: repeat(4, 196px) 196px repeat(4, 196px);
  /* Första raden är fast: fasrubrikerna ligger i kolumnceller som spänner
     hela höjden (för sticky), så raden kan inte auto-storleksättas. */
  grid-template-rows: 58px repeat(8, minmax(74px, auto));
  gap: 10px 20px;
  align-items: center;
  min-width: max-content;
}

/* Faskolumn – subtil panel bakom varje omgång som grupperar fasen visuellt,
   och bär den sticky fasrubriken. */
.bracket.two-sided > .round-cell {
  grid-row: 1 / -1;
  align-self: stretch;
  justify-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  margin: -6px -7px;
  padding-top: 8px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(16, 30, 52, .55), rgba(14, 26, 44, .24) 22%, rgba(14, 26, 44, .24) 78%, rgba(16, 30, 52, .45));
  border: 1px solid rgba(120, 152, 185, .14);
}
.bracket.two-sided > .round-cell.is-final {
  background: linear-gradient(180deg, rgba(224, 178, 58, .13), rgba(224, 178, 58, .03) 26%, rgba(224, 178, 58, .03) 74%, rgba(224, 178, 58, .10));
  border-color: rgba(224, 178, 58, .24);
}

/* Fasrubrik som pill – fastnar i överkant när man rullar i trädet. */
.bracket.two-sided > .round-cell .round-title {
  position: sticky;
  top: 6px;
  z-index: 6;
  pointer-events: auto;
  width: auto;
  max-width: calc(100% - 12px);
  padding: 6px 16px 7px;
  border-radius: 12px;
  line-height: 1.25;
  /* Trädet ligger alltid på mörk fotobakgrund – pillern är därför alltid mörk
     med ljus text, oavsett ljust/mörkt färgschema. */
  color: #f0f4f9;
  background: linear-gradient(180deg, rgba(20, 36, 60, .94), rgba(11, 21, 37, .9));
  border: 1px solid rgba(120, 152, 185, .32);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.bracket.two-sided > .round-cell .round-title.final-label {
  border-color: color-mix(in srgb, var(--gold) 48%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--gold) 22%, transparent), 0 6px 18px rgba(0, 0, 0, .4);
}
.round-title .round-sub {
  display: block;
  margin-top: 1px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: none;
  color: #a8bdd4;
}
.round-title.final-label .round-sub { color: color-mix(in srgb, var(--gold) 60%, #a8bdd4); }
.bracket-center-stack {
  display: grid;
  grid-template-rows: repeat(8, minmax(74px, auto));
  align-items: center;
  width: 100%;
  min-width: 0;
}
.bracket-finals-block {
  grid-row: 3 / span 4;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-self: center;
  width: 100%;
}
.bracket-finals-block .match.final {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--gold) 42%, transparent),
    0 6px 28px rgba(0,0,0,.5);
}
.bracket-bronze-block {
  grid-row: 7 / span 2;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-self: start;
  width: 100%;
  margin: 0 auto;
  opacity: .92;
}
.bracket-bronze-block .round-title { grid-row: auto; padding: 0; font-size: 10.5px; margin-top: 0; }
html.view-bracket .bracket-bronze-block .round-title { font-size: 11px; padding: 0; opacity: .92; }
html.view-bracket .bracket-bronze-block .round-title.bronze-title {
  font-size: 12px;
  font-weight: 800;
  opacity: 1;
  color: color-mix(in srgb, var(--gold) 75%, #fff);
  letter-spacing: .7px;
  text-shadow: 0 1px 10px rgba(0,0,0,.9);
}

.round-title {
  font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px;
  color: var(--ink); text-align: center; padding: 4px 0 8px; opacity: .85; grid-row: 1;
}
.final-label { color: var(--gold); font-size: 13px; }

.match {
  position: relative; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 8px 10px;
  color: var(--ink);
}
.m-meta { display: flex; justify-content: space-between; align-items: center; font-size: 10.5px; color: var(--ink-soft); margin-bottom: 6px; }
.m-no { font-weight: 800; letter-spacing: .3px; color: var(--ink); }
.m-rel { font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--bg-soft); }
.m-rel.live { color: #fff; background: var(--live); }
.m-rel.soon { color: var(--ink); background: var(--bg-soft); border: 1px solid var(--line-strong); }
.m-rel.done { color: var(--adv); }
.m-rel.await { color: var(--third-q); }
.match.live-now { border-color: var(--live); box-shadow: 0 0 0 2px color-mix(in srgb, var(--live) 35%, transparent), var(--shadow); }

.side { display: flex; align-items: center; gap: 8px; padding: 5px 4px; border-radius: 7px; font-size: 13.5px; color: var(--ink); }
.side + .side { margin-top: 2px; }
.side .s-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); font-weight: 600; }
.side.win { background: var(--adv-bg); font-weight: 800; }
.side.win .s-name { font-weight: 800; }
.side.prov .s-name { font-style: italic; color: var(--ink); font-weight: 500; }
.side.tbd .s-name { font-style: italic; color: var(--ink); font-weight: 500; font-size: 13px; }
.s-name.placeholder { font-size: 13px; color: var(--ink); font-weight: 500; }
/* TBD-platser i trädet visas som färgkodade chips (Etta grupp E, Vinnare match …) */
.side .s-name.placeholder.seed-chip {
  flex: 0 1 auto;
  margin-right: auto;
  font-style: normal;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 9px;
  line-height: 1.3;
}
/* I slutspelsträdet: mjukare platshållare (Vinnare match …) – inte lika skrikiga som gruppkval-chips */
.bracket .side .s-name.placeholder.seed-chip {
  flex: 1;
  min-width: 0;
  font-size: inherit;
  font-weight: 500;
  font-style: italic;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink-soft);
  background: transparent;
  border: 1px dashed color-mix(in srgb, var(--line-strong) 70%, transparent);
  padding: 2px 8px;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  line-height: 1.25;
}
.match.bronze {
  border-color: color-mix(in srgb, #b07a3a 45%, var(--line));
  box-shadow: none;
  font-size: 12.5px;
  padding: 8px 8px;
}
.match.bronze .m-no,
.match.bronze .side { font-size: 12.5px; }
.match.bronze .k-score { width: 28px; height: 28px; flex-shrink: 0; }
.k-score { width: 32px; height: 30px; }

.pen-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); font-size: 11px; color: var(--ink-soft); }
.pen-btn { border: 1px solid var(--line-strong); background: var(--bg-soft); color: var(--ink-soft); font: inherit; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; cursor: pointer; }
.pen-btn.on { background: var(--usa-red); color: #fff; border-color: var(--usa-red); }
.m-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 7px; padding-top: 6px; border-top: 1px solid var(--line);
  font-size: 10.5px; color: var(--ink-soft);
}
.m-when { font-weight: 600; min-width: 0; color: var(--ink); }

.match-expand {
  flex: none; width: 26px; height: 26px; padding: 0;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg-soft);
  color: var(--ink-soft); font: inherit; line-height: 1;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s, color .15s;
}
.match-expand-icon {
  width: 15px; height: 15px; display: block;
  transition: transform .2s ease;
}
.match-expand.on .match-expand-icon { transform: rotate(180deg); }
.match-expand:hover { background: var(--usa-red); color: #fff; border-color: var(--usa-red); }
.match-expand.on { background: var(--usa-red); color: #fff; border-color: var(--usa-red); }
.match.expanded { border-color: var(--usa-red); box-shadow: 0 0 0 2px color-mix(in srgb, var(--usa-red) 30%, transparent), var(--shadow); }

.match.final { border-color: var(--gold); box-shadow: 0 0 0 2px color-mix(in srgb, var(--gold) 38%, transparent), var(--shadow); }
.match.final.expanded { border-color: var(--gold); box-shadow: 0 0 0 2px color-mix(in srgb, var(--gold) 38%, transparent), var(--shadow); }
.bronze-title { color: #d9a85c; margin-top: 0; }

.champ-slot {
  display: flex; align-items: center; gap: 10px; margin: 4px 0;
  background: linear-gradient(135deg, color-mix(in srgb, var(--gold) 20%, var(--card)), var(--card));
  border: 1px solid color-mix(in srgb, var(--gold) 45%, var(--line)); border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow);
}
.champ-slot.empty { color: var(--ink-soft); justify-content: center; font-size: 13px; font-weight: 600; }
.champ-slot.empty.final-label { color: var(--gold); font-size: 15px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; }
.champ-slot .trophy { font-size: 20px; }
.champ-slot .flag { width: 28px; height: 19px; }
.champ-txt { display: flex; flex-direction: column; font-size: 11px; color: var(--ink-soft); }
.champ-txt strong { font-size: 15px; color: var(--ink); }
.champ-slot.prov .champ-txt strong { font-style: italic; }

/* sidopanel – flytande, öppnas via Utvidga-knappen */
.bracket-aside {
  position: fixed; top: 76px; right: 16px; z-index: 80; width: 330px;
  max-height: calc(100vh - 96px); overflow-y: auto;
  background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 16px;
  opacity: 0; transform: translateX(12px); pointer-events: none; transition: opacity .15s, transform .15s;
}
.bracket-aside.show { opacity: 1; transform: translateX(0); pointer-events: auto; }
.bracket-aside.aside-left {
  right: auto;
  left: 16px;
  transform: translateX(-12px);
}
.bracket-aside.aside-left.show { transform: translateX(0); }
.aside-head {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 34px 12px;
  margin: -2px 0 12px;
  border-bottom: 1px solid var(--line);
}
.aside-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-align: center;
}
.aside-round {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .55px;
  text-transform: uppercase;
  color: var(--ink);
  line-height: 1.2;
}
.aside-match-no {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .25px;
  color: var(--ink-soft);
}
.aside-close {
  position: absolute;
  right: 0;
  top: 0;
  border: 0;
  background: var(--bg-soft);
  color: var(--ink-soft);
  width: 26px;
  height: 26px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.aside-close:hover { color: var(--ink); background: color-mix(in srgb, var(--line) 40%, var(--bg-soft)); }
/* Seed-chip – färgkodad etikett för kvalväg (Etta grupp E, 3:a grupp …,
   Vinnare match …). Används i matchup-grafiken och i slutspelsträdets kort. */
.seed-chip {
  display: inline-block;
  max-width: 100%;
  font-style: normal;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .4px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--line-strong);
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.seed-chip.seed-adv {
  color: var(--adv);
  border-color: color-mix(in srgb, var(--adv) 42%, var(--line));
  background: color-mix(in srgb, var(--adv) 13%, var(--bg-soft));
}
.seed-chip.seed-third {
  color: var(--third-q);
  border-color: color-mix(in srgb, var(--third-q) 45%, var(--line));
  background: color-mix(in srgb, var(--third-q) 14%, var(--bg-soft));
}

/* "Vem möter vem"-grafik */
.aside-matchup {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: 8px;
  margin: 6px 0 16px;
}
.mu-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 9px;
  padding: 13px 8px 14px;
  min-width: 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--usa-navy) 30%, var(--bg-soft)), var(--bg-soft));
  border: 1px solid var(--line);
  border-radius: 12px;
}
.mu-side.win {
  border-color: color-mix(in srgb, var(--adv) 55%, var(--line));
  background: linear-gradient(180deg, color-mix(in srgb, var(--adv) 18%, var(--bg-soft)), var(--bg-soft));
}
.mu-seed {
  font-size: 9.5px;
  padding: 3px 9px;
  line-height: 1.3;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}
.mu-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}
.mu-team .flag,
.mu-flag-ph {
  width: 48px;
  height: 32px;
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.18), 0 3px 8px rgba(0,0,0,.35);
  flex: none;
}
.mu-flag-ph { background: var(--line); box-shadow: 0 0 0 1px rgba(0,0,0,.18); }
.mu-name {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.mu-side.win .mu-name { font-weight: 800; }
.mu-team.prov .mu-name { font-style: italic; color: var(--ink-soft); font-weight: 600; }
.mu-team.tbd .mu-name { font-style: italic; color: var(--ink-soft); font-weight: 600; font-size: 13px; }
.mu-vs {
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mu-vs span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--usa-red);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .5px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.18);
}
.mini-group.thirds .mini-group-head { background: var(--third-q-bg); color: var(--third-q); }
.mini-group.third .mini-group-head { color: var(--third-o); }
.aside-section-title { font-size: 12px; font-weight: 700; color: var(--ink-soft); margin: 6px 0 8px; }
.mini-group { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 10px; }
.mini-group-head { background: var(--bg-soft); font-weight: 700; font-size: 12px; padding: 6px 10px; }
.standings.mini { font-size: 12.5px; }
.standings.mini td { padding: 5px 4px; }

/* ====================================================================
   KALENDER
==================================================================== */
.calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "panels"
    "cal";
  gap: 16px;
  align-items: start;
  margin: 4px 0 22px;
}
.calendar-layout > .next-matches-row { grid-area: panels; }
.calendar-layout > .cal-shell { grid-area: cal; }

.cal-shell {
  position: relative;
  background: linear-gradient(180deg, color-mix(in srgb, var(--usa-navy-mid) 55%, var(--card)), var(--card) 120px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 6px 20px 18px;
  overflow: hidden;
}
.cal-shell::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, var(--usa-red), color-mix(in srgb, var(--usa-red) 30%, var(--usa-blue)) 55%, var(--usa-blue));
  opacity: .85;
  pointer-events: none;
}

.cal { display: flex; flex-direction: column; gap: 2px; }
.cal-day {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
}
.cal-day:first-child { border-top: 0; padding-top: 10px; }
.cal-date {
  position: sticky;
  top: calc(88px + env(safe-area-inset-top, 0px));
  align-self: start;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 10px 12px 9px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, color-mix(in srgb, var(--usa-navy-mid) 50%, var(--card)), var(--card) 64px);
  box-shadow: var(--shadow);
  min-width: 86px;
  overflow: hidden;
}
.cal-date::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--usa-red);
  opacity: .9;
}
.cal-dow {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .55px;
  color: color-mix(in srgb, var(--usa-red) 50%, var(--ink-soft));
  font-weight: 800;
}
.cal-dnum {
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -1px;
  margin: 3px 0 2px;
  color: #f7fafd;
}
.cal-mon { font-size: 11.5px; font-weight: 600; color: var(--ink-soft); }
.cal-body { display: flex; flex-direction: column; gap: 10px; }

.cal-row {
  display: grid;
  grid-template-columns: 56px 118px 1fr 104px;
  align-items: center;
  gap: 12px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--usa-navy-mid) 40%, var(--card)), var(--card) 56px);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 11px 14px;
  position: relative;
  overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.cal-row::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--usa-red), color-mix(in srgb, var(--usa-red) 35%, var(--usa-blue)) 60%, var(--usa-blue));
  opacity: .7;
  pointer-events: none;
}
.cal-row:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
}
.cal-row.ko { cursor: default; }
.cal-row.is-next {
  border-color: color-mix(in srgb, var(--usa-red) 55%, var(--line));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--usa-red) 28%, transparent), 0 6px 18px rgba(196, 30, 58, .18);
}
.cal-row.is-recent {
  border-color: color-mix(in srgb, var(--usa-blue) 45%, var(--line));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--usa-blue) 22%, transparent), var(--shadow);
}
.cal-row.is-live {
  border-color: color-mix(in srgb, var(--live) 45%, var(--line));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--live) 22%, transparent), var(--shadow);
}
.cal-time {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: 13px;
  color: var(--ink);
}
.cal-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--ink-soft);
  justify-self: start;
  white-space: nowrap;
  border: 1px solid var(--line-strong);
}
.cal-badge.grp {
  color: #fff;
  background: linear-gradient(145deg, var(--usa-red), color-mix(in srgb, var(--usa-red) 55%, var(--usa-navy)));
  border: none;
  font-weight: 800;
  letter-spacing: .3px;
  box-shadow: 0 2px 6px rgba(196, 30, 58, .28);
}
.cal-badge.cal-group-btn {
  cursor: pointer;
  font-family: inherit;
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
.cal-badge.cal-group-btn:hover {
  filter: brightness(1.08);
  box-shadow: 0 3px 10px rgba(196, 30, 58, .38);
}
.cal-group-backdrop {
  position: fixed; inset: 0;
  background: rgba(8, 14, 20, .45);
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
  z-index: 55;
}
.cal-group-backdrop.open { opacity: 1; pointer-events: auto; }
.cal-group-popup {
  position: fixed;
  left: 50%; top: 50%;
  transform: translate(-50%, -48%) scale(.97);
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 56;
  width: min(92vw, 440px);
  max-height: min(82vh, 540px);
  overflow: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px 16px;
}
.cal-group-popup.open {
  opacity: 1; pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}
.cal-group-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 10px;
}
.cal-group-head h3 { margin: 0; font-size: 17px; letter-spacing: -.2px; }
.cal-group-close {
  border: 0; background: var(--bg-soft); color: var(--ink-soft);
  width: 30px; height: 30px; border-radius: 9px;
  cursor: pointer; font-size: 18px; line-height: 1; flex: none;
}
.cal-group-close:hover { color: var(--ink); background: var(--line); }
.cal-group-popup .standings.mini { margin-top: 4px; }
.cal-badge.R32, .cal-badge.R16 { color: #7eb0ff; background: color-mix(in srgb, #2a5088 35%, transparent); }
.cal-badge.QF, .cal-badge.SF { color: #f0a060; background: color-mix(in srgb, #8a4a18 30%, transparent); }
.cal-badge.FINAL { color: var(--gold); background: var(--third-q-bg); }
.cal-badge[class~="3RD"] { color: #b07a3a; }
.cal-match { display: flex; align-items: center; justify-content: center; gap: 12px; }
.cal-side { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; min-width: 0; }
.cal-side.prov { font-style: italic; color: var(--ink-soft); }
.cal-side.home { justify-content: flex-end; text-align: right; flex: 1; }
.cal-side.away { justify-content: flex-start; flex: 1; }
.cal-score { font-weight: 800; font-variant-numeric: tabular-nums; min-width: 42px; text-align: center; }
.cal-score sup { color: var(--ink-soft); font-size: 9px; }
.cal-vs { color: var(--ink-soft); min-width: 42px; text-align: center; }
.cal-venue {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  white-space: nowrap;
  width: 100%;
  min-width: 0;
}
.cal-next {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  padding: 0 8px;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .55px;
  color: #ffd9df;
  background: color-mix(in srgb, var(--usa-red) 55%, rgba(10, 18, 32, .6));
  border: 1px solid color-mix(in srgb, var(--usa-red) 70%, transparent);
  border-radius: 999px;
  white-space: nowrap;
  flex: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}
.cal-next-slot {
  visibility: hidden;
  pointer-events: none;
}
.cal-tv {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 20px;
  padding: 0 6px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .2px;
  color: #fff;
  box-sizing: border-box;
}
.cal-tv.svt { background: #1a6b3c; }
.cal-tv.tv4 { background: var(--usa-red); }
.cal-tv-empty { visibility: hidden; }

/* ====================================================================
   LAG-PANEL (drawer)
==================================================================== */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(8,14,20,.4); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 60; }
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.team-drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: 400px; max-width: 92vw; z-index: 70;
  background: var(--card); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg);
  transform: translateX(100%); transition: transform .25s ease; display: flex; flex-direction: column;
}
.team-drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.dh-flag .flag { width: 40px; height: 27px; }
.dh-title { flex: 1; min-width: 0; }
.dh-title h3 { margin: 0; font-size: 19px; }
.dh-sub { font-size: 12px; color: var(--ink-soft); }
.drawer-close { border: 0; background: var(--bg-soft); color: var(--ink-soft); width: 30px; height: 30px; border-radius: 9px; cursor: pointer; font-size: 18px; line-height: 1; }
.drawer-body { padding: 16px 18px 30px; overflow-y: auto; }

.status-pill { display: inline-block; font-size: 12.5px; font-weight: 700; padding: 6px 12px; border-radius: 999px; margin-bottom: 14px; }
.status-pill.adv { color: var(--adv); background: var(--adv-bg); }
.status-pill.third-q { color: var(--third-q); background: var(--third-q-bg); }
.status-pill.third-o, .status-pill.out { color: var(--ink-soft); background: var(--bg-soft); }

.drawer-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }
.dc-title { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-soft); margin-bottom: 10px; }
.dc-empty { color: var(--ink-soft); font-size: 13px; }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat-box { background: var(--bg-soft); border-radius: 10px; padding: 9px; text-align: center; }
.sb-val { display: block; font-size: 17px; font-weight: 800; }
.sb-lbl { font-size: 10.5px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .3px; }

.tm-row { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "when tag" "opp res"; gap: 2px 8px; padding: 8px 0; border-bottom: 1px solid var(--line); align-items: center; }
.tm-row:last-child { border-bottom: 0; }
.tm-row.big { background: var(--bg-soft); border: 0; border-radius: 10px; padding: 10px 12px; }
.tm-when { grid-area: when; font-size: 11.5px; color: var(--ink-soft); }
.tm-opp { grid-area: opp; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13.5px; }
.tm-opp .flag { width: 20px; height: 14px; }
.tm-tag { grid-area: tag; justify-self: end; font-size: 10.5px; color: var(--ink-soft); font-weight: 700; }
.tm-res { grid-area: res; justify-self: end; font-weight: 800; font-variant-numeric: tabular-nums; }
.tm-res.v { color: var(--adv); } .tm-res.f { color: var(--live); } .tm-res.o { color: var(--ink-soft); }
.tm-rel { grid-area: res; justify-self: end; font-size: 11.5px; font-weight: 700; }
.tm-rel.soon { color: var(--ink); } .tm-rel.live { color: var(--live); } .tm-rel.up { color: var(--ink-soft); } .tm-rel.await { color: var(--third-q); }

/* ====================================================================
   TOOLTIP
==================================================================== */
.tooltip {
  position: fixed; z-index: 90; max-width: 300px; pointer-events: none; opacity: 0; transform: translateY(4px);
  transition: opacity .12s; background: var(--card); border: 1px solid var(--line-strong);
  border-radius: 12px; box-shadow: var(--shadow-lg); padding: 11px 13px; font-size: 12.5px;
}
.tooltip.show { opacity: 1; transform: translateY(0); }
.tip-head { font-size: 12.5px; margin-bottom: 7px; padding-bottom: 7px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tip-row { display: flex; align-items: center; gap: 7px; margin-top: 3px; color: var(--ink); }
.tip-row span { width: 16px; text-align: center; }
.tip-dim { color: var(--ink-soft); }

/* ---------- Live-banner + live-markörer ---------- */
.live-banner {
  position: fixed; left: 50%; bottom: 18px; transform: translate(-50%, 140%);
  z-index: 85; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line-strong); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 10px 16px; font-size: 14px; transition: transform .3s ease; max-width: 94vw;
}
.live-banner.show { transform: translate(-50%, 0); }
.lb-live { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; color: #fff; background: var(--live); padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.lb-live .live-dot { background: #fff; }
.lb-tag { font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.lb-match { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.lb-match b { font-variant-numeric: tabular-nums; font-size: 16px; }
.lb-match .flag { width: 22px; height: 15px; }
.lb-demo { font-size: 10px; font-weight: 800; letter-spacing: .6px; color: var(--ink-soft); border: 1px solid var(--line-strong); padding: 2px 7px; border-radius: 6px; }

.fixture.live { background: color-mix(in srgb, var(--live) 7%, transparent); border-radius: 8px; }
.fx-live { display: inline-flex; align-items: center; gap: 4px; color: var(--live); font-weight: 800; font-size: 10px; }
.cal-row.is-live { border-color: var(--live); box-shadow: 0 0 0 2px color-mix(in srgb, var(--live) 22%, transparent), var(--shadow); }
.cal-livet { display: inline-flex; align-items: center; gap: 4px; color: var(--live); font-weight: 800; }

/* ---------- Footer ---------- */
.foot { max-width: var(--maxw); margin: 10px auto 0; padding: 22px 20px 40px; color: var(--ink-soft); font-size: 12px; border-top: 1px solid var(--line); }
.foot p { margin: 0 0 6px; max-width: 100ch; }
.foot .todo { color: var(--third-q); }

/* ---------- Responsivt / mobil ---------- */
@media (max-width: 900px) {
  .page-intro {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
  }
  .page-intro-main {
    flex: 0 0 auto;
  }
  .groups-layout {
    gap: 14px;
    margin-bottom: 18px;
  }
  .hero-head { min-height: clamp(54px, 11vw, 88px); padding: 8px 16px 4px; }
}

@media (max-width: 580px) {
  .next-matches-row {
    grid-template-columns: 1fr;
    max-width: none;
  }
}

@media (max-width: 780px) {
  .container { padding: 16px 14px 8px; }
  .foot { padding: 18px 14px calc(28px + env(safe-area-inset-bottom, 0px)); font-size: 11px; }

  /* Topbar – tydlig radordning */
  .hero-header { padding-top: env(safe-area-inset-top, 0px); }
  .topbar-inner {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "nav nav"
      "search controls";
    gap: 10px;
    padding: 10px 14px 12px;
  }
  .controls { grid-area: controls; margin-left: 0; align-self: center; }
  .nav {
    grid-area: nav;
    order: unset;
    width: 100%;
    display: flex;
    padding: 3px;
  }
  .nav .seg {
    flex: 1;
    text-align: center;
    padding: 10px 6px;
    min-height: 44px;
    font-size: 13px;
  }
  .search {
    grid-area: search;
    order: unset;
    max-width: none;
    flex-basis: auto;
    min-width: 0;
    width: 100%;
  }
  #teamSearch {
    font-size: 16px;
    padding: 11px 14px;
    min-height: 44px;
  }

  .page-intro {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    margin-bottom: 18px;
  }
  .page-intro h2,
  .groups-layout > .page-intro-main h2 { font-size: 21px; }
  .groups-layout > .next-matches-row,
  .calendar-layout > .next-matches-row,
  .next-matches-row { grid-template-columns: 1fr; width: 100%; }

  .groups-grid { grid-template-columns: 1fr; }
  .cal-group-popup .standings {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    min-width: 320px;
  }

  /* Kalender – kort med kompakt rubrikrad + centrerad matchrad */
  .cal-shell { padding: 4px 12px 14px; }
  .cal-day { grid-template-columns: 56px 1fr; gap: 10px; padding: 12px 0; }
  .cal-date {
    position: sticky;
    top: calc(118px + env(safe-area-inset-top, 0px));
    align-self: start;
    padding: 8px 9px 7px;
    min-width: 0;
  }
  .cal-dnum { font-size: 22px; }
  .cal-row {
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "time badge venue"
      "match match match";
    align-items: center;
    gap: 8px 10px;
    padding: 11px 14px;
  }
  .cal-time { grid-area: time; justify-self: start; font-size: 12.5px; }
  .cal-badge { grid-area: badge; justify-self: start; }
  .cal-venue {
    grid-area: venue;
    justify-self: end;
    justify-content: flex-end;
    width: auto;
    gap: 6px;
  }
  .cal-match {
    grid-area: match;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-width: 0;
    padding-top: 2px;
  }
  .cal-side { font-size: 13.5px; gap: 6px; min-width: 0; }
  .cal-side.home { justify-content: flex-end; text-align: right; flex: 1 1 0; }
  .cal-side.away { justify-content: flex-start; text-align: left; flex: 1 1 0; }
  .cal-score,
  .cal-vs { flex: none; min-width: 40px; }
  /* Tomma platshållare (Nästa-slot / saknad TV-kanal) tar ingen plats i mobil */
  .cal-next-slot,
  .cal-tv-empty { display: none; }

  /* Slutspel */
  html.view-bracket,
  html.view-bracket body { background-attachment: scroll; }
  html.view-bracket main.container {
    padding: 16px 14px 0;
  }
  html.view-bracket .bracket-scroll {
    margin: 0 -14px;
    padding: 4px 0 0 10px;
    scroll-padding-inline: 14px;
  }
  html.view-bracket .foot {
    padding: 8px 14px calc(10px + env(safe-area-inset-bottom, 0px));
    font-size: 10px;
  }
  .bracket-aside {
    width: auto;
    left: 10px;
    right: 10px;
    top: auto;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    max-height: min(62vh, 520px);
  }

  .team-drawer { width: min(100%, 420px); }
  .drawer-body { padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }

  #liveToasts {
    right: 10px;
    left: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    align-items: stretch;
  }
  .live-toast { min-width: 0; max-width: none; width: 100%; }
}

@media (max-height: 720px) {
  html.view-bracket .foot { display: none; }
}

@media (max-width: 560px) {
  .hero-head { min-height: 52px; }
  .hero-bg { object-position: 72% 96%; }
  .hero-kicker { font-size: 9.5px; letter-spacing: 1px; margin-bottom: 3px; }
  .legend { gap: 10px; }
  .lg { font-size: 12px; }

  .nm-head { flex-wrap: wrap; gap: 8px; }
  .nm-timer { gap: 4px; }
  .nm-val { font-size: 16px; }
  .nm-unit { min-width: 26px; }

  .fx-match {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .fx-team.home,
  .fx-team.away {
    justify-content: center;
    text-align: center;
    width: 100%;
  }
  .fx-score { min-width: unset; justify-content: center; }
  .score,
  .k-score {
    width: 44px;
    height: 40px;
    font-size: 16px;
  }
  .k-score { width: 40px; height: 38px; }

  .match-expand {
    width: 36px;
    height: 36px;
  }
  .match-expand-icon { width: 17px; height: 17px; }
  .pen-btn { min-height: 36px; padding: 6px 10px; }

  /* Kalender på telefon: datumet blir en horisontell rubrik, matchkorten
     behåller den centrerade layouten från ≤780px (rubrikrad + matchrad). */
  .cal-day { grid-template-columns: 1fr; gap: 6px; }
  .cal-date {
    position: static;
    flex-direction: row;
    align-items: baseline;
    gap: 8px;
    padding: 8px 10px;
    margin-bottom: 4px;
    width: 100%;
    border-radius: 10px;
  }
  .cal-dnum { font-size: 20px; margin: 0; }
  .cal-row { gap: 7px 8px; padding: 11px 13px; }
  .cal-match { gap: 8px; }
  .cal-side { font-size: 13px; gap: 5px; }
  .cal-score,
  .cal-vs { min-width: 34px; }

  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .matches-toggle { min-height: 44px; padding: 12px 9px; }
  .players-card { overflow-x: hidden; }
  .pm-card {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    border-radius: var(--radius) var(--radius) 0 0;
    padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 400px) {
  .topbar-inner { padding: 8px 10px 10px; }
  .nav .seg { font-size: 12px; padding: 10px 4px; }
  .controls .reset { padding: 8px 10px; font-size: 12px; }
  .container { padding: 14px 10px 8px; }
  .group-head { padding: 12px 12px 8px; }
  .matches-toggle { width: calc(100% - 24px); margin-left: 12px; margin-right: 12px; }
}

@media (hover: none) and (pointer: coarse) {
  .seg,
  .team-open,
  .matches-toggle,
  .cal-badge.cal-group-btn,
  .match-expand,
  .drawer-close,
  .cal-group-close,
  .sr-item {
    -webkit-tap-highlight-color: transparent;
  }
  .standings tbody tr[data-team]:active td {
    background: color-mix(in srgb, var(--usa-blue) 12%, transparent);
  }
  button.team-open:active,
  button.nm-spot-row:active {
    opacity: .85;
  }
}

/* ---------- Spelarlista i lag-lådan (live.js) ---------- */
.players-card .players-status { color: var(--ink-soft); font-size: 13px; padding: 4px 0; }
.players-empty { color: var(--ink-soft); font-size: 13px; line-height: 1.5; }
.players-empty .muted { color: var(--ink-soft); opacity: .8; font-size: 12px; }
.players-empty code {
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 6px; padding: 1px 5px; font-size: 11.5px;
}

/* Trupp indelad per position (Målvakter / Försvarare / …) */
.squad { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.squad-group-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--ink-soft); padding: 0 2px 4px;
  border-bottom: 1px solid var(--line); margin-bottom: 4px;
}
.squad-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--bg-soft); border: 1px solid var(--line);
  font-size: 11px; font-weight: 600; letter-spacing: 0;
}
.squad-source {
  margin: 0 0 8px; font-size: 12px; line-height: 1.45; color: var(--ink-soft);
}
.squad-updated {
  margin-top: 2px; font-size: 11.5px; color: var(--ink-soft); opacity: .85;
  text-align: right; font-variant-numeric: tabular-nums;
}
.player-list { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.player-row {
  display: grid; align-items: center; gap: 12px;
  grid-template-columns: minmax(0, 1fr) 7.5rem;
  width: 100%; text-align: left; cursor: pointer;
  background: transparent; border: 0; border-radius: var(--radius-sm);
  padding: 8px 6px; color: var(--ink); font: inherit;
  transition: background .12s ease;
}
.player-row:hover { background: var(--bg-soft); }
.pr-name {
  display: flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 500; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pr-meta {
  font-size: 12.5px; color: var(--ink-soft); text-align: right;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.pr-cap, .pm-cap {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%; flex: none;
  background: var(--accent); color: #fff;
  font-size: 9.5px; font-weight: 800; letter-spacing: 0; line-height: 1;
}
.pm-cap { width: 18px; height: 18px; font-size: 10.5px; margin-left: 8px; vertical-align: middle; }

/* ---------- Spelarprofil (modal) ---------- */
.player-modal { position: fixed; inset: 0; z-index: 80; display: none; }
.player-modal.open { display: block; }
.pm-backdrop { position: absolute; inset: 0; background: rgba(8,14,22,.55); backdrop-filter: blur(2px); }
.pm-card {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(440px, calc(100vw - 32px)); background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 22px;
}
.pm-close {
  position: absolute; top: 12px; right: 12px; width: 32px; height: 32px;
  border: 0; border-radius: 8px; background: var(--bg-soft); color: var(--ink-soft);
  font-size: 20px; line-height: 1; cursor: pointer;
}
.pm-close:hover { background: var(--line); }
.pm-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; padding-right: 32px; }
.pm-photo { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 2px solid var(--line); flex: none; }
.pm-photo.placeholder {
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-soft); color: var(--ink-soft); font-size: 26px; font-weight: 700;
}
.pm-id h3 { margin: 0; font-size: 19px; }
.pm-sub { color: var(--ink-soft); font-size: 13px; }
.pm-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pm-stat {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 12px 6px;
}
.pm-val { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pm-lbl { font-size: 11px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; }
.pm-info { margin-top: 16px; display: flex; flex-direction: column; }
.pm-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 9px 2px; border-top: 1px solid var(--line); font-size: 14px;
}
.pm-row:first-child { border-top: 0; }
.pm-row-lbl { color: var(--ink-soft); font-size: 13px; flex: none; }
.pm-row-val { font-weight: 500; text-align: right; min-width: 0; }
.pm-note { margin-top: 16px; font-size: 12px; color: var(--ink-soft); text-align: center; }

/* ---------- Mål-notiser (WebSocket) ---------- */
#liveToasts { position: fixed; right: 16px; bottom: 16px; z-index: 90; display: flex; flex-direction: column; gap: 10px; }
.live-toast {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line);
  border-left: 4px solid var(--live); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); padding: 12px 16px;
  min-width: 240px; max-width: 340px;
  opacity: 0; transform: translateX(20px); transition: opacity .35s ease, transform .35s ease;
}
.live-toast.show { opacity: 1; transform: translateX(0); }
.lt-ic { font-size: 22px; }
.lt-title { font-weight: 700; font-size: 14px; }
.lt-sub { font-size: 12.5px; color: var(--ink-soft); }

/* WebSocket-ansluten: liten grön prick i sync-badgen */
.sync-badge.ws-on::before {
  content: "";
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--adv);
  margin-right: 6px;
  vertical-align: middle;
  box-shadow: 0 0 6px color-mix(in srgb, var(--adv) 70%, transparent);
}

/* Auto-sync badge (football-data) */
.sync-badge {
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: #fff;
  border-radius: 999px; padding: 4px 10px; white-space: nowrap;
}
.sync-badge.ok {
  background: linear-gradient(90deg, var(--adv), color-mix(in srgb, var(--adv) 80%, #0a3d2a));
  border: 1px solid color-mix(in srgb, var(--adv) 55%, #fff);
}
.sync-badge.pending {
  background: color-mix(in srgb, var(--usa-navy) 85%, #fff);
  border: 1px solid color-mix(in srgb, var(--usa-navy) 50%, #fff);
}
.sync-badge.error {
  background: color-mix(in srgb, #8a3b28 90%, #000);
  border: 1px solid color-mix(in srgb, #c0392b 45%, #fff);
}

.score-display {
  display: inline-block; min-width: 1.4em; text-align: center;
  font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.score-display.score-empty { color: var(--ink-soft); font-weight: 600; }
.side .score-display { margin-left: auto; min-width: 1.6em; font-size: 14px; }

/* ---------- Ljust läge: dämpa mörka gradienter ---------- */
@media (prefers-color-scheme: light) {
  body {
    background-image:
      radial-gradient(1100px 540px at 88% -8%, rgba(196, 30, 58, .06), transparent 62%),
      radial-gradient(1000px 520px at 2% -4%, rgba(61, 109, 181, .08), transparent 60%);
  }
  .card, .next-matches, .cal-shell, .cal-row, .cal-date {
    background: var(--card);
  }
  .cal-dnum { color: var(--ink); }
}
