/* ---------- zmienne ---------- */
:root {
  --bg: #f6f5f1; --surface: #fff; --surface-2: #efede7; --text: #1b1d1a; --muted: #62675e;
  --line: #e3e0d8; --line-strong: #cfcbc0;
  --accent: #1f5c46; --accent-hover: #17493700; --accent-strong: #174937; --on-accent: #fff; --accent-soft: #e4efe8;
  --warm: #a94e29; --warm-soft: #f8e9e1;
  --warn-bg: #fbf2de; --warn-line: #e8d09a; --warn-text: #664809;
  --danger: #a32d25;
  --shadow: 0 1px 2px rgb(24 26 20 / .05), 0 10px 28px -18px rgb(24 26 20 / .22);
  --serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, sans-serif;
  --radius: 14px; --radius-sm: 10px; --header: 60px;
  --map-filter: saturate(.5) contrast(.96) brightness(1.02);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f110f; --surface: #171a17; --surface-2: #1f231f; --text: #ebede7; --muted: #9aa094;
    --line: #282d27; --line-strong: #3a4138;
    --accent: #8ecdac; --accent-strong: #a8dcc0; --on-accent: #0c231a; --accent-soft: #1b2e24;
    --warm: #e39169; --warm-soft: #33221a;
    --warn-bg: #2a2312; --warn-line: #55461c; --warn-text: #ecd592;
    --danger: #f1958c;
    --shadow: none;
    --map-filter: invert(1) hue-rotate(180deg) saturate(.35) brightness(.92) contrast(.9);
    color-scheme: dark;
  }
}

