/* Tanuki Cave – Gestaltung nach den UI-Regeln (Waldbau-Farben). Keine Fremdschriften. */

:root {
  --ground: #F7EFE3;
  --card: #FFFAF2;
  --soft: #F1E7D8;
  --soft2: #EADFCB;
  --line: #EFE5D6;
  --edge: #E4D6C1;
  --ink: #3D2E22;
  --muted: #6E5A4B;
  --muted2: #7A6656;
  --box: #9C8670;
  --moss: #5E7F43;
  --moss-ink: #4F6E37;
  --moss-soft: #E3EBD8;
  --terra: #B5562F;
  --danger: #8A3E1F;
  --danger-edge: #C98A6F;
  --unsorted: #D9B79F;
  --font: ui-rounded, "Nunito", "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: ui-rounded, "Fredoka", "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .4; }
a { color: var(--moss-ink); }
input::placeholder, textarea::placeholder { color: var(--muted2); }
:focus-visible { outline: 3px solid #8FB37A; outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.scroll::-webkit-scrollbar { display: none; }

#app { height: 100%; }
.shell { height: 100%; max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; position: relative; }

/* ---- Kopf ---- */
.head { padding: calc(18px + var(--safe-t)) 12px 2px 20px; display: flex; align-items: center; gap: 6px; }
.head-main { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.area-btn { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; height: 30px; margin-left: -10px; padding: 0 10px; border: none; border-radius: 999px; background: transparent; color: var(--muted); display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.title { margin: 0; font-family: var(--display); font-weight: 700; font-size: 27px; line-height: 1.1; }
.back { height: 40px; margin-left: -8px; padding: 0 8px; border: none; background: none; border-radius: 999px; display: flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 800; color: var(--muted); }
.icon-btn { width: 44px; height: 44px; flex: none; border: none; border-radius: 999px; background: transparent; color: var(--ink); display: flex; align-items: center; justify-content: center; padding: 0; }
.icon-btn.soft { background: var(--soft); }
.pill { height: 44px; padding: 0 14px; border: none; border-radius: 999px; background: var(--moss); color: #FFFAF2; font-size: 14px; font-weight: 800; display: flex; align-items: center; gap: 6px; flex: none; }
.pill.light { background: var(--soft2); color: var(--ink); }
.status-pill { margin: 4px 20px 0; align-self: flex-start; padding: 5px 12px; border-radius: 999px; background: #F3DCCF; color: var(--danger); font-size: 13px; font-weight: 800; }

/* ---- Chips ---- */
.chips { padding: 8px 20px 0; display: flex; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { height: 44px; flex: none; padding: 0 14px; border-radius: 999px; font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 6px; background: transparent; color: var(--ink); border: 2px solid var(--edge); }
.chip.view.on { border-color: var(--ink); background: var(--card); font-weight: 800; }
.chip.sel { height: 40px; padding: 0 12px; background: var(--card); font-weight: 800; }
.chip.sel.on { background: var(--ink); border-color: var(--ink); color: #FFFAF2; }
.chip.sugg { height: 36px; border: none; background: var(--soft2); }
.chip.sugg.green { background: var(--moss-soft); font-weight: 800; }
.chip.dashed { border-style: dashed; border-color: var(--box); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.chip-add { width: 44px; height: 44px; flex: none; border: none; border-radius: 999px; background: transparent; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.spacer { flex: 1; }
.meta-right { font-size: 14px; font-weight: 800; color: var(--moss-ink); white-space: nowrap; }
.activity { padding: 2px 22px 0; display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--muted); }
.activity .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--moss); }

/* ---- Inhalt ---- */
.content { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 20px 14px; display: flex; flex-direction: column; gap: 12px; scrollbar-width: none; }
.content::-webkit-scrollbar { display: none; }
.card { background: var(--card); border-radius: 22px; padding: 10px 6px 4px; box-shadow: 0 2px 0 var(--edge); border: 2px solid var(--card); }
.card.unsorted { border: 2px dashed var(--unsorted); }
.card.plain { padding: 14px 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; padding: 0 12px 4px; gap: 8px; }
.card-title { margin: 0; display: flex; align-items: center; gap: 8px; font-family: var(--display); font-weight: 600; font-size: 17px; }
.card-title .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.card-meta { font-size: 13px; font-weight: 700; color: var(--muted2); }
.korb { background: #EFE6D8; border-radius: 22px; padding: 4px 6px 6px; display: flex; flex-direction: column; }
.korb-head { min-height: 50px; border: none; background: transparent; display: flex; align-items: center; gap: 10px; padding: 0 10px; color: var(--ink); width: 100%; }
.korb-head .t { flex: 1; text-align: left; font-family: var(--display); font-weight: 600; font-size: 17px; }

.row { display: flex; align-items: center; gap: 2px; min-height: 56px; padding: 0 10px 0 2px; border-top: 1px solid var(--line); }
.row.drag-over { background: var(--moss-soft); }
.row.dragging { opacity: .4; }
.row-main { flex: 1; min-width: 0; min-height: 52px; display: flex; flex-direction: column; justify-content: center; gap: 1px; padding: 6px 4px 6px 0; border: none; background: transparent; text-align: left; color: var(--ink); }
.row-name { font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
.row-name.done { color: var(--muted); text-decoration: line-through; }
.sub { font-size: 13px; color: var(--muted2); }
.sub.hint { color: var(--moss-ink); font-weight: 700; }
.cb { width: 48px; height: 48px; flex: none; border: none; background: transparent; padding: 0; display: flex; align-items: center; justify-content: center; }
.cb span { width: 26px; height: 26px; border-radius: 9px; border: 2.5px solid var(--box); display: flex; align-items: center; justify-content: center; background: var(--card); }
.cb.on span { background: var(--moss); border-color: var(--moss); }
.avatar { width: 26px; height: 26px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; color: var(--ink); }
.avatar.lg { width: 44px; height: 44px; font-size: 18px; }
.tag-btn { height: 34px; padding: 0 10px; border: none; border-radius: 999px; background: #F3DCCF; color: var(--danger); font-size: 12px; font-weight: 800; flex: none; }
.grip { color: var(--box); flex: none; }

/* ---- Knöpfe ---- */
.btn { height: 48px; padding: 0 16px; border-radius: 16px; font-size: 15px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 2px solid transparent; text-decoration: none; }
.btn.primary { background: var(--moss); color: #FFFAF2; }
.btn.add { background: var(--terra); color: #FFFAF2; }
.btn.secondary { background: transparent; border-color: var(--edge); color: var(--ink); }
.btn.danger { background: transparent; border-color: var(--danger-edge); color: var(--danger); }
.btn.dark { background: var(--ink); color: #FFFAF2; }
.btn.small { height: 40px; padding: 0 12px; font-size: 13px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn.soft { background: var(--soft); color: var(--ink); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1; }

/* ---- Hinweis, Rückfrage, Vorschläge, Eingabe ---- */
.toast { margin: 0 16px 8px; min-height: 48px; padding: 4px 6px 4px 16px; border-radius: 16px; background: var(--ink); color: #FFFAF2; display: flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 700; }
.toast .t { flex: 1; line-height: 1.3; padding: 6px 0; }
.toast button { height: 40px; padding: 0 10px; border: none; border-radius: 12px; background: transparent; color: #F2C88B; font-size: 14px; font-weight: 800; flex: none; }
.prompt { margin: 0 16px 8px; padding: 12px 12px 10px 14px; border-radius: 20px; background: var(--card); box-shadow: 0 2px 0 var(--edge); display: flex; flex-direction: column; gap: 8px; }
.prompt-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.sugg-row { padding: 0 16px 6px; display: flex; gap: 6px; align-items: center; overflow-x: auto; min-height: 40px; scrollbar-width: none; }
.sugg-row::-webkit-scrollbar { display: none; }
.sugg-label { font-size: 12px; font-weight: 800; color: var(--muted); flex: none; }
.inputbar { margin: 0 16px 10px; display: flex; gap: 8px; align-items: center; background: var(--card); border-radius: 22px; padding: 5px 5px 5px 16px; box-shadow: 0 2px 0 var(--edge), 0 0 0 2px var(--edge); }
.inputbar input { flex: 1; min-width: 0; height: 44px; border: none; background: transparent; font-size: 16px; font-weight: 600; outline: none; }
.inputbar .plus { width: 46px; height: 46px; flex: none; border: none; border-radius: 17px; background: var(--terra); color: #FFFAF2; display: flex; align-items: center; justify-content: center; padding: 0; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label, .label { font-size: 13px; font-weight: 800; color: var(--muted); }
.input, textarea.input { height: 46px; width: 100%; padding: 0 14px; border: 2px solid var(--edge); border-radius: 14px; background: #FFFFFF; font-size: 16px; color: var(--ink); outline: none; }
textarea.input { height: auto; min-height: 220px; padding: 12px 14px; line-height: 1.55; resize: vertical; }
.input:focus { border-color: var(--moss); }
.input.small { height: 44px; padding: 0 10px; border-radius: 12px; font-size: 15px; }
.stepper { display: inline-flex; align-items: center; background: var(--soft); border-radius: 14px; }
.stepper button { width: 44px; height: 44px; border: none; background: transparent; font-size: 22px; font-weight: 800; padding: 0; color: var(--ink); }
.stepper span { min-width: 36px; text-align: center; font-size: 16px; font-weight: 800; }

/* ---- Navigation ---- */
.nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 6px 12px calc(14px + var(--safe-b)); background: var(--card); border-top: 1px solid var(--soft2); }
.nav button { border: none; background: transparent; min-height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 13px; font-weight: 700; color: var(--muted); }
.nav button .ic { width: 64px; height: 32px; border-radius: 999px; display: flex; align-items: center; justify-content: center; }
.nav button.on { color: var(--ink); font-weight: 800; }
.nav button.on .ic { background: var(--moss-soft); }

/* ---- Blätter ---- */
.backdrop { position: fixed; inset: 0; background: rgba(61, 46, 34, .38); z-index: 20; border: none; padding: 0; width: 100%; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-width: 760px; margin: 0 auto; max-height: 94%; background: var(--card); border-radius: 30px 30px 0 0; z-index: 21; display: flex; flex-direction: column; }
.sheet.top { top: 0; bottom: auto; border-radius: 0 0 28px 28px; max-height: 90%; }
.grip-bar { align-self: center; width: 44px; height: 5px; border-radius: 999px; background: #D9CBB6; margin-top: 10px; flex: none; }
.sheet-head { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px 6px 22px; }
.sheet-head h2 { margin: 0; font-family: var(--display); font-weight: 600; font-size: 22px; }
.sheet-head .sub { font-size: 14px; font-weight: 700; color: var(--muted); }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 20px 18px; display: flex; flex-direction: column; gap: 16px; }
.sheet-foot { padding: 10px 20px calc(18px + var(--safe-b)); border-top: 1px solid var(--line); }

/* ---- Leerzustand, Höhle ---- */
.empty { padding: 40px 24px 0; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.empty h2 { margin: 0; font-family: var(--display); font-weight: 600; font-size: 21px; }
.empty p { margin: 0; font-size: 15px; line-height: 1.45; color: var(--muted); max-width: 320px; }
.hoehle-card { background: var(--card); border-radius: 22px; padding: 16px; box-shadow: 0 2px 0 var(--edge); display: flex; flex-direction: column; gap: 6px; border: none; text-align: left; width: 100%; color: var(--ink); }
.hoehle-card h3 { margin: 0; font-family: var(--display); font-weight: 600; font-size: 18px; }
.hoehle-card .big { font-size: 15px; line-height: 1.45; }

/* ---- Rezepte ---- */
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.rcard { background: var(--card); border-radius: 20px; box-shadow: 0 2px 0 var(--edge); overflow: hidden; display: flex; flex-direction: column; border: none; padding: 0; text-align: left; color: var(--ink); position: relative; }
.rcard .ph { height: 108px; display: flex; align-items: center; justify-content: center; background-size: cover; background-position: center; }
.rcard .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rcard .tx { padding: 8px 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.rcard .nm { font-size: 15px; font-weight: 800; line-height: 1.25; }
.rcard .plus { position: absolute; right: 8px; top: 60px; width: 44px; height: 44px; border: none; border-radius: 999px; background: var(--card); box-shadow: 0 2px 0 rgba(61, 46, 34, .18); display: flex; align-items: center; justify-content: center; }
.rcard .plus.on { background: var(--moss); color: #FFFAF2; }
.hero { position: relative; height: 220px; background: #F6E3C2; display: flex; align-items: center; justify-content: center; flex: none; }
.hero img { width: 100%; height: 100%; object-fit: cover; }
.hero .tl { position: absolute; left: 14px; top: calc(14px + var(--safe-t)); }
.hero .tr { position: absolute; right: 14px; top: calc(14px + var(--safe-t)); display: flex; gap: 6px; }
.hero .icon-btn, .hero .pill { background: var(--card); color: var(--ink); }
.recipe-cols { display: flex; flex-direction: column; gap: 18px; }
.recipe-layout { display: flex; flex-direction: column; gap: 16px; padding: 16px 20px 28px; }
.ing-row { display: flex; align-items: baseline; gap: 12px; min-height: 36px; padding: 6px 0; border-top: 1px solid var(--line); }
.ing-row .q { width: 84px; flex: none; text-align: right; font-weight: 800; font-size: 15px; }
.group-label { padding: 10px 0 2px; font-size: 12px; font-weight: 800; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; }
.steps p { margin: 0 0 10px; font-size: 17px; line-height: 1.75; }
.ref { font-weight: 700; text-decoration: underline; text-decoration-color: #9DB487; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.qty { padding: 1px 6px; border-radius: 7px; background: var(--moss-soft); font-size: 13px; font-weight: 800; white-space: nowrap; }
.notes { padding: 14px 16px; border-radius: 18px; background: #EFE6D8; display: flex; flex-direction: column; gap: 6px; }
.badge { height: 28px; padding: 0 10px; border-radius: 999px; background: var(--soft2); font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; }
.detect { padding: 12px 14px; border-radius: 18px; background: var(--ground); display: flex; flex-direction: column; gap: 10px; }
.detect .ok { height: 32px; padding: 0 10px; border-radius: 999px; background: var(--moss-soft); font-size: 13px; font-weight: 800; display: inline-flex; align-items: center; gap: 6px; }
.unsure { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 14px; background: var(--card); border: 2px dotted var(--danger-edge); }
.ing-edit { display: flex; gap: 6px; align-items: center; }
.ing-group { display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 18px; background: var(--ground); }
.photo-btn { height: 110px; border: 2px dashed #C9B79F; border-radius: 20px; background: var(--ground); color: var(--muted); font-size: 15px; font-weight: 800; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; width: 100%; overflow: hidden; padding: 0; }
.photo-btn img { width: 100%; height: 100%; object-fit: cover; }

/* ---- Wochenplan ---- */
.day-empty { min-height: 44px; padding: 0 14px; border-radius: 16px; background: var(--soft); border: 2px solid var(--soft); display: flex; align-items: center; justify-content: space-between; color: var(--muted); }
.day-empty.drop { border-color: var(--moss); }
.meal-label { padding: 4px 10px 2px; font-size: 12px; font-weight: 800; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; }
.drag-ghost { position: fixed; z-index: 50; pointer-events: none; background: var(--card); border-radius: 14px; padding: 10px 14px; box-shadow: 0 6px 18px rgba(61, 46, 34, .25); font-weight: 800; }
.drop-target { outline: 3px solid var(--moss); outline-offset: -3px; }

/* ---- Einstellungen, Einstieg ---- */
.settings-section { display: flex; flex-direction: column; gap: 10px; }
.settings-section h2 { margin: 6px 0 0; font-family: var(--display); font-weight: 600; font-size: 19px; }
.member-row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 6px 10px; border-top: 1px solid var(--line); }
.qr { background: #fff; border-radius: 18px; padding: 10px; align-self: center; }
.code-box { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 15px; line-height: 1.6; padding: 12px 14px; border-radius: 14px; background: #fff; border: 2px solid var(--edge); word-break: break-all; user-select: all; }
.onb { min-height: 100%; display: flex; flex-direction: column; padding: calc(30px + var(--safe-t)) 24px calc(24px + var(--safe-b)); gap: 18px; max-width: 520px; margin: 0 auto; }
.onb h1 { margin: 0; font-family: var(--display); font-weight: 700; font-size: 30px; line-height: 1.15; }
.onb p { margin: 0; font-size: 16px; line-height: 1.5; color: var(--muted); }
.avatars { display: flex; gap: 10px; flex-wrap: wrap; }
.avatars button { border: 3px solid transparent; border-radius: 50%; padding: 2px; background: none; }
.avatars button.on { border-color: var(--ink); }
.area-row { min-height: 68px; border: none; border-radius: 18px; background: transparent; color: var(--ink); display: flex; align-items: center; gap: 14px; padding: 0 14px; text-align: left; width: 100%; }
.area-row.on { background: var(--moss-soft); }
.area-row .ic { width: 40px; height: 40px; border-radius: 12px; background: var(--soft2); color: var(--muted); display: flex; align-items: center; justify-content: center; flex: none; }
.area-row.on .ic { background: var(--moss); color: #FFFAF2; }
.area-row .t { flex: 1; display: flex; flex-direction: column; }
.soon { font-size: 12px; font-weight: 800; color: var(--muted); padding: 3px 9px; background: var(--soft); border-radius: 999px; }
.diag { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; white-space: pre-wrap; background: #fff; border-radius: 12px; padding: 10px; border: 2px solid var(--edge); }

/* ---- Breite Bildschirme (Tablet, Computer) ---- */
@media (min-width: 760px) {
  .grid2 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .recipe-cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 24px; align-items: start; }
  .steps p { font-size: 19px; }
  .hero { height: 280px; border-radius: 0 0 28px 28px; }
}
@media (min-width: 1100px) {
  .shell { max-width: 1000px; }
  .sheet { max-width: 720px; }
}
