/* Spacery NYC: style. Kolory jako tokeny, ciemny motyw niżej. */
:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #f0eee9;
  --text: #1c1b19;
  --muted: #6b6760;
  --border: #e2dfd8;
  --accent: #c2410c;
  --accent-text: #ffffff;
  --accent-soft: #fdeee6;
  --my: #c2410c;
  --hint-bg: #fff7dc;
  --hint-border: #f2d77c;
  --warn: #b45309;
  --shadow: 0 8px 28px rgba(20, 18, 14, .16), 0 1px 3px rgba(20, 18, 14, .1);
  --map-casing: #ffffff;
  --radius: 14px;
  --sheet-h: 50vh;
  --panel-w: 400px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15161a;
    --surface: #1d1f24;
    --surface-2: #272a31;
    --text: #ecebe8;
    --muted: #a3a09a;
    --border: #33363e;
    --accent: #fb923c;
    --accent-text: #1a1208;
    --accent-soft: #3a2618;
    --my: #fb923c;
    --hint-bg: #2e2a17;
    --hint-border: #5c4f1d;
    --warn: #fbbf24;
    --shadow: 0 8px 28px rgba(0, 0, 0, .5), 0 1px 3px rgba(0, 0, 0, .4);
    --map-casing: #101114;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15161a;
  --surface: #1d1f24;
  --surface-2: #272a31;
  --text: #ecebe8;
  --muted: #a3a09a;
  --border: #33363e;
  --accent: #fb923c;
  --accent-text: #1a1208;
  --accent-soft: #3a2618;
  --my: #fb923c;
  --hint-bg: #2e2a17;
  --hint-border: #5c4f1d;
  --warn: #fbbf24;
  --shadow: 0 8px 28px rgba(0, 0, 0, .5), 0 1px 3px rgba(0, 0, 0, .4);
  --map-casing: #101114;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
}
button, input { font: inherit; color: inherit; }
a { color: var(--accent); }
code { font-size: .9em; background: var(--surface-2); padding: 0 .3em; border-radius: 4px; }

#map { position: fixed; inset: 0; background: var(--surface-2); }

