/* ---------- Kolory: jasny (domyślny) i ciemny motyw ---------- */
:root {
  --bg: #e9edeb;
  --panel: #ffffff;
  --soft: #f2f5f3;
  --ink: #16201b;
  --muted: #5d6b64;
  --line: #d3dbd6;
  --accent: #e8590c;
  --accent-hover: #d14d07;
  --accent-ink: #ffffff;
  --focus: #1c7ed6;
  --danger: #d42a2a;
  --radius: 6px;
  --font: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0c110f;
  --panel: #141a17;
  --soft: #1b231f;
  --ink: #e5ebe8;
  --muted: #94a39b;
  --line: #29332e;
  --accent: #ff7a2f;
  --accent-hover: #ff8f50;
  --accent-ink: #1b0c03;
  --focus: #4dabf7;
  --danger: #ff6b6b;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 16px/1.5 var(--font); color: var(--ink); background: var(--bg); }
a { color: var(--accent); }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- Pasek Monster Fishing nad nagłówkiem ---------- */
.mf-banner {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 6px 16px;
  background: var(--accent); color: var(--accent-ink); text-decoration: none; font-weight: 700; font-size: 15px; text-align: center;
}
.mf-banner:hover { background: var(--accent-hover); }

/* ---------- Pasek górny ---------- */
.bar {
  height: 60px; display: flex; align-items: center; gap: 16px;
  padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 19px; letter-spacing: -.01em; }
.brand-mark { width: 30px; height: 30px; }
.brand-mark rect { fill: var(--accent); }
.brand-mark path { fill: var(--accent-ink); }

.tabs { display: flex; gap: 4px; height: 100%; margin-left: 8px; }
.tabs a {
  display: flex; align-items: center; padding: 0 14px; height: 100%;
  color: var(--muted); text-decoration: none; font-weight: 600; border-bottom: 3px solid transparent;
}
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); }

.bar-right { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.lang { display: flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.lang button { border: 0; background: none; padding: 9px 13px; font: 600 14px var(--mono); cursor: pointer; color: var(--muted); }
.lang button + button { border-left: 1px solid var(--line); }
.lang button.on { background: var(--ink); color: var(--panel); }

.icon-btn { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: var(--radius); background: none; cursor: pointer; }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.icon-btn .i-moon { fill: currentColor; stroke: none; }
:root[data-theme="dark"] .i-moon, :root:not([data-theme="dark"]) .i-sun { display: none; }

/* ---------- Układ ---------- */
.app { display: grid; grid-template-columns: 420px minmax(0, 1fr); height: calc(100dvh - 100px); }
.panel { overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line); scrollbar-width: thin; }

.step { padding: 20px; border-bottom: 1px solid var(--line); transition: opacity .15s; }
.step.locked { opacity: .35; pointer-events: none; }
.step h2 { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; font-size: 18px; font-weight: 600; }
.n { width: 28px; height: 28px; display: grid; place-items: center; flex: none; border-radius: 50%; background: var(--ink); color: var(--panel); font: 600 14px var(--mono); }
.hint { color: var(--muted); font-size: 14px; margin: 12px 0 0; }
.note { color: var(--muted); font-size: 13px; margin: 14px 0 0; padding: 10px 12px; background: var(--soft); border-radius: var(--radius); }

/* ---------- Przyciski ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 46px; padding: 0 18px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); font-weight: 600; cursor: pointer; text-decoration: none; color: var(--ink);
}
.btn:hover:not(:disabled) { border-color: var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.btn-big { width: 100%; min-height: 56px; font-size: 17px; }
.btn-big + .btn-big { margin-top: 10px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tiles button {
  min-height: 50px; padding: 8px 12px; text-align: left; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); font-size: 15px; font-weight: 500; cursor: pointer; line-height: 1.25;
}
.tiles button:hover { border-color: var(--ink); }
.tiles button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }

/* ---------- Pola ---------- */
.input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); color: var(--ink); font: inherit;
}
.input:focus { outline: none; border-color: var(--focus); }
.input-big { min-height: 52px; font-size: 17px; }

.list-head { display: flex; justify-content: space-between; align-items: center; margin: 12px 0 6px; color: var(--muted); font-size: 14px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.seg button { border: 0; background: none; padding: 6px 12px; font-size: 14px; cursor: pointer; color: var(--muted); white-space: nowrap; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--soft); color: var(--ink); font-weight: 600; }

.lake-list { position: relative; list-style: none; margin: 0; padding: 0; max-height: 320px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.lake-list:empty { display: none; }
.lake-list li + li { border-top: 1px solid var(--line); }
.lake-list button {
  width: 100%; min-height: 50px; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 8px 14px; border: 0; background: none; text-align: left; cursor: pointer;
}
.lake-list button:hover { background: var(--soft); }
.lake-list b { font-weight: 600; overflow-wrap: anywhere; }
.lake-list small { color: var(--muted); font: 13px var(--mono); white-space: nowrap; }
.lake-list li.on button { background: var(--accent); color: var(--accent-ink); }
.lake-list li.on small { color: inherit; opacity: .85; }

.lake-info { margin-bottom: 18px; }
.lake-info h3 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.lake-info p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.lake-info b { color: var(--ink); }

/* Suwak strefy buforowej */
.buffer { padding: 16px; background: var(--soft); border-radius: var(--radius); }
.buffer-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.buffer-value { font: 600 40px/1 var(--mono); letter-spacing: -.02em; }
.buffer-value span { font-size: 18px; color: var(--muted); margin-left: 6px; }
.step-btn {
  width: 52px; height: 52px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel);
  font-size: 26px; line-height: 1; cursor: pointer;
}
.step-btn:hover { border-color: var(--ink); }
input[type=range] { width: 100%; margin: 18px 0 4px; height: 28px; accent-color: var(--accent); cursor: pointer; }
.scale { display: flex; justify-content: space-between; color: var(--muted); font: 12px var(--mono); }

