:root {
  --green: #0f0;
  --bg: #000;
  --muted: #666;

  --card-upcoming: #0f0f0f;
  --card-live: #1a1a1a;
  --card-finished: #1a1a1a;
  --card-empty: #111;
  --card-text: #fff;

  --row-h: 100px;
  --row-gap: 10px;
  --col-gap: 20px;
  --edge-gap: 30px;

  --cols-visible: 5;

  --col-min: 280px;

  --logo-league: 50px;
  --logo-team: 28px;

  --logo-halo: drop-shadow(0 0 1px rgba(255, 255, 255, 0.9));

  --flash-wash: rgba(0, 255, 0, 0.25);
  --flash-glow: rgba(0, 255, 0, 0.6);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

* {
  font-family: monospace;
}

html {
  overflow-x: hidden;
  height: 100%;

  scrollbar-gutter: stable;
}

body {
  background: var(--bg);
  color: var(--green);
  font-size: 16px;
  overflow-x: hidden;
  margin: 0;
  padding: 0;
  max-width: 100vw;
  min-height: 100vh;
  display: flex;
  flex-direction: column;

  position: relative;
}

footer {
  display: flex;
  justify-content: space-between;

  align-items: last baseline;
  gap: 24px;
  margin-top: 40px;

  padding: 16px var(--edge-gap);
  font-size: 12px;
  color: var(--muted);
}

.footer-note { display: block; }

.footer-line { display: block; }

.footer-meta {
  display: block;
  flex-shrink: 0;
  text-align: right;
}

.footer-copy,
.footer-contact {
  display: block;
  color: var(--green);
}

.date-navigation-container {
  width: 100%;
  background: var(--bg);
  padding: 20px 0 0 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 17px;
  flex-wrap: wrap;
  box-sizing: border-box;
}

.date-navigation {
  display: flex;
  justify-content: center;
  gap: 20px;
  align-items: center;
}

.date-btn {
  background: transparent;
  border: 2px solid var(--green);
  color: var(--green);
  padding: 7px 24px;
  border-radius: 8px;
  font-family: monospace;
  font-weight: bold;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  min-width: 120px;
}

.date-dropdown {
  position: relative;
  display: inline-flex;
}

.date-picker-trigger {
  padding-right: 30px;
  position: relative;
}

.date-picker-arrow {
  position: absolute;
  right: 10px;
  top: 50%;
  width: 0;
  height: 0;
  margin-top: -3px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid currentColor;
  transition: transform 0.2s ease;
}

.date-dropdown.open .date-picker-arrow {
  transform: rotate(180deg);
}

.date-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 100%;
  background: var(--card-empty);
  border: 2px solid var(--green);
  border-top: none;
  border-radius: 0 0 6px 6px;
  z-index: 1000;
  display: none;

}

.date-dropdown.open .date-dropdown-menu {
  display: block;
}

.date-dropdown-option {
  display: block;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: none;
  color: var(--green);
  font-family: monospace;
  font-weight: bold;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-align: center;
  cursor: pointer;
}

.date-dropdown-option:hover {
  background: var(--green);
  color: var(--bg);
}

.date-dropdown-option--selected {
  background: var(--green);
  color: var(--bg);
}

.date-dropdown-option--dead {
  opacity: 0.35;
  pointer-events: none;
}

.date-btn:hover {
  background: var(--green);
  color: var(--bg);
  box-shadow: 0 4px 8px rgba(0, 255, 0, 0.3);
}

.date-btn.active {
  background: var(--green);
  color: var(--bg);
  box-shadow: 0 2px 4px rgba(0, 255, 0, 0.2);
}

.global-last-updated {
  position: absolute;
  top: 20px;
  right: var(--edge-gap);

  max-width: 260px;
  font-size: 12px;
  color: var(--green);
  text-align: right;

  min-height: 15px;
}

.global-last-updated .updated-now,
.global-last-updated .next-update {
  display: block;
}

.global-last-updated .updated-sep {
  display: none;
}

.global-last-updated .next-update {
  font-size: inherit;
  color: inherit;
  opacity: 1;
}

.global-last-updated.stale {
  color: #f33;
}

.sports-grid {
  display: flex;
  gap: var(--col-gap);

  padding: 15px var(--edge-gap) 0 var(--edge-gap);
  width: 100%;
  max-width: 100%;
  align-items: stretch;
  box-sizing: border-box;

  flex: 1;
  min-height: 0;

  min-width: 0;
}

.sport {
  flex: 1;
  min-width: 0;
  padding-right: var(--col-gap);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;

  min-height: 100%;
  box-sizing: border-box;
  overflow: visible;
}