/* ---------- pasek górny ---------- */
.topbar {
  position: fixed; z-index: 1002;
  top: calc(env(safe-area-inset-top) + 10px); left: 12px; right: 64px;
  display: flex; align-items: center; gap: 8px;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.topbar h1 {
  margin: 0; font-size: 15px; font-weight: 650; line-height: 1.2;
  background: var(--surface); color: var(--text);
  padding: 10px 14px; border-radius: 999px; box-shadow: var(--shadow);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.icon-btn {
  flex: none; width: 40px; height: 40px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  box-shadow: var(--shadow); cursor: pointer; font-size: 18px; line-height: 1;
  display: inline-grid; place-items: center;
}
.icon-btn.sm { width: 34px; height: 34px; box-shadow: none; font-size: 15px; }
.icon-btn:disabled { opacity: .35; cursor: default; }

/* ---------- panel / arkusz ---------- */
.sheet {
  position: fixed; z-index: 1001; left: 0; right: 0; bottom: 0;
  height: var(--sheet-h);
  background: var(--surface); color: var(--text);
  border-radius: 18px 18px 0 0; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  transition: height .25s ease;
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet.dragging { transition: none; }
.sheet-handle {
  flex: none; height: 26px; display: grid; place-items: center; cursor: grab; touch-action: none;
}
.sheet-handle span { width: 44px; height: 5px; border-radius: 3px; background: var(--border); }
.tabs {
  flex: none; display: flex; gap: 4px; padding: 0 12px 8px; border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none;
}
.tabs button {
  flex: 1 0 auto; border: 0; background: transparent; padding: 8px 10px; border-radius: 10px;
  font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.tabs button.active { background: var(--accent-soft); color: var(--accent); }
.panel-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 12px 16px 24px; -webkit-overflow-scrolling: touch; }

@media (min-width: 900px) {
  .sheet {
    top: 0; right: auto; width: var(--panel-w); height: auto !important;
    border-radius: 0; transition: none;
  }
  .sheet-handle { display: none; }
  .tabs { padding-top: 76px; }
  .topbar { left: 12px; right: auto; max-width: calc(var(--panel-w) - 24px); }
  .panel-body { padding: 16px 20px 32px; }
}
@media (max-width: 899px) {
  .leaflet-bottom { bottom: var(--sheet-h); transition: bottom .25s ease; }
}

/* ---------- elementy ---------- */
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pad { padding: 12px 0; }
.count { font-size: 13px; margin: 4px 0 8px; }
.warn { color: var(--warn); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: baseline; flex: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 8px 14px; border-radius: 12px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-text);
  font-weight: 600; font-size: 14px; text-decoration: none; cursor: pointer;
}
.btn-ghost { background: transparent; color: var(--accent); }
.btn-ghost.on { background: var(--accent-soft); }
.btn.danger { color: #dc2626; border-color: currentColor; }
.btn-small { min-height: 34px; padding: 4px 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.actions.col { flex-direction: column; }
.link-btn { border: 0; background: none; color: var(--accent); cursor: pointer; font-weight: 600; font-size: 14px; padding: 0; }

.search-row input {
  width: 100%; min-height: 44px; padding: 8px 14px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface-2);
}
.search-row input:focus { outline: 2px solid var(--accent); outline-offset: 0; }

.filters { margin: 10px 0 4px; border: 1px solid var(--border); border-radius: 12px; padding: 0 12px; }
.filters summary {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; cursor: pointer; font-weight: 600; list-style: none;
}
.filters summary::-webkit-details-marker { display: none; }
.filters summary span::before { content: "▸ "; color: var(--muted); }
.filters[open] summary span::before { content: "▾ "; }
.filter-group { padding: 4px 0 10px; }
.filter-group h4 { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.filter-group input[type="range"] { width: 100%; accent-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; min-height: 34px; padding: 4px 12px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  font-size: 13px; cursor: pointer;
}
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }

.day { margin: 14px 0 6px; }
.day-title { display: flex; align-items: center; margin: 0; font-size: 16px; }
.day > .small { margin: 2px 0 8px; }
.route-card {
  width: 100%; display: flex; gap: 12px; align-items: flex-start; text-align: left;
  padding: 12px; margin: 8px 0; border-radius: var(--radius);
  border: 1px solid var(--border); border-left: 5px solid var(--c);
  background: var(--surface); cursor: pointer;
}
.route-card:hover { background: var(--surface-2); }
.route-badge {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  background: var(--c); color: #fff; font-weight: 700; display: grid; place-items: center; font-size: 14px;
}
.route-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.route-title { font-weight: 650; line-height: 1.3; }
.route-type, .route-meta { font-size: 13px; color: var(--muted); }

.place-list { list-style: none; margin: 0; padding: 0; }
.place-row {
  width: 100%; display: flex; gap: 10px; align-items: center; text-align: left;
  padding: 8px 4px; border: 0; border-bottom: 1px solid var(--border); background: none; cursor: pointer;
}
.place-row > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.place-name { font-weight: 600; }
.place-ico {
  flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: color-mix(in srgb, var(--c) 18%, transparent); font-size: 15px; margin-right: 6px;
}
.place-row .place-ico { margin-right: 0; }

.detail h2 { margin: 4px 0 4px; font-size: 22px; line-height: 1.25; }
.detail h3 { margin: 20px 0 8px; font-size: 16px; }
.detail h4 { margin: 0 0 4px; font-size: 15px; }
.detail .lead { font-size: 16px; }
.back-btn { border: 0; background: none; color: var(--accent); font-weight: 600; padding: 4px 0; cursor: pointer; font-size: 15px; }
.eyebrow { display: flex; align-items: center; margin: 8px 0 0; font-size: 13px; font-weight: 600; color: var(--muted); }
.stats { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.stats span { background: var(--surface-2); border-radius: 999px; padding: 3px 10px; font-size: 13px; font-weight: 600; }
.stats span.muted { background: none; font-weight: 400; }
.card { background: var(--surface-2); border-radius: var(--radius); padding: 12px 14px; margin: 12px 0; }
.card h3 { margin: 0 0 6px; }
.card p { margin: 0; }
.card.hint { background: var(--hint-bg); border: 1px solid var(--hint-border); }
.card.event { border-left: 4px solid var(--accent); }
.bullets { margin: 0; padding-left: 20px; }
.bullets li { margin: 4px 0; }

.stops { list-style: none; margin: 0; padding: 0; }
.stop, .my-stop {
  display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border);
}
.stop-num {
  flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--c); color: #fff;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
}
.stop-num.my { background: var(--my); color: var(--accent-text); border-radius: 8px; }
.stop-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.stop-mode { font-size: 12px; color: var(--muted); }
.stop-name { flex: 1; text-align: left; border: 0; background: none; padding: 2px 0; font-weight: 600; cursor: pointer; min-width: 0; }
button.stop-name:hover { color: var(--accent); }
.stop-nav {
  flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px;
  border: 1px solid var(--border); text-decoration: none; font-weight: 700;
}
.my-btns { display: flex; gap: 4px; flex: none; }

details.block > summary { list-style: none; cursor: pointer; }
details.block > summary::-webkit-details-marker { display: none; }
details.block > summary h3 { display: inline; }
details.block > summary::after { content: " ▸"; color: var(--muted); }
details.block[open] > summary::after { content: " ▾"; }
details.block > summary { margin: 20px 0 8px; }
.steps { padding-left: 22px; margin: 0; }
.steps li { margin: 0 0 12px; }
.steps p { margin: 0 0 6px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }
.tag-btn {
  border: 1px solid var(--border); background: var(--surface); border-radius: 999px;
  padding: 3px 10px; font-size: 13px; cursor: pointer;
}
.tag-btn:hover { border-color: var(--accent); }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 12px 0; font-size: 14px; }
.facts dt { color: var(--muted); font-weight: 600; }
.facts dd { margin: 0; }
.route-links { display: flex; flex-direction: column; gap: 6px; }
.route-chip {
  text-align: left; border: 1px solid var(--border); border-left: 4px solid var(--c);
  background: var(--surface); border-radius: 10px; padding: 8px 10px; cursor: pointer; font-size: 14px;
}
.acc-niska { color: var(--warn); }
.acc { margin-top: 16px; }

.switch { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--muted); margin: 8px 0; }
.switch input { accent-color: var(--accent); margin-top: 3px; }

