:root {
  --bg: #f6f3ef; --card: #fff; --ink: #1f2328; --muted: #6b6f76; --line: #e2ddd6;
  --pri: #e8590c; --pri-ink: #fff; --warn-bg: #fff4d6; --warn-line: #f0a400; --err: #c92a2a; --ok: #2b8a3e;
  --r: 14px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #17191c; --card: #22252a; --ink: #eceff3; --muted: #a2a8b0; --line: #353a41;
          --warn-bg: #3d3214; --warn-line: #f0a400; }
}
* { box-sizing: border-box; }
html { font-size: 18px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; line-height: 1.45; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: .8rem; font-weight: normal; }
h1 { font-size: 1.7rem; margin: .3em 0; } h2 { font-size: 1.3rem; margin: 0 0 .7em; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 1rem;
  padding: .7rem 1rem; background: var(--card); border-bottom: 1px solid var(--line); }
.top .back { min-height: 52px; font-size: 1rem; border-color: var(--pri); color: var(--pri); }
.top .ttl { text-align: right; }
.top .ttl { font-weight: 700; flex: 1; }
@media (max-width: 560px) { .top .ttl, .top .who { display: none; } .top .back { flex: 1; } }
.top .who { color: var(--muted); font-size: .85rem; }

main { max-width: 1100px; margin: 0 auto; padding: 1rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 1.2rem; margin-bottom: 1rem; }
.center { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 1rem; padding: 2.5rem 1.2rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 56px; padding: .6rem 1.4rem; border-radius: 12px; border: 2px solid var(--line);
  background: var(--card); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none; touch-action: manipulation; user-select: none; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--pri); border-color: var(--pri); color: var(--pri-ink); }
.btn.ghost { background: transparent; }
.btn.big { min-height: 60px; font-size: 1.05rem; }
.btn.huge { min-height: 84px; font-size: 1.45rem; padding: 1rem 2.2rem; border-radius: 18px; }
.btn.full { width: 100%; margin-top: 1rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.icon { min-width: 56px; padding: 0; font-size: 1.3rem; }
.btn.danger { color: var(--err); }
.row { display: flex; flex-wrap: wrap; } .gap { gap: .8rem; }

.drop { border: 3px dashed var(--line); border-radius: 22px; padding: 3rem 1.5rem; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 1.2rem; margin-bottom: 1rem; background: var(--card); }
.drop.over { border-color: var(--pri); background: color-mix(in srgb, var(--pri) 8%, var(--card)); }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .8rem; margin: 1rem 0; }
.thumb { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.thumb img { width: 100%; height: 230px; object-fit: cover; object-position: top; display: block; }
.thumb .num { position: absolute; top: 6px; left: 6px; background: var(--pri); color: #fff; border-radius: 99px;
  min-width: 34px; height: 34px; display: grid; place-items: center; font-weight: 700; }
.thumb .ctrl { display: flex; justify-content: space-between; }
.thumb .ctrl button { flex: 1; min-height: 52px; border: 0; border-top: 1px solid var(--line); background: var(--card);
  color: var(--ink); font-size: 1.2rem; cursor: pointer; }
.thumb .ctrl button.del { color: var(--err); }

.spinner { width: 72px; height: 72px; border: 7px solid var(--line); border-top-color: var(--pri);
  border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.field { margin-bottom: .9rem; border-radius: 10px; }
.field label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .25rem; font-weight: 600; }
.inp { width: 100%; min-height: 52px; padding: .6rem .8rem; font: inherit; color: var(--ink);
  background: var(--bg); border: 2px solid var(--line); border-radius: 10px; }
textarea.inp { min-height: 90px; resize: vertical; }
.inp:focus { outline: none; border-color: var(--pri); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .9rem; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0 .9rem; }

/* Unsichere Angaben */
.unc { background: var(--warn-bg); outline: 3px solid var(--warn-line); outline-offset: 2px; padding: .5rem; }
.unc .inp.flag { border-color: var(--warn-line); border-width: 3px; }
.unc-note { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: .4rem; font-size: .9rem; font-weight: 600; }
.unc-note .btn { min-height: 46px; padding: .3rem 1rem; font-size: .9rem; }
.banner { border-radius: var(--r); padding: 1rem 1.2rem; margin-bottom: 1rem; font-weight: 600; }
.banner.warn { background: var(--warn-bg); border: 2px solid var(--warn-line); }
.banner.info { background: var(--card); border: 2px solid var(--line); font-weight: normal; }

/* Zutaten */
.ing-head, .ing { display: grid; grid-template-columns: 100px 120px 1.4fr 1fr 56px; gap: .5rem; align-items: start; }
.ing-head { font-size: .8rem; color: var(--muted); font-weight: 600; margin-bottom: .3rem; }
.ing { margin-bottom: .6rem; border-radius: 10px; }
.ing .sec { grid-column: 1 / -1; }
.ing .unc-note { grid-column: 1 / -1; margin-top: 0; }

/* Schritte */
.step { border: 1px solid var(--line); border-radius: 12px; padding: .9rem; margin-bottom: .8rem; }
.step-top { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.step-top .n { font-weight: 800; font-size: 1.2rem; flex: 1; }
.step .grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin-top: .5rem; }
.step .grid4 label { font-size: .75rem; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: .3rem; background: var(--bg); border: 2px solid var(--line);
  border-radius: 99px; padding: .3rem .4rem .3rem 1rem; min-height: 48px; }
.chip button { border: 0; background: none; color: var(--err); font-size: 1.3rem; min-width: 40px; min-height: 40px; cursor: pointer; }
.chips input { flex: 1; min-width: 180px; }

/* Bildoptionen */
.imgopts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .8rem; }
.imgopt { border: 3px solid var(--line); border-radius: 14px; background: var(--bg); cursor: pointer; padding: 0;
  overflow: hidden; display: flex; flex-direction: column; color: var(--ink); font: inherit; text-align: center; min-height: 200px; }