.check { display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; }
.stats:empty { display: none; }
.stats div { background: var(--panel); padding: 12px 14px; }
.stats b { display: block; font: 600 22px var(--mono); }
.stats span { color: var(--muted); font-size: 13px; }
.stats .error, .stats .info { grid-column: 1 / -1; color: var(--danger); background: var(--panel); margin: 0; padding: 12px 14px; }
.stats .info { color: var(--ink); font-size: 14px; }

/* ---------- Zakładki O serwisie i Kontakt ---------- */
.page { min-height: calc(100dvh - 100px); padding: 48px 16px; }
.page-inner { max-width: 560px; margin: 0 auto; padding: 32px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.page h1 { margin: 0 0 8px; font-size: 28px; letter-spacing: -.01em; }
.page p { color: var(--muted); margin: 0 0 24px; }
.page .small { font-size: 13px; margin: 24px 0 0; }
.page-inner { max-width: 720px; }
.page-narrow { max-width: 560px; }
.noscript { margin: 0; padding: 14px 16px; background: var(--accent); color: var(--accent-ink); font-weight: 600; text-align: center; }
.page h2 { font-size: 19px; margin: 32px 0 12px; }
.page .lead { color: var(--ink); font-size: 17px; }
.boats { margin: 24px 0 0; }
.boats-row { display: grid; grid-template-columns: 446fr 416fr 293fr; gap: 12px; align-items: end; color: var(--ink); text-decoration: none; }
.boats-row span { text-align: center; }
.boats img { display: block; width: 100%; height: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.boats b { display: block; margin-top: 6px; font-size: 14px; }
.boats figcaption { margin-bottom: 12px; font-weight: 600; }
.boats figcaption a { color: var(--accent); }
/* rysunki mają czarne linie na białym – w ciemnym motywie odwracamy */
:root[data-theme="dark"] .boats img { filter: invert(1); }
.guide { list-style: none; counter-reset: g; margin: 0; padding: 0; }
.guide li { counter-increment: g; position: relative; padding: 0 0 18px 44px; }
.guide li::before {
  content: counter(g); position: absolute; left: 0; top: 0; width: 28px; height: 28px; display: grid; place-items: center;
  border-radius: 50%; background: var(--ink); color: var(--panel); font: 600 14px var(--mono);
}

/* ---------- Mapa ---------- */
.app { position: relative; }
.map-wrap { position: relative; isolation: isolate; }
#map { position: absolute; inset: 0; background: var(--soft); }
.leaflet-container { font-family: var(--font); }
.pl-mask { fill: var(--bg); fill-opacity: .75; }
.pl-border { stroke: var(--muted); stroke-dasharray: 6 5; }
:root[data-theme="dark"] .tiles-osm { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.88) saturate(.7); }
:root[data-theme="dark"] .leaflet-bar a, :root[data-theme="dark"] .leaflet-control-layers {
  background: var(--panel); color: var(--ink); border-color: var(--line);
}
:root[data-theme="dark"] .leaflet-control-attribution { background: rgba(20, 26, 23, .85); color: var(--muted); }
:root[data-theme="dark"] .leaflet-control-attribution a { color: var(--ink); }
:root[data-theme="dark"] .leaflet-popup-content-wrapper, :root[data-theme="dark"] .leaflet-popup-tip,
:root[data-theme="dark"] .leaflet-tooltip { background: var(--panel); color: var(--ink); border-color: var(--line); }

.loader, .toast {
  position: absolute; left: 50%; transform: translateX(-50%); z-index: 800;
  display: flex; align-items: center; gap: 12px; max-width: calc(100% - 24px);
  padding: 10px 12px 10px 16px; background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 6px 20px rgba(0, 0, 0, .18); font-weight: 500;
}
.loader { top: 50%; transform: translate(-50%, -50%); padding: 14px 18px; }
.toast { bottom: 40px; }
.toast.error { border-left: 4px solid var(--danger); }
.spinner { width: 20px; height: 20px; flex: none; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.legend {
  position: absolute; left: 10px; bottom: 24px; z-index: 700; display: flex; flex-wrap: wrap; gap: 4px 14px;
  padding: 7px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); font-size: 13px;
}
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 2px; background: var(--c); margin-right: 6px; vertical-align: -1px; }
.legend b { font-weight: 500; }

.file-warning {
  position: absolute; inset: 0; z-index: 900; display: grid; place-content: center; gap: 8px;
  padding: 24px; text-align: center; background: var(--panel);
}
.file-warning h3 { margin: 0; font-size: 20px; }
.file-warning p { margin: 0; color: var(--muted); max-width: 460px; }

/* ---------- Telefony ---------- */
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); height: auto; }
  .map-wrap { order: -1; height: 55vh; min-height: 340px; }
  .panel { overflow: visible; border-right: 0; }
  .legend { display: none; }
  .page { padding: 16px; }
  .page-inner { padding: 22px; }
}
@media (max-width: 640px) {
  .bar { height: auto; flex-wrap: wrap; padding: 10px 12px 0; gap: 8px 10px; }
  .tabs { order: 3; width: 100%; height: 44px; margin: 0; }
  .tabs a { flex: 1; justify-content: center; padding: 0 6px; font-size: 14px; line-height: 1.2; text-align: center; }
  .app, .page { min-height: calc(100dvh - 152px); }
  .mf-banner { font-size: 14px; }
  .lang button { padding: 8px 9px; }
}