.sport:last-child {
  padding-right: 0;
}

.sport-header {
  cursor: grab;

  touch-action: pan-y;
}

.sport-dragging {
  opacity: 0.94;
  z-index: 20;
  position: relative;
  background: var(--bg);
  box-shadow: 0 0 0 2px var(--green), 0 20px 45px rgba(0, 0, 0, 0.7);
  will-change: transform;
}

.sport-dragging .sport-header {
  cursor: grabbing;
}

.sport-dragging .sport-grip {
  opacity: 0.9;
}

.sport-sliding {
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}

body.column-drag {
  user-select: none;
  cursor: grabbing;
}

.sport-header {
  margin: 0 0 20px 0;
  line-height: 1;
  text-align: center;
  font-size: 48px;
  padding: 0 0 15px 0;
  min-height: 40px;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.sport-header::before {
  content: "";
  flex: 0 0 50px;
}

.sport-picker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  font-size: 24px;
  font-family: inherit;
  font-weight: bold;
  line-height: 1;
  padding: 7px 14px;
  max-width: 100%;
  color: var(--green);

  background: transparent;
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.sport:hover .sport-picker,
.sport-picker.open {
  background: var(--green);
  color: var(--bg);
  border-color: var(--green);
}

.sport:hover .sport-picker .sport-mark,
.sport-picker.open .sport-mark {
  filter: brightness(0);
}

.sport-picker .sport-mark {
  width: 22px;
  height: 22px;
}

.sport-name {
  font-size: 24px;
  font-weight: bold;

  color: inherit;
  text-transform: uppercase;
  letter-spacing: 2px;
  user-select: none;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sport-header .sport-toggle-arrow,
.sport-header .sport-grip {
  opacity: 0;
  transition: opacity 0.15s ease;
}

.sport:hover .sport-toggle-arrow,
.sport:hover .sport-grip {
  opacity: 1;
}

.sport-grip {
  width: 14px;
  flex: 0 0 14px;
  color: var(--green);
  font-size: 14px;

  pointer-events: none;
}

.sport-toggle-arrow {
  cursor: pointer;
  user-select: none;
  display: inline-block;
  width: 14px;
  height: 14px;

  padding: 8px;
  box-sizing: content-box;
  flex-shrink: 0;

  position: relative;
}

.sport-toggle-arrow::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 0;
  height: 0;
  border-left: 9px solid var(--green);
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.sport-expanded .sport-toggle-arrow::before {
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 9px solid var(--green);
  border-bottom: none;
}

.league-section {
  margin: 0;
  padding: 0;
  border: none;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  position: relative;
  flex: 0 0 auto;
  height: auto;
}

.league-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: transparent;
  color: var(--green);
  padding: 0;
  margin: 0 0 var(--row-gap) 0;
  border-radius: 0;
  border: none;
  height: var(--row-h);
  min-height: var(--row-h);
  max-height: var(--row-h);
  flex-shrink: 0;
  box-sizing: border-box;
}

.league-header {
  cursor: default;
  position: relative;
}

.league-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  flex-direction: column;
  justify-content: center;

  max-width: 100%;
}

.league-name {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  font-weight: normal;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  min-height: 20px;
  position: relative;
  transition: color 0.15s ease;
  cursor: pointer;
  max-width: 100%;
}

.league-section:not(.league-collapsed) .league-name {
  color: var(--green);
}

.league-toggle:hover .league-name,
.league-toggle:focus-visible .league-name {
  color: var(--green);
}

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

.league-count {
  margin-left: 5px;
  flex-shrink: 0;
}

.league-toggle-arrow {
  margin-left: 6px;
  display: inline-block;
  width: 14px;
  height: 14px;
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
}

.league-toggle-arrow::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 0;
  height: 0;
  border-left: 7px solid var(--muted);
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
}

.league-section:not(.league-collapsed) .league-toggle-arrow::before {
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 7px solid var(--green);
  border-bottom: none;
}

.league-toggle:hover .league-toggle-arrow::before,
.league-toggle:focus-visible .league-toggle-arrow::before {
  border-left: 7px solid var(--green);
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
}

.league-section:not(.league-collapsed) .league-toggle:hover .league-toggle-arrow::before,
.league-section:not(.league-collapsed) .league-toggle:focus-visible .league-toggle-arrow::before {
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 7px solid var(--green);
  border-bottom: none;
}

.games-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
  flex: 0 0 auto;
  transition: all 0.3s ease;
  overflow: hidden;
}

