/* Mycelium – Waldboden-Designsystem */

:root {
  --blattlicht: #ecefe2;
  --pilzweiss: #fbfaf3;
  --humus: #26332b;
  --humus-60: #5c6a60;
  --moos: #3b6e4f;
  --moos-dunkel: #2b523b;
  --wurzelbraun: #6b4f36;
  --sonne: #e9a13b;
  --sonne-hell: #fbedd6;
  --faden: #a9bda6;
  --karte-rand: #dde2cf;
  --gefahr: #a4442f;
  --radius: 18px;
  --schatten: 0 1px 2px rgba(38,51,43,.06), 0 6px 18px rgba(38,51,43,.07);
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Nunito Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: #22301f;
  color: var(--humus);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.2; margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: var(--font-body); cursor: pointer; }
input, textarea, select { font-family: var(--font-body); font-size: 1rem; }

:focus-visible { outline: 3px solid var(--sonne); outline-offset: 2px; border-radius: 6px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---- Bühne & Telefonrahmen ---- */
.stage {
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  background: radial-gradient(1200px 500px at 50% -10%, #35492f 0%, transparent 60%), #22301f;
}
.phone {
  width: min(420px, 100vw);
  min-height: 100dvh;
  background: var(--blattlicht);
  display: flex;
  flex-direction: column;
  position: relative;
}
@media (min-width: 480px) {
  .stage { padding: 24px 0; align-items: flex-start; }
  .phone {
    min-height: calc(100dvh - 48px);
    border-radius: 32px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0,0,0,.45);
    border: 1px solid #45573f;
  }
}
main { flex: 1; padding: 20px 18px 96px; }

/* ---- Bottom-Navigation ---- */
nav.tabs {
  position: sticky; bottom: 0;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(251,250,243,.92);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--karte-rand);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
nav.tabs a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 0 4px; min-height: 52px;
  color: var(--humus-60); border-radius: 14px;
}
nav.tabs a.active { color: var(--moos-dunkel); }
nav.tabs .ic { position: relative; width: 26px; height: 26px; }
nav.tabs .ic svg { width: 100%; height: 100%; }
nav.tabs .dot {
  position: absolute; top: -5px; right: -9px;
  background: var(--sonne); color: #3d2c10;
  font-size: .68rem; font-weight: 800;
  border-radius: 999px; min-width: 17px; height: 17px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}
nav.tabs .lbl { font-size: .72rem; font-weight: 700; }

/* ---- Bausteine ---- */
.card {
  background: var(--pilzweiss);
  border: 1px solid var(--karte-rand);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px;
  border-radius: 999px; border: none;
  font-size: 1rem; font-weight: 700;
  transition: transform .12s ease, background .15s ease;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--moos); color: var(--pilzweiss); }
