/* ── VARIABLES & RESET ─────────────────────────────────────────────────────── */
:root {
  --red:    #E8192C;
  --dark:   #0d0d0d;
  --dark2:  #161616;
  --dark3:  #1f1f1f;
  --dark4:  #2a2a2a;
  --border: #2e2e2e;
  --text:   #f0f0f0;
  --muted:  #888;
  --edited: #f5a623;
  --champ:  #1a6bc4;
  --clq:    #5ea3ee;
  --eclq:   #1aca63;
  --rel:    #b02020;
  --green:  #27ae60;
}

body.light {
  --dark:   #f4f4f4;
  --dark2:  #ffffff;
  --dark3:  #ebebeb;
  --dark4:  #e0e0e0;
  --border: #d0d0d0;
  --text:   #111111;
  --muted:  #666666;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--dark);
  color: var(--text);
  font-family: 'Barlow', sans-serif;
  font-size: 16px; /* was 14px — scaled up */
  min-height: 100vh;
}

/* ── HEADER ────────────────────────────────────────────────────────────────── */
header {
  background: var(--dark2);
  border-bottom: 3px solid var(--red);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 12px;
}

.logo {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900;
  font-size: 24px;
  letter-spacing: .04em;
  white-space: nowrap;
  flex-shrink: 0;
}
.logo span { color: var(--red); }

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
  min-width: 0;
}

/* ── HEADER CONTROLS ───────────────────────────────────────────────────────── */
.edited-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.edited-legend-bar { width: 3px; height: 14px; background: var(--edited); border-radius: 1px; }

.reset-all-btn {
  padding: 7px 14px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 4px;
  transition: all .2s;
  white-space: nowrap;
}
.reset-all-btn:hover { border-color: var(--edited); color: var(--edited); }