/* ---------- podstawy ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 15.5px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
main { padding: 20px 16px 104px; overflow-wrap: anywhere; }
.page { margin: 0 auto; max-width: 600px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.012em; line-height: 1.22; text-wrap: balance; }
h1 { font-size: 1.75rem; margin: 4px 0 16px; }
h2 { font-size: 1.25rem; margin: 32px 0 12px; }
h3 { font-size: 1.18rem; margin: 0; }
p { margin: 10px 0; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.muted { color: var(--muted); }
.pre { white-space: pre-wrap; }
small, .meta { color: var(--muted); font-size: .84rem; }
.eyebrow { margin: 0; color: var(--warm); font-size: .72rem; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 16px; height: 16px; }
.icon.lg { width: 28px; height: 28px; stroke-width: 1.5; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- nagłówek i nawigacja ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: var(--header); max-width: 960px; margin: 0 auto; padding: 0 16px; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--text); text-decoration: none; font: 600 1.35rem var(--serif); letter-spacing: -.01em; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.tools { display: flex; gap: 4px; }
.tool { position: relative; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; color: var(--text); }
.tool:hover { background: var(--surface-2); }
.badge { position: absolute; top: 4px; right: 3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--warm); color: var(--bg); font-size: .66rem; font-weight: 700; line-height: 17px; text-align: center; }
.tabs { position: fixed; z-index: 30; bottom: 0; left: 0; right: 0; display: flex; justify-content: center; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs a { flex: 1; max-width: 140px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 4px 9px; color: var(--muted); font-size: .72rem; font-weight: 600; text-decoration: none; }
.tabs a[aria-current] { color: var(--accent); }
.tabs a[aria-current] .icon { stroke-width: 2.1; }
.tabs a.add .icon { width: 38px; height: 24px; padding: 2px 0; border-radius: 8px; background: var(--accent); color: var(--on-accent); }

/* ---------- przyciski i formularze ---------- */
button, input, select, textarea { font: inherit; color: inherit; }
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 9px 18px; margin: 0; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-size: .93rem; font-weight: 600; text-decoration: none; cursor: pointer; transition: background-color .15s, border-color .15s; }
button:hover, .btn:hover { background: var(--surface-2); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
button.primary:hover, .btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
button.link { min-height: 36px; padding: 4px 6px; border: 0; background: none; color: var(--muted); font-weight: 500; font-size: .86rem; }
button.link:hover { color: var(--text); background: none; text-decoration: underline; }
button.danger, button.link.danger { color: var(--danger); }
button:disabled { opacity: .55; cursor: wait; }
.block { width: 100%; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 16px 0; }

input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea { width: 100%; min-height: 46px; padding: 10px 13px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 3px solid var(--accent-soft); outline-offset: 0; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .75; }
textarea { resize: vertical; line-height: 1.5; }
select { appearance: none; padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23808578' stroke-width='1.6'%3E%3Cpath d='M1 1.5 6 6.5l5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; }
form > button[type=submit] { width: 100%; min-height: 48px; margin-top: 8px; }
.field { display: block; margin: 16px 0; }
.field > span:first-child { display: block; margin-bottom: 6px; font-size: .85rem; font-weight: 600; }
.field small { display: block; margin-top: 5px; }
.check { display: flex; gap: 11px; align-items: flex-start; margin: 12px 0; cursor: pointer; }
.check input { flex: none; width: 19px; height: 19px; margin: 2px 0 0; accent-color: var(--accent); }
fieldset { min-width: 0; margin: 20px 0; padding: 0; border: 0; }
legend { margin-bottom: 8px; padding: 0; font-size: .85rem; font-weight: 600; }
.segmented { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 12px; }
.segmented label { flex: 1; position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { display: block; padding: 9px; border-radius: 9px; text-align: center; font-size: .9rem; font-weight: 600; color: var(--muted); }
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / .14); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); }
.toggles { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.toggles label { position: relative; cursor: pointer; }
.toggles input { position: absolute; opacity: 0; }
.toggles span { display: block; padding: 7px 14px; border: 1px solid var(--line-strong); border-radius: 99px; background: var(--surface); font-size: .86rem; }
.toggles input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.toggles input:focus-visible + span { outline: 2px solid var(--accent); }
.drop { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; aspect-ratio: 4 / 3; margin: 12px 0; overflow: hidden; border: 1.5px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--muted); text-align: center; cursor: pointer; }
.drop:hover { border-color: var(--accent); color: var(--accent); }
.drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.drop strong { color: var(--text); }
.drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.drop .change { position: absolute; bottom: 12px; right: 12px; padding: 6px 12px; border-radius: 99px; background: rgb(15 17 15 / .72); color: #fff; font-size: .8rem; font-weight: 600; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.row > input.amount { width: 78px; }
.row > select { width: 112px; }
.row > .grow { flex: 1 1 150px; width: auto; }
.row > input[type=time] { width: 132px; margin-left: auto; }
.row .check { margin: 0; }
button.remove { width: 40px; min-height: 40px; padding: 0; border: 0; background: none; color: var(--muted); }
.error { color: var(--danger); font-weight: 600; font-size: .9rem; }

/* ---------- karty i listy ---------- */
.panel { margin: 14px 0; padding: 4px 18px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel > h2 { margin-top: 16px; }
.panel.flush { padding: 0 16px; }
.feed { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; margin: 16px 0; }
.card { display: flex; flex-direction: column; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; gap: 11px; padding: 12px 14px; }
.who { min-width: 0; line-height: 1.3; }
.who a, .name { color: var(--text); font-weight: 600; text-decoration: none; }
.who small { display: block; }
.media { position: relative; display: block; aspect-ratio: 4 / 3; background: var(--surface-2); }
.media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.overlay { position: absolute; left: 12px; bottom: 12px; display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 99px; background: rgb(15 17 15 / .68); backdrop-filter: blur(6px); color: #fff; font-size: .76rem; font-weight: 600; }
.card-body { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px 16px; }
.card-body h3 a { color: var(--text); text-decoration: none; }
.card-body h3 a:hover { color: var(--accent); }
.facts { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: .84rem; }
.facts span { display: inline-flex; align-items: center; gap: 5px; }
.byline { display: flex; align-items: center; gap: 8px; font-size: .86rem; }
.byline a { color: var(--text); font-weight: 600; text-decoration: none; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags:empty { display: none; }
.tag { padding: 3px 10px; border-radius: 99px; background: var(--surface-2); color: var(--muted); font-size: .76rem; font-weight: 600; }
.tag.good { background: var(--accent-soft); color: var(--accent); }
.tag.warn { background: var(--warn-bg); color: var(--warn-text); }

.avatar { display: inline-grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 50%; font: 600 .95rem var(--serif); background: var(--accent-soft); color: var(--accent); }
.avatar.t1 { background: var(--warm-soft); color: var(--warm); }
.avatar.t2 { background: var(--warn-bg); color: var(--warn-text); }
.avatar.t3 { background: var(--surface-2); color: var(--text); }
.avatar.sm { width: 26px; height: 26px; font-size: .72rem; }
.avatar.lg { width: 68px; height: 68px; font-size: 1.6rem; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 32px; }
.section-head h2 { margin: 0; }
.section-head a { font-size: .86rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.page-head { margin-bottom: 18px; }
.page-head h1 { margin: 4px 0 0; }
.back { display: inline-flex; align-items: center; gap: 4px; margin: -8px 0 10px -6px; }

.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 16px 0; padding: 32px 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--muted); text-align: center; }
.empty p { margin: 0; max-width: 34ch; }
.empty .icon { color: var(--accent); }
.banner { display: flex; align-items: center; gap: 12px; margin: 14px 0; padding: 14px 16px; border: 1px solid transparent; border-radius: var(--radius); background: var(--accent-soft); color: var(--accent); font-weight: 600; text-decoration: none; }
.banner > span { flex: 1; }
.banner a { color: inherit; }
.note { display: flex; gap: 12px; align-items: flex-start; margin: 18px 0; padding: 13px 15px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); font-size: .9rem; }
.note.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-text); }

