:root {
  color-scheme: light;
  --bg: #f7f4ed;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #5d6978;
  --line: #dde2e8;
  --accent: #087e8b;
  --accent-strong: #0b5563;
  --gold: #d19826;
  --danger: #a83f39;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  background: #000000;
  color: #ffffff;
  padding: 28px clamp(16px, 4vw, 56px);
}

.header-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: end;
  max-width: 1180px;
  margin: 0 auto;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.header-logo {
  width: clamp(58px, 9vw, 86px);
  height: clamp(58px, 9vw, 86px);
  object-fit: contain;
  flex: 0 0 auto;
}

.subtitle {
  margin: 12px 0 0;
  color: #cbd7e3;
  max-width: 620px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 999px;
  color: #dbe8ef;
  white-space: nowrap;
}

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px clamp(16px, 4vw, 56px) 48px;
  width: 100%;
  flex: 1;
}

footer {
  border-top: 1px solid var(--line);
  background: #ffffff;
  color: var(--muted);
  padding: 16px clamp(16px, 4vw, 56px);
  font-size: 0.84rem;
}

.footer-inner {
  display: flex;
  justify-content: center;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  max-width: 1180px;
  margin: 0 auto;
  text-align: center;
}

.footer-separator {
  color: #a8b2bd;
}

.footer-button {
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  padding: 0;
  cursor: pointer;
  font-weight: 700;
}

.footer-link {
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration: none;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 24px;
}

.tabs {
  display: inline-grid;
  grid-template-columns: repeat(4, 1fr);
  background: #e7ecef;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px;
}

.tab {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  min-width: 112px;
  min-height: 36px;
  cursor: pointer;
}