.btn-primary:hover { background: var(--moos-dunkel); }
.btn-ghost { background: transparent; color: var(--moos); border: 1.5px solid var(--moos); }
.btn-sun { background: var(--sonne); color: #3d2c10; }
.btn-danger-ghost { background: transparent; color: var(--gefahr); border: 1.5px solid currentColor; }
.wide { width: 100%; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 999px;
  font-size: .8rem; font-weight: 700; white-space: nowrap;
}
.chip-wurzel { background: #efe6db; color: var(--wurzelbraun); }
.chip-zweig { background: #e2ecdd; color: var(--moos-dunkel); }
.chip-freundeskreis { background: #dcebe9; color: #2c5e58; }
.chip-weit { background: #e7e4f0; color: #4d4470; }
.chip-ich { background: var(--sonne-hell); color: #7a5210; }
.chip-none { background: #eceae0; color: var(--humus-60); }

.muted { color: var(--humus-60); }
.small { font-size: .85rem; }
.center { text-align: center; }
.brand {
  font-family: var(--font-display); font-weight: 700; font-size: 1.05rem;
  color: var(--moos-dunkel); margin: 0 0 10px; letter-spacing: .02em;
}
.back { display: inline-block; margin-bottom: 12px; font-weight: 700; font-size: .9rem; }
.page-h1 { font-size: 1.4rem; margin-bottom: 6px; }
.lede { margin: 0 0 16px; }

.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; line-height: 1; flex-shrink: 0;
}

/* ---- Entdecken ---- */
.topic {
  display: flex; gap: 14px; align-items: center; padding: 16px; margin-bottom: 14px;
  background: linear-gradient(135deg, var(--sonne-hell), var(--pilzweiss) 70%);
}
.topic .topic-emoji { font-size: 2rem; }
.topic h1 { font-size: 1.4rem; }
.topic p { margin: 2px 0 0; }
.filters { display: flex; gap: 8px; margin-bottom: 10px; }
.filters a {
  border: 1.5px solid var(--karte-rand); background: var(--pilzweiss);
  border-radius: 999px; padding: 8px 16px;
  font-weight: 700; color: var(--humus-60); min-height: 40px;
  display: inline-flex; align-items: center;
}
.filters a.on { background: var(--moos); border-color: var(--moos); color: var(--pilzweiss); }
.intro { margin: 0 2px 14px; }
.feed { display: flex; flex-direction: column; gap: 12px; }

.listing { display: block; padding: 16px; }
.listing:active { transform: scale(.99); }
.listing .top, .l-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.type { font-size: .75rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.type.biete { color: var(--moos-dunkel); }
.type.suche { color: #7a5210; }
.listing h3 { font-size: 1.15rem; margin-bottom: 4px; }
.listing .desc {
  margin: 0 0 12px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.who { display: flex; align-items: center; gap: 10px; border-top: 1px dashed var(--karte-rand); padding-top: 10px; }
.who-text { display: flex; flex-direction: column; line-height: 1.25; flex: 1; min-width: 0; }
.who .time { white-space: nowrap; }
.empty { padding: 24px; text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.empty p { margin: 0; }

/* ---- Angebotsdetail ---- */
.detail { padding: 18px; margin-bottom: 12px; }
.detail h1 { font-size: 1.35rem; margin-bottom: 8px; }
.detail .desc { margin: 0 0 14px; }
.owner { display: flex; gap: 10px; align-items: center; border-top: 1px dashed var(--karte-rand); padding-top: 12px; }
.owner p { margin: 0; }
.reach-note { margin: 10px 0 0; }
.connection { padding: 16px; margin-bottom: 12px; }
.connection h2 { font-size: 1.05rem; margin-bottom: 6px; }
.connection > p { margin: 0 0 12px; }

.thread { display: flex; align-items: flex-start; justify-content: center; gap: 2px; }
.thread .node { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 58px; }
.thread .name { font-size: .78rem; font-weight: 700; }
.thread .role {
  font-size: .68rem; font-weight: 700; color: var(--wurzelbraun);
  background: #efe6db; border-radius: 999px; padding: 1px 8px;
}
.thread .strand { flex: 1 1 40px; height: 24px; margin-top: 10px; min-width: 28px; }
.thread .wisp { animation: crawl 2.6s linear infinite; }
@keyframes crawl { to { stroke-dashoffset: -14; } }

.ask { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.ask textarea {
  border: 1.5px solid var(--karte-rand); border-radius: 12px;
  padding: 10px 12px; resize: vertical; background: #fff; width: 100%;
}
.ask p { margin: 0; }
.done { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; margin-bottom: 12px; }
.reqs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.req-line { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; background: var(--blattlicht); }
.req-line .req-text { flex: 1; display: flex; flex-direction: column; line-height: 1.3; }

/* ---- Teilen ---- */
form.share { display: flex; flex-direction: column; gap: 16px; }
.seg {
  display: grid; grid-template-columns: 1fr 1fr;
  background: var(--pilzweiss); border: 1.5px solid var(--karte-rand);
  border-radius: 999px; padding: 4px;
}
.seg label {
  text-align: center; padding: 10px 0; border-radius: 999px;
  font-weight: 700; color: var(--humus-60); cursor: pointer;
}
.seg input { position: absolute; opacity: 0; }
.seg input:checked + span { display: block; }
.seg label:has(input:checked) { background: var(--moos); color: var(--pilzweiss); }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; }
.field input, .field textarea {
  border: 1.5px solid var(--karte-rand); border-radius: 12px;
  padding: 12px; background: #fff; font-weight: 400; width: 100%;
}
fieldset.reach { border: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
fieldset.reach legend { font-weight: 700; padding: 0; margin-bottom: 4px; }
.option { display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; }
.option input { position: absolute; opacity: 0; }
.option:has(input:checked) { border-color: var(--moos); box-shadow: 0 0 0 1.5px var(--moos); }
.option .icon { font-size: 1.4rem; }
.option .text { flex: 1; display: flex; flex-direction: column; line-height: 1.3; }
.option .count {
  text-align: center; font-family: var(--font-display); font-weight: 700;
  font-size: 1.3rem; color: var(--moos-dunkel); line-height: 1;
}
.option .count em {
  display: block; font-family: var(--font-body); font-style: normal;
  font-size: .65rem; font-weight: 700; color: var(--humus-60);
}

/* ---- Netzwerk ---- */
.add-row { display: flex; gap: 10px; margin-bottom: 14px; }
.add-row .btn { flex: 1; }
.panel { padding: 16px; margin-bottom: 16px; }
.panel p { margin: 0 0 8px; }
.scanframe {
  position: relative; border: 2px dashed var(--moos); border-radius: 14px;
  height: 110px; display: flex; align-items: flex-end; justify-content: center;
  overflow: hidden;
  background: repeating-linear-gradient(90deg, #e7ead9 0 8px, #eef0e2 8px 16px);
}
.scanline {
  position: absolute; left: 8px; right: 8px; top: 8px; height: 3px;
  background: var(--sonne); border-radius: 3px;
  animation: sweep 1.3s ease-in-out infinite alternate;
}
@keyframes sweep { from { top: 8px; } to { top: 96px; } }
.found { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 8px; }
.found .found-text p { margin: 0 0 6px; }
.q { font-weight: 700; margin: 10px 0 8px; }
.level-row { display: flex; gap: 10px; margin-bottom: 10px; }
.level-row .btn { flex: 1; }
.linkbox {
  display: flex; gap: 8px; align-items: center;
  background: var(--blattlicht); border-radius: 12px; padding: 8px 8px 8px 12px;
}
.linkbox code { flex: 1; font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group { margin-bottom: 20px; }
.group h2 { font-size: 1.1rem; }
.group .count-n { font-family: var(--font-body); font-size: .9rem; font-weight: 700; }
.group .sub { margin: 2px 0 10px; }
.person { display: flex; align-items: center; gap: 10px; padding: 12px; margin-bottom: 8px; }
.p-text { flex: 1; display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.p-text .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-actions { display: flex; flex-direction: column; gap: 6px; }
.mini {
  border: 1px solid var(--karte-rand); background: var(--blattlicht);
  border-radius: 999px; padding: 5px 10px;
  font-size: .75rem; font-weight: 700; color: var(--moos-dunkel);
  min-height: 30px; width: 100%;
}
.mini.danger { color: var(--gefahr); }

/* ---- Anfragen ---- */
.section-h2 { font-size: 1.05rem; margin: 0 0 8px; }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 12px; margin-bottom: 8px; }
.note.fresh { border-color: var(--sonne); background: linear-gradient(120deg, var(--sonne-hell), var(--pilzweiss) 55%); }
.note .n-icon { font-size: 1.2rem; }
.note .n-text { flex: 1; }
.note .n-text p { margin: 0 0 2px; }
.note .go { font-size: 1.4rem; align-self: center; padding: 0 4px; }
.reqcard { display: flex; align-items: center; gap: 10px; padding: 12px; margin-bottom: 8px; }
.reqcard .r-text { flex: 1; display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.st { font-size: .72rem; font-weight: 800; border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.st-offen { background: var(--sonne-hell); color: #7a5210; }
.st-ok { background: #dcecdd; color: var(--moos-dunkel); }
.st-nein { background: #eee3df; color: var(--gefahr); }
section.block { margin-bottom: 20px; }

/* ---- Anfrage-Detail / Chat ---- */
.head { padding: 16px; margin-bottom: 12px; }
.kicker { margin: 0 0 4px; text-transform: uppercase; letter-spacing: .06em; font-weight: 800; font-size: .72rem; }
.head h1 { font-size: 1.2rem; margin-bottom: 12px; }
.l-link { text-decoration: underline; text-decoration-color: var(--faden); text-underline-offset: 3px; }
.head p { margin: 0 0 10px; }
.head .note-t { margin: 10px 0 0; }
.decide { display: flex; gap: 10px; margin-bottom: 14px; }
.decide .btn { flex: 1; }
.chat { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.msg { display: flex; gap: 8px; align-items: flex-end; }
.msg.mine { justify-content: flex-end; }
.bubble {
  background: var(--pilzweiss); border: 1px solid var(--karte-rand);
  border-radius: 16px 16px 16px 4px; padding: 10px 12px; max-width: 78%;
}
.msg.mine .bubble { background: var(--moos); color: var(--pilzweiss); border-color: var(--moos); border-radius: 16px 16px 4px 16px; }
.bubble p { margin: 0 0 2px; }
.bubble .t { font-size: .68rem; }
.msg.mine .t { color: #d4e2d3; }
.compose { display: flex; gap: 8px; position: sticky; bottom: 84px; }
.compose input {
  flex: 1; border: 1.5px solid var(--karte-rand); border-radius: 999px;
  padding: 0 16px; min-height: 48px; background: #fff;
}
.compose .send { min-width: 48px; padding: 0; border-radius: 50%; }

/* ---- Fehler ---- */
.err { margin-top: 40px; padding: 24px; text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }

/* ---- v2: feste Telefonhöhe mit innerem Scrollen ---- */
.stage { align-items: stretch; }
.phone { height: 100dvh; min-height: 0; overflow: hidden; }
main { overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 24px; }
nav.tabs { position: static; }
@media (min-width: 480px) {
  .stage { align-items: center; padding: 24px 0; }
  .phone { height: min(820px, calc(100dvh - 48px)); min-height: 0; }
}

/* ---- Demo-Hinweis außerhalb des Telefons ---- */
.demo-note {
  display: none;
  position: fixed;
  right: 18px;
  bottom: 12px;
  margin: 0;
  color: #9db396;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .01em;
}
@media (min-width: 640px) { .demo-note { display: block; } }

/* ---- Filterzeilen ---- */
.filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.filters::-webkit-scrollbar { display: none; }
.filters a { flex-shrink: 0; font-size: .88rem; padding: 7px 14px; }
.filter-label { margin: 8px 2px 6px; font-weight: 700; }
.topic-tag { font-weight: 700; letter-spacing: 0; text-transform: none; color: var(--humus-60); }
.feed { margin-top: 14px; }

/* ---- Teilen: Themenwahl ---- */
.topic-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.option.slim { padding: 10px 12px; }
.option.slim .icon { font-size: 1.2rem; }

/* ---- Profil ---- */
.profil-preview { display: flex; align-items: center; gap: 14px; padding: 16px; margin-bottom: 14px; }
.saved { color: var(--moos-dunkel); font-weight: 800; margin: 0 0 10px; }
.emoji-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.emoji-opt { position: relative; cursor: pointer; }
.emoji-opt input { position: absolute; opacity: 0; }
.emoji-opt span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--pilzweiss); border: 1.5px solid var(--karte-rand); font-size: 1.3rem;
}
.emoji-opt input:checked + span { border-color: var(--moos); box-shadow: 0 0 0 2px var(--moos); }
.hue-slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 12px; border-radius: 999px;
  background: linear-gradient(90deg, hsl(0,42%,78%), hsl(60,42%,78%), hsl(120,42%,78%), hsl(180,42%,78%), hsl(240,42%,78%), hsl(300,42%,78%), hsl(360,42%,78%));
  outline-offset: 4px;
}
.hue-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%;
  background: var(--pilzweiss); border: 3px solid var(--moos); cursor: pointer;
}
.hue-slider::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--pilzweiss); border: 3px solid var(--moos); cursor: pointer;
}

/* Fünf Tabs */
nav.tabs { grid-template-columns: repeat(5, 1fr); }

/* ---- v3: Personenprofil, Reset-Knopf ---- */
.demo-corner { display: none; position: fixed; right: 18px; bottom: 12px; text-align: right; }
@media (min-width: 640px) { .demo-corner { display: block; } }
.demo-corner .demo-note { position: static; display: block; margin: 0 0 6px; }
.demo-reset {
  background: transparent; color: #9db396;
  border: 1px solid #4a5c44; border-radius: 999px;
  padding: 5px 12px; font-size: .75rem; font-weight: 700;
}
.demo-reset:hover { color: #ecefe2; border-color: #9db396; }
a.owner { border-radius: 12px; }
.profile-go { font-size: 1.4rem; margin-left: auto; }
.profil-link { display: inline-block; font-weight: 700; color: var(--moos-dunkel); margin-top: 4px; }
