:root {
  color-scheme: dark;
  --bg: #0a0a0b;
  --surface: #131315;
  --surface-hover: #1b1b1e;
  --border: #232327;
  --border-strong: #313137;
  --fg: #f2f2f3;
  --muted: #a3a3ab;
  --faint: #6f6f78;
  --live: #4ade80;
  --focus: #7cc4ff;
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding-left: 20px; padding-right: 20px; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1100;
  background: rgba(10, 10, 11, 0.85);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; min-height: 54px; padding-top: 6px; padding-bottom: 6px; }
.brand { font-weight: 600; font-size: 17px; letter-spacing: -0.01em; text-decoration: none; }
.updated { font-size: 12px; color: var(--muted); }
.nav { margin-left: auto; display: flex; gap: 2px; }
.nav a { text-decoration: none; font-size: 14px; color: var(--muted); padding: 6px 10px; border-radius: 8px; }
.nav a:hover { color: var(--fg); background: var(--surface); }
.nav a[aria-current="page"] { color: var(--fg); }

main { flex: 1; padding-top: 30px; padding-bottom: 56px; }
.loading { color: var(--muted); }

.intro { margin-bottom: 26px; }
.intro h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.25; margin: 0 0 8px; }
.intro p { margin: 0; color: var(--muted); max-width: 72ch; }
.intro a { color: var(--fg); text-underline-offset: 2px; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.panel h2 { font-size: 13px; font-weight: 500; margin: 0; }

/* Filters and chips */
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 32px; margin-bottom: 30px; }
.filter-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 9px; }
.link-btn { background: none; border: 0; padding: 0; font-size: 12px; color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.link-btn:hover { color: var(--fg); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  --c: #8b8b94;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 13px;
  line-height: 1.3;
  cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--c) 32%, transparent);
  background: color-mix(in srgb, var(--c) 9%, transparent);
  color: color-mix(in srgb, var(--c) 45%, var(--fg));
  transition: background 0.15s, border-color 0.15s, opacity 0.15s, color 0.15s;
}
.chip:hover { background: color-mix(in srgb, var(--c) 17%, transparent); }
.chip[aria-pressed="true"] { background: color-mix(in srgb, var(--c) 26%, transparent); border-color: var(--c); color: var(--fg); }
.chips.has-selection .chip[aria-pressed="false"] { opacity: 0.5; }
.chips.has-selection .chip[aria-pressed="false"]:hover { opacity: 0.85; }
.chip-plain { color: var(--fg); }
.chip-plain[aria-pressed="true"] { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.chip .count { color: var(--muted); font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] .count { color: inherit; opacity: 0.6; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.dot-lg { width: 12px; height: 12px; }

/* Day list */
.day { padding: 4px 0 26px; }
.day-head { margin-bottom: 10px; }
.day-head h2 { font-size: 15px; font-weight: 600; margin: 0; display: flex; align-items: center; gap: 8px; }
.day-head p { margin: 1px 0 0; font-size: 12px; color: var(--faint); }
.pill { font-size: 11px; font-weight: 500; padding: 1px 8px; border-radius: 999px; background: var(--surface-hover); border: 1px solid var(--border-strong); color: var(--muted); }
.empty { margin: 0; font-size: 13px; color: var(--faint); }

.events { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.event {
  display: grid;
  grid-template-columns: 172px minmax(0, 1fr) auto 104px;
  align-items: center;
  gap: 4px 16px;
  padding: 10px 14px 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: inset 3px 0 0 var(--c);
}
.when { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }
.what { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-width: 0; }
.rink-link { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; text-decoration: none; }
.rink-link:hover { text-decoration: underline; text-underline-offset: 2px; }
.type { font-size: 12px; color: var(--muted); border: 1px solid var(--border-strong); border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.meta { font-size: 13px; color: var(--muted); text-align: right; }
.action { justify-self: end; }
.act {
  display: inline-block;
  padding: 5px 11px;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  color: var(--fg);
  background: var(--surface-hover);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  transition: background 0.15s, border-color 0.15s;
}
a.act:hover { background: #26262b; border-color: var(--muted); }
.act-walkin { padding-left: 0; padding-right: 0; background: none; border-color: transparent; color: var(--faint); cursor: help; }
.live { font-size: 10.5px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--live); }

/* Rink list and rink page */
.rink-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.rink-card { display: block; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; text-decoration: none; transition: background 0.15s, border-color 0.15s; }
.rink-card:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.rink-card-name { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 15px; }
.rink-card-sub { display: block; margin-top: 4px; padding-left: 17px; font-size: 12.5px; color: var(--muted); }
.fineprint { margin: 18px 0 0; font-size: 12px; color: var(--faint); }

.back { display: inline-block; margin-bottom: 14px; font-size: 13px; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--fg); }
.rink-title { display: flex; align-items: center; gap: 12px; }
.type-tabs { margin-bottom: 26px; }
.empty-panel { color: var(--muted); font-size: 14px; padding: 20px; }
.empty-panel a, .off-feed a { color: var(--fg); text-underline-offset: 2px; }
.off-feed { grid-column: 1 / -1; margin: 0; padding-top: 14px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }

/* Map page */
.start-panel { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 20px; margin-bottom: 14px; }
.hint { margin: 3px 0 0; font-size: 13px; color: var(--muted); }
.start-actions { display: flex; gap: 8px; }
.btn { background: var(--surface-hover); border: 1px solid var(--border-strong); border-radius: 10px; padding: 8px 14px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.btn:hover:not(:disabled) { background: #232327; }
.btn:disabled { opacity: 0.45; cursor: default; }

.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; align-items: start; }
.map { height: 560px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #111113; }
.map-error { margin: 0; padding: 24px; color: var(--muted); font-size: 14px; }

.rink-distances { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rink-distances button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  text-align: left;
  font-size: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}
.rink-distances button:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.rink-distances .name { min-width: 0; }
.dist { margin-left: auto; padding-left: 8px; font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

.leaflet-container { background: #111113; font: 12px/1.4 var(--font); }
.map-inverted .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(0.8) contrast(0.95) saturate(0.4); }
.leaflet-tooltip.rink-label { background: transparent; border: 0; box-shadow: none; padding: 0; color: #e7e7ea; font-weight: 500; text-shadow: 0 1px 2px #000, 0 0 6px #000; }
.leaflet-tooltip.rink-label::before { display: none; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--fg); border: 1px solid var(--border-strong); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); }
.leaflet-popup-content { margin: 12px 16px; font-size: 13px; line-height: 1.5; }
.leaflet-popup-content a { color: var(--focus); }
.popup-sub { color: var(--muted); }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.leaflet-bar a, .leaflet-bar a:hover { background: var(--surface); color: var(--fg); border-bottom-color: var(--border-strong); }
.leaflet-bar { border-color: var(--border-strong) !important; }
.leaflet-control-attribution.leaflet-control { background: rgba(10, 10, 11, 0.75); color: var(--faint); }
.leaflet-control-attribution a { color: var(--muted); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 20px 0 28px; font-size: 12px; color: var(--faint); }
.site-footer p { margin: 0; }

@media (max-width: 860px) {
  .map-layout { grid-template-columns: 1fr; }
  .map { height: 380px; }
}

@media (max-width: 720px) {
  .filters { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .nav a { padding: 6px 8px; }
  main { padding-top: 22px; }
  .intro h1 { font-size: 23px; }
  .event { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "when action" "what what" "meta meta"; padding: 10px 12px 10px 15px; }
  .when { grid-area: when; }
  .what { grid-area: what; }
  .meta { grid-area: meta; text-align: left; }
  .meta:empty { display: none; }
  .action { grid-area: action; }
  .start-actions { width: 100%; }
  .start-actions .btn { flex: 1; }
}
