/* Unser Kochbuch – im Stil eines gedruckten Kochbuchs */
:root {
  --paper: #f3eee4; --ink: #1f1c18; --ink-2: #6a6256; --rule: #cdc3b1; --green: #2d4a3a; --green-tint: rgba(45, 74, 58, .07);
  --danger: #8b2e1f;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Noto Serif", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #171614; --ink: #ebe4d6; --ink-2: #a39a8b; --rule: #3a3630; --green: #9dbea2; --green-tint: rgba(157, 190, 162, .08);
    --danger: #d98a73; color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--paper); color: var(--ink); }
body {
  font: 17px/1.55 var(--serif); font-variant-numeric: oldstyle-nums; -webkit-font-smoothing: antialiased;
  min-height: 100vh; padding-bottom: calc(58px + var(--safe-b)); -webkit-text-size-adjust: 100%;
}
body.no-tabs { padding-bottom: var(--safe-b); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
svg.i { width: 1em; height: 1em; vertical-align: -.12em; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.sc { font-family: var(--sans); text-transform: uppercase; letter-spacing: .14em; font-size: .68rem; font-weight: 600; font-variant-numeric: lining-nums; }
.it { font-style: italic; }
.muted { color: var(--ink-2); }
.hidden { display: none !important; }
main { padding: 0 20px 28px; max-width: 680px; margin: 0 auto; }

/* ---- Kopf ---- */
.mast { text-align: center; padding: calc(14px + var(--safe-t)) 20px 0; max-width: 680px; margin: 0 auto; }
.mast-row { display: flex; justify-content: space-between; }
.mast-title { font-weight: 400; font-size: 2.35rem; line-height: 1.1; margin: 18px 0 6px; letter-spacing: -.01em; }
.mast-sub { color: var(--ink-2); font-size: .95rem; margin-bottom: 16px; }
.double { border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); height: 4px; margin: 0 20px; }
.page-head { padding: calc(22px + var(--safe-t)) 20px 0; max-width: 680px; margin: 0 auto; }
.page-head h1 { font-weight: 400; font-size: 2rem; line-height: 1.15; margin: 0 0 4px; }
.page-head .it { color: var(--ink-2); margin-bottom: 14px; }
.page-head + .double, .mast + .double { max-width: 640px; margin: 0 auto; }
@media (max-width: 680px) { .page-head + .double, .mast + .double { margin: 0 20px; } }

.bar {
  position: sticky; top: 0; z-index: 10; background: var(--paper); border-bottom: 1px solid var(--rule);
  padding: calc(12px + var(--safe-t)) 20px 12px; display: flex; align-items: center; gap: 12px;
}
.bar .t { flex: 1; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.lnk { border: 0; background: none; padding: 6px 0; color: var(--ink); white-space: nowrap; }
.lnk.green { color: var(--green); }
.lnk.danger { color: var(--danger); }

/* ---- Tabs ---- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center; gap: 4px;
  background: var(--paper); border-top: 1px solid var(--ink); padding-bottom: var(--safe-b);
}
.tabs a { flex: 1; max-width: 200px; text-align: center; padding: 16px 0 15px; text-decoration: none; color: var(--ink-2); }
.tabs a.on { color: var(--ink); }
.tabs a.on span { border-bottom: 2px solid var(--green); padding-bottom: 3px; }

/* ---- Buttons & Formular ---- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 15px 18px;
  border: 1px solid var(--ink); background: transparent; border-radius: 2px;
  font-family: var(--sans); text-transform: uppercase; letter-spacing: .14em; font-size: .72rem; font-weight: 600;
}
.btn.primary { background: var(--green); border-color: var(--green); color: var(--paper); }
.btn:disabled { opacity: .45; }
.btn + .btn { margin-top: 10px; }
.btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btns .btn + .btn { margin-top: 0; }

label.f { display: block; margin: 26px 0 4px; color: var(--ink-2); }
input[type=text], input[type=password], input[type=number], input[type=url], input[type=search], textarea {
  width: 100%; border: 0; border-bottom: 1px solid var(--rule); background: transparent; border-radius: 0;
  padding: 8px 0; outline: none; font-size: 17px; -webkit-appearance: none; appearance: none;
}
textarea { border: 1px solid var(--rule); padding: 10px 12px; resize: vertical; min-height: 130px; line-height: 1.55; }
input:focus, textarea:focus { border-color: var(--ink); }
::placeholder { color: var(--ink-2); opacity: .7; font-style: italic; }
.hint { font-size: .9rem; color: var(--ink-2); font-style: italic; margin-top: 6px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ---- Liste der Rezepte ---- */
.search { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--rule); margin-top: 18px; color: var(--ink-2); }
.search input { border: 0; padding: 10px 0; }
.filters { display: flex; gap: 18px; overflow-x: auto; scrollbar-width: none; padding: 14px 20px 4px; margin: 0 -20px; }
.filters::-webkit-scrollbar { display: none; }
.flt { flex: none; border: 0; background: none; padding: 4px 0; color: var(--ink-2); border-bottom: 1.5px solid transparent; }
.flt.on { color: var(--green); border-bottom-color: var(--green); }
.sortrow { display: flex; justify-content: space-between; align-items: center; margin: 14px 0 0; color: var(--ink-2); }
.sortrow select { border: 0; background: none; color: var(--ink-2); text-align: right; padding: 4px 0; -webkit-appearance: none; appearance: none; }

.entries { border-top: 1px solid var(--ink); margin-top: 8px; }
.entry { display: flex; gap: 16px; align-items: center; padding: 18px 0; border-bottom: 1px solid var(--rule); text-decoration: none; }
.entry-text { flex: 1; min-width: 0; }
.entry .k { color: var(--green); }
.entry-title { font-size: 1.3rem; line-height: 1.25; margin: 3px 0 2px; }
.entry-meta { color: var(--ink-2); font-size: .92rem; }
.entry-img { flex: none; width: 86px; height: 86px; background: var(--rule) center/cover; }
.heart-mark { color: var(--green); }

.empty { text-align: center; padding: 56px 24px; color: var(--ink-2); font-style: italic; }
.orn { text-align: center; color: var(--ink-2); font-size: 1.2rem; letter-spacing: .4em; margin: 34px 0 6px; }

/* ---- Rezept ---- */
.photo { margin: 0 -20px; height: min(62vw, 420px); background: var(--rule) center/cover; }
.kicker { color: var(--green); margin-top: 26px; }
.kicker button { border: 0; background: none; padding: 0; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; }
.r-title { font-weight: 400; font-size: 2.2rem; line-height: 1.12; margin: 8px 0 8px; letter-spacing: -.01em; }
.r-meta { color: var(--ink-2); margin: 0; }
.ratings { margin: 22px 0 0; border-top: 1px solid var(--rule); }
.rating { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.rating .sc { width: 70px; color: var(--ink-2); }
.stars { flex: 1; color: var(--green); letter-spacing: .08em; font-size: 1.15rem; }
.stars button { border: 0; background: none; padding: 0 2px; color: inherit; font-size: 1.25rem; line-height: 1; }
.stars .none { color: var(--ink-2); font-style: italic; font-size: .92rem; letter-spacing: 0; }
.heart { border: 0; background: none; padding: 4px; color: var(--ink-2); font-size: 1.2rem; }
.heart.on { color: var(--green); }
.heart.on svg { fill: currentColor; }

.sec { margin-top: 38px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; border-bottom: 1px solid var(--ink); padding-bottom: 8px; margin-bottom: 4px; }
.sec-head h2 { margin: 0; }
.portions { display: flex; align-items: center; gap: 4px; }
.portions button { border: 1px solid var(--rule); background: none; width: 30px; height: 30px; border-radius: 2px; font-size: 1.05rem; line-height: 1; color: var(--ink); }
.portions span { min-width: 104px; text-align: center; font-style: italic; }

ul.ing { list-style: none; padding: 0; margin: 0 0 18px; }
ul.ing li { display: flex; align-items: baseline; gap: 8px; padding: 9px 0; cursor: pointer; }
ul.ing li .q { flex: none; font-variant-numeric: lining-nums tabular-nums; }
ul.ing li .dots { flex: 1; border-bottom: 1px dotted var(--ink-2); opacity: .55; transform: translateY(-4px); min-width: 16px; }
ul.ing li .n { text-align: right; max-width: 68%; }
ul.ing li.plain .n { text-align: left; max-width: none; font-style: italic; }
ul.ing li.done { opacity: .35; text-decoration: line-through; }
ul.ing li.head { cursor: default; padding-top: 20px; color: var(--ink-2); }

ol.steps { list-style: none; counter-reset: s; padding: 0; margin: 10px 0 22px; }
ol.steps li { counter-increment: s; position: relative; padding: 0 0 18px 44px; }
ol.steps li::before { content: counter(s); position: absolute; left: 0; top: -6px; font-size: 1.9rem; line-height: 1; color: var(--green); font-variant-numeric: oldstyle-nums; }
.tl { border: 0; background: none; padding: 0; color: var(--green); border-bottom: 1px dotted var(--green); font-style: italic; }
.tl svg { margin-right: 3px; }
.notes { border-left: 2px solid var(--green); padding: 2px 0 2px 16px; font-style: italic; white-space: pre-wrap; }
.colophon { margin-top: 40px; padding-top: 14px; border-top: 1px solid var(--rule); color: var(--ink-2); font-size: .92rem; display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; }

/* ---- Formular-Foto & Kategorien ---- */
.photo-pick { margin-top: 22px; height: 190px; border: 1px dashed var(--ink-2); display: grid; place-items: center; text-align: center; color: var(--ink-2); background: center/cover; cursor: pointer; }
.photo-pick.has { border: 0; place-items: end; padding: 10px; }
.photo-pick.has .lnk { background: var(--paper); padding: 6px 10px; }
.photo-pick svg.i { font-size: 1.6rem; display: block; margin: 0 auto 6px; }
.tagpick { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; }
.tagpick .flt { padding: 2px 0; }

/* ---- Einkaufsliste ---- */
.add { display: flex; gap: 12px; align-items: center; border-bottom: 1px solid var(--ink); margin-top: 20px; }
.add input { border: 0; }
.add .lnk { color: var(--green); }
.item { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--rule); }
.box { width: 20px; height: 20px; flex: none; border: 1.5px solid var(--ink); display: grid; place-items: center; cursor: pointer; color: var(--paper); font-size: .85rem; }
.item.done .box { background: var(--green); border-color: var(--green); }
.item .txt { flex: 1; min-width: 0; cursor: pointer; }
.item.done .txt { text-decoration: line-through; color: var(--ink-2); }
.item .src { display: block; font-style: italic; color: var(--ink-2); font-size: .85rem; }
.item .x { border: 0; background: none; color: var(--ink-2); padding: 4px; font-size: .95rem; }
.list-sec { display: flex; justify-content: space-between; align-items: baseline; margin: 34px 0 0; padding-bottom: 8px; border-bottom: 1px solid var(--ink); }

/* ---- Glücksrad ---- */
.wheel-wrap { position: relative; width: min(86vw, 400px); aspect-ratio: 1; margin: 22px auto 0; }
.wheel-wrap canvas { width: 100%; height: 100%; display: block; }
.pointer { position: absolute; top: -4px; left: 50%; transform: translateX(-50%); width: 0; height: 0; border-left: 11px solid transparent; border-right: 11px solid transparent; border-top: 22px solid var(--ink); z-index: 2; }
.result { text-align: center; margin-top: 26px; animation: fade .5s ease; }
.result .r-title { font-size: 1.9rem; margin: 6px 0 4px; }
.result .btns { margin-top: 22px; }

/* ---- Kochmodus ---- */
.cook { display: flex; flex-direction: column; min-height: 100vh; padding: calc(10px + var(--safe-t)) 22px calc(20px + var(--safe-b)); max-width: 720px; margin: 0 auto; }
.cook .top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.cook .top .t { flex: 1; text-align: center; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress { height: 1px; background: var(--rule); margin: 12px 0 0; }
.progress div { height: 3px; margin-top: -1px; background: var(--green); transition: width .3s; }
.drawer { border-bottom: 1px solid var(--rule); max-height: 42vh; overflow: auto; padding-top: 6px; }
.step { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 28px 0; }
.step .sc { color: var(--green); margin-bottom: 14px; }
.step .s { font-size: clamp(1.55rem, 6vw, 2.25rem); line-height: 1.38; }
.cook .btns { grid-template-columns: 1fr 2fr; }

/* ---- Timer ---- */
.timers { position: fixed; left: 14px; right: 14px; bottom: calc(66px + var(--safe-b)); z-index: 30; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
body.no-tabs .timers { bottom: calc(14px + var(--safe-b)); }
body.cooking .timers { bottom: calc(96px + var(--safe-b)); }
.timer {
  pointer-events: auto; max-width: 460px; width: 100%; margin: 0 auto; display: flex; align-items: center; gap: 12px;
  background: var(--ink); color: var(--paper); padding: 10px 14px; border-radius: 2px;
}
.timer .lab { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-style: italic; opacity: .85; font-size: .92rem; }
.timer .tt { font-family: var(--sans); font-variant-numeric: tabular-nums; font-weight: 600; font-size: 1.05rem; letter-spacing: .04em; }
.timer button { border: 1px solid currentColor; background: none; color: inherit; padding: 4px 9px; border-radius: 2px; }
.timer.ring { background: var(--green); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .55; } }

/* ---- Dialog, Hinweis, Login ---- */
.sheet-bg { position: fixed; inset: 0; z-index: 50; background: rgba(20, 18, 15, .45); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.sheet { background: var(--paper); width: 100%; max-width: 560px; max-height: 88vh; overflow: auto; padding: 22px 22px calc(22px + var(--safe-b)); border-top: 4px double var(--ink); animation: up .25s ease; }
.sheet h3 { font-weight: 400; font-size: 1.5rem; margin: 0 0 6px; }
.sheet p { margin: 0 0 16px; }
.sheet .item label { flex: 1; cursor: pointer; }
.sheet input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--green); flex: none; margin: 0; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(30px); } }
.toast {
  position: fixed; left: 50%; top: calc(14px + var(--safe-t)); transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 2px; animation: fade .2s; max-width: 90vw; text-align: center;
}
.offline { text-align: center; padding: 6px; color: var(--ink-2); border-bottom: 1px solid var(--rule); }

.login { max-width: 380px; margin: 0 auto; padding: calc(70px + var(--safe-t)) 24px 24px; text-align: center; }
.login .mast-title { margin-top: 10px; }
.login form { text-align: left; margin-top: 30px; }
.login input { margin-bottom: 18px; }
.err { color: var(--danger); min-height: 1.5em; margin: 2px 0 12px; font-style: italic; }
