/* Kuchnia, telefon w jednej ręce: jasne tło, jedna kolumna, duże cele dotyku; zieleń bazylii tylko na akcjach. */
:root {
  color-scheme: light;
  --bg: #f5f6f3;
  --surface: #ffffff;
  --ink: #1b221f;
  --muted: #5b6761;
  --faint: #8a948f;
  --line: #dde2dd;
  --accent: #1d6a50;
  --accent-press: #155039;
  --accent-soft: #e4f1eb;
  --heat: #b23a0c;
  --heat-soft: #fdebe1;
  --salt: #2f5a74;
  --salt-soft: #e5eff5;
  --lid-soft: #eceeec;
  --special: #6a3b93;
  --special-soft: #f1e9f8;
  --warn-soft: #fff6c7;
  --warn-line: #e3c128;
  --bad: #a3261b;
  --bad-soft: #fdecea;
  --star: #e0a100;
  --display: "Bricolage Grotesque", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 12px;
  --tap: 48px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--body);
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); }
h1, h2 { font-family: var(--display); font-weight: 700; line-height: 1.15; text-wrap: balance; margin: 0; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.2rem; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.page { padding-block: 20px 48px; display: flex; flex-direction: column; gap: 20px; }
.narrow { max-width: 420px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: .875rem; }
.stack { display: flex; flex-direction: column; gap: 14px; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar-in { display: flex; align-items: center; justify-content: space-between; min-height: 56px; gap: 12px; }
.brand { font-family: var(--display); font-weight: 700; font-size: 1.35rem; color: var(--ink); text-decoration: none; }
.nav { display: flex; gap: 4px; }
.nav a { padding: 10px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 600; }
.nav a.on, .nav a:hover { color: var(--accent); background: var(--accent-soft); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 18px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink);
  font: 600 1rem var(--body); text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { border-color: var(--faint); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover, .btn.primary:active { background: var(--accent-press); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); border-color: var(--bad); background: var(--surface); }
.btn.big { min-height: 54px; font-size: 1.05rem; }
.btn.huge { min-height: 64px; font-size: 1.2rem; width: 100%; }
.icon-btn {
  width: var(--tap); height: var(--tap); flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 50%; background: var(--surface);
  color: var(--ink); font-size: 1.2rem; text-decoration: none; cursor: pointer;
}
.icon-btn.sm { width: 40px; height: 40px; font-size: 1rem; }
.icon-btn.del { color: var(--bad); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: .85rem; font-weight: 600; color: var(--muted); }
input, textarea, select {
  width: 100%; min-height: var(--tap); padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink);
  font: 1rem/1.4 var(--body);
}
textarea { resize: vertical; }
#text, #prompt { font: .85rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.field.check { flex-direction: row; align-items: center; gap: 10px; }
.field.check input { width: 22px; min-height: 22px; height: 22px; }
.field.check > span { color: var(--ink); font-weight: 500; font-size: 1rem; }

.notice { padding: 12px 14px; border-radius: var(--radius); border: 1px solid; }
.notice.ok { background: var(--accent-soft); border-color: var(--accent); }
.notice.bad { background: var(--bad-soft); border-color: var(--bad); }
.notice ul { margin: 6px 0 0; padding-left: 20px; }
.error-line { color: var(--bad); font-weight: 600; }

.login { min-height: 100svh; justify-content: center; }
.brand-big { font-size: 2.6rem; }

/* lista */
.filters { display: flex; flex-direction: column; gap: 10px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.filter-row select { width: auto; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.chip {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  color: var(--ink); text-decoration: none; font-weight: 500;
}
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .cards { grid-template-columns: 1fr 1fr; } }
.card {
  display: grid; grid-template-columns: 104px 1fr; gap: 14px; align-items: center;
  padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--ink); text-decoration: none; height: 100%;
}
.card:hover { border-color: var(--faint); }
.card-img { width: 104px; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--accent-soft); }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.noimg { display: grid; place-items: center; height: 100%; font: 700 2.4rem var(--display); color: var(--accent); }
.card-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.card h2 { font-size: 1.08rem; }
.orig { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.meta span + span::before { content: "·"; margin-right: 12px; color: var(--faint); }
.empty { text-align: center; padding: 48px 0; display: flex; flex-direction: column; gap: 14px; align-items: center; }

/* przepis */
.recipe { display: flex; flex-direction: column; gap: 22px; }
.hero { width: 100%; max-height: 360px; object-fit: cover; border-radius: var(--radius); }
.r-head { display: flex; flex-direction: column; gap: 6px; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 700; color: var(--accent); }
.title-pl { font-size: 1.1rem; color: var(--muted); }
.facts { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 8px 0 0; }
.facts div { display: flex; flex-direction: column; }
.facts dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 700; }
.facts dd { margin: 0; font-weight: 600; }
.section { display: flex; flex-direction: column; gap: 10px; padding-top: 18px; border-top: 1px solid var(--line); }
.section.first { border-top: 0; padding-top: 0; }
.table-scroll { overflow-x: auto; margin: 0 -4px; }
.ingr { width: 100%; border-collapse: collapse; font-size: .95rem; background: var(--surface); border-radius: var(--radius); }
.ingr th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); padding: 8px 6px; border-bottom: 1px solid var(--line); }
.ingr td { padding: 10px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ingr .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ingr td:first-child, .ingr th:first-child { padding-left: 10px; }
.c-check { width: 40px; }
.c-check input { width: 24px; height: 24px; min-height: 24px; margin: 0; accent-color: var(--accent); }
.ingr label { font-weight: 600; cursor: pointer; }
.ingr .note { display: block; font-size: .82rem; color: var(--muted); }
.ingr tr.done td:not(.c-check) { color: var(--faint); text-decoration: line-through; }
.ingr tr.special td:nth-child(2) label::after { content: " ●"; color: var(--special); }
.shop-tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--special-soft); color: var(--special); font-weight: 600; font-size: .85rem; }
@media (max-width: 560px) {
  .ingr thead { display: none; }
  .ingr, .ingr tbody { display: block; }
  .ingr tr { display: grid; grid-template-columns: 40px 1fr auto; gap: 2px 8px; padding: 10px 10px; border-bottom: 1px solid var(--line); }
  .ingr td { display: block; padding: 0; border: 0; }
  .ingr td:first-child { padding: 0; grid-row: span 3; }
  .ingr td:nth-child(4), .ingr td:nth-child(5) { grid-column: 2 / 4; font-size: .88rem; color: var(--muted); }
  .ingr td:nth-child(4):empty, .ingr td:nth-child(5):empty { display: none; }
}

