:root {
  --bg: #0e0e12;
  --surface: #17171d;
  --surface-2: #202029;
  --line: #2c2c37;
  --text: #f3f3f7;
  --muted: #9a9aab;
  --accent: #ff5d8f;
  --accent-2: #ffb15d;
  --accent-grad: linear-gradient(135deg, #ff5d8f, #ffb15d);
  --on-accent: #1d0a12; /* dunkle Schrift auf Verlauf: Kontrast > 7:1 (WCAG AA) */
  --danger: #ff5a5a;
  --star: #ffcc33;
  --radius: 14px;
  --tabbar-h: 64px;
  --appbar-h: 56px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
/* iOS: kein "Bild sichern"-Menü bei langem Drücken, kein Ziehen von Bildern */
img { -webkit-touch-callout: none; -webkit-user-drag: none; }
.tile, .fcard, .tab, .act, button { -webkit-touch-callout: none; touch-action: manipulation; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  font-size: 15px;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
svg { width: 22px; height: 22px; flex: none; }
input[type="search"] { font: inherit; }
h1, h2, h3 { margin: 0; }

/* ---------- App-Bar ---------- */
.appbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  padding-top: var(--safe-top);
  background: rgba(14, 14, 18, 0.82);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}
.appbar-normal, .appbar-select {
  height: var(--appbar-h); display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; gap: 12px;
}
.appbar-select { display: none; }
body.selecting .appbar-normal { display: none; }
body.selecting .appbar-select { display: flex; }
.appbar-title { font-size: 22px; font-weight: 750; letter-spacing: -0.02em; }
.appbar-count { font-weight: 650; }
.btn-text { color: var(--accent); font-weight: 600; padding: 8px 4px; }
.btn-text.strong { font-weight: 750; }

main {
  padding-top: calc(var(--appbar-h) + var(--safe-top));
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 24px);
  min-height: 100%;
}
.view { display: none; padding: 12px 12px 0; }
.view.active { display: block; }

/* ---------- Tab- & Aktionsleiste ---------- */
.tabbar, .actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex; justify-content: space-around; align-items: stretch;
  background: rgba(18, 18, 23, 0.9);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
}
.tab, .act {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 11px; font-weight: 600;
}
.tab.active { color: var(--text); }
.tab.active svg { color: var(--accent); }
.actionbar { display: none; }
body.selecting .tabbar { display: none; }
body.selecting .actionbar { display: flex; }
.act { color: var(--text); }
.act:disabled { opacity: 0.35; }
.act.danger { color: var(--danger); }

.fab {
  position: fixed; z-index: 21; right: 18px;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 18px);
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--accent-grad); color: var(--on-accent);
  display: grid; place-items: center;
  box-shadow: 0 10px 30px rgba(255, 93, 143, 0.35);
  transition: transform 0.15s;
}
.fab:active { transform: scale(0.92); }
.fab svg { width: 28px; height: 28px; }
body.selecting .fab, body:not(.on-gallery) .fab { display: none; }

/* ---------- Galerie ---------- */
.gallery-toolbar {
  display: none; align-items: center; justify-content: space-between;
  padding: 2px 2px 12px; color: var(--muted); font-size: 13px;
}
body.has-media .gallery-toolbar { display: flex; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-2); color: var(--text);
  padding: 8px 12px; border-radius: 999px; font-weight: 600; font-size: 13px;
}
.chip-btn svg { width: 17px; height: 17px; color: var(--accent); }

