:root {
  --red: #d71920;
  --red-2: #ef2330;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --paper: #ffffff;
  --bg: #f3f4f6;
  --blue: #2563eb;
  --green: #16a34a;
  --gold: #facc15;
  --dark: #0f172a;
  --dark-2: #1e293b;
  --radius: 20px;
  --shadow: 0 10px 24px rgba(17,24,39,.08);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; cursor: pointer; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: calc(16px + env(safe-area-inset-top)) 14px 12px;
  background: linear-gradient(135deg, var(--red), var(--red-2));
  color: white;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
}

.brand-row {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.brand-title {
  margin: 0 0 10px;
  font-size: clamp(27px, 4vw, 40px);
  line-height: 1;
  font-weight: 1000;
  letter-spacing: -.8px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 7px 11px;
  background: rgba(17,24,39,.22);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 999px;
  font-weight: 900;
  font-size: 12px;
  backdrop-filter: blur(10px);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(22,163,74,.24);
}

.install-button {
  border: 0;
  border-radius: 13px;
  background: var(--dark);
  color: white;
  min-height: 42px;
  padding: 0 16px;
  font-weight: 1000;
}

.tabs {
  margin-top: 13px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
}

.tab {
  border: 1px solid rgba(255,255,255,.34);
  border-radius: 14px;
  padding: 12px 4px;
  background: rgba(255,255,255,.16);
  color: white;
  font-size: 12px;
  font-weight: 1000;
}

.tab.is-active {
  background: white;
  color: var(--red);
}

main {
  padding: 14px;
  padding-bottom: calc(22px + env(safe-area-inset-bottom));
}

.view { display: none; }
.view.is-active { display: block; }
.grid { display: grid; gap: 14px; }

.date-section {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.date-heading {
  margin: 2px 0 -2px;
  color: #374151;
  font-weight: 1000;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.match-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.match-card.is-live {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(22,163,74,.15), var(--shadow);
}

.match-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 1000;
  border-bottom: 1px solid #eef0f3;
}

.tv-pill {
  flex: 0 0 auto;
  color: #b91c1c;
  background: #fff7f7;
  border: 1px solid #fecaca;
  border-radius: 999px;
  padding: 5px 9px;
}

.scoreboard {
  display: grid;
  grid-template-columns: 1fr 86px 1fr;
  align-items: center;
  gap: 12px;
  padding: 20px 16px 12px;
}

.team-panel { text-align: center; min-width: 0; }
.flag { font-size: 46px; line-height: 1; margin-bottom: 6px; }
.abbr { font-size: 20px; font-weight: 1000; line-height: 1; }
.name { margin-top: 4px; color: var(--muted); font-size: 13px; }

.score-panel { text-align: center; }
.score-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 42px;
  line-height: 1;
  font-weight: 1000;
}

.clock {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 9px;
  border-radius: 10px;
  background: #f3f4f6;
  border: 1px solid #d9dee7;
  font-size: 13px;
  font-weight: 1000;
}
.clock.is-live { color: var(--green); border-color: rgba(22,163,74,.3); }

.scorers {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  gap: 12px;
  padding: 10px 16px 16px;
  color: #374151;
  font-size: 13px;
}
.scorer-divider { background: #d1d5db; min-height: 24px; }
.goal { margin: 3px 0; line-height: 1.35; }
.no-goals { color: #9ca3af; }

.details {
  border-top: 1px solid #eef0f3;
  padding: 13px 16px;
  background: #fafafa;
}
summary {
  color: var(--blue);
  cursor: pointer;
  font-weight: 1000;
}
.detail-grid { display: grid; gap: 8px; margin-top: 11px; }
.detail-item {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px;
  color: #374151;
  font-size: 13px;
}
a { color: var(--blue); text-decoration: none; font-weight: 900; }

.section-title {
  margin: 18px 0 10px;
  font-size: 20px;
  font-weight: 1000;
}

.bracket-images {
  display: grid;
  gap: 14px;
}

.bracket-figure {
  margin: 0;
  background: #071a4a;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid #1d4ed8;
}

.bracket-figure img {
  display: block;
  width: 100%;
  height: auto;
}

.bracket-figure figcaption {
  padding: 10px 14px;
  background: #07111f;
  color: white;
  font-size: 13px;
  font-weight: 1000;
}

.fixture-columns {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 10px;
  scrollbar-width: thin;
}
.fixture-round { min-width: 280px; display: grid; gap: 12px; }
.round-title {
  padding: 10px;
  border-radius: 14px;
  background: var(--dark);
  color: white;
  text-align: center;
  font-weight: 1000;
}
.fixture-card {
  background: var(--dark);
  color: white;
  border-radius: 18px;
  padding: 13px;
  box-shadow: var(--shadow);
}
.fixture-team {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin: 6px 0;
  padding: 9px;
  border-radius: 12px;
  background: var(--dark-2);
  font-weight: 900;
}
.fixture-meta {
  color: var(--gold);
  text-align: center;
  margin-top: 9px;
  font-size: 12px;
  font-weight: 1000;
}

.group-title {
  margin: 18px 0 8px;
  font-size: 19px;
  font-weight: 1000;
}
.table-wrap {
  overflow-x: auto;
  border-radius: 18px;
  box-shadow: var(--shadow);
}
table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  font-size: 13px;
}
th, td {
  padding: 10px 8px;
  border-bottom: 1px solid #eef0f3;
  text-align: center;
  white-space: nowrap;
}
th { background: var(--dark); color: white; font-size: 12px; }
td.team-cell { text-align: left; font-weight: 1000; }

.empty, .loading, .error {
  background: white;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 18px;
  box-shadow: var(--shadow);
}
.error { color: #b91c1c; }

.install-toast {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--dark);
  color: white;
  border-radius: 18px;
  padding: 12px;
  box-shadow: 0 14px 40px rgba(0,0,0,.3);
  z-index: 40;
}
.install-toast.show { display: flex; }
.install-toast button {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  background: white;
  color: var(--dark);
  font-weight: 1000;
}

@media (max-width: 650px) {
  .tabs { overflow-x: auto; display: flex; }
  .tab { min-width: 92px; }
  .scoreboard { grid-template-columns: 1fr 78px 1fr; padding: 18px 12px 10px; }
  .score-line { font-size: 36px; }
  .flag { font-size: 40px; }
  .abbr { font-size: 18px; }
  .name { font-size: 12px; }
  .match-head { align-items: start; flex-direction: column; }
}

@media (min-width: 1000px) {
  main { padding: 18px 24px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .date-section { display: block; }
  .date-section .match-card { margin-bottom: 14px; }
  .bracket-images { grid-template-columns: minmax(360px, 520px) 1fr; align-items: start; }
  .bracket-figure.wide { align-self: stretch; }
}

/* v4 knockout board: no static images */
.bracket-images,
.bracket-figure { display: none !important; }

.bracket-board {
  background: radial-gradient(circle at 50% 18%, rgba(37,99,235,.35), transparent 32%), linear-gradient(150deg, #071a4a, #020617);
  border: 1px solid #1d4ed8;
  border-radius: 28px;
  padding: 16px;
  color: white;
  box-shadow: 0 18px 42px rgba(2,6,23,.28);
  overflow: hidden;
}

.bracket-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.bracket-topline h2 {
  margin: 0;
  font-size: clamp(26px, 5vw, 48px);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.bracket-topline p {
  margin: 6px 0 0;
  color: #bfdbfe;
  font-weight: 800;
  font-size: 13px;
}

.cup-mark {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(180deg, #fde68a, #f59e0b);
  box-shadow: 0 0 30px rgba(250,204,21,.35);
  font-size: 38px;
  flex: 0 0 auto;
}

.bracket-columns {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(250px, 290px);
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x proximity;
}

.bracket-round { scroll-snap-align: start; }

.round-title {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.18);
  color: white;
  border-radius: 14px;
  padding: 10px;
  margin-bottom: 10px;
  text-align: center;
  font-weight: 1000;
  position: sticky;
  top: 0;
  backdrop-filter: blur(10px);
}

.fixture-card {
  background: rgba(15,23,42,.92);
  border: 1px solid rgba(148,163,184,.22);
  border-radius: 18px;
  padding: 11px;
  margin-bottom: 12px;
  box-shadow: 0 10px 22px rgba(0,0,0,.22);
}

.fixture-card.is-live { border-color: rgba(34,197,94,.8); }
.fixture-card.is-final { opacity: .86; }

.fixture-team {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  padding: 8px 10px;
  background: rgba(30,41,59,.92);
  border-radius: 13px;
  margin: 6px 0;
  font-weight: 1000;
}

.fixture-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fixture-score {
  min-width: 36px;
  text-align: center;
  background: #020617;
  border-radius: 9px;
  padding: 5px 8px;
}

.fixture-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 9px;
  color: #facc15;
  font-size: 12px;
  font-weight: 1000;
}

.fixture-tv {
  text-align: center;
  margin-top: 7px;
  color: #fecaca;
  font-weight: 1000;
  font-size: 12px;
}

@media (min-width: 900px) {
  .tabs { grid-template-columns: repeat(5, minmax(120px, 1fr)); }
  main { padding: 18px 28px; }
  .scoreboard { grid-template-columns: 1fr 140px 1fr; }
  .match-card { border-radius: 24px; }
}

@media (max-width: 560px) {
  .tabs { grid-template-columns: repeat(3, 1fr); }
  .tab { padding: 10px 2px; }
  .brand-title { font-size: 26px; }
  .scoreboard { grid-template-columns: 1fr 76px 1fr; gap: 8px; padding: 16px 10px 10px; }
  .score-line { font-size: 34px; }
  .abbr { font-size: 18px; }
  .flag { font-size: 40px; }
}


/* Custom install prompt removed */
.install-button,
.install-toast,
#installButton,
#installToast,
#installToastButton {
  display: none !important;
}


.install-button,
.install-toast,
#installButton,
#installToast,
#installToastButton {
  display: none !important;
}