.macros { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.macro { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 8px; display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0; }
.macro b { font: 700 1.25rem var(--display); font-variant-numeric: tabular-nums; }
.macro span { font-size: .78rem; color: var(--muted); }
.macro.kcal { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.macro.kcal span { color: var(--line); }
@media (max-width: 380px) { .macros { grid-template-columns: repeat(2, 1fr); } }
.breakdown { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: .92rem; }
.breakdown li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; }
.b-val { font-variant-numeric: tabular-nums; font-weight: 600; }
.b-bar { grid-column: 1 / -1; height: 6px; background: var(--lid-soft); border-radius: 3px; overflow: hidden; }
.b-bar i { display: block; height: 100%; width: var(--w); background: var(--accent); border-radius: 3px; }

.change { background: var(--warn-soft); border: 2px solid var(--warn-line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.change-type { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; }
.plain { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.steps-preview summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; min-height: var(--tap); }
.steps-preview summary::after { content: "▾"; color: var(--muted); }
.steps-preview[open] summary::after { content: "▴"; }
.steps-preview summary::-webkit-details-marker { display: none; }
.steps-preview ol { margin: 6px 0 0; padding-left: 22px; display: flex; flex-direction: column; gap: 12px; }
.steps-preview .badges { margin-top: 6px; }

.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 8px; font-weight: 700; font-size: .9rem; }
.badge.heat { background: var(--heat-soft); color: var(--heat); }
.badge.lid { background: var(--lid-soft); color: var(--ink); }
.badge.lid.off { color: var(--muted); }
.badge.salt { background: var(--salt-soft); color: var(--salt); font-weight: 600; }

.history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.history li { display: flex; gap: 12px; align-items: flex-start; }
.history img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; }
.history li > div { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.stars { color: var(--star); letter-spacing: 1px; }
.stars .off { color: var(--line); }
.r-actions { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 18px; border-top: 1px solid var(--line); }

/* edycja */
.back a { text-decoration: none; font-weight: 600; }
.edit-form { display: flex; flex-direction: column; gap: 18px; }
.group { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 14px; margin: 0; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.group legend { font: 700 1.1rem var(--display); padding: 0 6px; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (min-width: 620px) { .grid2 { grid-template-columns: 1fr 1fr; } .grid2 > .grid3 { grid-column: 1 / -1; } }
.items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.item { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--bg); }
.item-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.item-tools { display: flex; gap: 6px; }
.item-body { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.item-body .wide { grid-column: 1 / -1; }
.item-body input, .item-body select, .item-body textarea { background: var(--surface); }
.save-bar { position: sticky; bottom: 0; display: flex; gap: 10px; padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--bg); border-top: 1px solid var(--line); }
.save-bar .primary { flex: 1; }
.danger-zone { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding-top: 24px; }

.profile-form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.profile-form .field { grid-column: 1 / -1; }
.profile-form .field.short { grid-column: auto; }
.profile-form button { grid-column: 1 / -1; }
.prompt-preview summary { cursor: pointer; padding: 8px 0; color: var(--accent); font-weight: 600; }

/* tryb gotowania */
.cook-body { background: var(--surface); }
.cook {
  min-height: 100svh; display: flex; flex-direction: column;
  max-width: 760px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.cook-top {
  position: sticky; top: 0; z-index: 5; background: var(--surface);
  display: flex; align-items: center; gap: 12px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 0 8px;
}
.cook-progress-label { flex: 1; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.pill-btn { min-height: var(--tap); padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font: 600 1rem var(--body); color: var(--ink); cursor: pointer; }
.progress { height: 6px; background: var(--lid-soft); border-radius: 3px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s ease; }
.timers { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 8px; position: sticky; top: calc(64px + env(safe-area-inset-top, 0px)); z-index: 4; background: var(--surface); }
.timer { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 12px; border-radius: 999px; background: var(--ink); color: var(--surface); font-size: .9rem; max-width: 100%; }
.timer .t-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 14ch; opacity: .8; }
.timer .t-left { font-variant-numeric: tabular-nums; font-size: 1.05rem; }
.timer .t-x { border: 0; background: rgba(255, 255, 255, .15); color: inherit; border-radius: 999px; min-width: 36px; height: 36px; font: 700 .9rem var(--body); cursor: pointer; }
.timer.rang { background: var(--heat); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .65; } }
.cook-stage { flex: 1; padding-block: 16px 24px; touch-action: pan-y; }
.cook-step { display: flex; flex-direction: column; gap: 16px; }
.step-photos { display: flex; flex-direction: column; gap: 10px; }
.step-photos:empty { display: none; }
.step-photo { margin: 0; position: relative; }
.step-photo img { width: 100%; max-height: 46svh; object-fit: cover; border-radius: var(--radius); cursor: zoom-in; }
.photo-del { position: absolute; right: 8px; top: 8px; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 0; background: rgba(0, 0, 0, .6); color: #fff; font: 600 .85rem var(--body); cursor: pointer; }
.step-no { font-size: .85rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.step-title { font-size: clamp(1.9rem, 7vw, 2.6rem); }
.cook-step .badge { font-size: 1.15rem; padding: 8px 14px; border-radius: 10px; }
.cook-step .badges { gap: 8px; }
.step-text { font-size: clamp(1.35rem, 5.4vw, 1.75rem); line-height: 1.45; max-width: 34ch; }
.timer-btn { align-self: flex-start; min-height: 60px; font-size: 1.3rem; font-variant-numeric: tabular-nums; border: 2px solid var(--ink); }
.timer-btn.running { background: var(--ink); color: var(--surface); }
.add-photo { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-top: 8px; border-top: 1px dashed var(--line); }
.upload-status { color: var(--muted); font-size: .9rem; }
.cook-nav {
  position: sticky; bottom: 0; z-index: 5; background: var(--surface);
  display: grid; grid-template-columns: 1fr 2fr; gap: 10px;
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
}
.cook-nav .btn { min-height: 64px; font-size: 1.25rem; }
.done-step .rating { border: 0; padding: 0; margin: 0; }
.done-step legend { font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.stars-input { display: inline-flex; flex-direction: row-reverse; gap: 4px; }
.stars-input input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.stars-input label { font-size: 2.6rem; line-height: 1; color: var(--line); cursor: pointer; padding: 2px; }
.stars-input input:checked ~ label, .stars-input label:hover, .stars-input label:hover ~ label { color: var(--star); }
.stars-input input:focus-visible + label { outline: 3px solid var(--accent); border-radius: 6px; }

.drawer { position: fixed; inset: 0; z-index: 20; background: rgba(20, 26, 23, .45); display: flex; justify-content: flex-end; }
.drawer-panel {
  width: min(92vw, 420px); height: 100%; overflow-y: auto; background: var(--surface);
  padding: calc(12px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) calc(16px + env(safe-area-inset-bottom, 0px)) 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; }
.drawer-list { list-style: none; margin: 0; padding: 0; }
.drawer-list li { display: grid; grid-template-columns: 1fr auto; gap: 0 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 1.1rem; }
.d-name { font-weight: 600; }
.d-qty { font-variant-numeric: tabular-nums; white-space: nowrap; }
.d-house { grid-column: 1 / -1; color: var(--muted); font-size: .95rem; }
.drawer-list li.special .d-name::after { content: " ●"; color: var(--special); }
.lightbox { position: fixed; inset: 0; z-index: 30; background: #000; display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox .icon-btn { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); right: max(12px, env(safe-area-inset-right, 0px)); }

@media (prefers-reduced-motion: reduce) {
  .progress i { transition: none; }
  .timer.rang { animation: none; }
}
