/* Sammelbox – Liquid-Glass-Oberfläche auf Basis #76C7F3
   Layout: eine Spalte wie eine iOS-App, große Titel, schwebende Glas-Tab-Leiste unten, Sheets von unten. */
:root {
  --brand: #76C7F3;
  --brand-ink: #0A5E8C;        /* lesbarer Blauton für Text und Links */
  --on-brand: #062F46;
  --bg: #EEF7FC;
  --bg-2: #DCEFFA;
  --ink: #0E2230;
  --ink-2: #55697A;
  --line: rgba(14, 34, 48, .08);
  --glass: rgba(255, 255, 255, .58);
  --glass-strong: rgba(255, 255, 255, .78);
  --glass-edge: rgba(255, 255, 255, .85);
  --glass-shadow: 0 10px 30px rgba(20, 70, 100, .14), 0 1px 2px rgba(20, 70, 100, .08);
  --danger: #D93A34;
  --danger-bg: rgba(217, 58, 52, .10);
  --field: rgba(255, 255, 255, .7);
  --blob-1: rgba(118, 199, 243, .75);
  --blob-2: rgba(160, 225, 214, .55);
  --blob-3: rgba(186, 204, 255, .55);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", system-ui, sans-serif;
  --r-l: 28px;
  --r-m: 18px;
  --r-s: 12px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand-ink: #9AD7F8; --on-brand: #04263A;
    --bg: #07141D; --bg-2: #0B2130; --ink: #EAF5FC; --ink-2: #93A9B8;
    --line: rgba(255, 255, 255, .09);
    --glass: rgba(28, 48, 62, .52); --glass-strong: rgba(28, 48, 62, .82); --glass-edge: rgba(255, 255, 255, .16);
    --glass-shadow: 0 10px 30px rgba(0, 0, 0, .45), 0 1px 2px rgba(0, 0, 0, .3);
    --danger: #FF6B63; --danger-bg: rgba(255, 107, 99, .14); --field: rgba(255, 255, 255, .07);
    --blob-1: rgba(118, 199, 243, .35); --blob-2: rgba(80, 160, 150, .28); --blob-3: rgba(100, 110, 210, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand-ink: #9AD7F8; --on-brand: #04263A;
  --bg: #07141D; --bg-2: #0B2130; --ink: #EAF5FC; --ink-2: #93A9B8;
  --line: rgba(255, 255, 255, .09);
  --glass: rgba(28, 48, 62, .52); --glass-strong: rgba(28, 48, 62, .82); --glass-edge: rgba(255, 255, 255, .16);
  --glass-shadow: 0 10px 30px rgba(0, 0, 0, .45), 0 1px 2px rgba(0, 0, 0, .3);
  --danger: #FF6B63; --danger-bg: rgba(255, 107, 99, .14); --field: rgba(255, 255, 255, .07);
  --blob-1: rgba(118, 199, 243, .35); --blob-2: rgba(80, 160, 150, .28); --blob-3: rgba(100, 110, 210, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

/* Hintergrund: weiche Farbflächen, durch die das Glas lebt */
.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%); }
.blob { position: absolute; border-radius: 50%; filter: blur(60px); }
.b1 { width: 60vmax; height: 60vmax; left: -20vmax; top: -25vmax; background: var(--blob-1); }
.b2 { width: 45vmax; height: 45vmax; right: -18vmax; top: 20vh; background: var(--blob-2); }
.b3 { width: 50vmax; height: 50vmax; left: 10vw; bottom: -30vmax; background: var(--blob-3); }

/* Glas */
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-edge);
}

#app {
  max-width: 920px;
  margin: 0 auto;
  padding-top: calc(env(safe-area-inset-top, 0px) + 12px);
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 120px);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.view { display: flex; flex-direction: column; gap: 16px; }

.large-title { padding: 18px 4px 0; }
.large-title h1 { margin: 0; font-size: 34px; line-height: 1.1; font-weight: 700; letter-spacing: -.02em; }
.sub { margin: 4px 0 0; color: var(--ink-2); font-size: 15px; }
.muted { color: var(--ink-2); }