.grid {
  display: grid; gap: 3px;
  grid-template-columns: repeat(3, 1fr);
}
.tile {
  position: relative; aspect-ratio: 1; overflow: hidden; border-radius: 4px;
  background: var(--surface); cursor: pointer;
}
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.15s; }
.tile .badge {
  position: absolute; left: 6px; bottom: 6px; display: flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700; background: rgba(0, 0, 0, 0.55); padding: 3px 6px; border-radius: 6px;
}
.tile .badge svg { width: 14px; height: 14px; }
.tile .fname {
  position: absolute; right: 6px; bottom: 6px; max-width: 70%;
  display: flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700; background: rgba(0, 0, 0, 0.6); color: #fff;
  padding: 4px; border-radius: 7px;
}
.tile .fname svg { width: 14px; height: 14px; color: var(--accent-2); }
.tile .fname span { display: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile:focus-visible, .fcard:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.tile .check {
  position: absolute; top: 7px; right: 7px; width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid #fff; background: rgba(0, 0, 0, 0.25); display: none; place-items: center;
}
.tile .check svg { width: 15px; height: 15px; opacity: 0; }
body.selecting .tile .check { display: grid; }
.tile.selected .check { background: var(--accent); border-color: var(--accent); }
.tile.selected .check svg { opacity: 1; }
.tile.selected img { transform: scale(0.9); border-radius: 6px; }
.tile.busy::after {
  content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, 0.4);
  animation: pulse 1s infinite alternate;
}
@keyframes pulse { to { opacity: 0.3; } }

/* ---------- Leerzustand ---------- */
.empty { text-align: center; padding: 48px 24px; max-width: 460px; margin: 0 auto; }
.empty.small { padding-top: 64px; }
.empty h2 { font-size: 20px; margin: 18px 0 8px; }
.empty p { color: var(--muted); line-height: 1.5; margin: 0 0 22px; }
.empty-art {
  width: 120px; height: 120px; margin: 0 auto; border-radius: 32px;
  background: conic-gradient(from 200deg, #ff5d8f, #ffb15d, #5dd6ff, #9b7bff, #ff5d8f);
  box-shadow: 0 20px 60px rgba(255, 93, 143, 0.25);
  -webkit-mask: radial-gradient(circle at 50% 50%, transparent 26px, #000 27px);
          mask: radial-gradient(circle at 50% 50%, transparent 26px, #000 27px);
}
body.has-media #galleryEmpty { display: none; }
#favsEmpty { display: none; }
body.no-favs #favsEmpty { display: block; }

/* ---------- Buttons ---------- */
.btn-primary, .btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 20px; border-radius: 14px; font-weight: 700;
}
.btn-primary { background: var(--accent-grad); color: var(--on-accent); }
.btn-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px;
  background: var(--surface-2); font-weight: 700; font-size: 14px;
}
.btn-pill svg { width: 18px; height: 18px; color: var(--accent); }
.hint { color: var(--muted); font-size: 12px; margin: -4px 2px 12px; line-height: 1.4; }
.btn-primary:disabled { opacity: 0.4; }
.btn-secondary { background: var(--surface-2); }
.btn-primary.block { width: 100%; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; }
.icon-btn:active { background: var(--surface-2); }

/* ---------- Suche & Chips ---------- */
.searchbar {
  display: flex; align-items: center; gap: 8px; background: var(--surface);
  border-radius: 12px; padding: 0 12px; margin-bottom: 10px;
}
.searchbar svg { color: var(--muted); width: 18px; height: 18px; }
.searchbar input {
  flex: 1; background: none; border: 0; outline: 0; color: var(--text); padding: 12px 0; font-size: 16px;
}
.chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px; scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: 36px; padding: 8px 14px; border-radius: 999px; background: var(--surface-2);
  font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap;
}
.chip.active { background: var(--text); color: var(--bg); }

