:root {
  --bg: #f2f3ee;
  --surface: #ffffff;
  --surface-soft: #f7f8f4;
  --ink: #111713;
  --muted: #6f776f;
  --line: #dfe3dc;
  --green: #0c6b44;
  --green-soft: #dcefe5;
  --lime: #c7f345;
  --red: #ea3d35;
  --shadow: 0 12px 40px rgba(24, 38, 28, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "DM Sans", sans-serif;
  transition: background 180ms ease, color 180ms ease;
}

.pull-refresh {
  position: fixed;
  z-index: 20;
  top: 0;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 0 0 12px 12px;
  background: var(--surface);
  color: var(--muted);
  font-size: 9px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -110%);
  transition: transform 160ms ease, opacity 160ms ease;
  box-shadow: var(--shadow);
}

.pull-refresh.is-visible { opacity: 1; }
.pull-refresh.is-refreshing { transform: translate(-50%, 0) !important; }
.pull-refresh__spinner { width: 12px; height: 12px; border: 2px solid var(--line); border-top-color: var(--green); border-radius: 50%; }
.pull-refresh.is-refreshing .pull-refresh__spinner { animation: spin 700ms linear infinite; }

button, a { font: inherit; }
button { color: inherit; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1440px;
  margin: auto;
  padding: 22px 32px;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  color: inherit;
  font-family: Manrope, sans-serif;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.5px;
  text-decoration: none;
}

.brand strong { color: var(--green); }

.brand__ball {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--lime);
  font-size: 11px;
  letter-spacing: -0.2px;
}

.topbar__actions { display: flex; align-items: center; gap: 18px; }

.sync-status {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.sync-status span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #23a36a;
  box-shadow: 0 0 0 4px rgba(35, 163, 106, 0.12);
}

.icon-button, .text-button {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
}

main {
  max-width: 1440px;
  margin: auto;
  padding: 18px 32px 48px;
}

[hidden] { display: none !important; }

.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  padding: 52px clamp(24px, 5vw, 72px);
  border-radius: 28px;
  background:
    radial-gradient(circle at 82% 15%, rgba(199, 243, 69, 0.32), transparent 23%),
    linear-gradient(125deg, #092d20, #0d573b);
  color: white;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--green);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.7px;
  text-transform: uppercase;
}

.hero .eyebrow { color: var(--lime); }

h1, h2, p { margin-top: 0; }

h1, h2 {
  font-family: Manrope, sans-serif;
  letter-spacing: -1.5px;
}

h1 {
  max-width: 650px;
  margin-bottom: 12px;
  font-size: clamp(38px, 6vw, 76px);
  line-height: 0.98;
}

.hero__copy { margin-bottom: 0; color: rgba(255, 255, 255, 0.68); }

.hero__meta {
  min-width: 210px;
  padding-left: 28px;
  border-left: 1px solid rgba(255, 255, 255, 0.18);
}

.hero__meta span, .hero__meta small { display: block; color: rgba(255, 255, 255, 0.62); font-size: 11px; }
.hero__meta strong { display: block; margin: 8px 0 3px; font-size: 20px; }
.hero__meta strong span { display: inline; color: white; font-size: inherit; }

.filters { display: flex; gap: 8px; margin: 26px 0; overflow-x: auto; }
.filters--primary { margin-top: 0; }

.filter {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.filter span {
  display: grid;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  place-items: center;
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 9px;
}

.filter .filter__live { background: var(--red); color: white; }
.filter.is-active { border-color: var(--ink); background: var(--ink); color: white; }
.filter--overview { margin-left: 4px; border-style: dashed; }

.dashboard {
  display: block;
}

.section-heading, .panel__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-heading { margin: 34px 4px 16px; }
.section-heading h2, .panel__heading h2 { margin: 0; font-size: 24px; }
.timezone { color: var(--muted); font-size: 10px; }

.match-list { display: grid; gap: 24px; }
.match-day { display: grid; gap: 8px; }
.match-day__games { display: grid; gap: 8px; }

.match-day__heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  padding: 0 4px 4px;
}

