/* Page base, slot list, and the 絞り込み条件 panel. */
:root {
  --bg: #ffffff;
  --text: #1f2328;
  --muted: #656d76;
  --line: #d8dee4;
  --accent: #1a7f37;
  --date-bg: #f6f8fa;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --text: #e6edf3;
    --muted: #8d96a0;
    --line: #30363d;
    --accent: #3fb950;
    --date-bg: #161b22;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0 auto;
  max-width: 720px;
  padding: 16px;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
  line-height: 1.5;
}

h1 { font-size: 1.4rem; margin: 8px 0 4px; }
.muted { color: var(--muted); font-size: 0.85rem; }
a { color: inherit; }

.date-heading {
  position: sticky;
  top: 0;
  margin: 20px 0 0;
  padding: 6px 10px;
  background: var(--date-bg);
  border-bottom: 1px solid var(--line);
  font-size: 1rem;
}

.slot {
  display: grid;
  grid-template-columns: 6.5em 1fr auto;
  gap: 8px;
  align-items: baseline;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.slot-time { font-variant-numeric: tabular-nums; font-weight: 600; }
.slot-park { font-weight: 600; }
.slot-court { color: var(--muted); font-size: 0.85rem; }
.slot-open { color: var(--accent); font-weight: 600; white-space: nowrap; }

.empty { padding: 24px 10px; color: var(--muted); }
.empty button {
  margin-left: 6px;
  padding: 4px 10px;
  font: inherit;
  color: var(--text);
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}

footer { margin: 32px 0 16px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* 絞り込み条件 (ソフトカード): each filter is its own rounded white tile on a light grey base. */
#filters {
  --f-base: #f2f2f5;
  --f-tile: #ffffff;
  --f-text: #1d1d1f;
  --f-muted: #6e6e73;
  --f-line: #e3e3e8;
  --f-primary: #1a7f37;
  --f-on-primary: #ffffff;
  --f-soft: #e6f4ea;
  --f-hover: #f5f5f7;
  --f-sat: #0a66c2;
  --f-sun: #c9372c;
  --f-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 14px rgba(0, 0, 0, 0.05);

  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 16px 0 8px;
  padding: 10px;
  background: var(--f-base);
  border-radius: 24px;
  color: var(--f-text);
}

@media (prefers-color-scheme: dark) {
  #filters {
    --f-base: #161618;
    --f-tile: #232326;
    --f-text: #f5f5f7;
    --f-muted: #a1a1a6;
    --f-line: #3a3a3e;
    --f-primary: #34c759;
    --f-on-primary: #0b1d10;
    --f-soft: #183522;
    --f-hover: #2c2c30;
    --f-sat: #64a8ff;
    --f-sun: #ff8a80;
    --f-shadow: none;
  }
}

.filter-head {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 0;
}
.filter-title { margin: 0; font-size: 1.05rem; }
.result-count {
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--f-soft);
  color: var(--f-primary);
  font-size: 0.85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.reset-btn {
  margin-left: auto;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--f-tile);
  color: var(--f-text);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--f-shadow);
  cursor: pointer;
}
.reset-btn:hover { background: var(--f-hover); }

/* Tiles */
.filter-selects,
.filter-group {
  background: var(--f-tile);
  border-radius: 18px;
  box-shadow: var(--f-shadow);
  padding: 12px 14px 14px;
}
.filter-selects {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.filter-group { display: grid; gap: 8px; align-content: start; }
.filter-group:has(#filter-weekday) { grid-column: 1 / -1; }

.field-label { font-size: 0.75rem; font-weight: 600; color: var(--f-muted); }
.field { display: grid; gap: 4px; min-width: 0; }

.field select {
  appearance: none;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0 30px 0 12px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--f-text);
  background: var(--f-hover) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%236e6e73' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  text-overflow: ellipsis;
}
.field select.is-set { background-color: var(--f-soft); color: var(--f-primary); }

.segmented {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  padding: 4px;
  background: var(--f-hover);
  border-radius: 14px;
}
.segmented button {
  min-height: 40px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--f-text);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}
.segmented button.sat { color: var(--f-sat); }
.segmented button.sun { color: var(--f-sun); }
.segmented button:hover { background: var(--f-tile); }
.segmented button[aria-pressed="true"] { background: var(--f-primary); color: var(--f-on-primary); box-shadow: var(--f-shadow); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  min-height: 40px;
  padding: 0 14px;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--f-text);
  background: var(--f-hover);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}
.chip:hover { background: var(--f-line); }
.chip[aria-pressed="true"] { background: var(--f-primary); color: var(--f-on-primary); }

#filters :focus-visible { outline: 2px solid var(--f-primary); outline-offset: 2px; }

@media (max-width: 560px) {
  #filters { grid-template-columns: 1fr; border-radius: 20px; }
  .filter-selects { grid-template-columns: 1fr 1fr; }
}