.menu { overflow: hidden; margin: 16px 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.menu a { display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 10px 16px; color: var(--text); font-weight: 500; text-decoration: none; }
.menu a + a { border-top: 1px solid var(--line); }
.menu a:hover { background: var(--surface-2); }
.menu a > span { flex: 1; }
.menu a > .icon:first-child { color: var(--accent); }
.menu a > .icon:last-child { color: var(--muted); }
.pill { flex: none !important; padding: 1px 9px; border-radius: 99px; background: var(--warm); color: var(--bg); font-size: .75rem; font-weight: 700; }

.choice { display: flex; align-items: center; gap: 16px; margin: 12px 0; padding: 20px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); text-decoration: none; }
.choice:hover { border-color: var(--accent); }
.choice .mark { display: grid; place-items: center; flex: none; width: 52px; height: 52px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); }
.choice div { flex: 1; }
.choice strong { display: block; font: 600 1.12rem var(--serif); }
.choice span.muted { display: block; font-size: .87rem; line-height: 1.45; }

.person { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 0; }
.person + .person { border-top: 1px solid var(--line); }
.person .name { flex: 1; }
.person .buttons { display: flex; gap: 6px; }
.person .buttons button { min-height: 38px; padding: 6px 12px; }
.profile-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.profile-head h1 { margin: 0; }
.profile-head p { margin: 2px 0 0; }

/* ---------- widok dania i przepisu ---------- */
.hero { overflow: hidden; margin-bottom: 18px; border-radius: var(--radius); background: var(--surface-2); }
.hero img { display: block; width: 100%; max-height: 440px; aspect-ratio: 4 / 3; object-fit: cover; }
.title-block h1 { margin: 6px 0 10px; font-size: 2rem; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 18px 0; border-block: 1px solid var(--line); }
.stats div { padding: 13px 6px; text-align: center; }
.stats div + div { border-left: 1px solid var(--line); }
.stats strong { display: block; font: 600 1.12rem var(--serif); }
.stats small { display: block; font-size: .72rem; letter-spacing: .07em; text-transform: uppercase; }
.story { font: 1.07rem/1.65 var(--serif); }
.ingredients { margin: 0; padding: 0; list-style: none; }
.ingredients li { display: flex; gap: 14px; padding: 10px 0; }
.ingredients li + li { border-top: 1px solid var(--line); }
.ingredients b { flex: none; width: 94px; font-variant-numeric: tabular-nums; }
.equipment { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.equipment li { padding: 5px 13px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); font-size: .86rem; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { position: relative; min-height: 36px; margin: 0 0 20px; padding: 3px 0 0 50px; counter-increment: step; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 33px; height: 33px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font: 600 .95rem var(--serif); }

.comments { margin-top: 36px; padding-top: 8px; border-top: 1px solid var(--line); }
.comment { display: flex; gap: 11px; margin: 14px 0; }
.comment > div { min-width: 0; flex: 1; }
.bubble { padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px var(--radius) var(--radius) var(--radius); }
.bubble p { margin: 2px 0 0; }
.comment .under { display: flex; gap: 4px; align-items: center; }
.list-item { display: block; margin: 10px 0; padding: 13px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--text); text-decoration: none; }
.list-item p { margin: 0; }
.list-item.unread { border-left: 3px solid var(--warm); }
blockquote { margin: 10px 0; padding: 2px 0 2px 14px; border-left: 3px solid var(--line-strong); }
.panel img { max-width: 100%; border-radius: var(--radius-sm); }