/* ---------- Filter-Karten ---------- */
.filter-grid {
  display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
}
.fcard { position: relative; text-align: left; }
.fcard .thumb {
  width: 100%; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface);
  display: block; position: relative;
}
.fcard img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fcard .name { display: block; font-size: 12px; font-weight: 600; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fcard .cat { display: block; font-size: 11px; color: var(--muted); }
.star {
  position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; color: #fff; background: rgba(0, 0, 0, 0.35);
}
.star svg { width: 18px; height: 18px; }
.star.on { color: var(--star); }

.filter-strip {
  display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 14px; scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.filter-strip::-webkit-scrollbar { display: none; }
.filter-strip .fcard { flex: none; width: 76px; scroll-snap-align: start; }
.filter-strip .fcard .thumb { border-radius: 10px; outline: 2px solid transparent; outline-offset: 2px; }
.filter-strip .fcard.active .thumb { outline-color: var(--accent); }
.filter-strip .fcard.active .name { color: var(--accent); }
.filter-strip .star { width: 26px; height: 26px; top: 3px; right: 3px; }
/* größere Trefferfläche für kleine Sterne */
.star::after { content: ""; position: absolute; inset: -8px; }
.filter-strip .star svg { width: 15px; height: 15px; }

/* ---------- Sheets ---------- */
.scrim {
  position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.5);
  opacity: 0; pointer-events: none; transition: opacity 0.25s;
}
.scrim.show { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
  background: var(--surface); border-radius: 22px 22px 0 0;
  padding: 8px 16px calc(16px + var(--safe-bottom));
  transform: translateY(105%); transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
  max-height: 88vh; max-height: 88dvh; overflow-y: auto; overscroll-behavior: contain;
}
.sheet.show { transform: none; }
.sheet-handle { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 8px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sheet-head h3 { font-size: 18px; }
.muted { color: var(--muted); margin: 0 0 12px; }

.segmented {
  display: flex; background: var(--bg); border-radius: 12px; padding: 4px; margin-bottom: 14px;
}
.segmented button {
  flex: 1; padding: 10px; border-radius: 9px; font-weight: 650; color: var(--muted);
}
.segmented button b { font-weight: 800; margin-left: 4px; }
.segmented button.active { background: var(--surface-2); color: var(--text); }
.segmented button:disabled { opacity: 0.35; }

.slider-row { display: flex; align-items: center; gap: 12px; margin: 4px 0 14px; font-size: 13px; font-weight: 600; }
.slider-row output { width: 40px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
input[type="range"] {
  flex: 1; -webkit-appearance: none; appearance: none; height: 4px; border-radius: 2px;
  background: var(--line); outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 0; }

.progress { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; margin-bottom: 16px; }
.progress div { height: 100%; width: 0; background: var(--accent-grad); transition: width 0.2s; }
.export-actions { display: grid; gap: 10px; }
.export-actions[hidden] { display: none; }

/* ---------- Editor ---------- */
.editor {
  position: fixed; inset: 0; z-index: 30; overscroll-behavior: contain; background: #000;
  display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.editor.show { transform: none; }
.editor-bar {
  padding-top: var(--safe-top); height: calc(var(--appbar-h) + var(--safe-top));
  display: flex; align-items: center; justify-content: space-between; padding-left: 8px; padding-right: 8px;
}
.editor-name { font-weight: 650; font-size: 14px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 0 8px; }
.editor-stage { flex: 1; min-height: 0; position: relative; display: grid; place-items: center; padding: 8px; }
.editor-stage canvas { max-width: 100%; max-height: 100%; object-fit: contain; display: block; border-radius: 4px; }
.ed-overlay {
  position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 4;
  display: flex; justify-content: space-between; align-items: center; gap: 8px; pointer-events: none;
}
#edReset { margin-left: auto; }
.pill:disabled { opacity: 0.4; }
.pill {
  pointer-events: auto; display: inline-flex; align-items: center; gap: 6px;
  background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  padding: 8px 12px; border-radius: 999px; font-size: 12px; font-weight: 650;
}
.pill svg { width: 16px; height: 16px; }
.pill[hidden] { display: none; }
.ed-filtername {
  position: absolute; top: 18px; left: 50%; transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.55); padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 700;
  opacity: 0; transition: opacity 0.3s; pointer-events: none;
}
.ed-filtername.show { opacity: 1; }
.editor-panel {
  background: var(--bg); padding: 12px 12px calc(6px + var(--safe-bottom)); border-radius: 18px 18px 0 0;
  max-height: 50vh; max-height: 50dvh; overflow-y: auto; overscroll-behavior: contain;
}
.ed-tabs { margin-bottom: 12px; }
.face-status { color: var(--muted); font-size: 13px; line-height: 1.45; margin: 0 2px 12px; }
.retouch-group {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted);
  margin: 6px 2px 10px; font-weight: 750;
}
.retouch-row { display: block; margin: 0 0 14px; }
.retouch-head { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.retouch-head output { color: var(--muted); font-variant-numeric: tabular-nums; }
.retouch-row input { width: 100%; }
.ed-tabs { position: sticky; top: -12px; z-index: 2; box-shadow: 0 -12px 0 var(--bg); }
body.selecting .install-banner { display: none; }
.btn-secondary.block { width: 100%; margin-top: 4px; }
.btn-secondary svg { width: 18px; height: 18px; }

/* ---------- Installation ---------- */
.appbar-actions { display: flex; align-items: center; gap: 4px; }
.install-banner {
  display: flex; align-items: center; gap: 12px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 6px 10px 12px; margin-bottom: 12px;
}
.install-banner img { border-radius: 10px; flex: none; }
.install-banner div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.install-banner span { color: var(--muted); font-size: 12px; line-height: 1.35; }
.btn-primary.small { padding: 9px 12px; font-size: 13px; border-radius: 10px; }
.steps { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 10px; }
.steps li { display: flex; align-items: center; gap: 14px; background: var(--bg); border-radius: 12px; padding: 14px; line-height: 1.4; }
.steps svg { color: var(--accent); width: 26px; height: 26px; }

/* ---------- Toast / Drop ---------- */
.toast {
  position: fixed; left: 50%; z-index: 60; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 90px);
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); font-weight: 650; padding: 10px 16px; border-radius: 12px;
  transition: opacity 0.2s, transform 0.2s; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.dropzone {
  position: fixed; inset: 0; z-index: 70; display: none; place-items: center;
  background: rgba(255, 93, 143, 0.18); border: 3px dashed var(--accent); font-size: 22px; font-weight: 750;
}
.dropzone.show { display: grid; }

/* ---------- Tablet / Desktop ---------- */
@media (min-width: 640px) {
  .tile .fname { padding: 4px 7px; }
  .tile .fname span { display: inline; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
  .tile { border-radius: 10px; }
  .filter-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px; }
}
@media (min-width: 960px) {
  :root { --tabbar-h: 0px; }
  .tabbar, .actionbar {
    top: calc(var(--appbar-h) + var(--safe-top)); right: auto; width: 96px; height: auto;
    flex-direction: column; justify-content: flex-start; gap: 6px; padding: 16px 0;
    border-top: 0; border-right: 1px solid var(--line);
  }
  .tab, .act { flex: none; height: 72px; font-size: 12px; }
  main { padding-left: 96px; padding-bottom: 40px; }
  .view { padding: 20px 28px 0; max-width: 1400px; margin: 0 auto; }
  .fab { bottom: 28px; right: 28px; }
  .toast { bottom: 40px; }
  .sheet {
    left: 50%; right: auto; bottom: 50%; width: 640px; border-radius: 22px;
    transform: translate(-50%, 50%) scale(0.95); opacity: 0; pointer-events: none;
    transition: transform 0.2s, opacity 0.2s;
  }
  .sheet.show { transform: translate(-50%, 50%); opacity: 1; pointer-events: auto; }
  .sheet-handle { display: none; }
  .sheet .filter-strip {
    display: grid; grid-template-columns: repeat(6, 1fr); max-height: 46vh; overflow-y: auto;
  }
  .sheet .filter-strip .fcard { width: auto; }
  .sheet .chips { flex-wrap: wrap; }
  .editor { flex-direction: row; flex-wrap: wrap; }
  .editor-bar { width: 100%; }
  .editor-stage { height: calc(100% - var(--appbar-h)); }
  .editor-panel {
    width: 380px; height: calc(100% - var(--appbar-h)); max-height: none; border-radius: 18px 0 0 0; overflow-y: auto;
  }
  .editor-panel .filter-strip {
    flex-wrap: wrap; overflow: visible; display: grid; grid-template-columns: repeat(3, 1fr);
  }
  .editor-panel .filter-strip .fcard { width: auto; }
  .editor-panel .chips { flex-wrap: wrap; }
}

/* =========================================================
   Version 2: Profi-Werkzeuge
   ========================================================= */

/* Galerie-Filter & Leerzustände */
.gallery-toolbar { gap: 10px; padding: 0 0 10px; }
.gallery-filter { padding: 0; flex: 1; min-width: 0; }
.gallery-toolbar .chip-btn { flex: none; min-height: 36px; }
/* Hinweise oben anzeigen, solange ein Dialog offen ist */
body:has(.sheet.show) .toast { bottom: auto; top: calc(var(--safe-top) + 16px); }
body:not(.has-media) .gallery-filter { display: none; }
.empty-inline { color: var(--muted); text-align: center; padding: 32px 16px; margin: 0; }

/* KI-Kennzeichnung auf Porträt-Filtern */
.ai-badge {
  position: absolute; left: 5px; top: 5px; font-size: 9px; font-weight: 800; letter-spacing: 0.06em;
  background: rgba(0, 0, 0, 0.6); color: var(--accent-2); padding: 3px 5px; border-radius: 5px;
}

/* Editor-Kopfzeile */
.editor-bar { gap: 4px; }
.editor-name { flex: 1; min-width: 0; }
.editor-tools { display: flex; align-items: center; gap: 2px; }
.editor-tools .icon-btn:disabled { opacity: 0.3; }
@media (max-width: 380px) { .editor-name { display: none; } .editor-tools { margin-left: auto; } }

/* Editor-Reiter: 4 gleich breite Tabs */
.ed-tabs button { padding: 9px 4px; font-size: 13px; }

/* Regler */
.retouch-row.changed .retouch-head output { color: var(--accent); }
.retouch-row.bipolar input[type="range"] {
  background: linear-gradient(90deg, var(--line) 0 49.6%, var(--muted) 49.6% 50.4%, var(--line) 50.4% 100%);
}
.pill.on { background: var(--text); color: var(--bg); }

/* Zuschnitt */
.crop-tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 2px 0 12px; }
.tool-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px;
  background: var(--surface); border-radius: 12px; font-size: 12px; font-weight: 600;
}
.tool-btn svg { color: var(--accent); }
.crop-overlay { position: absolute; overflow: hidden; touch-action: none; z-index: 3; }
.crop-box {
  position: absolute; box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6); outline: 2px solid #fff; outline-offset: -2px;
  cursor: move; touch-action: none;
}
.crop-grid {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(90deg, transparent 33%, rgba(255, 255, 255, 0.45) 33%, rgba(255, 255, 255, 0.45) calc(33% + 1px), transparent calc(33% + 1px), transparent 66%, rgba(255, 255, 255, 0.45) 66%, rgba(255, 255, 255, 0.45) calc(66% + 1px), transparent calc(66% + 1px)),
    linear-gradient(180deg, transparent 33%, rgba(255, 255, 255, 0.45) 33%, rgba(255, 255, 255, 0.45) calc(33% + 1px), transparent calc(33% + 1px), transparent 66%, rgba(255, 255, 255, 0.45) 66%, rgba(255, 255, 255, 0.45) calc(66% + 1px), transparent calc(66% + 1px));
}
.crop-box b { position: absolute; width: 28px; height: 28px; border: 0 solid #fff; touch-action: none; }
.crop-box b::after { content: ""; position: absolute; inset: -10px; }
.crop-box b[data-h="nw"] { left: 0; top: 0; border-left-width: 4px; border-top-width: 4px; cursor: nwse-resize; }
.crop-box b[data-h="ne"] { right: 0; top: 0; border-right-width: 4px; border-top-width: 4px; cursor: nesw-resize; }
.crop-box b[data-h="sw"] { left: 0; bottom: 0; border-left-width: 4px; border-bottom-width: 4px; cursor: nesw-resize; }
.crop-box b[data-h="se"] { right: 0; bottom: 0; border-right-width: 4px; border-bottom-width: 4px; cursor: nwse-resize; }

/* Export fertig */
.export-done {
  width: 56px; height: 56px; border-radius: 50%; margin: 4px auto 12px; display: grid; place-items: center;
  background: var(--accent-grad); color: var(--on-accent); animation: pop 0.35s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.export-done svg { width: 30px; height: 30px; }
@keyframes pop { from { transform: scale(0.4); opacity: 0; } }

/* Einstellungen */
.settings .segmented { margin-bottom: 14px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 2px 8px; font-size: 14px; }
.set-row b { display: block; font-weight: 650; }
.set-row small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.set-row.toggle { background: var(--bg); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; cursor: pointer; }
.set-row input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; width: 50px; height: 30px; border-radius: 15px; background: var(--line);
  position: relative; flex: none; transition: background 0.2s; cursor: pointer; margin: 0;
}
.set-row input[type="checkbox"]::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff;
  transition: transform 0.2s;
}
.set-row input[type="checkbox"]:checked { background: var(--accent); }
.set-row input[type="checkbox"]:checked::after { transform: translateX(20px); }
.set-row input[type="checkbox"]:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.danger-text { color: var(--danger); }
.about p { display: flex; gap: 10px; line-height: 1.45; margin: 0 2px 10px; font-size: 13px; }
.about svg { color: var(--accent); flex: none; width: 20px; height: 20px; }
.muted.small { font-size: 12px; }
.settings .btn-secondary.block { margin-bottom: 18px; }

