/* Krümelpost – kindgerecht, ruhig, große Bedienelemente */
:root {
  --paper: #FFF8EE; --card: #FFFFFF; --ink: #3B2A1E; --soft: #7A6656; --line: #F1E2CE;
  --koralle: #E8664A; --honig: #F5B82E; --gruen: #5DBB63; --blau: #4A90D9; --rot: #D93F44;
  --gruppe: #F5B82E; --gruppe-ink: #FFFFFF;
  --r: 16px; --schatten: 0 2px 8px rgba(80, 50, 20, .10);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --paper: #1E1814; --card: #2A221C; --ink: #F6EDE3; --soft: #C2B1A1; --line: #3B3029; --schatten: 0 2px 8px rgba(0,0,0,.35); color-scheme: dark; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.45 var(--font); -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
a { color: var(--koralle); }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; z-index: 99; background: var(--card); padding: 8px 12px; border-radius: 8px; }
.ic, .sym { flex: none; display: block; }
.laden { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--soft); }
.noscript { padding: 24px; }
.versteckt { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Rahmen: auf großen Bildschirmen mittig wie ein Handy */
.rahmen { max-width: 680px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; position: relative; padding-bottom: calc(86px + env(safe-area-inset-bottom)); }
@media (min-width: 720px) { .rahmen { border-left: 1px solid var(--line); border-right: 1px solid var(--line); } }

/* Kopf in Gruppenfarbe */
.kopf { position: sticky; top: 0; z-index: 20; background: var(--gruppe); color: var(--gruppe-ink); padding: calc(10px + env(safe-area-inset-top)) 14px 12px; display: flex; align-items: center; gap: 12px; box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.kopf .sym-kreis { width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,.28); display: flex; align-items: center; justify-content: center; }
.kopf .titel { flex: 1; min-width: 0; background: none; border: 0; padding: 4px 0; text-align: left; color: inherit; cursor: pointer; }
.kopf .titel b { display: flex; align-items: center; gap: 4px; font-size: 19px; line-height: 1.2; }
.kopf .titel span { display: block; font-size: 13px; opacity: .92; font-weight: 600; }
.kopf .titel[disabled] { cursor: default; }
.rund { width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255,255,255,.28); color: inherit; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: inset 0 0 0 2px rgba(255,255,255,.55); }
.rund:active { transform: scale(.96); }
.kopf.einfach { background: var(--card); color: var(--ink); box-shadow: 0 1px 0 var(--line); }
.kopf.einfach h1 { margin: 0; font-size: 20px; flex: 1; }

main { padding: 14px 14px 24px; }
h1, h2, h3 { line-height: 1.2; }
h2 { font-size: 19px; margin: 22px 2px 10px; }
.unter { color: var(--soft); font-size: 14px; }