/* ---------- logowanie ---------- */
.welcome { max-width: 440px; margin: 12px auto 0; text-align: center; }
.welcome > img { width: 72px; height: 72px; border-radius: 18px; }
.welcome h1 { margin: 20px 0 10px; font-size: 2.05rem; }
.welcome > p { color: var(--muted); }
.features { margin: 26px 0; padding: 0; list-style: none; text-align: left; }
.features li { display: flex; gap: 14px; align-items: center; padding: 13px 0; }
.features li + li { border-top: 1px solid var(--line); }
.features .icon { color: var(--accent); }
details.dev { margin: 22px 0; padding: 4px 18px; border: 1px dashed var(--line-strong); border-radius: var(--radius); text-align: left; }
details.dev[open] { padding-bottom: 18px; }
details.dev summary { padding: 10px 0; font-size: .86rem; font-weight: 600; color: var(--muted); cursor: pointer; }

/* ---------- mapa ---------- */
#map { height: 62vh; min-height: 360px; max-height: 620px; margin: 8px 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); isolation: isolate; box-shadow: var(--shadow); }
.leaflet-tile-pane { filter: var(--map-filter); }
.leaflet-container { font-family: var(--sans); background: var(--surface-2) !important; }
.leaflet-bar a { background: var(--surface) !important; color: var(--text) !important; border-color: var(--line) !important; }
.leaflet-control-attribution { background: color-mix(in srgb, var(--surface) 85%, transparent) !important; color: var(--muted); }
.leaflet-control-attribution a { color: var(--accent) !important; }
.leaflet-marker-icon.pin { display: grid; place-items: center; border: 3px solid var(--surface); border-radius: 50%; background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: .85rem; box-shadow: 0 3px 10px rgb(0 0 0 / .3); }
.leaflet-marker-icon.pin.fresh { background: var(--warm); color: var(--bg); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .82rem; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 7px; border-radius: 50%; background: var(--accent); }
.legend span.fresh::before { background: var(--warm); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
button.chip { min-height: 38px; padding: 6px 15px; border-radius: 99px; font-size: .86rem; }
.search { display: grid; gap: 0 12px; }

/* ---------- nakładki ---------- */
.toast { position: fixed; z-index: 40; left: 50%; bottom: 88px; transform: translateX(-50%); width: max-content; max-width: 90vw; padding: 11px 18px; border-radius: var(--radius-sm); background: var(--text); color: var(--bg); font-size: .9rem; font-weight: 500; box-shadow: 0 8px 24px rgb(0 0 0 / .25); }
dialog { width: min(460px, 92vw); padding: 6px 22px 18px; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 24px 60px rgb(0 0 0 / .35); }
dialog::backdrop { background: rgb(8 10 8 / .6); }

/* ---------- strony prawne ---------- */
.legal { max-width: 680px; margin: 0 auto; }
.legal h2 { font-size: 1.1rem; }

/* ---------- szerszy ekran ---------- */
@media (min-width: 560px) {
  .search { grid-template-columns: 1fr 220px; }
}
@media (min-width: 860px) {
  .tabs { top: 0; bottom: auto; left: 50%; right: auto; transform: translateX(-50%); height: var(--header); padding: 0; background: none; border: 0; }
  .tabs a { flex-direction: row; gap: 8px; max-width: none; padding: 0 16px; font-size: .88rem; border-bottom: 2px solid transparent; }
  .tabs a[aria-current] { border-bottom-color: var(--accent); }
  .tabs a.add .icon { width: 30px; height: 22px; }
  main { padding: 32px 24px 64px; }
  .page.wide { max-width: 912px; }
  .wide .feed { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .columns { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 40px; align-items: start; }
  .columns > aside { position: sticky; top: calc(var(--header) + 20px); }
  .toast { bottom: 24px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