/* Suche */
.search { display: flex; align-items: center; gap: 8px; padding: 0 14px; height: 44px; border-radius: 999px; }
.search svg { width: 18px; height: 18px; fill: none; stroke: var(--ink-2); stroke-width: 2; stroke-linecap: round; flex: none; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 16px; }
.search input::-webkit-search-cancel-button { opacity: .5; }

/* Filter-Chips */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px 4px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: 999px; font-size: 15px; font-weight: 500; white-space: nowrap;
  background: var(--glass); border: 1px solid var(--glass-edge);
  -webkit-backdrop-filter: blur(18px) saturate(170%); backdrop-filter: blur(18px) saturate(170%);
  transition: transform .15s ease, background .2s ease;
}
.chip:active { transform: scale(.96); }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; }
.chip .n { color: var(--ink-2); font-variant-numeric: tabular-nums; font-size: 13px; }
.chip.on { background: var(--brand); color: var(--on-brand); border-color: transparent; }
.chip.on .n { color: var(--on-brand); opacity: .7; }
.chip.add { color: var(--brand-ink); }

/* Raster der Beiträge */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 880px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.post {
  display: flex; flex-direction: column; text-align: left; padding: 0; border-radius: var(--r-m);
  overflow: hidden; min-width: 0; transition: transform .18s ease;
}
.post:active { transform: scale(.97); }
.thumb { position: relative; aspect-ratio: 4 / 5; width: 100%; max-width: 100%; background-size: cover; background-position: center; display: flex; align-items: flex-end; }
.thumb .ph { position: absolute; inset: 0; display: grid; place-items: center; }
.thumb .ph svg { width: 34%; height: 34%; fill: none; stroke: rgba(255,255,255,.9); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.badge {
  position: relative; margin: 8px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  color: #fff; background: rgba(0, 0, 0, .32); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.badge.demo { margin-left: auto; background: rgba(255,255,255,.35); color: #08283A; }
.post-meta { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.post-title { font-weight: 600; font-size: 15px; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.post-cat { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); min-width: 0; }
.post-cat .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.post-cat span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Leerer Zustand */
.empty { text-align: center; padding: 48px 24px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.empty-icon { width: 72px; height: 72px; border-radius: 22px; display: grid; place-items: center; margin-bottom: 8px; }
.empty-icon svg { width: 30px; height: 30px; fill: none; stroke: var(--brand-ink); stroke-width: 1.8; stroke-linejoin: round; }
.empty h2 { margin: 0; font-size: 20px; }
.empty p { margin: 0; color: var(--ink-2); max-width: 32ch; }

/* Liste (Kategorien) */
.list { list-style: none; margin: 0; padding: 0; border-radius: var(--r-m); overflow: hidden; }
.list li + li { border-top: 1px solid var(--line); }
.list button { width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 0; background: transparent; text-align: left; }
.list .sw { width: 30px; height: 30px; border-radius: 9px; flex: none; }
.list .name { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .n { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.list .chev { width: 14px; height: 14px; fill: none; stroke: var(--ink-2); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; opacity: .6; }
.btn-row { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-radius: var(--r-m); color: var(--brand-ink); font-weight: 600; text-align: left; }
.plus-dot { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--brand); color: var(--on-brand); font-size: 22px; line-height: 1; }

/* Karten (Mehr) */
.card { border-radius: var(--r-m); padding: 16px 18px; }
.card h3 { margin: 0 0 8px; font-size: 17px; }
.card p { margin: 0 0 10px; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.steps li::marker { color: var(--brand-ink); font-weight: 700; }
.fineprint { font-size: 13px; color: var(--ink-2); text-align: center; padding: 0 12px; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 16px;
  border-radius: 999px; border: 1px solid var(--glass-edge); background: var(--glass-strong); font-weight: 600; font-size: 15px;
  color: var(--brand-ink); text-decoration: none; cursor: pointer; transition: transform .15s ease;
}
.btn:active { transform: scale(.97); }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 14px; }
.btn.wide { width: 100%; min-height: 48px; }
.btn.primary { background: var(--brand); color: var(--on-brand); border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.danger-soft { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.link { border: 0; background: transparent; color: var(--brand-ink); font-size: 16px; padding: 6px 2px; }
.link.strong { font-weight: 700; }

/* Tab-Leiste */
.tabbar-wrap {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center; align-items: center; gap: 10px;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  pointer-events: none;
}
.tabbar { pointer-events: auto; display: flex; gap: 2px; padding: 5px; border-radius: 999px; }
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 76px; padding: 6px 10px 5px;
  border: 0; border-radius: 999px; background: transparent; color: var(--ink-2); font-size: 11px; font-weight: 600; transition: background .2s, color .2s;
}
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.tab[data-view="mehr"] svg { fill: currentColor; stroke: none; }
.tab.active { color: var(--brand-ink); background: rgba(118, 199, 243, .22); }
.fab { pointer-events: auto; width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); border-color: rgba(255,255,255,.6); }
.fab svg { width: 26px; height: 26px; stroke: var(--on-brand); stroke-width: 2.4; stroke-linecap: round; fill: none; }
.fab:active { transform: scale(.94); }

/* Sheets */
.scrim { position: fixed; inset: 0; z-index: 30; background: rgba(4, 20, 30, .28); animation: fade .2s ease; }
.sheet {
  position: fixed; z-index: 31; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(640px, 100%); max-height: calc(100% - env(safe-area-inset-top, 0px) - 24px);
  display: flex; flex-direction: column; border-radius: var(--r-l) var(--r-l) 0 0;
  background: var(--glass-strong); padding-bottom: env(safe-area-inset-bottom, 0px);
  animation: rise .32s cubic-bezier(.2, .9, .25, 1);
}
.grabber { width: 38px; height: 5px; border-radius: 3px; background: var(--ink-2); opacity: .35; margin: 8px auto 0; flex: none; }
.sheet-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 6px 16px 8px; flex: none; }
.sheet-head h2 { margin: 0; font-size: 17px; font-weight: 700; text-align: center; }
.sheet-head .link:first-child { justify-self: start; }
.sheet-head .link:last-child { justify-self: end; }
.sheet-body { overflow-y: auto; padding: 8px 18px 22px; display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: 13px; font-weight: 600; color: var(--ink-2); letter-spacing: .02em; text-transform: uppercase; }
.field > label .muted { text-transform: none; letter-spacing: 0; font-weight: 400; }
input[type="text"], input[type="url"], textarea {
  width: 100%; min-width: 0; border: 1px solid var(--line); background: var(--field); border-radius: var(--r-s);
  padding: 12px 14px; font-size: 16px; outline: none; resize: vertical;
}
input:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(118, 199, 243, .3); }
.input-row { display: flex; gap: 8px; align-items: center; }
.hint { margin: 0; font-size: 13px; color: var(--ink-2); min-height: 1em; }
.hint.warn { color: var(--danger); }
.hint.ok { color: var(--brand-ink); }
.cat-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-pick .chip { background: var(--field); border-color: var(--line); -webkit-backdrop-filter: none; backdrop-filter: none; }
.cat-pick .chip.on { background: var(--brand); border-color: transparent; }
.img-row { display: flex; gap: 12px; align-items: center; }
.img-preview { width: 72px; height: 90px; border-radius: 12px; background: var(--field) center / cover; border: 1px dashed var(--line); flex: none; }
.img-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.detail-actions { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; }
.swatches { display: flex; flex-wrap: wrap; gap: 12px; }
.swatch { width: 38px; height: 38px; border-radius: 50%; border: 3px solid transparent; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.swatch.on { border-color: var(--ink); }

/* Hinweis-Toast */
.toast {
  position: fixed; z-index: 40; left: 50%; transform: translateX(-50%);
  top: calc(env(safe-area-inset-top, 0px) + 14px); padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 15px;
  background: var(--glass-strong); animation: drop .3s ease; max-width: calc(100% - 32px); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

@keyframes rise { from { transform: translate(-50%, 100%); } to { transform: translate(-50%, 0); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes drop { from { transform: translate(-50%, -20px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Fallback ohne Glas-Unterstützung */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass, .chip { background: var(--glass-strong); }
}
