:root {
  --bg: #f5f0e8;
  --surface: #fffaf3;
  --surface-2: #efe6d9;
  --text: #231d19;
  --muted: #6f6258;
  --line: #e3d8c8;
  --accent: #b0502a;
  --accent-ink: #ffffff;
  --glass: #2d5b8c;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 6px 20px rgba(60, 40, 20, .06);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14110f;
    --surface: #1e1916;
    --surface-2: #29221d;
    --text: #f1e9df;
    --muted: #a99a8c;
    --line: #342b25;
    --accent: #e27b4c;
    --accent-ink: #1a0f0a;
    --glass: #86aedb;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.5 var(--sans);
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

.view {
  max-width: 640px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 20px) 16px calc(env(safe-area-inset-bottom) + 96px);
}

/* ---------- wielkość tekstu ---------- */
.textsize-row { display: flex; justify-content: flex-end; }
.textsize { display: inline-flex; align-items: center; gap: 6px; }
.textsize-label { margin-right: 2px; font-size: 13px; color: var(--muted); }
.textsize button {
  min-width: 44px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-weight: 700;
  font-size: 16px;
}
.textsize button:disabled { opacity: .35; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

/* ---------- ekran główny ---------- */
.hero { text-align: center; padding: 12px 0 24px; }
.eyebrow { margin: 0; font-size: 13px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.brand {
  margin: 6px 0 4px;
  font: 600 clamp(28px, 8.5vw, 40px)/1.1 var(--serif);
  letter-spacing: .08em;
}
.subtitle { margin: 0; font: italic 20px/1.3 var(--serif); color: var(--muted); }
.meta { margin: 14px 0 22px; font-size: 14px; color: var(--muted); }

.btn-primary {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 17px 20px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  font-size: 18px;
}
.btn-primary:active { transform: scale(.99); opacity: .92; }
.btn-secondary {
  width: 100%;
  margin-top: 12px;
  border: 1.5px solid var(--accent);
  border-radius: 12px;
  padding: 12px 16px;
  background: transparent;
  color: var(--accent);
  font-weight: 600;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.offline { margin-bottom: 26px; }
.offline-head { display: flex; gap: 12px; align-items: center; }
.offline-head .ico { flex: none; width: 26px; height: 26px; color: var(--glass); }
.offline-title { margin: 0; font-weight: 600; }
.offline-status { margin: 0; font-size: 14px; color: var(--muted); }
.offline.done .ico { color: #3f8a4f; }
.progress { margin-top: 12px; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.progress-bar { width: 0; height: 100%; background: var(--glass); transition: width .2s; }
.hint { margin: 12px 0 0; font-size: 14px; color: var(--muted); }

.list { margin-bottom: 26px; }
.group-title {
  margin: 22px 4px 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.group { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); }
.row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 13px 14px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  text-align: left;
}
.row:first-child { border-top: 0; }
.row:active { background: var(--surface-2); }
.row-play {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--accent);
}
.row-play svg { width: 18px; height: 18px; }
.row.done .row-play { background: transparent; border: 1.5px solid var(--line); color: var(--muted); }
.row.current .row-play { background: var(--accent); color: var(--accent-ink); }
.row-main { flex: 1; min-width: 0; }
.row-title { display: block; font-weight: 600; line-height: 1.3; }
.row-where { display: block; font-size: 14px; color: var(--muted); line-height: 1.35; }
.row-dur { flex: none; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }

.map-card { margin-bottom: 8px; }
.map-card h2 { margin: 0 0 2px; font: 600 19px/1.3 var(--serif); }
.map-note { margin: 0 0 10px; font-size: 14px; color: var(--muted); }
.map svg { display: block; width: 100%; height: auto; }
#map-box .map { padding-bottom: 14px; }
.m-street { fill: var(--surface-2); }
.m-park { fill: rgba(95, 145, 90, .16); }
.m-pond { fill: rgba(45, 91, 140, .28); }
.m-block { fill: var(--bg); stroke: var(--line); }
.m-church { fill: var(--surface); stroke: var(--muted); stroke-width: 1.4; }
.m-nave { stroke: var(--line); stroke-width: 1; }
.m-future { fill: none; stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 3; }
.m-under { fill: none; stroke: var(--glass); stroke-width: 1.2; stroke-dasharray: 4 3; }
.m-school { fill: var(--surface); stroke: var(--muted); stroke-width: 1.2; }
.m-facade-n, .m-facade-p { stroke: var(--glass); stroke-width: 4; stroke-linecap: round; }
.m-facade-p { stroke: var(--accent); }
.m-tower { fill: var(--surface); stroke: var(--muted); stroke-width: 1; }
.m-star { fill: var(--glass); }
.m-label, .m-park-label, .m-small, .m-facade-label, .m-note, .m-compass text { font-family: var(--sans); fill: var(--muted); text-anchor: middle; }
.m-label { font-size: 9.5px; font-weight: 600; letter-spacing: .02em; }
.m-park-label { font-size: 8px; font-style: italic; }
.m-small { font-size: 8.5px; }
.m-facade-label { font-size: 9.5px; font-weight: 700; fill: var(--text); }
.m-note { font-size: 9.5px; text-anchor: start; }
.m-compass circle { fill: var(--surface); stroke: var(--line); }
.m-compass path { fill: var(--accent); }
.m-compass text { font-size: 9px; font-weight: 700; fill: var(--accent); }
.m-pin { cursor: pointer; }
.m-pin circle { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.m-pin text { font-family: var(--sans); font-size: 10px; font-weight: 700; fill: var(--accent-ink); text-anchor: middle; pointer-events: none; }
.m-pin.done circle { fill: var(--surface-2); stroke: var(--muted); stroke-width: 1.2; }
.m-pin.done text { fill: var(--muted); }
.m-pin.dim { opacity: .35; }
.m-pin.active circle { stroke: var(--text); stroke-width: 2.5; }
.m-pin:focus { outline: none; }
.m-pin:focus-visible circle { stroke: var(--text); stroke-width: 3; }

.tips h2 { margin: 0 0 8px; font: 600 19px/1.3 var(--serif); }
.tips ul { margin: 0; padding-left: 20px; }
.tips li { margin: 6px 0; font-size: 15px; }
.foot { margin: 22px 4px 0; font-size: 13px; color: var(--muted); }

.mini {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 12px);
  transform: translateX(-50%);
  width: min(608px, calc(100% - 32px));
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .18);
  text-align: left;
}
.mini-icon { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); }
.mini-icon svg { width: 16px; height: 16px; }
.mini-text { min-width: 0; }
.mini-title { display: block; font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-time { display: block; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- odtwarzacz ---------- */
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.link-btn { border: 0; background: none; padding: 8px 4px; color: var(--accent); font-weight: 600; font-size: 17px; }
.counter { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.section-label { margin: 0 0 4px; font-size: 13px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.p-title { margin: 0 0 18px; font: 600 clamp(26px, 7.5vw, 34px)/1.15 var(--serif); }

.player-card { padding: 20px 18px 22px; }
#seek {
  width: 100%;
  height: 28px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  --pct: 0%;
}
#seek::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--accent) var(--pct), var(--surface-2) var(--pct));
}
#seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -8px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--surface);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
}
#seek::-moz-range-track { height: 6px; border-radius: 3px; background: var(--surface-2); }
#seek::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--accent); }
#seek::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 3px solid var(--surface); }
.times { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }

.controls { display: flex; justify-content: center; align-items: center; gap: 28px; margin-top: 14px; }
.skip {
  display: grid;
  justify-items: center;
  gap: 2px;
  width: 68px;
  padding: 8px 0;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}
.skip svg { width: 30px; height: 30px; }
.skip:active { background: var(--surface-2); }
.play-big {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 6px 18px rgba(176, 80, 42, .35);
}
.play-big svg { width: 36px; height: 36px; }
.play-big .i-pause { display: none; }
.play-big.playing .i-play { display: none; }
.play-big.playing .i-pause { display: block; }
.play-big:active { transform: scale(.97); }
.p-error { margin: 14px 0 0; font-size: 14px; color: var(--accent); text-align: center; }

.cue {
  display: flex;
  gap: 12px;
  margin: 18px 0;
  padding: 16px;
  border-left: 4px solid var(--glass);
  border-radius: 4px 14px 14px 4px;
  background: var(--surface-2);
}
.cue .ico { flex: none; width: 24px; height: 24px; margin-top: 2px; color: var(--glass); }
.cue-where { margin: 0 0 2px; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.cue-text { margin: 0; font: 19px/1.45 var(--serif); }

.transcript { margin: 0 0 22px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.transcript summary { padding: 14px 2px; font-weight: 600; color: var(--accent); list-style: none; }
.transcript summary::-webkit-details-marker { display: none; }
.transcript summary::after { content: " ▾"; }
.transcript[open] summary::after { content: " ▴"; }
#transcript p { margin: 0 0 14px; font: 18px/1.6 var(--serif); }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pager-btn {
  display: grid;
  gap: 2px;
  min-height: 64px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  text-align: left;
  font-weight: 600;
  color: var(--accent);
}
.pager-btn.next { text-align: right; }
.pager-btn small { font-weight: 400; font-size: 13px; color: var(--muted); line-height: 1.3; }
.pager-btn:disabled { opacity: .35; }
.pager-btn.next.suggest { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pager-btn.next.suggest small { color: var(--accent-ink); opacity: .85; }
