:root {
  --bg: #f6f0e6;
  --paper: #fffaf2;
  --ink: #2a211b;
  --muted: #7a6c60;
  --line: #e6dccd;
  --accent: #c8462b;
  --accent-ink: #fff;
  --accent-soft: #f7dfd5;
  --olive: #6b7a3a;
  --olive-soft: #e7ebd6;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 6px 20px rgba(60, 40, 20, .07);
  --radius: 18px;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter", -apple-system, system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1714; --paper: #252019; --ink: #f2e9dc; --muted: #a8998a; --line: #3a322a;
    --accent: #e8664a; --accent-soft: #4a2a20; --olive: #a9b86f; --olive-soft: #2f3322;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans); }
body { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
main { max-width: 640px; margin: 0 auto; padding: calc(14px + env(safe-area-inset-top)) 16px 24px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.15; margin: 0; }
h1 { font-size: 30px; letter-spacing: -.01em; }
h2 { font-size: 21px; margin: 26px 0 10px; }
h3 { font-size: 15px; font-family: var(--sans); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea, select {
  font: inherit; color: var(--ink); width: 100%; background: var(--paper); border: 1.5px solid var(--line);
  border-radius: 14px; padding: 12px 14px; outline: none; font-size: 16px;
}
input:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 84px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hello { color: var(--muted); margin: 4px 0 18px; }

/* --- tryby --- */
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode {
  background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 14px;
  text-align: left; box-shadow: var(--shadow); transition: transform .12s, border-color .12s;
}
.mode:active { transform: scale(.98); }
.mode .ico { font-size: 28px; display: block; margin-bottom: 6px; }
.mode b { display: block; font-family: var(--serif); font-size: 17px; }
.mode small { color: var(--muted); font-size: 13px; line-height: 1.3; display: block; margin-top: 2px; }
.mode.on { border-color: var(--accent); background: var(--accent-soft); }

.panel { background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 16px; margin-top: 14px; box-shadow: var(--shadow); }
.panel label.lbl { display: block; font-weight: 600; font-size: 14px; margin: 14px 0 6px; }
.panel label.lbl:first-child { margin-top: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid var(--line); background: var(--bg); border-radius: 999px; padding: 7px 13px; font-size: 14px;
  white-space: nowrap;
}
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.seg { display: flex; background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px; padding: 3px; }
.seg button { flex: 1; border: 0; background: none; padding: 8px 4px; border-radius: 9px; font-size: 14px; font-weight: 500; }
.seg button.on { background: var(--paper); box-shadow: var(--shadow); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0 0; font-size: 15px; }
.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: .15s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: .15s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--olive); }
.switch input:checked + span::after { transform: translateX(20px); }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; border: 0; border-radius: 16px;
  padding: 15px 18px; font-weight: 600; font-size: 16px; background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 6px 18px rgba(200, 70, 43, .28); margin-top: 16px;
}
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); box-shadow: none; }
.btn.small { width: auto; padding: 10px 14px; font-size: 14px; margin: 0; }

/* --- pomysły --- */
.ideas { display: grid; gap: 10px; margin-top: 14px; }
.idea { background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; gap: 12px; align-items: flex-start; box-shadow: var(--shadow); }
.idea .e { font-size: 34px; line-height: 1; }
.idea b { font-family: var(--serif); font-size: 17px; display: block; }
.idea p { margin: 4px 0 8px; font-size: 14px; color: var(--muted); line-height: 1.4; }
.idea .meta { font-size: 12px; color: var(--muted); }