/* Einführung */
.onboarding {
  position: fixed; inset: 0; z-index: 80; background: radial-gradient(120% 80% at 50% 0%, #2a1420 0%, var(--bg) 60%);
  display: flex; flex-direction: column; padding: calc(var(--safe-top) + 16px) 24px calc(var(--safe-bottom) + 20px);
  opacity: 0; transition: opacity 0.25s; touch-action: pan-y;
}
.onboarding.show { opacity: 1; }
.ob-skip { align-self: flex-end; color: var(--muted); }
.ob-slides { flex: 1; position: relative; min-height: 0; }
.ob-slide {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; opacity: 0; transform: translateX(30px); transition: opacity 0.3s, transform 0.3s; pointer-events: none;
}
.ob-slide.active { opacity: 1; transform: none; pointer-events: auto; }
.ob-slide h2 { font-size: 26px; letter-spacing: -0.02em; margin: 28px 0 10px; }
.ob-slide p { color: var(--muted); line-height: 1.5; max-width: 340px; margin: 0; }
.ob-art { position: relative; width: min(64vw, 270px, 38vh); aspect-ratio: 1; }
.ob-art img { background: var(--surface); }
.ob-stack img {
  position: absolute; width: 70%; aspect-ratio: 1; object-fit: cover; border-radius: 22px; left: 15%; top: 15%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5); border: 3px solid rgba(255, 255, 255, 0.9);
}
.ob-stack img:nth-child(1) { transform: rotate(-14deg) translate(-30%, 6%); }
.ob-stack img:nth-child(2) { transform: rotate(12deg) translate(30%, 4%); }
.ob-stack img:nth-child(3) { transform: translateY(-4%); }
.ob-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ob-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 14px; }
.ob-grid img:nth-child(2), .ob-grid img:nth-child(3) { outline: 3px solid var(--accent); outline-offset: -3px; }
.ob-check {
  position: absolute; right: -10px; top: -10px; width: 44px; height: 44px; border-radius: 50%;
  background: var(--accent-grad); color: var(--on-accent); display: grid; place-items: center;
  box-shadow: 0 8px 24px rgba(255, 93, 143, 0.4);
}
.ob-split { border-radius: 26px; overflow: hidden; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5); }
.ob-split img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ob-split img:nth-child(2) { clip-path: inset(0 0 0 50%); }
.ob-split i { position: absolute; left: calc(50% - 1.5px); top: 0; bottom: 0; width: 3px; background: #fff; }
.ob-foot { display: grid; gap: 18px; justify-items: center; }
.ob-dots { display: flex; gap: 8px; }
.ob-dots i { width: 8px; height: 8px; border-radius: 4px; background: var(--line); transition: width 0.2s, background 0.2s; }
.ob-dots i.on { width: 24px; background: var(--accent); }
.ob-foot .btn-primary { max-width: 420px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