.theme-btn {
  width: 34px; height: 34px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 17px;
  cursor: pointer;
  border-radius: 4px;
  transition: all .2s;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.theme-btn:hover { border-color: var(--text); color: var(--text); }

.phase-toggle {
  display: flex;
  background: var(--dark3);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}
.phase-btn {
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.phase-btn.active { background: var(--red); color: #fff; }

/* ── MOBILE NAV (hidden on desktop) ───────────────────────────────────────── */
.mobile-nav {
  display: none;
  align-items: center;
  justify-content: space-between;
  background: var(--dark2);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
}
.mobile-nav-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 22px;
  width: 40px; height: 40px;
  border-radius: 4px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.mobile-nav-btn:hover { background: var(--dark3); }
.mobile-nav-label {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: .06em;
  color: var(--red);
}

/* ── DESKTOP LAYOUT ────────────────────────────────────────────────────────── */
.main {
  display: grid;
  grid-template-columns: 460px 1fr;
  height: calc(100vh - 60px);
  overflow: hidden;
}

/* ── FIXTURES PANEL ────────────────────────────────────────────────────────── */
.fixtures-panel {
  background: var(--dark2);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.matchday-block { border-bottom: 1px solid var(--border); }
.matchday-header {
  padding: 8px 16px;
  background: var(--dark3);
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
}
.matchday-header .md-num { color: var(--red); font-size: 14px; }

.fixture-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 6px 12px;
  border-bottom: 1px solid #1a1a1a;
  border-left: 3px solid transparent;
  transition: background .15s;
  gap: 6px;
}
.fixture-row:hover { background: var(--dark3); }
.fixture-row.edited { border-left-color: var(--edited); }
.fixture-row.edited .score-num { color: var(--edited); }

/* Home team — text right-aligned */
.team-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.team-name.home { text-align: right; }

/* Away team cell — logo + name + reset button */
.away-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  min-width: 0;
}
.away-cell .reset-btn { margin-left: auto; flex-shrink: 0; }

/* ── SCORE CONTROLS ────────────────────────────────────────────────────────── */
.score-ctrl { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.score-side { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.score-nums { display: flex; align-items: center; gap: 4px; min-width: 48px; justify-content: center; }
.score-num {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 20px;
  min-width: 16px;
  text-align: center;
}
.score-sep { color: var(--muted); font-size: 16px; font-weight: 600; }
.score-unplayed {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: var(--muted);
  min-width: 48px;
  text-align: center;
}

.sbtn {
  width: 22px; height: 22px;
  border: 1px solid var(--border);
  background: var(--dark4);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
  flex-shrink: 0;
}
.sbtn:hover { background: var(--red); border-color: var(--red); }
.sbtn:active { transform: scale(.9); }

.reset-btn {
  width: 20px; height: 20px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 17px;
  cursor: pointer;
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  transition: color .15s;
  flex-shrink: 0;
}
.reset-btn:hover { color: var(--edited); }

/* ── TABLE PANEL ───────────────────────────────────────────────────────────── */
.table-panel {
  overflow-y: auto;
  background: var(--dark);
  display: flex;
  flex-direction: column;
}
.table-section { padding: 18px 22px; }
.table-section + .table-section { border-top: 2px solid var(--border); }

.table-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900;
  font-size: 14px;
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.pill { padding: 2px 8px; border-radius: 3px; font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.pill-champ { background: var(--champ); color: #fff; }
.pill-rel   { background: var(--rel);   color: #fff; }
.pill-grund { background: var(--red);   color: #fff; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700; font-size: 11px;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); padding: 5px 7px;
  text-align: center; border-bottom: 1px solid var(--border);
}
th.left { text-align: left; }
td { padding: 6px 7px; text-align: center; color: var(--text); border-bottom: 1px solid #1a1a1a; }
td.left { text-align: left; }
tr:last-child td { border-bottom: none; }

.rank-num { color: var(--muted); font-family: 'Barlow Condensed', sans-serif; font-size: 13px; }
.pts-cell { font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 16px; }
.half-star { color: var(--edited); font-size: 11px; }

.form-row { display: flex; gap: 3px; justify-content: center; }
.formdot { width: 8px; height: 8px; border-radius: 50%; }
.formdot-w { background: var(--green); }
.formdot-d { background: #e6a817; }
.formdot-l { background: var(--rel); }
.formdot-n { background: var(--border); }

tr.zone-champ td:first-child { border-left: 3px solid var(--champ); }
tr.zone-clq   td:first-child { border-left: 3px solid var(--clq); }
tr.zone-eclq  td:first-child { border-left: 3px solid var(--eclq); }
tr.zone-rel   td:first-child { border-left: 3px solid var(--rel); }

.start-pts-note { font-size: 11px; color: var(--muted); margin-top: 8px; font-style: italic; }
.halve-note { font-family: 'Barlow Condensed', sans-serif; font-size: 12px; color: var(--muted); margin-top: 12px; letter-spacing: .04em; }
.halve-note span { color: var(--edited); }

/* ── SCROLLBARS ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── MOBILE ────────────────────────────────────────────────────────────────── */
@media (max-width: 700px) {
  body { font-size: 15px; }

  /* Header collapses gracefully */
  header {
    height: auto;
    min-height: 52px;
    padding: 8px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .logo { font-size: 18px; }
  .header-right { gap: 8px; flex-wrap: wrap; }
  .edited-legend { display: none; }
  .reset-all-btn { font-size: 11px; padding: 5px 10px; }
  .phase-btn { padding: 7px 10px; font-size: 11px; }

  /* Show mobile round nav */
  .mobile-nav { display: flex; }

  /* Stack layout vertically */
  .main {
    display: flex;
    flex-direction: column;
    height: auto;
    overflow: visible;
  }

  /* Fixtures: only show active matchday block */
  .fixtures-panel {
    border-right: none;
    border-bottom: 2px solid var(--border);
    overflow-y: visible;
    background: var(--dark2);
  }
  .matchday-block { display: none; }
  .matchday-block.mobile-active { display: block; }
  .matchday-header { display: none; } /* round nav handles the label */

  /* Table: always visible below fixtures */
  .table-panel {
    overflow-y: visible;
    background: var(--dark);
  }

  /* Scale down table columns on small screens */
  table { font-size: 12px; }
  th, td { padding: 5px 4px; }
  .pts-cell { font-size: 14px; }
  .formdot { width: 7px; height: 7px; }

  /* Fixture rows a touch bigger for fat fingers */
  .sbtn { width: 26px; height: 26px; font-size: 16px; }
  .score-num { font-size: 22px; }
}
