:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.5;
  color: #1d252d;
  background: #f5f7f8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button {
  font: inherit;
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.75rem);
  line-height: 1.02;
  font-weight: 760;
  letter-spacing: 0;
}

.status-banner {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid #ddb572;
  border-radius: 8px;
  background: #fff7e8;
  color: #6f4700;
}

.filters {
  display: grid;
  grid-template-columns:
    minmax(180px, 1.2fr)
    minmax(160px, 1fr)
    minmax(120px, 0.7fr)
    minmax(120px, 0.7fr)
    minmax(250px, auto);
  gap: 12px;
  align-items: end;
  margin-bottom: 24px;
  padding: 12px;
  border: 1px solid #d8dee2;
  border-radius: 8px;
  background: #ffffff;
}

.filters[hidden] {
  display: none;
}

.filter-field {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.filter-field span {
  color: #64717c;
  font-size: 0.76rem;
  font-weight: 750;
  text-transform: uppercase;
}

.filter-field select,
.filter-button {
  width: 100%;
  min-height: 38px;
  border: 1px solid #b9c2c9;
  border-radius: 8px;
  background: #ffffff;
  color: #1d252d;
  font: inherit;
}

.filter-field select {
  padding: 0 10px;
}

.filter-actions {
  display: grid;
  grid-template-columns: repeat(3, max-content);
  gap: 8px;
  justify-content: end;
}

.filter-button {
  padding: 0 14px;
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
}

.filter-button:hover:not(:disabled),
.filter-field select:hover {
  border-color: #5d6f7c;
}

.filter-button:disabled {
  cursor: default;
  opacity: 0.55;
}

.availability {
  display: grid;
  gap: 28px;
}

.club-section {
  min-width: 0;
}

.club-section.is-collapsed .club-header {
  margin-bottom: 0;
}

.club-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #d8dee2;
  transition: margin-bottom 180ms ease;
}

.club-title-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.club-title-row > div {
  min-width: 0;
}

.club-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  margin-top: 1px;
  border: 1px solid #b9c2c9;
  border-radius: 6px;
  background: #ffffff;
  color: #1d252d;
  cursor: pointer;
  font: inherit;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
}

.club-toggle:hover {
  border-color: #5d6f7c;
  background: #f5f7f8;
}

.club-header h2 {
  font-size: 1.55rem;
  line-height: 1.2;
  font-weight: 760;
}

.club-status {
  flex: 0 0 auto;
  padding: 4px 9px;
  border-radius: 999px;
  background: #dff3e8;
  color: #12633a;
  font-size: 0.78rem;
  font-weight: 750;
}

.club-status.is-stale {
  background: #fff0c9;
  color: #7a4c00;
}

.club-status.is-error {
  background: #fce2df;
  color: #8f261d;
}

.club-message {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid #ddb572;
  border-radius: 8px;
  background: #fff7e8;
  color: #6f4700;
  font-size: 0.92rem;
  font-weight: 650;
}

.club-body {
  display: grid;
  grid-template-rows: 1fr;
  opacity: 1;
  transition:
    grid-template-rows 220ms ease,
    opacity 180ms ease;
}

.club-section.is-collapsed .club-body {
  grid-template-rows: 0fr;
  opacity: 0;
}

.club-body-inner {
  min-height: 0;
  overflow: hidden;
}

.days {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.day-panel,
.empty-state,
.loading-state {
  border: 1px solid #d8dee2;
  border-radius: 8px;
  background: #ffffff;
}

.day-panel {
  min-width: 0;
  overflow: hidden;
}

.day-panel.is-past {
  background: #eef1f3;
}

.day-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid #e4e8eb;
}

.day-header h2 {
  font-size: 1.25rem;
  line-height: 1.2;
}

.day-header p {
  margin-top: 3px;
  color: #64717c;
  font-size: 0.92rem;
}

.day-status {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: #edf4f7;
  color: #335a67;
  font-size: 0.78rem;
  font-weight: 700;
}

.window-list {
  display: grid;
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
  background: #e4e8eb;
}

.window-row {
  display: grid;
  grid-template-columns: minmax(96px, 0.8fr) minmax(0, 1.2fr);
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 10px 12px 10px 16px;
  background: #ffffff;
}

.window-row.is-past {
  color: #8a949c;
  background: #eef1f3;
}

.window-row.is-past .window-time,
.window-row.is-past .window-availability {
  opacity: 0.7;
}

.window-row.is-adjacent-warning {
  background: #fffaf0;
}

.window-row.is-critical {
  background: #fff8f7;
}

.window-time {
  display: grid;
  gap: 4px;
  min-width: 0;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.window-warning {
  width: max-content;
  max-width: 100%;
  padding: 2px 6px;
  border-radius: 999px;
  background: #fff0c9;
  color: #7a4c00;
  font-size: 0.72rem;
  font-weight: 760;
  line-height: 1.3;
}

.window-availability {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.window-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  gap: 3px;
  min-width: 74px;
  min-height: 38px;
  padding: 5px 8px;
  border-radius: 8px;
  text-align: center;
}

.window-count strong {
  font-size: 1.2rem;
  line-height: 1;
}

.court-badge {
  max-width: min(180px, 100%);
  padding: 2px 6px;
  border: 1px solid #cfd7dc;
  border-radius: 999px;
  background: #f5f7f8;
  color: #34434e;
  font-size: 0.68rem;
  font-weight: 750;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.count-good {
  background: #dff3e8;
  color: #12633a;
}

.count-limited {
  background: #fff0c9;
  color: #7a4c00;
}

.count-critical {
  background: #fce2df;
  color: #8f261d;
}

.count-past {
  background: #e2e7eb;
  color: #59656f;
}

.past-day,
.empty-state,
.loading-state {
  display: grid;
  min-height: 280px;
  place-items: center;
  padding: 24px;
  color: #64717c;
  font-weight: 700;
}

.loading-state {
  gap: 10px;
}

.loading-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #d8dee2;
  border-top-color: #335a67;
  border-radius: 999px;
  animation: spin 900ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 860px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

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

  .filter-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }

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

  .club-header {
    align-items: stretch;
    flex-direction: column;
  }

  .club-status {
    align-self: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .club-header,
  .club-body {
    transition: none;
  }

  .loading-spinner {
    animation: none;
  }
}

@media (max-width: 420px) {
  .page {
    width: min(100% - 20px, 1180px);
    padding-top: 20px;
  }

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

  .filter-actions {
    grid-template-columns: 1fr;
  }

  .window-row {
    grid-template-columns: 1fr;
    padding-left: 12px;
  }

  .window-availability {
    justify-content: flex-start;
  }

  .window-count {
    min-width: 68px;
  }
}