/* ---------- mapa: pinezki ---------- */
.leaflet-container { font: inherit; background: var(--surface-2); }
.leaflet-marker-icon.pin-wrap { background: none; border: 0; overflow: visible; }
.pin {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -50%);
  display: grid; place-items: center; border-radius: 50%; cursor: pointer;
}
.pin::before { content: ""; position: absolute; inset: -9px; } /* większe pole dotyku */
.pin--dot {
  width: 14px; height: 14px; background: var(--c); border: 2px solid var(--map-casing);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
}
.pin--dot span { display: none; font-size: 14px; line-height: 1; }
.zoom-near .pin--dot { width: 28px; height: 28px; background: var(--surface); border: 2.5px solid var(--c); }
.zoom-near .pin--dot span { display: block; }
.pin--view {
  width: 14px; height: 14px; background: transparent; border: 2.5px dashed var(--c);
}
.pin--view span { display: none; }
.zoom-near .pin--view { width: 28px; height: 28px; background: var(--surface); opacity: .85; }
.zoom-near .pin--view span { display: block; font-size: 13px; }
.pin--num {
  width: 26px; height: 26px; background: var(--c); color: #fff; font-size: 12px; font-weight: 700;
  border: 2px solid var(--map-casing); box-shadow: 0 1px 4px rgba(0, 0, 0, .4);
}
.pin--my {
  width: 26px; height: 26px; border-radius: 8px; background: var(--my); color: var(--accent-text);
  font-size: 12px; font-weight: 700; border: 2px solid var(--map-casing); box-shadow: 0 1px 4px rgba(0, 0, 0, .4);
}
.pin--me {
  width: 18px; height: 18px; background: #2563eb; border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(37, 99, 235, .35), 0 1px 4px rgba(0, 0, 0, .4);
}
.pin-hi {
  position: absolute; left: 0; top: 0; width: 46px; height: 46px; transform: translate(-50%, -50%);
  border-radius: 50%; border: 3px solid var(--accent); background: color-mix(in srgb, var(--accent) 18%, transparent);
  animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse { 0% { transform: translate(-50%, -50%) scale(.7); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1.25); opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .pin-hi { animation: none; } }
.loc-acc { fill: #2563eb; fill-opacity: .12; stroke: #2563eb; stroke-opacity: .4; stroke-width: 1; }
.my-line { stroke: var(--my); }
.picking { cursor: crosshair; }

.leaflet-bar a, .leaflet-bar a:hover {
  background: var(--surface); color: var(--text); border-bottom-color: var(--border);
  width: 40px; height: 40px; line-height: 40px; font-size: 18px;
}
.leaflet-bar { border: 1px solid var(--border) !important; box-shadow: var(--shadow) !important; border-radius: 12px !important; overflow: hidden; }
.leaflet-top.leaflet-right { top: env(safe-area-inset-top); }
.leaflet-control-attribution { background: color-mix(in srgb, var(--surface) 80%, transparent) !important; color: var(--muted); }
.leaflet-control-attribution a { color: var(--muted); }
.leaflet-tooltip { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: var(--shadow); }
@media (max-width: 899px) { .leaflet-control-zoom { display: none; } }

.pick-banner {
  position: fixed; z-index: 1002; left: 50%; transform: translateX(-50%);
  top: calc(env(safe-area-inset-top) + 62px);
  display: flex; align-items: center; gap: 10px; max-width: calc(100% - 32px);
  background: var(--surface); color: var(--text); border: 1px solid var(--accent);
  border-radius: 14px; padding: 8px 8px 8px 14px; box-shadow: var(--shadow); font-size: 14px;
}
.pick-banner[hidden] { display: none; }

.toast {
  position: fixed; z-index: 1003; left: 50%; bottom: calc(var(--sheet-h) + 16px);
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px;
  font-size: 14px; max-width: calc(100% - 32px); transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 900px) { .toast { bottom: 24px; left: calc(var(--panel-w) + (100% - var(--panel-w)) / 2); } }

/* ---------- oznaczenia: odwiedzone / pomijam ---------- */
:root { --ok: #16a34a; --skip: #6b7280; }
.pin.is-visited::after {
  content: "✓"; position: absolute; right: -6px; top: -6px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--ok); color: #fff; font-size: 10px; line-height: 14px; text-align: center; font-weight: 700;
  border: 1.5px solid var(--map-casing);
}
.pin--dot.is-visited { background: var(--ok); }
.pin--dot.is-visited::after { display: none; }
.zoom-near .pin--dot.is-visited { background: var(--surface); border-color: var(--ok); }
.zoom-near .pin--dot.is-visited::after { display: block; }
.pin--num.is-visited { background: var(--ok); }
.pin--num.is-visited::after { display: none; }
.pin.is-skip { opacity: .4; filter: grayscale(1); }

.stop.is-visited .stop-name { color: var(--muted); }
.stop.is-skip .stop-name { color: var(--muted); text-decoration: line-through; }
.stop.is-skip .stop-num { background: var(--skip); }
.stop.is-visited .stop-num { background: var(--ok); }
.stop.is-next { background: var(--accent-soft); border-radius: 10px; padding-left: 6px; padding-right: 6px; }
.st-btn {
  flex: none; width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--muted); cursor: pointer; font-size: 15px; font-weight: 700; padding: 0;
}
.st-btn.st-visited.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.st-btn.st-skip.on { background: var(--skip); border-color: var(--skip); color: #fff; }
.btn.st-visited { color: var(--ok); border-color: var(--ok); }
.btn.st-visited.on { background: var(--ok); color: #fff; }
.btn.st-skip { color: var(--skip); border-color: var(--skip); }
.btn.st-skip.on { background: var(--skip); color: #fff; }
.st-row { margin-top: -4px; }
.st-mark { font-weight: 700; }
.st-mark.st-visited { color: var(--ok); }
.st-mark.st-skip { color: var(--skip); }

.prog { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.prog-bar { flex: 1; max-width: 160px; height: 6px; border-radius: 3px; background: var(--surface-2); display: flex; overflow: hidden; }
.prog-bar i { display: block; height: 100%; }
.prog-bar .v { background: var(--ok); }
.prog-bar .s { background: var(--skip); opacity: .6; }
.prog-txt { font-size: 12px; color: var(--muted); font-weight: 600; }
.card.progress .prog-bar { max-width: none; background: var(--surface); }
.card.progress p { margin: 6px 0 0; }
.next .link-btn { font-size: inherit; text-align: left; }
.proposals { margin: 4px 0 6px; }
.card.small p { margin: 0 0 4px; }
.card.small p:last-child { margin: 0; }

/* Ciemny motyw mapy: te same kafelki, odwrócone i przygaszone. */
.map-dark .base-tiles { filter: invert(1) hue-rotate(180deg) brightness(1.02) contrast(.9) saturate(.55); }

/* ---------- role miejsc: hotel, biuro, stacje, punkty nawigacyjne ---------- */
.pin--role {
  width: 22px; height: 22px; background: var(--c); color: #fff; font-size: 12px; font-weight: 800;
  border: 2px solid var(--map-casing); box-shadow: 0 1px 4px rgba(0, 0, 0, .4); font-family: system-ui, sans-serif;
}
.pin.pin--transit { width: 16px; height: 16px; border-radius: 5px; font-size: 9px; }
.zoom-near .pin.pin--transit { width: 22px; height: 22px; font-size: 12px; }
.pin.pin--hotel, .pin.pin--biuro { width: 28px; height: 28px; border-radius: 8px; font-size: 14px; z-index: 1; }
.pin--way { width: 10px; height: 10px; }
.pin--num-transit { border-radius: 7px; }
.stop-num--role { border-radius: 7px; }
.st-none { flex: none; width: 72px; }

/* ---------- oznaczenia spacerów ---------- */
.route-card.is-done, .route-card.is-skip { opacity: .55; }
.route-card.is-done:hover, .route-card.is-skip:hover { opacity: .85; }
.route-card.is-skip .route-title { text-decoration: line-through; }
.rst-tag { align-self: flex-start; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 1px 8px; margin-bottom: 2px; }
.rst-tag.rst-done { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.rst-tag.rst-skip { background: var(--surface-2); color: var(--skip); }
.btn.rst-done { color: var(--ok); border-color: var(--ok); }
.btn.rst-done.on { background: var(--ok); color: #fff; }
.btn.rst-skip { color: var(--skip); border-color: var(--skip); }
.btn.rst-skip.on { background: var(--skip); color: #fff; }
.rst-row { margin-top: 4px; }

.pitch { font-size: 16.5px; line-height: 1.55; margin: 10px 0 12px; }
.route-facts { margin: 8px 0; }

.legend { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: 14px; }
.legend li { display: flex; align-items: center; gap: 10px; }
.pin-demo {
  flex: none; display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
  background: var(--c); border: 2px solid var(--map-casing); box-shadow: 0 0 0 1px var(--border);
  color: #fff; font-size: 11px; font-weight: 800;
}
.pin-demo--role { border-radius: 6px; width: 22px; height: 22px; }
.pin-demo--num { width: 22px; height: 22px; background: var(--muted); }

/* Punkty organizacyjne: kolory spoza palety dni, żeby nie myliły się z trasą. */
.pin--hotel, .pin--biuro, .pin-demo.pin--hotel, .pin-demo.pin--biuro, .stop-num.pin--hotel, .stop-num.pin--biuro {
  background: var(--text); color: var(--bg); border-color: var(--bg);
}
.pin--transit, .pin--num-transit, .pin-demo.pin--transit, .stop-num.pin--transit {
  background: #fff; color: #1d4ed8; border: 2px solid #1d4ed8;
}
.pin--num-transit.is-visited { background: #fff; color: var(--ok); border-color: var(--ok); }
