:root {
  color-scheme: light;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-soft: #f0fdfa;
  --text: #0f172a;
  --muted: #64748b;
  --line: #ccfbf1;
  --line-2: #e2e8f0;
  --teal: #0f766e;
  --amber: #d97706;
  --danger: #be123c;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #f0fdfa, #fffbeb 260px, var(--bg) 620px);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100% - 24px));
  margin: 0 auto;
  padding: 18px 0 40px;
}

.league-menu,
.table-info,
.table-wrap {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.league-menu {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 10px;
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.tab {
  min-width: 136px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #334155;
  cursor: pointer;
  padding: 9px 13px;
  text-align: left;
  white-space: nowrap;
}

.tab[aria-pressed="true"] {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
}

.tab span {
  display: block;
  white-space: nowrap;
}

.tab span {
  font-size: 13px;
  font-weight: 900;
}

.table-info {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  margin-bottom: 12px;
  padding: 14px;
}

.view-controls {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  padding: 4px;
  box-shadow: var(--shadow);
}

.view-controls button {
  min-width: 132px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #475569;
  cursor: pointer;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 950;
  white-space: nowrap;
}

.view-controls button[aria-pressed="true"] {
  background: var(--teal);
  color: #fff;
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.2);
}

.league-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.league-card img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.league-card h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.1;
}

.table-wrap {
  overflow: hidden;
}

.fixtures-panel {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}

[hidden] {
  display: none !important;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th:nth-child(1),
td:nth-child(1) {
  width: 48px;
}

th:nth-child(2),
td:nth-child(2) {
  width: 150px;
}

th:nth-child(n + 3),
td:nth-child(n + 3) {
  width: 72px;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line-2);
  text-align: right;
  font-size: 14px;
  white-space: nowrap;
}

th {
  background: linear-gradient(90deg, #f0fdfa, #fffbeb);
  color: #475569;
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

th:nth-child(1),
td:nth-child(1) {
  position: sticky;
  left: 0;
  z-index: 3;
  background: #fff;
}

th:nth-child(1) {
  z-index: 5;
  background: #f0fdfa;
}

th:nth-child(2),
td:nth-child(2) {
  position: sticky;
  left: 48px;
  z-index: 3;
  background: #fff;
  box-shadow: 8px 0 14px rgba(15, 23, 42, 0.05);
}

th:nth-child(2) {
  z-index: 5;
  background: linear-gradient(90deg, #f0fdfa, #fffbeb);
}

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

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

tbody tr:hover {
  background: #fffbeb;
}

.pos {
  width: 52px;
  color: var(--muted);
  text-align: center;
  font-weight: 900;
}

.team {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 150px;
  min-width: 150px;
  max-width: 150px;
  font-weight: 900;
}

.team span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team img,
.crest-fallback {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: 50%;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 0 0 1px var(--line-2);
}

.positive {
  color: var(--teal);
  font-weight: 900;
}

.negative {
  color: var(--danger);
  font-weight: 900;
}

.points {
  color: var(--amber);
  font-weight: 1000;
}

.empty {
  padding: 32px 16px;
  color: var(--muted);
  text-align: center;
  font-weight: 800;
}

.notice {
  background: #fffbeb;
  color: #92400e;
  font-weight: 800;
  text-align: left;
  white-space: normal;
}

.fixture-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.fixture-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line-2);
  background: linear-gradient(90deg, #f0fdfa, #fffbeb);
  padding: 10px 12px;
}

.fixture-meta span {
  min-width: 0;
  overflow: hidden;
  color: var(--teal);
  font-size: 11px;
  font-weight: 950;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.fixture-meta strong {
  color: #334155;
  font-size: 12px;
  font-weight: 950;
  white-space: nowrap;
}

.fixture-teams {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 74px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 14px 12px;
}

.fixture-team {
  display: grid;
  gap: 7px;
  justify-items: center;
  min-width: 0;
  text-align: center;
}

.fixture-team img,
.fixture-team .crest-fallback {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 0 0 1px var(--line-2);
}

.fixture-team span {
  width: 100%;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 950;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fixture-score {
  display: grid;
  justify-items: center;
  gap: 5px;
}

.fixture-score strong {
  display: grid;
  place-items: center;
  min-width: 54px;
  min-height: 34px;
  border: 1px solid #fde68a;
  border-radius: 999px;
  background: #fffbeb;
  color: var(--amber);
  font-size: 13px;
  font-weight: 1000;
}

.fixture-score span {
  border-radius: 999px;
  background: #ecfdf5;
  color: var(--teal);
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 950;
  white-space: nowrap;
}

.status {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 20;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ecfdf5;
  color: var(--muted);
  padding: 9px 12px;
  box-shadow: var(--shadow);
  font-size: 12px;
  font-weight: 900;
}

.status[data-tone="ready"] {
  color: var(--teal);
}

.status[data-tone="error"] {
  color: var(--danger);
  background: #fff1f2;
  border-color: #fecdd3;
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 18px, 1180px);
    padding-top: 10px;
  }

  .table-info {
    align-items: flex-start;
    flex-direction: column;
  }

  .table-wrap {
    overflow-x: auto;
  }

  .view-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .view-controls button {
    min-width: 0;
  }

  .fixtures-panel {
    grid-template-columns: 1fr;
  }

  th,
  td {
    padding: 10px 8px;
  }
}