/* Karten und Knöpfe */
.karte { background: var(--card); border-radius: var(--r); box-shadow: var(--schatten); padding: 14px; margin-bottom: 12px; }
.knopf { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 18px; border-radius: 14px; border: 0; background: var(--koralle); color: #fff; font-weight: 700; cursor: pointer; text-decoration: none; }
.knopf:active { transform: translateY(1px); }
.knopf[disabled] { opacity: .55; cursor: not-allowed; }
.knopf.zweit { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }
.knopf.gruen { background: var(--gruen); }
.knopf.rot { background: var(--rot); }
.knopf.klein { min-height: 38px; padding: 6px 12px; border-radius: 11px; font-size: 14px; }
.knopf.voll { width: 100%; }
.knopfreihe { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.link { background: none; border: 0; color: var(--koralle); font-weight: 700; padding: 8px 4px; cursor: pointer; text-decoration: underline; }

/* Formulare */
label.feld { display: block; margin-bottom: 14px; font-weight: 700; font-size: 15px; }
label.feld small { display: block; font-weight: 500; color: var(--soft); margin-top: 2px; }
.eingabe, select.eingabe, textarea.eingabe { display: block; width: 100%; margin-top: 6px; min-height: 50px; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); font-size: 17px; }
.eingabe:focus { outline: none; border-color: var(--koralle); box-shadow: 0 0 0 3px rgba(232,102,74,.18); }
textarea.eingabe { min-height: 120px; resize: vertical; line-height: 1.45; }
.pin { letter-spacing: .45em; font-variant-numeric: tabular-nums; font-size: 22px; text-align: center; }
.code { letter-spacing: .12em; text-transform: uppercase; font-size: 20px; text-align: center; font-weight: 700; }
.fehler { background: #FDE7E6; color: #8C1D1D; border-radius: 12px; padding: 10px 12px; margin: 10px 0; font-weight: 600; }
.hinweis { background: #FFF1D6; color: #6B4A10; border-radius: 12px; padding: 10px 12px; margin: 10px 0; }
.ok { background: #E3F5E4; color: #1E5B23; border-radius: 12px; padding: 10px 12px; margin: 10px 0; font-weight: 600; }
@media (prefers-color-scheme: dark) { .fehler { background: #4A1F1F; color: #FFD6D3; } .hinweis { background: #45361A; color: #FFE8B8; } .ok { background: #1F3D22; color: #CDEFD0; } }
fieldset { border: 0; padding: 0; margin: 0 0 14px; }
legend { font-weight: 700; margin-bottom: 6px; font-size: 15px; }
.wahl { display: flex; flex-wrap: wrap; gap: 8px; }
.wahl label { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 12px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); cursor: pointer; font-weight: 600; }
.wahl input { width: 20px; height: 20px; accent-color: var(--koralle); }
.wahl label:has(input:checked) { border-color: var(--koralle); background: rgba(232,102,74,.08); }

/* Willkommen */
.willkommen { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 28px 20px; max-width: 460px; margin: 0 auto; }
.willkommen .logo { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.willkommen .logo b { font-size: 34px; letter-spacing: -.5px; }
.willkommen p.lead { font-size: 18px; color: var(--soft); margin: 0 0 22px; }
.streifen { display: flex; height: 6px; position: fixed; top: 0; left: 0; right: 0; }
.streifen i { flex: 1; }

/* Feed */
.beitrag { padding: 0; overflow: hidden; }
.beitrag .autor { display: flex; align-items: center; gap: 10px; padding: 12px 12px 6px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--gruen); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; flex: none; }
.beitrag .autor b { display: block; }
.beitrag .autor small { color: var(--soft); }
.beitrag .text { padding: 2px 14px 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.beitrag .aktionen { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 8px; }
.herz { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 10px; border: 0; background: none; color: var(--soft); font-weight: 700; cursor: pointer; border-radius: 12px; }
.herz.an { color: var(--koralle); }
.menue-knopf { width: 44px; height: 44px; border: 0; background: none; color: var(--soft); border-radius: 12px; cursor: pointer; margin-left: auto; }
.fotos { display: grid; gap: 3px; }
.fotos.n1 { grid-template-columns: 1fr; }
.fotos.n2 { grid-template-columns: 1fr 1fr; }
.fotos.n3p { grid-template-columns: repeat(3, 1fr); }
.fotos button { padding: 0; border: 0; background: #E9DCCB; aspect-ratio: 1; position: relative; cursor: zoom-in; overflow: hidden; }
.fotos.n1 button { aspect-ratio: auto; max-height: 520px; }
.fotos img { width: 100%; height: 100%; object-fit: cover; }
.fotos .plus { position: absolute; inset: 0; background: rgba(0,0,0,.45); color: #fff; font-size: 26px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.leer { text-align: center; padding: 34px 18px; color: var(--soft); }
.leer .gross { font-size: 18px; color: var(--ink); font-weight: 700; margin: 10px 0 6px; }

/* Untere Leiste */
.leiste { position: fixed; z-index: 30; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 680px; background: var(--card); border-top: 1px solid var(--line); display: flex; justify-content: space-around; align-items: center; padding: 6px 8px calc(8px + env(safe-area-inset-bottom)); }
.leiste a { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 64px; min-height: 52px; justify-content: center; text-decoration: none; color: var(--soft); font-size: 12px; font-weight: 700; border-radius: 12px; }
.leiste a[aria-current="page"] { color: var(--koralle); }
.leiste a.plus span.kreis { width: 56px; height: 56px; border-radius: 50%; background: var(--koralle); color: #fff; display: flex; align-items: center; justify-content: center; margin-top: -22px; box-shadow: 0 4px 12px rgba(232,102,74,.5); }

/* Fotoauswahl beim Schreiben */
.vorschau { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin: 10px 0; }
.vorschau div { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: #E9DCCB; }
.vorschau img { width: 100%; height: 100%; object-fit: cover; }
.vorschau button { position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.fortschritt { height: 10px; border-radius: 10px; background: var(--line); overflow: hidden; margin: 10px 0; }
.fortschritt i { display: block; height: 100%; width: 0; background: var(--gruen); transition: width .2s; }

/* Kamera */
.kamera { position: fixed; inset: 0; z-index: 60; background: #000; color: #fff; display: flex; flex-direction: column; }
.kamera video { flex: 1; width: 100%; height: 100%; object-fit: cover; }
.kamera .ziel { position: absolute; left: 50%; top: 45%; width: 180px; height: 180px; margin: -90px 0 0 -90px; border-radius: 50%; border: 4px solid #fff; box-shadow: 0 0 0 9999px rgba(0,0,0,.35); pointer-events: none; }
.kamera .ziel.misst { border-color: var(--honig); animation: puls 1s infinite; }
@keyframes puls { 50% { transform: scale(1.06); } }
.kamera .oben { position: absolute; top: 0; left: 0; right: 0; padding: calc(14px + env(safe-area-inset-top)) 16px 14px; display: flex; justify-content: space-between; align-items: center; background: linear-gradient(rgba(0,0,0,.6), transparent); }
.kamera .unten { position: absolute; bottom: 0; left: 0; right: 0; padding: 18px 16px calc(22px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0,0,0,.75)); text-align: center; }
.kamera .unten p { margin: 0 0 12px; font-size: 18px; font-weight: 700; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.kamera .rund { background: rgba(0,0,0,.35); }

/* Dialoge */
dialog { border: 0; border-radius: 22px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); background: var(--card); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(30, 20, 10, .5); }
dialog .dkopf { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 4px 18px; }
dialog .dkopf h2 { margin: 0; }
dialog .dinhalt { padding: 6px 18px 18px; overflow: auto; }
.x { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--paper); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.codekarte { text-align: center; background: var(--paper); border-radius: 18px; padding: 18px; margin: 8px 0 12px; }
.codekarte .gross { font: 800 32px/1.2 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .08em; margin: 8px 0; color: var(--ink); }
.gruppenliste button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px; margin-bottom: 8px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); cursor: pointer; text-align: left; font-weight: 700; font-size: 17px; }
.gruppenliste button[aria-current="true"] { border-color: var(--koralle); }
.punkt { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; flex: none; }

/* Lichtbild */
.licht { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.94); display: flex; align-items: center; justify-content: center; }
.licht img { max-width: 100%; max-height: 100%; object-fit: contain; }
.licht .rund { position: absolute; background: rgba(255,255,255,.15); color: #fff; }
.licht .zu { top: calc(12px + env(safe-area-inset-top)); right: 12px; }
.licht .vor { right: 12px; top: 50%; } .licht .zur { left: 12px; top: 50%; }
.licht .zaehler { position: absolute; bottom: calc(16px + env(safe-area-inset-bottom)); color: #fff; font-weight: 700; }

/* Verwaltung */
.reiter { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 8px; margin: 0 -2px; scrollbar-width: none; }
.reiter button { flex: none; min-height: 42px; padding: 8px 14px; border-radius: 999px; border: 2px solid var(--line); background: var(--card); font-weight: 700; cursor: pointer; }
.reiter button[aria-selected="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.zeile { display: flex; align-items: center; gap: 12px; }
.zeile .wachs { flex: 1; min-width: 0; }
.zeile b { display: block; overflow-wrap: anywhere; }
.chip { display: inline-block; font-size: 12.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--paper); color: var(--soft); margin: 4px 4px 0 0; }
.chip.warn { background: #FFF1D6; color: #8A5A10; } .chip.gut { background: #E3F5E4; color: #1E5B23; } .chip.aus { background: #FDE7E6; color: #8C1D1D; }
.farbwahl { display: flex; flex-wrap: wrap; gap: 8px; }
.farbwahl label { width: 44px; height: 44px; border-radius: 50%; cursor: pointer; position: relative; box-shadow: inset 0 0 0 2px rgba(0,0,0,.08); }
.farbwahl input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.farbwahl label:has(input:checked) { box-shadow: 0 0 0 3px var(--card), 0 0 0 6px var(--ink); }
.farbwahl label:has(input:focus-visible) { outline: 3px solid var(--koralle); outline-offset: 4px; }
.symbolwahl label { width: 52px; height: 52px; justify-content: center; padding: 0; }
.symbolwahl input { position: absolute; opacity: 0; }
.mess { display: flex; gap: 10px; justify-content: center; margin: 12px 0; }
.mess i { width: 46px; height: 46px; border-radius: 50%; border: 3px dashed var(--line); display: block; }

/* Meldung unten */
#toast { position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 14px; font-weight: 700; opacity: 0; pointer-events: none; transition: .25s; z-index: 90; max-width: calc(100vw - 32px); text-align: center; }
#toast.zeigen { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Druck: nur die Codekarte */
@media print {
  body * { visibility: hidden; }
  .druckbar, .druckbar * { visibility: visible; }
  .druckbar { position: absolute; left: 0; top: 0; width: 100%; padding: 20mm; }
  .druckbar .knopfreihe, .druckbar .x { display: none; }
}