.tab[aria-selected="true"] {
  background: var(--panel);
  color: var(--accent-strong);
  box-shadow: 0 1px 4px rgba(23, 32, 42, 0.13);
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.groups {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.group {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.group h2 {
  margin: 0;
  padding: 14px 16px;
  font-size: 1rem;
  border-bottom: 1px solid var(--line);
  background: #f9fbfc;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  vertical-align: middle;
}

th:first-child,
td:first-child,
th:nth-child(2),
td:nth-child(2) {
  text-align: left;
}

th {
  color: var(--muted);
  font-weight: 650;
  font-size: 0.75rem;
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.rank {
  width: 1%;
  white-space: nowrap;
  font-weight: 800;
}

.owner-with-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.prize-note,
.prize-row-note,
.muted {
  color: var(--muted);
}

.prize-note {
  margin: -4px 16px 14px;
  font-size: 0.88rem;
  line-height: 1.45;
}

.prize-row-note {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
  line-height: 1.35;
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1;
}

.sweepstake-rank-first td {
  background: #fff2c7;
  border-bottom-color: #e4c05a;
}

.sweepstake-rank-first td:first-child {
  box-shadow: inset 4px 0 0 #d19826;
}

.sweepstake-rank-first .rank-badge {
  background: #d19826;
  color: #221604;
}

.sweepstake-rank-second td {
  background: #f2f5f8;
  border-bottom-color: #c3ccd6;
}

.sweepstake-rank-second td:first-child {
  box-shadow: inset 4px 0 0 #9aa6b2;
}

.sweepstake-rank-second .rank-badge {
  background: #c8d0d8;
  color: #25313d;
}

.sweepstake-rank-last td {
  background: #f5eadc;
  border-bottom-color: #d6b789;
}

.sweepstake-rank-last td:first-child {
  box-shadow: inset 4px 0 0 #9b6b32;
}

.sweepstake-rank-last .rank-badge {
  background: #9b6b32;
  color: #ffffff;
}

.owner-teams {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.owner-team {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.owner-team img {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.team-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.crest {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex: 0 0 auto;
}

.team-name {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 650;
}

.owner {
  display: block;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 650;
  margin-top: 2px;
}

.fixtures {
  display: grid;
  gap: 12px;
}

.match {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  width: 100%;
  color: inherit;
  cursor: pointer;
  text-align: inherit;
  font: inherit;
}

.match:hover {
  border-color: rgba(8, 126, 139, 0.45);
  box-shadow: 0 2px 10px rgba(23, 32, 42, 0.08);
}

.match-team {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.match-team.away {
  justify-content: flex-end;
  text-align: right;
}

.score {
  display: grid;
  gap: 4px;
  min-width: 86px;
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
}

.scoreline {
  color: var(--ink);
  font-size: 1.4rem;
  font-weight: 800;
}

.live-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 2px 8px;
  background: rgba(168, 63, 57, 0.1);
  color: var(--danger);
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.round {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.empty,
.error {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
}

.error {
  border-color: #e0aaa6;
  color: var(--danger);
}

.detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  background: rgba(23, 32, 42, 0.4);
  padding: clamp(12px, 3vw, 28px);
  overflow: auto;
}

.detail-overlay.visible {
  display: block;
}

.detail-panel {
  max-width: 980px;
  margin: 0 auto;
  background: var(--panel);
  border-radius: 8px;
  border: 1px solid var(--line);
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(23, 32, 42, 0.28);
}

.detail-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: #f9fbfc;
}

.detail-close {
  width: 40px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
  font-size: 1.3rem;
  line-height: 1;
}

.detail-title {
  margin: 0;
  font-size: clamp(1.2rem, 3vw, 2rem);
  line-height: 1.1;
}

.detail-meta {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.detail-body {
  display: grid;
  gap: 16px;
  padding: 16px;
}

.detail-score {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.detail-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 1px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.detail-divider {
  align-self: stretch;
  min-height: 34px;
  background: var(--line);
}

.detail-team {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.detail-team.away {
  justify-content: flex-end;
  text-align: right;
}

.detail-scoreline {
  font-size: 2rem;
  font-weight: 850;
  white-space: nowrap;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.detail-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  min-width: 0;
}

.detail-section h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.detail-load {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--accent-strong);
  padding: 0 12px;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.scorers-list,
.cards-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.scorers-list li,
.cards-list li {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.scorers-list strong,
.cards-list strong {
  color: var(--ink);
}

.away-list {
  text-align: right;
}

.event-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25em;
  margin-right: 0.35em;
}

.away-list .event-icon {
  margin-right: 0;
  margin-left: 0.35em;
}

.red-card-icon {
  display: inline-block;
  width: 0.72em;
  height: 1em;
  border-radius: 2px;
  background: #c5221f;
  vertical-align: -0.12em;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.cookie-banner {
  position: fixed;
  right: clamp(12px, 3vw, 28px);
  bottom: clamp(12px, 3vw, 28px);
  left: clamp(12px, 3vw, 28px);
  z-index: 20;
  display: none;
  max-width: 760px;
  margin-left: auto;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 45px rgba(23, 32, 42, 0.2);
  padding: 16px;
}

.cookie-banner.visible {
  display: block;
}

.cookie-banner h2 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.cookie-banner p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.cookie-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.cookie-actions button,
.cookie-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #ffffff;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.cookie-actions .primary {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
  color: #ffffff;
}

@media (max-width: 700px) {
  .header-inner {
    grid-template-columns: 1fr;
  }

  .brand-title {
    align-items: flex-start;
  }

  .toolbar {
    align-items: stretch;
  }

  .tabs {
    width: 100%;
  }

  .tabs {
    grid-template-columns: repeat(2, 1fr);
  }

  .tab {
    min-width: 0;
  }

  .match {
    grid-template-columns: 1fr;
  }

  .match-team.away {
    justify-content: flex-start;
    text-align: left;
  }

  .score {
    justify-self: start;
    text-align: left;
  }

  .detail-split {
    grid-template-columns: 1fr;
  }

  .detail-divider {
    min-height: 1px;
    width: 100%;
  }

  .away-list {
    text-align: left;
  }

  .footer-separator {
    display: none;
  }

  .cookie-actions button,
  .cookie-actions a {
    width: 100%;
  }
}