.imgopt img { width: 100%; height: 170px; object-fit: cover; display: block; }
.imgopt .ph { height: 170px; display: grid; place-items: center; font-size: 2.6rem; }
.imgopt .lbl { padding: .6rem; font-weight: 600; font-size: .95rem; }
.imgopt.sel { border-color: var(--pri); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pri) 35%, transparent); }
.imgopt:disabled { opacity: .55; cursor: not-allowed; }

.savebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; gap: .8rem; justify-content: flex-end;
  padding: .8rem 1rem calc(.8rem + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); }
.savebar #btn-save { flex: 0 1 420px; }
.spacer { height: 100px; }
.okmark { width: 96px; height: 96px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 3.2rem; display: grid; place-items: center; }
.toast { position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%); z-index: 9; max-width: 92vw;
  background: var(--ink); color: var(--bg); padding: 1rem 1.4rem; border-radius: 12px; font-weight: 600; }
.toast.err { background: var(--err); color: #fff; }

/* Hochformat / schmal */
@media (max-width: 700px) {
  .ing-head { display: none; }
  .ing { grid-template-columns: 1fr 1fr 56px; border: 1px solid var(--line); padding: .6rem; }
  .ing .q { grid-column: 1; } .ing .u { grid-column: 2; } .ing .del { grid-column: 3; grid-row: 1; }
  .ing .nm { grid-column: 1 / -1; } .ing .nt { grid-column: 1 / -1; }
  .step .grid4 { grid-template-columns: 1fr 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  .savebar #btn-save { flex: 1; }
}

/* Einfügen aus der Zwischenablage */
.drop-hint { font-size: 1.15rem; font-weight: 600; margin: 0; }
.small-hint { margin: 0; font-size: .9rem; }
kbd { display: inline-block; padding: .05rem .45rem; border: 1px solid var(--line); border-bottom-width: 3px;
  border-radius: 6px; background: var(--bg); font: 600 .9em system-ui, sans-serif; }
.paste-zone { width: 100%; max-width: 560px; min-height: 64px; display: flex; align-items: center; justify-content: center;
  padding: .8rem 1rem; border: 2px dashed var(--line); border-radius: 14px; background: var(--bg); color: var(--muted);
  font-weight: 600; text-align: center; cursor: text; caret-color: transparent; outline: none; overflow: hidden;
  white-space: nowrap; -webkit-user-modify: read-write-plaintext-only; }
.paste-zone:empty::before { content: attr(data-hint-kbd); white-space: normal; }
.paste-zone:focus { border-color: var(--pri); color: var(--ink); background: color-mix(in srgb, var(--pri) 6%, var(--bg)); }
.paste-zone.flash { border-color: var(--ok); }
.clip-btn { min-height: 52px; font-size: .95rem; }
/* Geräte ohne Maus/Tastatur: Strg+V-Hinweise ausblenden, Touch-Hinweis zeigen */
@media (hover: none) and (pointer: coarse) {
  .kbd-only { display: none; }
  .paste-zone:empty::before { content: attr(data-hint-touch); }
}