.match-day__heading div { display: flex; align-items: baseline; gap: 8px; }
.match-day__heading h3 { margin: 0; font-family: Manrope, sans-serif; font-size: 14px; letter-spacing: -0.5px; }
.match-day__heading span, .match-day__heading small { color: var(--muted); font-size: 8px; }

.match-card {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) 86px;
  align-items: center;
  min-height: 98px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface);
  transition: transform 150ms ease, border-color 150ms ease;
}

.match-card:hover { transform: translateY(-2px); border-color: #bdc6bc; }
.match-card.is-live { border-left: 4px solid var(--red); cursor: pointer; }
.match-card.is-live:hover { border-color: var(--red); }
.match-card.is-live:focus-visible { outline: 3px solid rgba(234, 61, 53, 0.28); outline-offset: 3px; }

.match-time { color: var(--muted); font-size: 11px; font-weight: 700; }
.match-time strong { display: block; margin-bottom: 3px; color: var(--ink); font-size: 13px; }
.match-time .live-label { color: var(--red); }

.teams { display: grid; gap: 10px; }

.team-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 22px;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 700;
}

.team-row strong { text-align: right; font-size: 16px; }
.team-row.is-losing { color: var(--muted); font-weight: 500; }

.flag {
  display: block;
  width: 20px;
  height: 14px;
  border: 1px solid rgba(0, 0, 0, 0.09);
  border-radius: 2px;
  background: #ddd;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.flag-image { object-fit: contain; background: white; }

.flag--mx { background: linear-gradient(90deg, #147b4b 33%, white 33% 66%, #ce2736 66%); }
.flag--za { background: linear-gradient(145deg, #007a4d 40%, #ffb81c 40% 52%, #de3831 52%); }
.flag--ca { background: linear-gradient(90deg, #d22630 25%, white 25% 75%, #d22630 75%); }
.flag--ch { background: #d52b1e; }
.flag--us { background: repeating-linear-gradient(#b22234 0 2px, white 2px 4px); }
.flag--py { background: linear-gradient(#d52b1e 33%, white 33% 66%, #0038a8 66%); }
.flag--br { background: #149447; }
.flag--ma { background: #c1272d; }
.flag--de { background: linear-gradient(#161616 33%, #d3232a 33% 66%, #f0c800 66%); }
.flag--ec { background: linear-gradient(#fcd116 50%, #003893 50% 75%, #ce1126 75%); }
.flag--jp { background: radial-gradient(circle, #bc002d 0 35%, white 36%); }
.flag--au { background: #012169; }

.match-meta {
  padding-left: 14px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: 9px;
  line-height: 1.6;
}

.match-meta strong { display: block; color: var(--ink); font-size: 10px; }
.match-meta > span:first-of-type { display: block; }

.broadcast-badge {
  display: inline-grid;
  width: fit-content;
  min-width: 34px;
  margin-top: 6px;
  padding: 3px 6px;
  place-items: center;
  border-radius: 4px;
  background: white;
  color: #111713;
  font-size: 7px;
  font-weight: 800;
  letter-spacing: -0.2px;
  line-height: 1;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.14);
}

.broadcast-badge--ard { border-left: 5px solid #1783bd; }
.broadcast-badge--zdf { border-left: 5px solid #f28c22; }
.broadcast-badge--magenta { border-left: 5px solid #e20074; }

.panel {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
}

.panel__heading { margin-bottom: 20px; }
.panel__heading .flag { width: 28px; height: 19px; }

.germany-next {
  padding: 18px;
  border-radius: 15px;
  background: var(--ink);
  color: white;
}

.date-chip {
  display: inline-block;
  margin-bottom: 16px;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--lime);
  color: #172016;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.germany-next__match { display: grid; grid-template-columns: 34px 1fr 34px; gap: 10px; align-items: center; }
.germany-next__match div { display: grid; gap: 3px; text-align: center; font-size: 11px; }
.germany-next__match div span { color: rgba(255, 255, 255, 0.5); font-size: 9px; }
.germany-next p { margin: 16px 0 0; color: rgba(255, 255, 255, 0.46); font-size: 9px; text-align: center; }

.team-badge {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  color: transparent;
  font-size: 0;
}

.mini-schedule { display: grid; margin-top: 12px; }
.mini-game { display: grid; grid-template-columns: 74px 1fr auto; padding: 12px 2px; border-bottom: 1px solid var(--line); font-size: 10px; }
.mini-game:last-child { border-bottom: 0; }
.mini-game span { color: var(--muted); }
.mini-game strong { font-size: 11px; }

.eyebrow--live { color: var(--red); }
.text-button { color: var(--green); font-size: 10px; font-weight: 800; }
.ticker { display: grid; gap: 1px; max-height: 285px; overflow: auto; }

.ticker-event {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  animation: arrive 300ms ease;
}

.ticker-event:last-child { border-bottom: 0; }
.ticker-event__minute { color: var(--red); font-size: 11px; font-weight: 800; }
.ticker-event p { margin: 0; font-size: 11px; line-height: 1.45; }
.ticker-event strong { display: block; margin-bottom: 2px; font-size: 10px; }

footer {
  display: flex;
  justify-content: space-between;
  max-width: 1440px;
  margin: auto;
  padding: 24px 32px 36px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
}

.match-dialog {
  width: min(590px, calc(100vw - 28px));
  max-height: min(760px, calc(100vh - 28px));
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 28px 90px rgba(5, 18, 11, 0.3);
}

.match-dialog::backdrop { background: rgba(6, 17, 11, 0.66); backdrop-filter: blur(6px); }
.match-dialog[open] { animation: dialog-in 180ms ease-out; }

.dialog-close {
  position: absolute;
  z-index: 2;
  top: 16px;
  right: 16px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: white;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.dialog-score {
  padding: 32px 26px 28px;
  border-radius: 23px 23px 0 0;
  background: linear-gradient(130deg, #082e20, #0d6241);
  color: white;
}

.dialog-score__meta { display: flex; gap: 8px; align-items: center; margin-bottom: 25px; color: rgba(255, 255, 255, 0.6); font-size: 10px; }
.dialog-score__meta .broadcast-badge { margin: 0 44px 0 auto; }
.dialog-score__live { padding: 5px 8px; border-radius: 999px; background: var(--red); color: white; font-weight: 800; }
.dialog-score__teams { display: grid; grid-template-columns: 1fr auto 1fr; gap: 18px; align-items: center; }
.dialog-team { display: grid; justify-items: center; gap: 10px; text-align: center; font-size: 13px; font-weight: 700; }
.dialog-team .flag { width: 48px; height: 32px; border-radius: 5px; }
.dialog-result { font-family: Manrope, sans-serif; font-size: 42px; font-weight: 800; letter-spacing: -3px; white-space: nowrap; }

.dialog-body { padding: 24px 26px 28px; }
.dialog-body__heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dialog-body__heading h2 { margin: 0; font-size: 20px; }
.dialog-body__heading span { color: var(--muted); font-size: 9px; }
.dialog-news { display: grid; }
.dialog-news .ticker-event { grid-template-columns: 40px 1fr; padding: 16px 0; }
.dialog-news .ticker-event p { font-size: 12px; }
.dialog-news .ticker-event strong { font-size: 11px; }
.lineup-heading { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); }
.dialog-lineups { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.lineup-column h3 { margin: 10px 0; font-family: Manrope, sans-serif; font-size: 12px; }
.lineup-column ul { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.lineup-column li { display: grid; grid-template-columns: 24px 1fr; gap: 7px; align-items: center; padding: 7px 6px; border-radius: 7px; color: var(--muted); font-size: 9px; }
.lineup-column li.is-playing { background: var(--green-soft); color: var(--ink); }
.lineup-column li strong, .lineup-column li small { display: block; }
.lineup-column li small { margin-top: 1px; color: var(--muted); font-size: 7px; }
.player-number { display: grid; width: 21px; height: 21px; place-items: center; border-radius: 50%; background: var(--surface-soft); font-size: 8px; font-weight: 800; }
.lineup-empty { grid-column: 1 / -1; margin: 12px 0 0; padding: 18px; border-radius: 9px; background: var(--surface-soft); color: var(--muted); font-size: 10px; text-align: center; }

.tournament-view { display: grid; gap: 8px; }

.tournament-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  padding: 42px clamp(24px, 5vw, 64px);
  border-radius: 24px;
  background:
    radial-gradient(circle at 80% 20%, rgba(199, 243, 69, 0.28), transparent 22%),
    linear-gradient(125deg, #092d20, #0d573b);
  color: white;
}

.tournament-hero h1 { margin-bottom: 10px; font-size: clamp(38px, 5vw, 64px); }
.tournament-hero p { max-width: 620px; margin-bottom: 0; color: rgba(255, 255, 255, 0.65); }
.tournament-hero .eyebrow { color: var(--lime); }

.update-chip {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 9px;
}

.update-chip span { width: 6px; height: 6px; border-radius: 50%; background: var(--lime); }
.update-chip strong { color: white; }

.overview-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin: 42px 4px 14px;
}

.overview-heading h2 { margin: 0; font-size: 26px; }
.overview-heading > span { color: var(--muted); font-size: 9px; }

.groups-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.group-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
}

.group-card__heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 11px; }
.group-card__heading h3 { margin: 0; font-family: Manrope, sans-serif; font-size: 13px; }
.group-card__heading span { color: var(--muted); font-size: 7px; }
.group-table { display: grid; }

.group-row {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  min-height: 31px;
  border-top: 1px solid var(--line);
  font-size: 10px;
}

.group-row > strong { color: var(--muted); font-size: 8px; }
.group-row > span { font-weight: 600; }
.group-row small { color: var(--muted); font-size: 8px; }
.group-row small b { color: var(--ink); }
.group-row.is-qualified > strong { color: var(--green); }
.group-row.is-third > strong { color: #c78a11; }

.bracket-wrap { padding-bottom: 10px; overflow-x: auto; }

.bracket {
  display: grid;
  grid-template-columns: repeat(5, minmax(180px, 1fr));
  gap: 12px;
  min-width: 1020px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface-soft);
}

.bracket-round { display: grid; align-content: start; }
.bracket-round__heading { margin-bottom: 12px; }
.bracket-round__heading h3 { margin: 0 0 2px; font-family: Manrope, sans-serif; font-size: 12px; }
.bracket-round__heading span { color: var(--muted); font-size: 8px; }
.bracket-games { display: grid; align-content: space-around; height: 100%; gap: 11px; }

.bracket-game {
  position: relative;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.bracket-game.is-live { border-color: var(--red); }
.bracket-game div { display: flex; justify-content: space-between; gap: 6px; padding: 4px 0; font-size: 9px; font-weight: 600; }
.bracket-game div + div { border-top: 1px solid var(--line); }
.bracket-game small { position: absolute; top: -7px; right: 7px; padding: 2px 4px; border-radius: 4px; background: var(--red); color: white; font-size: 6px; font-weight: 800; }
.bracket-game p { margin: 5px 0 0; padding-top: 5px; border-top: 1px solid var(--line); color: var(--muted); font-size: 7px; }

body.dark {
  --bg: #101411;
  --surface: #171c18;
  --surface-soft: #202620;
  --ink: #f2f5ef;
  --muted: #929b92;
  --line: #2b332c;
  --green: #77d8a8;
  --green-soft: #193d2b;
  --shadow: none;
}

body.dark .brand__ball, body.dark .germany-next { background: #edf4ed; color: #111713; }

@keyframes arrive {
  from { opacity: 0; transform: translateY(-8px); }
}

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 900px) {
  .dashboard { grid-template-columns: 1fr; }
  .groups-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 650px) {
  .topbar, main, footer { padding-left: 16px; padding-right: 16px; }
  .sync-status { display: none; }
  .hero { align-items: start; flex-direction: column; gap: 30px; padding: 34px 24px; border-radius: 22px; }
  .hero__meta { padding: 0; border: 0; }
  .match-card { grid-template-columns: 58px 1fr; }
  .match-meta { display: none; }
  .tournament-hero { align-items: start; flex-direction: column; gap: 24px; padding: 32px 24px; }
  .groups-grid { grid-template-columns: 1fr; }
  .overview-heading > span { display: none; }
  .dialog-lineups { grid-template-columns: 1fr; }
}
