:root {
  --ink: #1a1d26;
  --muted: #4a5266;
  --accent: #128d9e;
  --card: rgba(255, 255, 255, 0.94);
  --line: rgba(26, 29, 38, 0.12);
  --shadow: 0 6px 24px rgba(26, 29, 38, 0.18);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  color: var(--ink);
}
html, body { margin: 0; height: 100%; background: #e9eef2; }
#map { position: fixed; inset: 0; }

.brand {
  position: fixed; top: calc(12px + env(safe-area-inset-top)); left: 12px; z-index: 2;
  background: var(--card); border-radius: 12px; padding: 8px 12px; box-shadow: var(--shadow);
  display: flex; gap: 8px; align-items: baseline; font-size: 15px;
}
.brand span, .brand a { color: var(--accent); font-weight: 600; font-size: 13px; }
.brand a { text-decoration: none; pointer-events: auto; }
.brand a:hover { text-decoration: underline; }

.actions {
  position: fixed; left: 12px; bottom: calc(40px + env(safe-area-inset-bottom)); z-index: 2;
  display: flex; gap: 8px; flex-wrap: wrap; max-width: calc(100vw - 24px);
}
.actions button {
  font: 600 14px/1 inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 11px 16px; box-shadow: var(--shadow); cursor: pointer;
}
.actions button.primary { background: var(--accent); color: #fff; border-color: transparent; }
.actions button:focus-visible { outline: 3px solid #7be7ff; outline-offset: 2px; }

.panel {
  position: fixed; left: 12px; bottom: calc(92px + env(safe-area-inset-bottom)); z-index: 3;
  width: min(280px, calc(100vw - 24px)); max-height: calc(100vh - 160px); overflow: auto;
  background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 12px 14px;
}
.panel h2 { font-size: 15px; margin: 0 0 6px; }
.panel fieldset { border: 0; margin: 0; padding: 6px 0; border-top: 1px solid var(--line); }
.panel legend { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 0; }
.panel label { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 14px; cursor: pointer; }
.panel label.off { color: #9aa1b0; cursor: default; }
.panel input { width: 18px; height: 18px; accent-color: var(--accent); }
.panel label.slider { flex-wrap: wrap; gap: 4px 8px; }
.panel label.slider output { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.panel label.slider input { width: 100%; height: 22px; }
.swatch { width: 14px; height: 14px; border-radius: 50%; flex: none; }

/* stacje narciarskie: lista (nad przyciskami) i karta stacji (lewa strona; na telefonie u dołu) */
.panel.stacje button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left;
  font: 600 14px/1.3 inherit; color: var(--ink); background: none; border: 0; border-top: 1px solid var(--line);
  padding: 9px 2px; cursor: pointer;
}
.panel.stacje button:hover { color: var(--accent); }
.panel.stacje button[hidden], .panel.stacje section[hidden] { display: none; }
.panel.stacje h3 { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
  margin: 12px 0 2px; }
.panel.stacje input[type="search"] { width: 100%; box-sizing: border-box; height: 36px; font: 14px inherit; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 8px; margin: 4px 0 2px; }
.panel.stacje small { font-weight: 400; color: var(--muted); font-size: 12px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 16px; height: 4px; border-radius: 2px; }
.card {
  position: fixed; top: calc(62px + env(safe-area-inset-top)); left: 12px; z-index: 3;
  width: min(300px, calc(100vw - 24px)); max-height: calc(100vh - 170px); overflow: auto;
  background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 12px 14px; font-size: 14px;
}
.card h2 { font-size: 17px; margin: 0 28px 2px 0; }
.card h3 { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
  margin: 12px 0 4px; }
.card .meta { margin: 0; color: var(--muted); font-size: 13px; }
.card ul { list-style: none; margin: 0; padding: 0; }
.card li { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.card li b { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.card ul.list li { border-top: 1px solid var(--line); }
.card li span small { display: block; color: var(--muted); font-size: 12px; }
.card .piste { min-width: 22px; padding: 1px 6px; border-radius: 5px; color: #fff; font-weight: 700; text-align: center; }
.card details summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 13px; margin-top: 8px; }
.card details[open] summary { display: none; }
.card .src { margin: 10px 0 0; font-size: 11px; color: var(--muted); }
.card .close {
  position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border: 0; border-radius: 8px;
  background: none; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer;
}

.maplibregl-popup-content { border-radius: 12px; padding: 10px 30px 10px 14px; font-size: 14px; box-shadow: var(--shadow); }
.maplibregl-popup-close-button { width: 26px; height: 26px; font-size: 18px; right: 2px; top: 2px; border-radius: 8px; }
.popup-name { font-weight: 700; margin-bottom: 4px; }
.popup-cat { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }

.debug {
  position: fixed; top: calc(60px + env(safe-area-inset-top)); left: 12px; z-index: 2; font: 12px/1.4 ui-monospace, monospace;
  background: rgba(26, 29, 38, .82); color: #fff; padding: 6px 9px; border-radius: 8px; white-space: pre;
}

@media (max-width: 520px) {
  .card { top: auto; bottom: calc(140px + env(safe-area-inset-bottom)); max-height: 46vh; }
  .actions button { padding: 10px 13px; font-size: 13px; }
  .maplibregl-ctrl-scale { display: none; }
  .panel { bottom: calc(140px + env(safe-area-inset-bottom)); max-height: calc(100vh - 220px); } /* przyciski w 2 rzędach */ /* kolidowała z przyciskami; skala jest w widoku z góry na desktopie */
}