/* --- karta przepisu --- */
.hero { border-radius: 24px; padding: 22px 18px 18px; color: #2a211b; position: relative; overflow: hidden; box-shadow: var(--shadow); }
.hero .big { font-size: 56px; line-height: 1; filter: drop-shadow(0 4px 8px rgba(0,0,0,.15)); }
.hero h1 { margin-top: 10px; font-size: 27px; }
.hero p { margin: 6px 0 0; font-size: 15px; opacity: .85; }
.hero .cuisine { position: absolute; top: 16px; right: 16px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; background: rgba(255,255,255,.55); padding: 4px 10px; border-radius: 999px; }
.c-wloska { background: linear-gradient(135deg, #f8d9b0, #f2b8a0); }
.c-polska { background: linear-gradient(135deg, #f3e3c3, #dcc9a6); }
.c-koreanska { background: linear-gradient(135deg, #f7c0a8, #e98f7a); }
.c-azjatycka { background: linear-gradient(135deg, #f6e1a5, #e9b97c); }
.c-francuska { background: linear-gradient(135deg, #e9dcf0, #cfc0e0); }
.c-bliskowschodnia { background: linear-gradient(135deg, #f5d79a, #e6ae6b); }
.c-meksykanska { background: linear-gradient(135deg, #f9c79a, #d9e3a0); }
.c-amerykanska { background: linear-gradient(135deg, #f3d0a7, #e3a780); }
.c-fusion, .c-inna { background: linear-gradient(135deg, #d6e6cf, #b8d4c4); }

.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.pill { background: rgba(255,255,255,.6); border-radius: 999px; padding: 5px 11px; font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 5px; }
.serv { display: inline-flex; align-items: center; gap: 2px; padding: 2px 4px; }
.serv button { border: 0; background: rgba(255,255,255,.7); width: 26px; height: 26px; border-radius: 50%; font-weight: 700; color: #2a211b; }
.dots i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: rgba(42,33,27,.25); margin-left: 2px; }
.dots i.on { background: #2a211b; }

.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.act { background: var(--paper); border: 1.5px solid var(--line); border-radius: 14px; padding: 10px 4px; font-size: 13px; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.act span { font-size: 20px; }
.act.on { border-color: var(--accent); color: var(--accent); }

.versions { display: flex; gap: 6px; align-items: center; margin-top: 14px; overflow-x: auto; padding-bottom: 2px; }
.versions .chip { padding: 5px 11px; font-size: 13px; }
.change { background: var(--olive-soft); border-radius: 14px; padding: 10px 12px; font-size: 14px; margin-top: 10px; }

.card { background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 6px 14px; box-shadow: var(--shadow); }
.ing { display: flex; align-items: baseline; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.ing:last-child { border-bottom: 0; }
.ing input { width: 20px; height: 20px; flex: none; accent-color: var(--olive); margin: 0; transform: translateY(3px); }
.ing .amt { font-weight: 600; min-width: 74px; font-variant-numeric: tabular-nums; }
.ing .nm { flex: 1; }
.ing .nm small { display: block; color: var(--muted); font-size: 13px; line-height: 1.35; }
.ing.done .nm, .ing.done .amt { text-decoration: line-through; opacity: .45; }
.buy { font-size: 11px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 2px 7px; border-radius: 999px; margin-left: 4px; white-space: nowrap; }
.group-name { font-family: var(--serif); font-weight: 700; font-size: 15px; padding: 10px 0 2px; color: var(--olive); }

.step { display: grid; grid-template-columns: 34px 1fr; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.step:last-child { border-bottom: 0; }
.num { width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: var(--bg); display: grid; place-items: center; font-family: var(--serif); font-weight: 700; }
.step b { display: block; font-size: 16px; margin-bottom: 2px; }
.step p { margin: 0; }
.step .tip { font-size: 14px; color: var(--muted); margin-top: 6px; padding-left: 10px; border-left: 3px solid var(--line); }
.tbtn { margin-top: 8px; border: 1.5px solid var(--olive); color: var(--olive); background: transparent; border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600; }
.term { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 600; text-decoration: underline dotted; text-underline-offset: 3px; }

.gloss dt { font-weight: 600; margin-top: 10px; }
.gloss dd { margin: 2px 0 10px; color: var(--muted); font-size: 15px; }
.tips li { margin: 6px 0; }

.fix .chips { margin-bottom: 10px; }
.stars { display: flex; gap: 4px; font-size: 30px; }
.stars button { border: 0; background: none; padding: 0 2px; color: var(--line); }
.stars button.on { color: #e0a526; }

/* --- listy --- */
.search { margin: 14px 0 6px; }
.list { display: grid; gap: 8px; margin-top: 10px; }
.item { display: flex; gap: 12px; align-items: center; background: var(--paper); border: 1.5px solid var(--line); border-radius: 16px; padding: 12px; text-decoration: none; box-shadow: var(--shadow); }
.item .e { font-size: 30px; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; flex: none; }
.item b { display: block; font-family: var(--serif); font-size: 16px; line-height: 1.2; }
.item small { color: var(--muted); font-size: 13px; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.empty span { font-size: 44px; display: block; margin-bottom: 6px; }

/* --- pasek dolny --- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); z-index: 20;
}
.tabbar a { flex: 1; text-align: center; text-decoration: none; font-size: 11px; font-weight: 600; color: var(--muted); padding: 4px 0; }
.tabbar a span { display: block; font-size: 20px; line-height: 1.3; }
.tabbar a.on { color: var(--accent); }

/* --- minutniki --- */
#timers { position: fixed; left: 12px; right: 12px; bottom: calc(72px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 6px; z-index: 25; pointer-events: none; max-width: 616px; margin: 0 auto; }
.timer { pointer-events: auto; display: flex; align-items: center; gap: 10px; background: var(--ink); color: var(--bg); border-radius: 14px; padding: 10px 14px; box-shadow: var(--shadow); }
.timer b { font-variant-numeric: tabular-nums; font-size: 20px; }
.timer span { flex: 1; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timer button { border: 0; background: rgba(255,255,255,.15); color: inherit; border-radius: 10px; padding: 5px 10px; font-size: 13px; }
.timer.ring { background: var(--accent); animation: ring .6s infinite alternate; }
@keyframes ring { to { transform: scale(1.03); } }

/* --- arkusz dolny --- */
.sheet { position: fixed; inset: 0; z-index: 40; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(20, 12, 6, .45); }
.sheet-panel { position: absolute; left: 0; right: 0; bottom: 0; background: var(--paper); border-radius: 22px 22px 0 0; padding: 8px 18px calc(22px + env(safe-area-inset-bottom)); max-height: 82vh; overflow: auto; max-width: 640px; margin: 0 auto; animation: up .2s ease-out; }
.sheet-grip { width: 40px; height: 5px; background: var(--line); border-radius: 9px; margin: 4px auto 12px; }
@keyframes up { from { transform: translateY(40px); opacity: .5; } }

/* --- ładowanie --- */
.loading { position: fixed; inset: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 94%, transparent); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px; }
.loading p { font-family: var(--serif); font-size: 21px; margin: 18px 0 4px; }
.loading small { color: var(--muted); }
.pot span { font-size: 64px; display: inline-block; animation: wobble 1.2s ease-in-out infinite; }
@keyframes wobble { 0%,100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg) translateY(-6px); } }

/* --- tryb gotowania --- */
.cook { position: fixed; inset: 0; z-index: 45; background: var(--bg); display: flex; flex-direction: column; padding: calc(14px + env(safe-area-inset-top)) 20px calc(18px + env(safe-area-inset-bottom)); }
.cook-top { display: flex; justify-content: space-between; align-items: center; }
.cook-top button { border: 0; background: var(--paper); border-radius: 12px; padding: 8px 12px; font-weight: 600; }
.progress { display: flex; gap: 4px; margin: 14px 0; }
.progress i { flex: 1; height: 5px; border-radius: 9px; background: var(--line); }
.progress i.on { background: var(--accent); }
.cook-body { flex: 1; overflow: auto; }
.cook-body .n { font-family: var(--serif); color: var(--accent); font-size: 18px; }
.cook-body h1 { font-size: 30px; margin: 4px 0 14px; }
.cook-body p { font-size: 21px; line-height: 1.5; margin: 0; }
.cook-body .tip { font-size: 16px; color: var(--muted); margin-top: 16px; padding-left: 12px; border-left: 3px solid var(--line); }
.cook-nav { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
.cook-nav .btn { margin: 0; }

.toast { position: fixed; left: 50%; top: calc(16px + env(safe-area-inset-top)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; z-index: 60; font-size: 14px; box-shadow: var(--shadow); max-width: 90vw; }
.err { background: var(--accent-soft); color: var(--accent); border-radius: 14px; padding: 12px; margin-top: 12px; font-size: 14px; }

/* --- plan na kilka dni --- */
.c-plan { background: linear-gradient(135deg, #dfe8c8, #c3d6a8); }
.pill.over { background: var(--accent); color: #fff; }
.day { margin-top: 10px; }
.day-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 10px 0 4px; }
.day-head b { font-family: var(--serif); font-size: 18px; }
.day-note { font-size: 13px; color: var(--olive); font-weight: 600; margin-bottom: 4px; }
.meal { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); text-decoration: none; }
.meal .slot { width: 82px; flex: none; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding-top: 2px; }
.meal .what { flex: 1; min-width: 0; }
.meal .what small { display: block; color: var(--muted); font-size: 13px; line-height: 1.35; }
.meal .kc { font-size: 12px; color: var(--muted); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
a.meal .what b { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.order { margin: 6px 0 10px; padding-left: 22px; }
.order li { margin: 6px 0; }
.shop-total { display: flex; justify-content: space-between; font-weight: 600; padding: 10px 0; }
.price { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; white-space: nowrap; }
.waiting { text-align: center; padding: 40px 16px; }
.waiting .pot { margin: 0 auto 14px; }


/* --- waga --- */
.weight { margin-top: 0; }
.wtop { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.wrow { display: flex; gap: 8px; margin-top: 6px; }
.wrow input { width: 96px; }
.wnow { text-align: right; }
.wnow small { display: block; color: var(--muted); font-size: 12px; }
.wnow b { font-family: var(--serif); font-size: 24px; }
.wchart { width: 100%; height: 110px; margin-top: 14px; display: block; }
.wdot { fill: var(--muted); opacity: .55; }
.wline { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.wscale { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 2px; }
.wentry { display: flex; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.wentry span { flex: 1; }
.wentry button { border: 0; background: none; color: var(--muted); }

.shop-head { display: flex; justify-content: space-between; align-items: baseline; margin: 20px 0 2px; padding: 10px 14px; border-radius: 12px; background: var(--ink); color: var(--bg); }
.shop-head b { font-family: var(--serif); font-size: 19px; }

/* ceny z gazetek i wydatki */
.offer { display: block; margin-top: 2px; }
.offer.ok { color: var(--olive); }
.offer.unsure { color: var(--accent); }
.upload-btn { display: block; text-align: center; cursor: pointer; }
.rc { margin-top: 10px; padding-top: 10px; padding-bottom: 10px; }
.rc summary { display: flex; justify-content: space-between; gap: 8px; cursor: pointer; }
.warn-txt { color: var(--accent); }
.tabbar a { min-width: 0; font-size: 10.5px; }
