/* technokitty 9.0.0 – Oberfläche nach /design: „girly, aber modern“. Blush-Töne, Hotpink als Akzent, Herzen nur als
   Details. Hell und dunkel, 7 Akzentfarben, Instrument Serif (kursiv) + Nunito – beide vom eigenen Server.
   Abweichung vom Grundgerüst: Die Seite scrollt als Ganzes (nicht in #main), weil Feed und Galerie daran hängen. */

@font-face {
  font-family: "Nunito"; font-style: normal; font-weight: 200 1000; font-display: swap;
  src: url("nunito.woff2?v=9.0.0") format("woff2");
}
@font-face {
  font-family: "Instrument Serif"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("instrument-serif-italic.woff2?v=9.0.0") format("woff2");
}

/* ---------- Farben und Maße (Design-Tokens aus /design 3, unverändert) ---------- */
:root, [data-accent="hotpink"] {
  --acc-d: #ff5cad; --acc2-d: #ffb3d6; --acc-l: #d6136f; --acc2-l: #ffd1e6;
}
[data-accent="bubblegum"] { --acc-d: #ff9ccd; --acc2-d: #ffd0e6; --acc-l: #c23d80; --acc2-l: #ffd9ea; }
[data-accent="lila"]      { --acc-d: #c48dff; --acc2-d: #e2c6ff; --acc-l: #8236d6; --acc2-l: #ead9ff; }
[data-accent="blau"]      { --acc-d: #6cb4ff; --acc2-d: #bcdcff; --acc-l: #1c66c4; --acc2-l: #d6e8ff; }
[data-accent="mint"]      { --acc-d: #4fdcae; --acc2-d: #b5f1dd; --acc-l: #0f7d5c; --acc2-l: #cdf3e6; }
[data-accent="orange"]    { --acc-d: #ffa266; --acc2-d: #ffd2b5; --acc-l: #b54e10; --acc2-l: #ffe1cf; }
[data-accent="gelb"]      { --acc-d: #f2cf4a; --acc2-d: #f8e6a2; --acc-l: #8a6d00; --acc2-l: #f8eab8; }

:root {
  --heart: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21.2c-.3 0-.6-.1-.8-.3C7.4 17.6 2.5 13.6 2.5 8.9 2.5 6 4.8 3.7 7.6 3.7c1.8 0 3.4.9 4.4 2.4 1-1.5 2.6-2.4 4.4-2.4 2.8 0 5.1 2.3 5.1 5.2 0 4.7-4.9 8.7-8.7 12-.2.2-.5.3-.8.3z'/%3E%3C/svg%3E");
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9.5 6 6 6-6 6'/%3E%3C/svg%3E");
  --i-alert: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7.6v5.2'/%3E%3Ccircle cx='12' cy='16.4' r='.35' stroke-width='2.4'/%3E%3C/svg%3E");
  --i-info: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5.4'/%3E%3Ccircle cx='12' cy='7.6' r='.35' stroke-width='2.4'/%3E%3C/svg%3E");
  --i-spark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M11 3.5c.6 4.3 2.3 6 6.5 6.5-4.2.6-5.9 2.3-6.5 6.5-.6-4.2-2.3-5.9-6.5-6.5 4.2-.5 5.9-2.2 6.5-6.5zM18.5 14.5c.3 2 1 2.7 3 3-2 .3-2.7 1-3 3-.3-2-1-2.7-3-3 2-.3 2.7-1 3-3z'/%3E%3C/svg%3E");
  /* technokitty: Symbole der Treffer-Leiste (gleiches Raster wie oben: 24er, Strich 2, runde Enden) */
  --i-select: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='m8.2 12.3 2.6 2.6 5-5.4'/%3E%3C/svg%3E");
  --i-all: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.5' y='3.5' width='7' height='7' rx='2'/%3E%3Crect x='13.5' y='3.5' width='7' height='7' rx='2'/%3E%3Crect x='3.5' y='13.5' width='7' height='7' rx='2'/%3E%3Cpath d='m14 17 2 2 4-4.5'/%3E%3C/svg%3E");
  --i-web: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='M3.5 12h17M12 3.5c2.4 2.5 3.5 5.3 3.5 8.5s-1.1 6-3.5 8.5c-2.4-2.5-3.5-5.3-3.5-8.5s1.1-6 3.5-8.5z'/%3E%3C/svg%3E");
  --i-similar: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='8' y='3.5' width='12.5' height='12.5' rx='2.5'/%3E%3Cpath d='M16 20.5H6a2.5 2.5 0 0 1-2.5-2.5V8'/%3E%3Cpath d='m10.5 13 2.6-2.8 2 2 1.4-1.4 1.8 2.2'/%3E%3C/svg%3E");
  --i-out: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7.5 16.5l9-9M9 7.5h7.5V15'/%3E%3C/svg%3E");
  --i-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.5' y='4.5' width='17' height='15' rx='3'/%3E%3Ccircle cx='9' cy='10' r='1.6'/%3E%3Cpath d='m4.5 17.5 5-5 3.5 3.5 2.5-2.5 4 4'/%3E%3C/svg%3E");
  --i-expand: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14.5 4.5h5v5M9.5 19.5h-5v-5M19.5 4.5l-6 6M4.5 19.5l6-6'/%3E%3C/svg%3E");
  --i-download: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v11m0 0-4.5-4.5M12 15l4.5-4.5M5 19.5h14'/%3E%3C/svg%3E");
  --i-feed: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='6' y='3.5' width='12' height='11' rx='2.5'/%3E%3Cpath d='M8 18.5h8M10 21h4'/%3E%3C/svg%3E");
  --i-gallery: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='6' y='5.5' width='12' height='13' rx='2.5'/%3E%3Cpath d='M2.5 8v8M21.5 8v8'/%3E%3C/svg%3E");
  --accent: var(--acc-d);
  --soft: var(--acc2-d);
  --ink: color-mix(in oklab, var(--accent) 10%, #2a0618);          /* Schrift auf Akzentflächen */
  --bg: color-mix(in oklab, var(--accent) 6%, #161014);
  --bg-2: color-mix(in oklab, var(--accent) 8%, #1f171c);          /* Karten, Eingaben */
  --bg-3: color-mix(in oklab, var(--accent) 13%, #282026);         /* Leisten, Marken */
  --line: color-mix(in oklab, var(--accent) 16%, #342a31);
  --text: color-mix(in oklab, var(--accent) 4%, #fbf1f6);
  --muted: color-mix(in oklab, var(--accent) 16%, #ab9aa4);
  --tl-line: color-mix(in oklab, var(--line) 78%, var(--muted));   /* sichtbarere Linie (Zeitleiste, Schalter aus) */
  --code: color-mix(in oklab, var(--accent) 4%, #120c10);
  --hi: color-mix(in oklab, var(--accent) 62%, var(--text));       /* Fett, Inline-Code, Namen */
  --tint: color-mix(in srgb, var(--accent) 12%, transparent);      /* Antippen, zarte Flächen */
  --tint-strong: color-mix(in srgb, var(--accent) 22%, transparent);
  --wash: color-mix(in srgb, var(--accent) 12%, transparent);      /* Farbschleier oben auf der Seite */
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 26px -14px rgba(0, 0, 0, .7);
  --lift: 0 6px 14px -8px rgba(0, 0, 0, .55);                      /* unter Akzentflächen; dunkel ohne Farbschein */
  --shade: rgba(8, 2, 6, .6);                                      /* Abdunklung hinter Fenstern */
  --gut: 16px;
  --r-card: 16px;
  --warn: #ffd166;
  --danger: #ff7a90;
  --ok: #7fe0b0;
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
  --mono: ui-monospace, "JetBrains Mono", "Roboto Mono", Menlo, monospace;
  color-scheme: dark;
}
:root[data-mode="light"] {
  --accent: var(--acc-l);
  --soft: var(--acc2-l);
  --ink: #ffffff;
  --bg: color-mix(in oklab, var(--accent) 3%, #fffafc);
  --bg-2: #ffffff;
  --bg-3: color-mix(in oklab, var(--accent) 7%, #fff7fa);
  --line: color-mix(in oklab, var(--accent) 14%, #f2e7ec);
  --text: color-mix(in oklab, var(--accent) 14%, #26121f);
  --muted: color-mix(in oklab, var(--accent) 18%, #78636e);        /* ≥ 4,9:1 auf --bg */
  --code: color-mix(in oklab, var(--accent) 3%, #fffbfd);
  --hi: color-mix(in oklab, var(--accent) 88%, var(--text));
  --tint: color-mix(in srgb, var(--accent) 7%, transparent);
  --tint-strong: color-mix(in srgb, var(--accent) 14%, transparent);
  --wash: color-mix(in srgb, var(--accent) 10%, transparent);
  --shadow: 0 1px 2px rgba(80, 20, 50, .06), 0 10px 26px -14px rgba(140, 20, 80, .28);
  --lift: 0 6px 16px -10px color-mix(in srgb, var(--accent) 60%, transparent);
  --shade: rgba(60, 15, 40, .28);
  --warn: #8f6200;
  --danger: #c62f4a;
  --ok: #1f8a5a;
  color-scheme: light;
}

/* ---------- Grundgerüst ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  min-height: 100dvh;
  color: var(--text); font: 16px/1.6 var(--font);
  background: linear-gradient(180deg, var(--wash) 0, transparent 320px) no-repeat, var(--bg);
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-tap-highlight-color: transparent;
  caret-color: var(--accent);
}
::selection { background: var(--tint-strong); }
* { scrollbar-width: thin; scrollbar-color: var(--tint-strong) transparent; }
button, select, textarea, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg circle { fill: currentColor; stroke: none; }
svg circle.ring { fill: none; stroke: currentColor; }
svg .fill { fill: currentColor; stroke: none; }
.nobr { white-space: nowrap; }
h1, h2, h3 { margin: 0; }

/* Herz als Detail: Maske, nimmt immer die Akzentfarbe an */
.toast::before, .brand::after, .pulse, .process > summary::before, .process-status li::before {
  content: ""; display: inline-block; flex: none; background: var(--accent);
  -webkit-mask: var(--heart) center / contain no-repeat; mask: var(--heart) center / contain no-repeat;
}

#app { display: flex; min-height: 100dvh; }
#main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
#content { width: 100%; max-width: calc(760px + 2 * var(--gut)); margin: 0 auto; padding: 10px var(--gut) 28px; }

/* ---------- Kopfzeile ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 4px;
  padding: calc(env(safe-area-inset-top) + 6px) 8px 6px 2px; min-height: 58px; border-bottom: 1px solid var(--line);
  background: linear-gradient(var(--wash), var(--wash)), var(--bg);
}
.icon-btn {
  background: none; border: 0; width: 44px; height: 44px; border-radius: 14px; padding: 0;
  display: grid; place-items: center; color: var(--text); flex: none;
}
.icon-btn:active { background: var(--tint); }
.title-box { flex: 1; min-width: 0; min-height: 44px; background: none; border: 0; text-align: left; padding: 2px 4px;
  display: flex; flex-direction: column; justify-content: center; gap: 1px; color: var(--text); }
.top-title { font-weight: 800; font-size: 16px; line-height: 1.25; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subtitle { display: block; font-size: 12.5px; line-height: 1.2; font-weight: 700; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Pille mit Ring: HQ-Prüfung „fertig / alle“ */
.pill {
  flex: none; height: 30px; display: inline-flex; align-items: center; gap: 7px; padding: 0 12px 0 8px; border-radius: 999px;
  font-size: 12.5px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums;
  border: 1px solid var(--line); background: var(--bg-2);
}
.pill::before {
  content: ""; flex: none; width: 15px; height: 15px; border-radius: 50%;
  background: conic-gradient(var(--ring, var(--accent)) var(--p, 0%), var(--tint-strong) 0);
  -webkit-mask: radial-gradient(circle, transparent 4px, #000 4.5px); mask: radial-gradient(circle, transparent 4px, #000 4.5px);
}
.pill:empty { display: none; }
.pill.done { --ring: var(--ok); }

/* ---------- Hinweise ---------- */
.banner {
  position: relative; margin: 10px var(--gut) 0; padding: 10px 14px 10px 42px; border-radius: var(--r-card);
  font-size: 13.5px; line-height: 1.45; font-weight: 600; text-wrap: pretty;
  background: color-mix(in srgb, var(--warn) 10%, var(--bg-2)); color: var(--text);
  border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent);
}
.banner::before {
  content: ""; position: absolute; left: 13px; top: 10.5px; width: 19px; height: 19px; background: var(--warn);
  -webkit-mask: var(--i-alert) center / contain no-repeat; mask: var(--i-alert) center / contain no-repeat;
}
.banner.bad { background: color-mix(in srgb, var(--danger) 10%, var(--bg-2)); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.banner.bad::before { background: var(--danger); }
.banner.info { background: color-mix(in srgb, var(--accent) 9%, var(--bg-2)); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.banner.info::before { background: var(--accent); -webkit-mask-image: var(--i-spark); mask-image: var(--i-spark); }
.banner:empty { display: none; }
#content .banner { margin: 6px 0 12px; }
#offlineBanner { display: flex; flex-wrap: wrap; align-items: center; }
#offlineBanner > span:first-child { flex: 1 0 100%; }
.banner-actions { display: flex; gap: 12px; margin: 0 0 -10px -4px; }

.note { display: flex; align-items: flex-start; gap: 7px; margin: 8px 0 0; font-size: 13.5px; line-height: 1.45;
  font-weight: 600; color: var(--text); text-wrap: pretty; }
.note::before { content: ""; flex: none; width: 16px; height: 16px; margin-top: 2px; background: var(--warn);
  -webkit-mask: var(--i-info) center / contain no-repeat; mask: var(--i-info) center / contain no-repeat; }
.note.bad { color: var(--danger); }
.note.bad::before { background: var(--danger); -webkit-mask-image: var(--i-alert); mask-image: var(--i-alert); }
.note:empty { display: none; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 6px 0 12px; text-wrap: pretty; }
.hint:empty { display: none; }
.field-label { font-size: 13px; font-weight: 800; color: var(--muted); }

/* ---------- Suche ---------- */
.search-area { margin: 6px 0 2px; }
.capsule { display: flex; align-items: center; gap: 4px; padding: 3px; border-radius: 26px;
  border: 1px solid var(--line); background: var(--bg-2); box-shadow: var(--shadow); }
.capsule:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--tint), var(--shadow); }
.capsule-input { flex: 1; min-width: 0; height: 44px; margin: 0; padding: 0 8px 0 15px; border: 0; border-radius: 999px;
  background: transparent; color: var(--text); font-size: 16px; font-weight: 700; outline: none;
  -webkit-appearance: none; appearance: none; }
.capsule-input::placeholder { color: var(--muted); opacity: 1; font-weight: 600; }
.capsule-input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.send { position: relative; width: 44px; height: 44px; padding: 0; border-radius: 50%; border: 0; color: var(--ink); flex: none;
  background: var(--accent); display: grid; place-items: center; box-shadow: var(--lift); }
.send:active { transform: scale(.94); }
.send:disabled { background: var(--tint-strong); color: var(--accent); box-shadow: none; }   /* nicht über opacity */
.send svg { width: 21px; height: 21px; stroke-width: 2.2; }
.send .i-stop { display: none; }
.send.stop { background: var(--bg-2); color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.send.stop .i-search { display: none; }
.send.stop .i-stop { display: block; }

/* Chips: Auswahl in einer Zeile, waagrecht scrollbar */
.controls { display: flex; align-items: center; gap: 6px; margin: 4px calc(var(--gut) * -1) 2px; padding: 6px var(--gut);
  overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
.controls::-webkit-scrollbar { display: none; }
.controls:empty { display: none; }
.chip { position: relative; display: inline-flex; align-items: center; gap: 3px; flex: none; height: 36px; padding: 0 6px 0 11px;
  border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); color: var(--text); }
.chip svg { width: 15px; height: 15px; color: var(--accent); stroke-width: 2.2; flex: none; }
.chip select { background: transparent; border: 0; height: 46px; margin: -5px 0; padding: 0 2px; font-size: 13.5px; font-weight: 800;
  outline: none; max-width: 150px; color: var(--text); field-sizing: content; cursor: pointer; }
.chip:has(select:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip select option { background: var(--bg-2); color: var(--text); }
.chip-btn { gap: 7px; padding: 0 13px 0 12px; font-size: 13.5px; font-weight: 800; line-height: 1; color: var(--text); white-space: nowrap; }
.chip-btn::after { content: ""; position: absolute; inset: -5px -3px; }   /* Tippfläche 46 px */
.chip-btn:active { background: var(--tint); }
.chip-btn:disabled { color: var(--muted); background: var(--bg-3); cursor: default; }
@media (max-width: 429px) { .chip > svg:not(.chev) { display: none; } .chip:not(.chip-btn) { padding-left: 12px; } }

/* Treffer-Leiste: Symbol als Maske vor dem Text (der Text wird per JS gesetzt) */
.toolbar .chip-btn::before { content: ""; flex: none; width: 16px; height: 16px; background: var(--accent);
  -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat; }
.toolbar .chip-btn:disabled::before { background: var(--muted); }
.t-select { --icon: var(--i-select); }
.t-all { --icon: var(--i-all); }
.t-download { --icon: var(--i-download); }
.t-feed { --icon: var(--i-feed); }
.t-gallery { --icon: var(--i-gallery); }
.chip-btn.primary { background: var(--accent); border-color: transparent; color: var(--ink); box-shadow: var(--lift); }
.chip-btn.primary::before { background: var(--ink); }
.chip-btn.primary:disabled { background: var(--tint-strong); color: var(--accent); box-shadow: none; }
.chip-btn.primary:disabled::before { background: var(--accent); }
.select-mode .t-select { background: var(--tint-strong); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
/* „Alle auswählen“ nur beim Auswählen; dann kein zweiter pinker Knopf (gespeichert wird über die Leiste unten),
   und Feed/Galerie erst nach „Fertig“ */
body:not(.select-mode) #selectAllBtn, body.select-mode #downloadAllBtn, body.select-mode #feedBtn, body.select-mode #galleryBtn { display: none; }
/* 600–899 px (Tablet, Handy quer): die Leiste bricht um, statt seitlich abzuschneiden */
@media (min-width: 600px) { body:not(.feed-mode):not(.gallery-mode) #toolbar { flex-wrap: wrap; overflow: visible; margin: 8px 0 4px; padding: 0; } }
.controls.suggest .chip-btn { padding: 0 14px; }
/* Am Handy nichts seitlich abschneiden: Filter und Vorschläge brechen um (Martin 26.10.) */
#filters, .controls.suggest { flex-wrap: wrap; overflow: visible; margin: 8px 0 2px; padding: 0; gap: 8px; }
#filters { gap: 10px 6px; }   /* so passen die drei Filter auf Deutsch bei 360 px in eine Zeile */
.controls.suggest { row-gap: 10px; }   /* Abstand ≥ 10 px: die 46-px-Tippflächen zweier Zeilen überlappen sich nicht */
.controls.suggest { margin: 8px 0 4px; }
@media (max-width: 599px) {
  /* Treffer-Leiste als 2 × 2-Raster: Auswählen + Alle speichern / Feed + Galerie. „Alle auswählen“ nur beim Auswählen,
     Feed und Galerie dann nicht (dort gibt es keine Auswahl-Leiste). */
  body:not(.feed-mode):not(.gallery-mode) #toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
    margin: 10px 0 6px; padding: 0; overflow: visible; }
  body:not(.feed-mode):not(.gallery-mode) #toolbar .chip-btn { width: 100%; min-width: 0; height: auto; min-height: 36px; padding-block: 4px;
    justify-content: center; white-space: normal; text-align: center; line-height: 1.15; }
  /* Kacheln: Titel bekommt die ganze Breite; Speichern gibt es im Vollbild, in den Details, im Feed und in der Galerie */
  body:not(.feed-mode):not(.gallery-mode) .card-dl { display: none; }
  body:not(.feed-mode):not(.gallery-mode) .card-info { padding-right: 12px; }
}

/* ---------- Leere Seite / Begrüßung ---------- */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  color: var(--muted); padding: 0 12px 7vh; }
.empty.start { padding: 34px 12px 10px; }
.mark { width: 64px; height: 64px; border-radius: 22px; display: grid; place-items: center;
  background: var(--accent); color: var(--ink); box-shadow: var(--lift); }
.mark svg { width: 30px; height: 30px; stroke: none; }
.empty .big { font: italic 400 50px/1.05 var(--serif); color: var(--text); letter-spacing: -.01em; margin: 22px 0 14px; text-wrap: balance; }
.empty .big em { font-style: inherit; color: var(--accent); }
.empty p { margin: 0 0 8px; max-width: 34ch; text-wrap: balance; }
.offline-only, body.is-offline #startText { display: none; }
body.is-offline .offline-only { display: block; }
body.is-offline .empty .mark { background: var(--bg-3); color: var(--muted); box-shadow: none; }
@media (prefers-reduced-motion: no-preference) {
  .mark { animation: rise .6s cubic-bezier(.2, .9, .3, 1.2) both; }
  .mark svg { animation: beat 1.2s ease-in-out .7s 2; }
}
@keyframes rise { from { transform: translateY(10px) scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes beat { 0%, 100% { transform: scale(.85); } 15% { transform: scale(1.1); } 30% { transform: scale(.92); } 45% { transform: scale(1.04); } }

/* ---------- Stand der Suche: Balken mit Text und Prozent (/design „Fortschritt langer Arbeit“) ---------- */
.statusbox { margin: 8px 0 2px; }
.fs-bahn { position: relative; height: 10px; border-radius: 999px; background: var(--tint); overflow: hidden; }
.fs-balken { height: 100%; width: 0; border-radius: 999px; background: var(--accent); transition: width .6s ease; }
.fs-bahn:not(.show) .fs-balken { background: var(--ok); }
.fs-bahn.searching .fs-balken { width: 30% !important; animation: tk-flow 1.6s cubic-bezier(.45, 0, .55, 1) infinite; }
@keyframes tk-flow { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
.fs-text { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-top: 6px; font-size: 13px; color: var(--muted); }
.fs-text span { min-width: 0; text-wrap: pretty; font-weight: 700; font-variant-numeric: tabular-nums; }
.fs-text b { flex: none; white-space: nowrap; color: var(--text); font-variant-numeric: tabular-nums; }
.process { margin: 2px 0 2px; }
.process > summary { display: flex; align-items: center; gap: 6px; min-height: 44px; width: max-content; max-width: 100%;
  font-size: 13px; font-weight: 800; color: var(--accent); list-style: none; cursor: pointer; border-radius: 12px; }
.process > summary::-webkit-details-marker { display: none; }
.process > summary::before { order: 3; width: 11px; height: 11px; opacity: 0; }
.process:has(#processStatus[data-state="working"]) > summary::before { opacity: 1; animation: beat 1s ease-in-out infinite; }
.process > summary .chev { width: 16px; height: 16px; stroke-width: 2.4; transition: transform .18s ease; }
.process[open] > summary .chev { transform: rotate(90deg); }
.process-status { margin: 0 0 10px; padding: 0; list-style: none; font-size: 13px; line-height: 1.5; color: var(--muted); overflow-wrap: anywhere; }
.process-status li { position: relative; padding-left: 16px; text-wrap: pretty; }
.process-status li + li { margin-top: 4px; }
.process-status li::before { position: absolute; left: 1px; top: .5em; width: 8px; height: 8px; }
.process-status:empty { display: none; }

/* ---------- Treffer ---------- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 4px; }
@media (min-width: 600px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; } }
.card { position: relative; min-width: 0; overflow: hidden; border-radius: var(--r-card); background: var(--bg-2); border: 1px solid var(--line); }
.card :focus-visible { outline-offset: -3px; }
body:not(.feed-mode):not(.gallery-mode) .grid > .card { content-visibility: auto; contain-intrinsic-size: auto 260px; }
.card.selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.gallery-index { display: none; }
.photo { position: relative; display: flex; align-items: center; justify-content: center; aspect-ratio: 1 / 1; overflow: hidden;
  background: var(--bg-3); text-decoration: none; }
.photo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.badge, .fullres-badge, .ai-tag { position: absolute; padding: 0 8px; border-radius: 999px; font-size: 11.5px; line-height: 1.7; font-weight: 800;
  font-variant-numeric: tabular-nums; white-space: nowrap; pointer-events: none; }
.badge { left: 7px; bottom: 7px; background: color-mix(in srgb, var(--bg) 82%, transparent); color: var(--text); }
.fullres-badge { left: 7px; top: 7px; display: none; background: var(--accent); color: var(--ink); }
.card.fullres .fullres-badge { display: block; }
.ai-tag { right: 7px; bottom: 7px; display: none; background: color-mix(in srgb, var(--bg) 82%, transparent); color: var(--accent); }
.card.ai-busy .ai-tag { display: block; }
.pick { position: absolute; right: 4px; top: 4px; z-index: 4; display: none; width: 44px; height: 44px; padding: 0; border: 0;
  background: none; place-items: center; color: transparent; }
.pick::before { content: ""; position: absolute; inset: 8px; border-radius: 50%; border: 2px solid #fff; background: rgba(0, 0, 0, .32); }
.pick svg { position: relative; width: 16px; height: 16px; stroke-width: 2.8; }
.select-mode .pick { display: grid; }
.card.selected .pick { color: var(--ink); }
.card.selected .pick::before { border-color: var(--accent); background: var(--accent); }
.card-info { display: flex; align-items: center; gap: 2px; padding: 2px 2px 2px 12px; }
.card-open { flex: 1; min-width: 0; min-height: 52px; display: flex; flex-direction: column; justify-content: center; gap: 1px;
  padding: 7px 0; border: 0; background: none; text-align: left; color: var(--text); border-radius: 10px; }
.card-open:active { background: var(--tint); }
.card .title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
  font-size: 13.5px; line-height: 1.35; font-weight: 700; }
.card .host { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; line-height: 1.4; font-weight: 600; color: var(--muted); }
.card-dl { color: var(--accent); }
.card-dl svg { width: 20px; height: 20px; stroke-width: 2; }
.end-marker { display: none; align-items: center; gap: 14px; margin: 34px 0 6px; color: var(--muted); font-size: 13px; font-weight: 800; text-align: center; }
.end-marker.show { display: flex; }
.end-marker::before, .end-marker::after { content: ""; flex: 1; min-width: 24px; height: 1px; background: var(--line); }
.continue-row { display: flex; justify-content: center; margin: 22px 0 4px; }
.continue-row:has(#continueBtn[hidden]) { display: none; }

/* ---------- Knöpfe ---------- */
.btn-primary { display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: none;
  background: var(--accent); color: var(--ink); border: 0; border-radius: 999px; padding: 0 20px; min-height: 44px;
  font-weight: 800; font-size: 14.5px; box-shadow: var(--lift); text-decoration: none; }
.btn-primary:active { transform: scale(.97); }
.btn-primary:disabled { background: var(--tint-strong); color: var(--accent); box-shadow: none; cursor: default; }
.link-btn { display: inline-flex; align-items: center; background: none; border: 0; color: var(--accent); font-size: 14px; font-weight: 800;
  padding: 8px 4px; min-height: 44px; text-decoration: none; border-radius: 10px; }
.link-btn:active { background: var(--tint); }
.link-btn:disabled { color: var(--muted); cursor: default; }
.retry-hq { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--text); font-size: 13.5px; font-weight: 800; text-align: center; }
.retry-hq:active { background: var(--tint); }
.retry-hq:disabled { color: var(--muted); background: var(--bg-3); cursor: default; }
.retry-hq[aria-busy="true"] { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }

/* ---------- Detail-Fenster eines Treffers ----------
   Oben das Bild (Antippen = Vollbild), Titel, eine Zeile Seite · Größe · HQ. Dann EIN Hauptknopf, drei Kacheln
   und eine Listen-Karte (/design) mit dem Stand von Originalsuche und KI. Lange Erklärungen nur, wenn es eine gibt. */
.detail-photo { position: relative; display: grid; place-items: center; width: 100%; padding: 0; border: 0; overflow: hidden;
  border-radius: var(--r-card); background: var(--bg-3); color: inherit; cursor: zoom-in; }
.detail-photo img { display: block; max-width: 100%; max-height: min(46dvh, 560px); object-fit: contain; }
.detail-photo::before { content: ""; position: absolute; right: 10px; bottom: 10px; width: 34px; height: 34px; border-radius: 50%;
  background: rgba(0, 0, 0, .52); }
.detail-photo::after { content: ""; position: absolute; right: 18px; bottom: 18px; width: 18px; height: 18px; background: #fff;
  -webkit-mask: var(--i-expand) center / contain no-repeat; mask: var(--i-expand) center / contain no-repeat; }
.detail-meta { margin: 14px 0 0; }
.detail-title { margin: 0; font-size: 16px; line-height: 1.35; font-weight: 800; overflow-wrap: anywhere; text-wrap: pretty; }
.detail-sub { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 6px; margin: 5px 0 0; }
.detail-host { min-width: 0; max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; margin-right: 2px;
  font-size: 13px; line-height: 1.5; font-weight: 700; color: var(--muted); }
.detail-save { display: flex; width: 100%; margin: 16px 0 0; }
.detail-save::before { content: ""; flex: none; width: 18px; height: 18px; background: currentColor;
  -webkit-mask: var(--i-download) center / contain no-repeat; mask: var(--i-download) center / contain no-repeat; }
.detail-save[aria-busy="true"]::before { -webkit-mask-image: var(--heart); mask-image: var(--heart); animation: beat 1s ease-in-out infinite; }
[aria-busy="true"]:is(.detail-save, .card-dl, #viewerSave, #catDownload) { pointer-events: none; }
.card-dl[aria-busy="true"], #viewerSave[aria-busy="true"], #catDownload[aria-busy="true"] { opacity: .6; }
/* Links als Listen-Karte: Symbol, Name, kleiner Pfeil nach außen – jede Zeile eine Zeile, auch auf Spanisch */
.link-row { display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 0;
  color: var(--text); text-decoration: none; font-size: 14.5px; line-height: 1.3; font-weight: 800; }
.links > .link-row:not([hidden]) ~ .link-row { border-top: 1px solid var(--line); }
.link-row::before { content: ""; flex: none; width: 20px; height: 20px; background: var(--accent);
  -webkit-mask: var(--i-web) center / contain no-repeat; mask: var(--i-web) center / contain no-repeat; }
.link-row.l-similar::before { -webkit-mask-image: var(--i-similar); mask-image: var(--i-similar); }
.link-row.l-tab::before { -webkit-mask-image: var(--i-image); mask-image: var(--i-image); }
.link-row::after { content: ""; flex: none; width: 16px; height: 16px; margin-left: auto; background: var(--muted);
  -webkit-mask: var(--i-out) center / contain no-repeat; mask: var(--i-out) center / contain no-repeat; }
.link-row:active { color: var(--accent); }
.link-row:focus-visible { outline-offset: 2px; border-radius: 10px; }
.detail-title { hyphens: auto; }
.facts { margin: 10px 0 0; padding: 0 14px; border-radius: var(--r-card); background: var(--bg-2); border: 1px solid var(--line); }
.facts .row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; column-gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line); }
.facts .row:last-child { border-bottom: 0; }
.facts .row > :not(.row-name):not(.row-val) { grid-column: 1 / -1; }
.row-name { min-width: 0; font-size: 14px; line-height: 1.4; font-weight: 800; color: var(--text); }
.row-val { grid-column: 2; font-size: 13px; line-height: 1.4; font-weight: 700; color: var(--muted); text-align: right;
  font-variant-numeric: tabular-nums; }
.facts .hint { margin: 4px 0 0; font-size: 12.5px; line-height: 1.45; }
.facts .note { margin: 6px 0 0; font-size: 13px; }
/* Knöpfe in der Liste: volle Breite (zwei Stufen teilen sie sich), zart gefüllt statt Rahmen im Rahmen */
.facts .retry-hq { width: 100%; margin-top: 10px; border: 0; border-radius: 999px; background: var(--tint); color: var(--hi); }
.facts .retry-hq:active { background: var(--tint-strong); }
.facts .retry-hq:disabled { background: var(--bg-3); color: var(--muted); }
.edit-actions { display: flex; gap: 8px; margin: 10px 0 0; }
.edit-actions > .retry-hq { flex: 1 1 0; min-width: 0; margin: 0; }
.edit-actions:not(:has(> :not([hidden]))) { display: none; }
.model-note { overflow-wrap: anywhere; }
.tag { display: inline-block; padding: 0 9px; border-radius: 999px; font-size: 11.5px; line-height: 1.7; font-weight: 800;
  color: var(--muted); background: var(--bg-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tag:empty { display: none; }
.tag.info { color: var(--hi); background: var(--tint); }

/* ---------- Zufallskatze ---------- */
.kitty { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); }
.kitty-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; }
.kitty-text { min-width: 0; }
.kitty-title { font: italic 400 32px/1.1 var(--serif); color: var(--text); letter-spacing: -.01em; padding-right: .18em; }
.kitty .hint { margin: 4px 0 0; }
#catStage { display: none; margin-top: 16px; }
.cat-card { overflow: hidden; border-radius: var(--r-card); background: var(--bg-2); border: 1px solid var(--line); }
#catImage { display: block; width: 100%; max-height: min(72vh, 680px); object-fit: contain; background: var(--bg-3); }
.cat-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 8px 0 14px;
  color: var(--muted); font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.foot { margin: 34px 0 6px; text-align: center; color: var(--muted); font-size: 12px; font-weight: 700; }

/* ---------- Auswahl-Leiste unten ---------- */
#selectionBar { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 12px); z-index: 30; display: none; align-items: center; gap: 4px;
  width: min(560px, calc(100% - 2 * var(--gut))); padding: 5px 6px 5px 18px; border-radius: 999px; transform: translateX(-50%);
  background: var(--bg-2); border: 1px solid var(--line); box-shadow: var(--shadow), 0 20px 40px -20px var(--shade); }
#selectionBar.show { display: flex; }
#selectionText { flex: 1 1 auto; min-width: 0; line-height: 1.2;
  font-size: 13.5px; font-weight: 800; font-variant-numeric: tabular-nums; }
#selectionBar .btn-primary { padding: 0 16px; font-size: 13.5px; }
#selectionBar .link-btn { padding: 8px 12px; }
body:has(#selectionBar.show) #content { padding-bottom: 96px; }
#selectionBar .icon-btn { flex: none; color: var(--muted); }
@media (min-width: 900px) { #selectionBar { left: calc(50% + 150px); width: min(560px, calc(100% - 300px - 2 * var(--gut))); } }

/* ---------- Seitenleiste (Handy: Schublade, ab 900 px fest) ---------- */
#drawer { position: fixed; inset: 0 auto 0 0; width: min(86vw, 340px); z-index: 50; display: flex; flex-direction: column;
  background: var(--bg-2); border-right: 1px solid var(--line); padding-top: env(safe-area-inset-top);
  transform: translateX(-102%); visibility: hidden;
  transition: transform .22s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .22s; }
#drawer.open { transform: none; box-shadow: 16px 0 40px -10px var(--shade); visibility: visible;
  transition: transform .22s cubic-bezier(.2, .8, .2, 1), visibility 0s linear 0s; }
#scrim { position: fixed; inset: 0; background: var(--shade); z-index: 40; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 8px 10px 26px; transition: box-shadow .16s ease; }
#drawer.scrolled .drawer-head { box-shadow: 0 1px 0 var(--line); }
.brand { display: inline-flex; align-items: flex-start; gap: 3px; font: italic 400 32px/1 var(--serif); letter-spacing: -.01em; padding-right: .1em; }
.brand::after { width: 11px; height: 11px; margin-top: 2px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 0 0 calc(env(safe-area-inset-bottom) + 20px); overscroll-behavior: contain; }
.section-head { display: flex; align-items: center; min-height: 36px; padding: 10px 14px 0 26px; font-size: 12.5px; font-weight: 800; color: var(--muted); }
.drawer-section { padding: 4px 14px 8px; }
.drawer-section > .field-label { display: block; margin: 16px 12px 8px; }
.drawer-section > .field-label:first-child { margin-top: 6px; }
.drawer-section .field-label { color: var(--text); font-weight: 700; }
.drawer-section > .hint { margin: 4px 12px 8px; }
.drawer-section > .field { margin: 12px 0 4px; }
.drawer-section > .field > .field-label, .drawer-section > .field > .field-hint { padding: 0 12px; }
.drawer-section > .link-btn { margin-left: 8px; }
@media (min-width: 900px) {
  #drawer { position: sticky; top: 0; height: 100dvh; transform: none; width: 300px; flex: none; visibility: visible; transition: none; }
  #scrim, #menuBtn, #drawerClose { display: none; }
  .topbar { padding-left: 14px; }
}

/* Felder */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field-hint { font-size: 12px; line-height: 1.45; color: var(--muted); margin: 0; }
.input { width: 100%; min-height: 44px; padding: 10px 14px; border-radius: 16px; outline: none; font-size: 15px;
  border: 1px solid var(--line); background: var(--bg-2); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--tint); }
select.input { appearance: none; -webkit-appearance: none; padding-right: 42px; cursor: pointer; font-weight: 700;
  background: var(--bg-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a8949f' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E") right 14px center / 18px no-repeat; }
:root[data-mode="light"] select.input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2378636e' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E"); }
select.input option { background: var(--bg-2); color: var(--text); }
select.input:disabled { color: var(--muted); background-color: var(--bg-3); cursor: default; }

/* Schalter (echte Checkbox unsichtbar, damit die Logik von 8.4 gleich bleibt), Segmente, Farbpunkte */
.switch { position: relative; flex: none; width: 46px; height: 28px; border-radius: 999px; background: var(--tl-line); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .16s ease; }
.switch-input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.switch-input:checked + .switch { background: var(--accent); }
.switch-input:checked + .switch::after { transform: translateX(18px); }
.switch-input:focus-visible + .switch { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-input:disabled + .switch { opacity: .45; }
.opt-row { position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-rows: minmax(28px, auto);
  column-gap: 12px; align-items: center; width: 100%; text-align: left; padding: 18px 14px 14px 12px; cursor: pointer;
  border-radius: var(--r-card); background: var(--bg); border: 1px solid var(--line); color: var(--text); }
.opt-row .tile { grid-column: 1; grid-row: 1; width: 40px; height: 40px; margin: -6px 0; border-radius: 12px;
  display: grid; place-items: center; background: var(--tint-strong); color: var(--accent); }
.opt-row .tile svg { width: 20px; height: 20px; }
.opt-row .name { grid-column: 2; grid-row: 1; font-size: 15px; line-height: 1.3; font-weight: 800; overflow-wrap: anywhere; hyphens: auto; }
.opt-row .switch { grid-column: 3; grid-row: 1; }
.opt-row .desc { grid-column: 2 / -1; display: block; margin-top: 4px; font-size: 13px; line-height: 1.45; color: var(--muted); }
.opt-row:has(.switch-input:disabled) { cursor: default; }
.opt-row:has(.switch-input:disabled) .tile { opacity: .45; }
.opt-row:has(.switch-input:disabled) .name { color: var(--muted); }
.seg { display: flex; gap: 2px; margin-bottom: 8px; padding: 4px; border-radius: 999px; background: var(--bg-3); }
.seg button { position: relative; flex: 1 1 auto; border: 0; background: none; border-radius: 999px; min-height: 36px;
  padding: 0 6px; font-size: 13px; font-weight: 800; color: var(--muted); }
.seg button::after { content: ""; position: absolute; inset: -4px 0; }   /* 44 px */
.seg button[aria-checked="true"] { background: var(--bg-2); color: var(--accent); box-shadow: var(--shadow); }
/* 7 Farbpunkte zu je 44 px passen nicht in die 300 px breite Leiste: zwei Reihen (4 + 3) */
.swatches { display: grid; grid-template-columns: repeat(4, 44px); justify-content: space-between; gap: 12px 14px; margin: 0 12px 4px; }
.swatch { width: 44px; height: 44px; border-radius: 50%; padding: 0; border: 3px solid var(--bg-2);
  box-shadow: 0 0 0 1px var(--line); background: var(--acc-d); }
[data-mode="light"] .swatch { background: var(--acc-l); }
.swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--text); }

/* ---------- Fenster von unten (Sheet) und Meldung (Toast) ---------- */
.sheet { position: fixed; inset: 0; z-index: 70; background: var(--shade); display: flex; align-items: flex-end; justify-content: center; }
.sheet-panel { position: relative; width: 100%; max-width: 720px; max-height: 92dvh; display: flex; flex-direction: column;
  background: var(--bg); border-radius: 28px 28px 0 0; overflow: hidden; box-shadow: 0 -12px 40px -10px var(--shade); outline: none; }
.sheet-panel::before { content: ""; position: absolute; left: 50%; top: 7px; width: 38px; height: 4px; margin-left: -19px; border-radius: 4px; background: var(--line); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 18px 8px 4px 20px;
  transition: box-shadow .16s ease; }
.sheet.scrolled .sheet-head { box-shadow: 0 1px 0 var(--line); }
.sheet-title { font: italic 400 28px/1.2 var(--serif); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: .18em; }
.sheet-body { overflow-y: auto; padding: 8px 20px calc(env(safe-area-inset-bottom) + 20px); overscroll-behavior: contain; }
.toast { position: fixed; left: 16px; right: 16px; top: calc(env(safe-area-inset-top) + 66px); width: max-content; margin-inline: auto;
  max-width: calc(100vw - 32px); z-index: 90; pointer-events: none; display: flex; align-items: center; gap: 8px;
  padding: 10px 18px 10px 14px; border-radius: 18px; font-size: 14px; font-weight: 700;
  color: var(--bg-2); background: var(--text); box-shadow: 0 14px 34px -10px var(--shade); }
.toast::before { width: 14px; height: 14px; }

/* ---------- Vollbild (Antippen eines Bildes): schwarz, Bild so groß wie möglich, Doppeltipp zoomt ---------- */
.viewer { position: fixed; inset: 0; z-index: 80; background: #000; }
.viewer-stage { position: absolute; inset: 0; display: grid; place-items: center; overflow: auto; overscroll-behavior: contain; cursor: zoom-in; }
.viewer-stage img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer.gross .viewer-stage { display: block; cursor: zoom-out; }
.viewer.gross .viewer-stage img { max-width: none; max-height: none; height: auto; }
.viewer-bar { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 6px; pointer-events: none;
  padding: calc(env(safe-area-inset-top) + 8px) 8px 18px; background: linear-gradient(rgba(0, 0, 0, .6), transparent); }
.viewer-bar > * { pointer-events: auto; }
.viewer-btn { color: #fff; background: rgba(0, 0, 0, .38); border-radius: 50%; }
.viewer-btn:active { background: rgba(255, 255, 255, .18); }
.viewer-title { flex: 1; min-width: 0; text-align: center; color: rgba(255, 255, 255, .86); font-size: 13px; font-weight: 800;
  font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Feed und Galerie: Maße wie in 8.4 (die Scroll-Logik hängt daran) ---------- */
body.feed-mode, body.gallery-mode { background: #000; }
body.feed-mode #drawer, body.gallery-mode #drawer, body.feed-mode .topbar, body.gallery-mode .topbar,
body.feed-mode .search-area, body.gallery-mode .search-area, body.feed-mode #message, body.gallery-mode #message,
body.feed-mode .statusbox, body.gallery-mode .statusbox, body.feed-mode .process, body.gallery-mode .process,
body.feed-mode #chips, body.gallery-mode #chips, body.feed-mode #toolbarStatus, body.gallery-mode #toolbarStatus,
body.feed-mode .kitty, body.gallery-mode .kitty, body.feed-mode .foot, body.gallery-mode .foot,
body.feed-mode .continue-row, body.gallery-mode .continue-row, body.feed-mode #selectionBar, body.gallery-mode #selectionBar { display: none !important; }
body.feed-mode #content, body.gallery-mode #content { max-width: none; padding: 0; }
body.feed-mode .toolbar, body.gallery-mode .toolbar { position: fixed; top: max(10px, env(safe-area-inset-top)); right: 10px; z-index: 65;
  margin: 0; padding: 0; overflow: visible; display: flex; gap: 6px; }
body.feed-mode .toolbar > :not(#feedBtn):not(#galleryBtn), body.gallery-mode .toolbar > :not(#feedBtn):not(#galleryBtn) { display: none; }
body.feed-mode .toolbar .chip-btn, body.gallery-mode .toolbar .chip-btn { background: color-mix(in srgb, var(--bg-2) 88%, transparent); box-shadow: var(--shadow); }
body.gallery-mode .end-marker { display: none !important; }
body.feed-mode .end-marker.show { min-height: 30dvh; margin: 0; padding: 28px 18px; justify-content: center; background: var(--bg); scroll-snap-align: start; }
body.feed-mode .end-marker::before, body.feed-mode .end-marker::after { max-width: 120px; }

body.feed-mode { scroll-snap-type: y mandatory; }
body.feed-mode .grid { display: block; width: 100%; margin: 0; }
body.feed-mode .grid > .card { content-visibility: auto; contain-intrinsic-size: auto 100dvh; }
body.feed-mode .card { min-height: 100dvh; margin: 0; padding: 0; border: 0; border-radius: 0; background: #000; scroll-snap-align: start; scroll-snap-stop: always; }
body.feed-mode .photo { aspect-ratio: auto; min-height: 76dvh; background: #000; }
body.feed-mode .photo img { width: 100%; height: 76dvh; object-fit: contain; object-position: 50% 50%; }
body.feed-mode .card-info { min-height: 24dvh; align-items: flex-start; padding: 10px 6px 28px var(--gut); background: var(--bg); }

body.gallery-mode { overflow: hidden; }
body.gallery-mode .grid { position: fixed; inset: 0; z-index: 60; display: flex; gap: 0; width: 100vw; height: 100dvh; margin: 0; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; scroll-behavior: smooth; scrollbar-width: none; overscroll-behavior-x: contain; touch-action: pan-x pinch-zoom; background: #000; }
body.gallery-mode .grid::-webkit-scrollbar { display: none; }
body.gallery-mode .card { flex: 0 0 100vw; width: 100vw; height: 100dvh; min-height: 100dvh; margin: 0; padding: 10px 14px max(14px, env(safe-area-inset-bottom));
  border: 0; border-radius: 0; background: #000; scroll-snap-align: start; scroll-snap-stop: always; overflow: hidden;
  display: grid; grid-template-rows: 44px minmax(0, 1fr) auto; gap: 10px; }
body.gallery-mode .gallery-index { display: flex; align-items: center; width: min(1120px, 100%); margin: 0 auto; padding: 0 240px 0 2px;
  color: rgba(255, 255, 255, .78); font-size: 12.5px; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
body.gallery-mode .photo { aspect-ratio: auto; width: min(1120px, 100%); height: 100%; min-height: 0; margin: 0 auto; border-radius: 12px; background: #0b0a0b; }
body.gallery-mode .photo img { width: 100%; height: 100%; object-fit: contain; object-position: 50% 50%; }
body.gallery-mode .card-info { width: min(1120px, 100%); max-height: 25dvh; margin: 0 auto; padding: 2px 2px 2px 14px; border-radius: var(--r-card);
  background: #1d1619; color: #f7eef2; overflow: auto; }
body.gallery-mode .card-info .title { color: #f7eef2; }
body.gallery-mode .card-info .host { color: #c4b2bb; }
body.gallery-mode .card-info .card-dl { color: #fff; }
body.gallery-mode .card .title, body.feed-mode .card .title { font-size: 16px; -webkit-line-clamp: 3; }
body.gallery-mode .card .host, body.feed-mode .card .host { font-size: 12.5px; }
body.gallery-mode .badge, body.feed-mode .badge { left: 12px; bottom: 12px; }
body.gallery-mode .fullres-badge, body.feed-mode .fullres-badge { top: 12px; left: 12px; }
@media (max-width: 620px) {
  body.gallery-mode .card { padding: 8px; grid-template-rows: 40px minmax(0, 1fr) auto; gap: 8px; }
  body.gallery-mode .gallery-index { padding: 0 250px 0 4px; }
  body.gallery-mode .toolbar { top: 6px; right: 6px; }
  body.gallery-mode .card-info { max-height: 32dvh; }
}
/* Unter 360 px passt der Zähler nicht neben die Knöpfe: dann wieder darunter */
@media (max-width: 359px) {
  body.gallery-mode .card { grid-template-rows: 64px minmax(0, 1fr) auto; }
  body.gallery-mode .gallery-index { align-items: flex-end; padding: 0 4px; }
}
/* Sehr schmal (z. B. 320 px mit großer Schrift): „Speichern“ in der Auswahl-Leiste nur als Symbol, die Anzahl bleibt lesbar */
@media (max-width: 300px) {
  #selectionBar #downloadSelectedBtn { width: 44px; padding: 0; font-size: 0; }
  #selectionBar #downloadSelectedBtn::before { content: ""; flex: none; width: 18px; height: 18px; background: currentColor;
    -webkit-mask: var(--i-download) center / contain no-repeat; mask: var(--i-download) center / contain no-repeat; }
}

/* ---------- Bewegung (zentral) ---------- */
.shimmer { background: linear-gradient(90deg, var(--muted) 20%, var(--accent) 50%, var(--muted) 80%); background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 1.8s linear infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -120% 0; } }
.pulse { width: 11px; height: 11px; animation: beat 1s ease-in-out infinite; }
@media (prefers-reduced-motion: no-preference) {
  .sheet:not([hidden]), #scrim:not([hidden]) { animation: fade-in .2s ease-out; }
  .sheet:not([hidden]) .sheet-panel { animation: sheet-up .32s cubic-bezier(.2, .85, .25, 1); }
  .viewer:not([hidden]) { animation: fade-in .18s ease-out; }
  .toast:not([hidden]) { animation: toast-in .24s cubic-bezier(.2, .8, .3, 1); }
  .banner:not([hidden]) { animation: fade-in .3s ease-out; }
  .card.ai-busy .ai-tag { animation: tag-glow 1.4s ease-in-out infinite; }
}
@keyframes fade-in { from { opacity: 0; } }
@keyframes sheet-up { from { transform: translateY(48px); opacity: 0; } }
@keyframes toast-in { from { transform: translateY(-8px); opacity: 0; } }
@keyframes tag-glow { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) {
  *, body.gallery-mode .grid { scroll-behavior: auto !important; }
  .shimmer, .pulse, .mark, .mark svg, .fs-bahn.searching .fs-balken, .process > summary::before { animation: none !important; }
  #drawer, .switch::after, .process > summary .chev, .fs-balken { transition: none; }
}