.league-collapsed .games-list {
  max-height: 0;
  opacity: 0;
  margin: 0;
  padding: 0;
}

.league-section:not(.league-collapsed) .games-list {
  max-height: none;
  opacity: 1;
}

.game-card {
  background: var(--green);
  color: var(--bg);

  padding: 12px 12px 8px;
  margin: 0 0 var(--row-gap) 0;
  border-radius: 0;
  border: none;
  position: relative;
  height: var(--row-h);
  min-height: var(--row-h);
  max-height: var(--row-h);
  display: flex;
  flex-direction: column;

  justify-content: flex-end;
  box-sizing: border-box;
  flex-shrink: 0;
}

.game-status-badge {
  position: absolute;
  top: 6px;
  right: 14px;
  font-size: 13px;
  font-weight: bold;
  color: var(--card-text);
}

.game-card--no-games {
  background: var(--card-empty);
  color: var(--muted);
  text-align: center;
  font-style: italic;
  display: flex;
  align-items: center;
  justify-content: center;
}

.team-lineup {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  min-height: 24px;
  margin: 0;
  gap: 8px;
}

.team-details {
  display: flex;
  align-items: center;
  flex: 0 1 auto;
  min-width: 0;
}

.team-logo-container {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-right: 8px;
}

.team-name-text {
  font-weight: bold;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-score-display {
  font-size: 16px;
  font-weight: bold;
  min-width: 24px;
  text-align: right;
  margin-left: auto;

  flex-shrink: 0;
}

.team-score-display.odds-display {
  color: var(--muted);
}

.game-card--upcoming {
  background: var(--card-upcoming);
  color: var(--card-text);
}

.game-card--live {
  background: var(--card-live);
  color: var(--card-text);
}

.game-card--finished {
  background: var(--card-finished);
  color: var(--muted);
  opacity: 0.7;
}

.game-card--finished .team-name-text,
.game-card--finished .game-status-badge {
  color: var(--muted);
}

@keyframes scoreFlash {
  0%   { color: var(--card-text); transform: scale(1); text-shadow: none; }
  15%  { color: var(--green); transform: scale(1.4);
         text-shadow: 0 0 10px var(--green), 0 0 20px var(--flash-glow); }
  100% { color: var(--card-text); transform: scale(1); text-shadow: none; }
}

.score-changed {
  animation: scoreFlash 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
  transform-origin: right center;
}

@keyframes scoreFlashRow {
  0%   { background: transparent; }
  22%  { background: var(--flash-wash); }
  100% { background: transparent; }
}

.score-changed-row {
  animation: scoreFlashRow 0.9s ease;
}

.team-logo {
  height: 20px;
  width: auto;
  vertical-align: middle;
  margin-right: 8px;
  display: inline-block;
  object-fit: contain;
}

.team-logo--team {
  max-height: var(--logo-team);
  max-width: var(--logo-team);
  width: auto;
  height: auto;
  object-fit: contain;
  filter: var(--logo-halo);
}

.team-logo--league {
  height: var(--logo-league);
  width: auto;
  margin-bottom: 4px;
  opacity: 0.45;
  transition: opacity 0.15s ease, filter 0.18s ease;
  filter: grayscale(0.7) brightness(0.9) var(--logo-halo);
}

.league-section:not(.league-collapsed) .team-logo--league,
.league-toggle:hover .team-logo--league,
.league-toggle:focus-visible .team-logo--league {
  opacity: 1;
  filter: var(--logo-halo);
}

.team-logo--lighten,
.league-section:not(.league-collapsed) .team-logo--lighten,
.league-toggle:hover .team-logo--lighten,
.league-toggle:focus-visible .team-logo--lighten {
  filter: brightness(0) invert(1);
}

.team-logo--generic,
.league-section:not(.league-collapsed) .team-logo--generic,
.league-toggle:hover .team-logo--generic,
.league-toggle:focus-visible .team-logo--generic {
  filter: none;
}

.team-logo--team.team-logo--generic {
  opacity: 0.7;
}

.mobile-sport-selector {
  display: none;
  padding: 0 20px 20px 20px;
  background: var(--bg);
}

.mobile-sport-display {
  display: none;
  padding: 0 20px 20px 20px;
}

.mobile-dropdown {
  position: relative;
  width: 100%;
}

.mobile-dropdown-trigger {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  background: var(--card-empty);
  color: var(--green);
  border: 2px solid var(--green);
  border-radius: 6px;
  font-weight: bold;
  text-align: center;
  outline: none;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  box-sizing: border-box;
}

.mobile-dropdown-text {
  flex: 1;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.sport-mark {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex-shrink: 0;
  transition: filter 0.2s ease;
}

.mobile-dropdown-trigger:hover .sport-mark,
.mobile-dropdown-option:hover .sport-mark {
  filter: brightness(0);
}

.mobile-dropdown-arrow {
  position: absolute;
  right: 12px;
  transition: transform 0.2s ease;
}

.mobile-dropdown-trigger:hover {
  background: var(--green);
  color: var(--bg);
}

.mobile-dropdown.open .mobile-dropdown-arrow {
  transform: rotate(180deg);
}

.mobile-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background: var(--card-empty);
  border: 2px solid var(--green);
  border-top: none;
  border-radius: 0 0 6px 6px;
  z-index: 1000;
  display: none;
  max-height: 200px;
  overflow-y: auto;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.mobile-dropdown.open .mobile-dropdown-menu {
  display: block;
}

.mobile-dropdown-option {
  padding: 12px;
  font-size: 16px;
  background: var(--card-empty);
  color: var(--green);
  border: none;
  width: 100%;
  text-align: center;
  font-family: monospace;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.mobile-dropdown-option:hover {
  background: var(--green);
  color: var(--bg);
}

.mobile-dropdown-option:first-child {
  border-top: 1px solid var(--green);
}

@media (max-width: 1168px) {
  :root {
    --row-h: 92px;
    --logo-league: 40px;
    --logo-team: 24px;
  }

  .sports-grid {
    display: none;
  }

  .sport {
    padding-right: 0;
  }

  .mobile-sport-selector,
  .mobile-sport-display {
    display: block;
  }

  .date-navigation-container { order: 1; }
  .mobile-sport-selector { order: 2; }
  .global-last-updated { order: 3; }
  .mobile-sport-display { order: 4; }
  .sports-grid { order: 5; }

  footer {
    order: 6;
    display: block;
    text-align: center;
    padding: 16px 20px;
  }

  .footer-line + .footer-line { margin-top: 8px; }

  .footer-meta {
    margin-top: 8px;
    text-align: center;
  }

  .footer-contact { margin-top: 8px; }

  .date-navigation-container {
    width: calc(100% - 40px);
    padding: 20px 0 22px 0;
    margin: 0 20px;
    gap: 0;
    flex-wrap: nowrap;
  }

  .mobile-sport-selector { padding-bottom: 0; }

  .global-last-updated {
    position: static;
    max-width: none;
    text-align: center;

    margin: 13px 0 20px 0;
  }

  .global-last-updated .updated-now,
  .global-last-updated .next-update,
  .global-last-updated .updated-sep {
    display: inline;
  }

  .date-navigation {
    width: 100%;
    gap: 10px;
    flex-wrap: nowrap;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
  }

  .date-btn {
    flex: 1;
    width: 33.333%;
    min-width: 0;
    padding: 12px 8px;
    font-size: 14px;
    background: var(--card-empty);
    border-radius: 6px;
    margin: 0;
    text-align: center;
    box-sizing: border-box;
  }

  .date-dropdown {
    flex: 1;
    min-width: 0;
  }

  .date-dropdown .date-btn {
    width: 100%;
  }

  .league-section {
    height: auto;
  }

  .game-card {
    padding: 14px 14px 8px;
  }

  .team-name-text {
    font-size: 16px;
  }

  .team-score-display {
    font-size: 18px;
    min-width: 28px;
  }

  .game-status-badge {
    font-size: 14px;
    top: 4px;
    right: 16px;
  }

  .team-logo-container {
    width: 28px;
    height: 28px;
  }

  .team-logo--league {
    opacity: 0.35;
    margin-bottom: 3px;
  }

  .mobile-sport-content .league-section:first-child {
    margin-top: 0;
  }
}

.sport-picker-menu {
  position: fixed;
  z-index: 1000;
  display: none;
  min-width: 220px;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--card-empty);
  border: 2px solid var(--green);
  border-radius: 6px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8);
}

.sport-picker-menu.open {
  display: block;
}

.sport-picker-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  padding: 11px 14px;
  background: transparent;
  border: none;
  color: var(--green);
  font-family: monospace;
  font-weight: bold;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-align: left;
  cursor: pointer;
}

.sport-picker-option .sport-mark {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}

.sport-picker-option:hover {
  background: var(--green);
  color: var(--bg);
}

.sport-picker-option:hover .sport-mark {
  filter: brightness(0);
}

.sport-picker-option--current {
  background: var(--green);
  color: var(--bg);
}

.sport-picker-option--current .sport-mark {
  filter: brightness(0);
}
