/* FRAME-App: mobil zuerst, Design „Galeriewand“ – helle, kühle Wand (dunkel nach Handy-Einstellung), Fotos wie Abzüge
   im Passepartout, Rahmen mit dunkler Kante. Aktionen in Tinte (hell: schwarz, dunkel: weiß); Terrakotta nur im Logo.
   Bausteine: Seitenkopf, Gruppen mit Zeilen (wie Einstellungen am Handy), Chips, Blätter von unten, eine Knopf-Rangfolge. */
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("fonts/bricolage.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}
:root {
  --bg: #eceeea;            /* Wand */
  --card: #ffffff;          /* Flächen */
  --paper: #ffffff;         /* Passepartout der Abzüge */
  --raised: #e4e8e3;
  --raised-2: #d6ddd6;
  --ink: #17201c;
  --muted: #59645f;
  --muted-2: #616b66;
  --line: #dde2dd;
  --track: #c9d0ca;
  --accent: #17201c;        /* Aktionen: Tinte */
  --accent-ink: #ffffff;    /* Schrift auf Aktionen */
  --accent-soft: #e1e6e1;
  --brand: #d99a7c;         /* nur der Punkt im Logo */
  --bezel: #23251f;         /* Rahmenkante */
  --danger: #b3362f;
  --ok: #1e8a50;
  --warn: #8a5a0b;
  --bad: #b3362f;
  --heart: #d93a3f;
  --shadow-print: 0 1px 2px rgba(23, 32, 28, .10), 0 10px 24px rgba(23, 32, 28, .07);
  --radius: 16px;
  --tabs-h: 64px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);       /* kräftiges Abbremsen: Rückmeldung, Ein- und Ausblenden */
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);   /* Blätter von unten, wie am iPhone */
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111312;
    --card: #1b1e1c;
    --paper: #252826;
    --raised: #252826;
    --raised-2: #2e322f;
    --ink: #eef1ed;
    --muted: #a3aca7;
    --muted-2: #8e9893;
    --line: #2a2e2b;
    --track: #3a403c;
    --accent: #eef1ed;
    --accent-ink: #111312;
    --accent-soft: #252826;
    --bezel: #050606;
    --danger: #f08a7a;
    --ok: #4cc38a;
    --warn: #e7b65c;
    --bad: #f08a7a;
    --heart: #f0626a;
    --shadow-print: 0 1px 2px rgba(0, 0, 0, .5), 0 10px 24px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; overflow-x: hidden; }   /* kein grauer Tipp-Blitz, nicht seitlich verschiebbar */
/* Bedienelemente: Tippen ohne Verzögerung, langes Drücken markiert keinen Text (Inhalte bleiben markierbar) */
button, a, summary, [role="button"], label.switch-row, input[role="switch"] {
  touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom, 0px) + 24px);
}
body.no-tabs { padding-bottom: 24px; }
h1 { font-size: 2.15rem; line-height: 1.04; margin: 0; font-weight: 700; letter-spacing: -.035em; }
h2 { font-size: 1.12rem; margin: 0 0 .4rem; font-weight: 600; letter-spacing: -.015em; }
p { margin: .4rem 0; }
code { font-size: .85em; background: var(--accent-soft); padding: .1em .35em; border-radius: 6px; word-break: break-all; }
svg { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
img { max-width: 100%; }
.muted { color: var(--muted); }
strong, b { font-weight: 600; }
.small { font-size: .875rem; }
.center { text-align: center; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }

/* ---------- Kopfzeile ---------- */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: calc(56px + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 16px 0 20px;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
body.no-tabs .top { display: none; }
.brand { display: flex; align-items: center; gap: 10px; }
.logo { position: relative; flex: 0 0 auto; width: 30px; height: 30px; box-sizing: border-box; border-radius: 8px;
  background: #17201c; box-shadow: inset 0 0 0 1px var(--line); display: flex; align-items: center; justify-content: center; }
.logo b { display: flex; align-items: baseline; gap: 1.5px; transform: translate(1px, .5px); color: #f1f3ef;
  font-size: 20px; font-weight: 700; line-height: 1; letter-spacing: -.04em; }
.logo b::after { content: ""; width: 3.5px; height: 3.5px; border-radius: 50%; background: var(--brand); }
.wordmark { font-size: 21px; font-weight: 700; letter-spacing: -.03em; }
.avatar-btn {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; text-decoration: none;
  background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: .95rem;
}
.wrap { max-width: 640px; margin: 0 auto; padding: 20px 16px 16px; }

/* ---------- Seitenkopf, Beschriftungen ---------- */
.page-title, .page-head { margin: 0 4px 18px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.page-lead { margin: -8px 4px 16px; color: var(--muted); font-size: .95rem; }
.label {
  margin: 22px 4px 8px; font-size: .88rem; font-weight: 600; color: var(--muted);
}
.block > .label:first-child, .label-row .label { margin-top: 0; }
.label-row { display: flex; align-items: center; gap: 10px; margin: 0 4px 8px; }
.label-row .label { margin: 0; }
.label-row .btn { margin-left: auto; }
.block { margin-bottom: 20px; }
.subhead { display: grid; grid-template-columns: minmax(88px, 1fr) minmax(0, max-content) minmax(88px, 1fr); align-items: center; margin: -6px -4px 18px; min-height: 44px; }
.subhead h1 { font-size: 1.05rem; text-align: center; letter-spacing: 0; grid-column: 2;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }   /* langer Rahmenname: gekürzt, ganz im title */
.back {
  grid-column: 1; justify-self: start; display: inline-flex; align-items: center; gap: 2px;
  color: var(--accent); text-decoration: none; font-weight: 500; padding: 8px 4px; min-height: 44px;
}
.back svg { width: 22px; height: 22px; }
.subhead .icon-btn { grid-column: 3; justify-self: end; width: 38px; height: 38px; }
.hint { font-size: .85rem; color: var(--muted-2); margin: 8px 4px 0; line-height: 1.5; }
.tip { font-size: .85rem; color: var(--muted-2); margin: 14px 4px 0; line-height: 1.5; }
.tip strong { color: var(--ink); font-weight: 500; }

/* ---------- Karten und Gruppen (Listen wie in den Einstellungen am Handy) ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.group { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 0; padding: 0; list-style: none; }
.group.pad { padding: 4px 14px 10px; }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 8px 16px;
  background: none; border: 0; color: var(--ink); font: inherit; text-align: left; text-decoration: none; cursor: pointer;
}
.group > .row + .row, .group > * + .row, .group > .row + * { border-top: 1px solid var(--line); }
button.row:active, a.row:active { background: var(--raised); }
.row .row-value { margin-left: auto; color: var(--muted); text-align: right; min-width: 0; overflow-wrap: anywhere; }
.row-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.row-text small { color: var(--muted-2); font-size: .8rem; line-height: 1.35; }
.chev { width: 16px; height: 16px; color: var(--muted-2); }
.row > .chev { margin-left: auto; }
.row .row-value + .chev { margin-left: 0; }
.row > span:first-child { min-width: 0; }
.row.off { opacity: .45; pointer-events: none; }
.link-row { color: var(--accent); font-weight: 500; }
.help-row { margin-top: 16px; }
.help-row svg:first-child { color: var(--muted); }
.help-row .chev { margin-left: auto; }

/* ---------- Knöpfe: Haupt (gefüllt), Neben (dunkel), Text, Gefährlich (roter Text) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 20px;
  border-radius: 999px; border: 1px solid var(--line);
  background: var(--raised); color: var(--ink);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
/* Druck-Rückmeldung: sofort beim Aufsetzen des Fingers, leicht kleiner */
.btn, .chip, .seg-mini button, .icon-btn, .pv-btn, .pv-act span, .qremove, .frame-card, .tile, .avatar-btn, .pic-btn, .toast-action { transition: transform 160ms var(--ease-out); }
.btn:active, .chip:active, .seg-mini button:active, .pv-act:active span, .toast-action:active { transform: scale(.97); }
.icon-btn:active, .pv-btn:active, .qremove:active, .avatar-btn:active, .pic-btn:active { transform: scale(.93); }
.frame-card:active, .tile:active { transform: scale(.985); }
.btn:disabled:active { transform: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.soft { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent); }
.btn.text { background: none; border-color: transparent; color: var(--accent); }
.btn.text.danger, .btn.quiet-danger { color: var(--danger); }
.btn.text.strong { font-weight: 600; }
.btn.danger:not(.text) { background: var(--danger); border-color: var(--danger); color: var(--accent-ink); }
.btn.big { width: 100%; min-height: 56px; font-size: 1.05rem; border-radius: 999px; }
.btn.big svg { width: 20px; height: 20px; }
.btn:disabled { opacity: .55; cursor: default; }
.small-btn { min-height: 38px; padding: 6px 14px; font-size: .9rem; border-radius: 99px; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); color: var(--accent);
}
.row-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.row-actions .btn { flex: 1 1 140px; }
.quiet-actions { display: flex; flex-direction: column; align-items: center; margin-top: 10px; }
.quiet-actions .btn { min-height: 44px; font-weight: 500; }
.quiet-actions .btn.text:not(.danger) { color: var(--muted); }
#logout { margin-top: 24px; background: var(--card); border-color: var(--line); font-weight: 500; }
.btn:not(.primary):not(.text):not(.soft):not(.danger) { background: var(--card); }

/* ---------- Chips (Rahmen-Umschalter: überall derselbe) ---------- */
.chip-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 2px; }
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 16px;
  border-radius: 99px; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font: inherit; font-size: .92rem; font-weight: 500; white-space: nowrap; cursor: pointer;
}
.chip svg { width: 16px; height: 16px; stroke: var(--accent); stroke-width: 2.4; display: none; }
.chip.multi[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.chip.multi[aria-pressed="true"] svg { display: block; }
.chip.single { min-height: 36px; color: var(--muted); }
.chip.single[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.frame-pick { margin-bottom: 14px; }

.seg-mini { display: flex; padding: 3px; border-radius: 11px; background: var(--card); border: 1px solid var(--line); }
.seg-mini button {
  min-height: 32px; padding: 0 13px; border: 0; border-radius: 8px; background: none; color: var(--muted);
  font: inherit; font-size: .85rem; font-weight: 500; cursor: pointer;
}
.seg-mini button[aria-pressed="true"] { background: var(--raised-2); color: var(--ink); }

/* ---------- Felder ---------- */
.field { display: block; margin: 14px 0; }
.field span { display: block; font-weight: 500; font-size: .875rem; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%; min-height: 50px; padding: 10px 14px; font: inherit;
  border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink);
}
.field.compact { margin: 12px 0 0; }
.field textarea { resize: none; line-height: 1.4; }
.notice { padding: 10px 14px; border-radius: 12px; background: var(--accent-soft); margin: 10px 0; font-size: .92rem; }
.notice.bad { background: color-mix(in srgb, var(--bad) 14%, transparent); }
.notice.warn { background: color-mix(in srgb, var(--warn) 12%, transparent); }

/* ---------- Anmelden ---------- */
.login { max-width: 420px; margin: 0 auto; padding: calc(6vh + env(safe-area-inset-top, 0px)) 12px 0; }
.login-mark {
  position: relative; width: 76px; height: 76px; margin: 0 auto; border-radius: 20px;
  background: var(--card); border: 1px solid var(--line);
}
.login-mark { background: #17201c; border-color: transparent; display: flex; align-items: center; justify-content: center; }
.mark-f { display: flex; align-items: baseline; gap: 3px; transform: translate(2px, 1px); color: #f1f3ef;
  font-size: 50px; font-weight: 700; line-height: 1; letter-spacing: -.04em; }
.mark-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--brand); }
.login-brand { text-align: center; font-size: 1.6rem; font-weight: 700; letter-spacing: -.03em; margin: 14px 0 0; }
.login-lead { text-align: center; color: var(--muted); margin: 26px 0 10px; }
.login form .btn { margin-top: 8px; }
.or { display: flex; align-items: center; gap: 12px; margin: 24px 0 16px; color: var(--muted-2); font-size: .8rem; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.login-more { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.login-more .btn { font-weight: 500; font-size: .92rem; padding: 10px 8px; background: var(--card); }
.login-foot { text-align: center; font-size: .8rem; color: var(--muted-2); margin: 28px 0 0; }
/* Sprache: leiser Textknopf unter dem Hinweis, zeigt die andere Sprache */
.lang-switch { display: flex; margin: 8px auto 24px; min-height: 44px; font-weight: 500; font-size: .9rem; color: var(--muted); }
.lang-switch svg { width: 18px; height: 18px; }

/* ---------- Senden ---------- */
.pick-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 32px 22px 22px; border-radius: 22px; }
.pick-card h2 { font-size: 1.15rem; margin: 10px 0 0; }
.pick-card p { margin: 0 0 14px; font-size: .92rem; }
.pick-icon { width: 72px; height: 72px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.pick-icon svg { width: 32px; height: 32px; stroke-width: 1.75; }
.queue { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.qitem { background: var(--paper); border: 0; border-radius: 4px; padding: 10px 10px 0; overflow: hidden; box-shadow: var(--shadow-print); }
.qimg { position: relative; height: 190px; border-radius: 1px; overflow: hidden; background: var(--accent-soft); display: grid; place-items: center; color: var(--muted); }
.qimg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.qimg > svg { width: 36px; height: 36px; stroke-width: 1.5; }
.qremove {
  position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: rgba(17, 19, 18, .6); color: #fff; display: grid; place-items: center; cursor: pointer;
}
.qremove svg { width: 16px; height: 16px; }
.qprog { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(12, 13, 15, .5); }
.qprog span { display: block; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .2s var(--ease-out); }
.qbadge {
  position: absolute; left: 10px; top: 10px; display: flex; align-items: center; gap: 6px; padding: 5px 10px 5px 8px;
  border-radius: 99px; background: rgba(17, 19, 18, .7); color: #fff; font-size: .78rem; font-weight: 600;
}
.qbadge svg { width: 14px; height: 14px; stroke-width: 2.6; }
.qbadge.done svg { color: var(--ok); }
.qcap { display: flex; align-items: flex-start; gap: 10px; padding: 0 4px; min-height: 52px; }
.qcap > svg { width: 18px; height: 18px; margin-top: 16px; color: var(--muted-2); stroke-width: 1.75; }
.qcaption {
  flex: 1; min-width: 0; min-height: 50px; padding: 14px 0; border: 0; background: none; resize: none; overflow: hidden;
  font: inherit; font-size: 1rem; line-height: 1.4; color: var(--ink); outline: none;   /* 16 px: iOS zoomt nicht hinein */
}
.qcaption::placeholder { color: var(--muted-2); }
.qmsg { margin: 0; padding: 12px 14px 0; font-style: italic; overflow-wrap: anywhere; color: var(--muted); }
.qjobs { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 10px 14px 12px; font-size: .85rem; }
.qjobs:empty { display: none; }
.job { color: var(--muted); }
.job strong { font-weight: 600; color: var(--ink); }
.job.done { color: var(--ok); }
.job.error { color: var(--bad); font-weight: 600; }
.job.offline { color: var(--warn); }
.send-bar {
  position: sticky; z-index: 4; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom, 0px));
  margin: 4px -16px 0; padding: 26px 16px 12px;
  background: linear-gradient(180deg, transparent, var(--bg) 42%);
  display: grid; gap: 8px;
}
.send-bar:not(:has(.btn:not([hidden]))) { display: none; }
.sent { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 40px 12px 0; }
.sent h2 { font-size: 1.6rem; margin: 18px 0 0; }
.sent > p { margin: 0 0 18px; line-height: 1.55; }
.sent .btn { max-width: 420px; }
.sent .notice { max-width: 420px; text-align: left; margin: -6px 0 18px; }
.sent-thumbs { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.sent-thumbs span { position: relative; width: 72px; height: 72px; border-radius: 14px; background: var(--accent-soft) center / cover; }
.sent-thumbs span::after {
  content: ""; position: absolute; right: -6px; bottom: -6px; width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid var(--bg); background: var(--ok) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='%230c0d0f' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 13px no-repeat;
}
.sent-thumbs span.wait::after { background: var(--warn); }

/* ---------- Galerie ---------- */
.gallery-day { display: flex; align-items: baseline; justify-content: space-between; margin: 18px 4px 8px; }
.gallery-day:first-child { margin-top: 4px; }
.gallery-day .label { margin: 0; }
.gallery-day span { font-size: .78rem; color: var(--muted-2); }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; border-radius: 10px; overflow: hidden; }
.tile { position: relative; aspect-ratio: 1; border: 0; padding: 0; overflow: hidden; background: var(--accent-soft); cursor: pointer; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile img.failed { opacity: .2; }
.tile .ico {
  position: absolute; display: flex; align-items: center; gap: 3px; color: #fff; font-size: .72rem; font-weight: 600;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .7));
}
.tile .ico svg { width: 15px; height: 15px; }
.tile .likes { left: 6px; bottom: 6px; }
.tile .likes svg { fill: #fff; stroke: none; }
.tile .bubble { right: 6px; bottom: 6px; }
.tile .pin { right: 6px; top: 6px; }
.tile .wait { left: 6px; top: 6px; padding: 2px 7px; border-radius: 99px; background: rgba(0, 0, 0, .6); filter: none; }
/* Wer es geschickt hat: kleiner runder Abzug oben links (Profilbild oder Anfangsbuchstabe), Rand im Ton des Passepartouts */
.tile .tile-from {
  position: absolute; left: 6px; top: 6px; flex: none; width: 26px; height: 26px; font-size: .7rem;
  border: 2px solid var(--paper); box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
}
.tile .tile-from + .wait { left: 36px; top: 8px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ---------- Foto-Ansicht (ganzflächig) ---------- */
.photo-view {
  width: 100%; height: var(--vvh, 100%); max-width: 100%; max-height: var(--vvh, 100%); margin: 0; padding: 0; border: 0;
  background: var(--bg); color: var(--ink);
}
.photo-view[open] { display: flex; flex-direction: column; }
.photo-view::backdrop { background: var(--bg); }
/* Foto-Ansicht blendet kurz ein und aus */
.photo-view, .photo-view::backdrop { opacity: 0; transition: opacity 200ms var(--ease-out), display 200ms allow-discrete, overlay 200ms allow-discrete; }
.photo-view[open], .photo-view[open]::backdrop { opacity: 1; }
@starting-style { .photo-view[open], .photo-view[open]::backdrop { opacity: 0; } }
.pv-top {
  display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 8px;
}
.pv-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--card); color: var(--ink);
  display: grid; place-items: center; cursor: pointer;
}
.pv-title { display: flex; flex-direction: column; align-items: center; font-size: .9rem; min-width: 0; }
.pv-title span { font-size: .78rem; color: var(--muted); }
.pv-title strong, #viewer-sender { min-width: 0; overflow-wrap: anywhere; }
.pv-menu {
  position: absolute; top: calc(62px + env(safe-area-inset-top, 0px)); right: 14px; z-index: 3; width: 260px;
  background: var(--raised); border: 1px solid var(--raised-2); border-radius: 14px; overflow: hidden;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .5);
}
.pv-menu button {
  width: 100%; min-height: 50px; padding: 0 16px; border: 0; background: none; color: var(--ink);
  display: flex; align-items: center; gap: 12px; font: inherit; font-weight: 500; text-align: left; cursor: pointer;
}
.pv-menu button + button { border-top: 1px solid var(--raised-2); }
.pv-menu .danger { color: var(--danger); }
.pv-stage { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; overflow: hidden; touch-action: none; }   /* Wischen übernimmt die App */
.pv-stage img { max-width: calc(100% - 24px); max-height: calc(100% - 12px); object-fit: contain; display: block;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 18px 40px rgba(0, 0, 0, .18); }
.pv-caption {
  position: absolute; left: 16px; right: 16px; bottom: 14px; margin: 0 auto; width: fit-content; max-width: calc(100% - 32px);
  padding: 10px 16px; border-radius: 12px; background: rgba(17, 19, 18, .66); color: #f1f3ef; text-align: center; line-height: 1.4;
  overflow-wrap: anywhere;
}
.pv-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: var(--card); color: var(--ink); display: none; place-items: center; cursor: pointer;
}
.pv-nav.prev { left: 12px; } .pv-nav.next { right: 12px; }
@media (hover: hover) and (pointer: fine) { .pv-nav:not([hidden]) { display: grid; } }
.pv-meta { display: flex; align-items: center; gap: 10px; padding: 14px 20px 4px; min-height: 52px; }
.pv-likes { margin-left: auto; display: flex; align-items: center; gap: 6px; color: var(--ink); font-size: .88rem; text-align: right; }
.pv-likes svg { width: 16px; height: 16px; fill: var(--heart); stroke: none; }
.pv-note { margin: 0 20px; font-size: .85rem; color: var(--muted); }
.pv-actions {
  display: flex; justify-content: center; gap: 8px; padding: 12px 20px calc(18px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line); background: var(--card); margin-top: 10px;
}
.pv-act {
  flex: 1; max-width: 150px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px 0;
  background: none; border: 0; color: var(--ink); font: inherit; font-size: .8rem; cursor: pointer;
}
.pv-act b { font-weight: 500; }
.pv-act span { width: 52px; height: 52px; border-radius: 50%; background: var(--raised); display: grid; place-items: center; }
.pv-act.on span { background: var(--accent); color: var(--accent-ink); }
.pv-act svg { width: 22px; height: 22px; stroke-width: 1.75; }
.pv-edit { padding: 8px 20px calc(18px + env(safe-area-inset-bottom, 0px)); background: var(--card); }
.caption-foot { display: flex; justify-content: flex-end; margin-top: 4px; }

/* ---------- Avatare ---------- */
.avatar { flex: 0 0 42px; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 1.05rem;
  background: var(--accent-soft); color: var(--accent); }
.avatar.small { flex-basis: 32px; width: 32px; height: 32px; font-size: .85rem; }
.avatar.big { flex-basis: 64px; width: 64px; height: 64px; font-size: 1.6rem; }
.avatar.has-img, .avatar-btn.has-img { background-size: cover; background-position: center; color: transparent; }
.pic-btn { border: 0; padding: 0; font: inherit; font-size: 1.6rem; font-weight: 600; cursor: pointer; position: relative; }
.pic-btn::after {
  content: ""; position: absolute; right: -2px; bottom: -2px; width: 24px; height: 24px; border-radius: 50%;
  border: 3px solid var(--bg); background: #17201c url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 8h3l2-3h6l2 3h3v11H4z' fill='none' stroke='%23f3f2ee' stroke-width='2' stroke-linejoin='round'/%3E%3Ccircle cx='12' cy='13' r='3.2' fill='none' stroke='%23f3f2ee' stroke-width='2'/%3E%3C/svg%3E") center / 13px no-repeat;
}
.pic-link { min-height: 32px; padding: 2px 0; justify-content: flex-start; font-weight: 500; font-size: .9rem; }
.pic-links { display: flex; flex-wrap: wrap; column-gap: 16px; }

/* ---------- Rahmen ---------- */
.frame-cards { display: grid; gap: 12px; }
.frame-card {
  display: flex; flex-direction: column; text-align: left; padding: 0; overflow: hidden; width: 100%;
  border-radius: 20px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; cursor: pointer;
}
.fc-shot { position: relative; aspect-ratio: 16 / 7; margin: 14px 14px 0; padding: 7px; border-radius: 8px; background: var(--bezel);
  box-shadow: 0 6px 14px rgba(0, 0, 0, .18); display: grid; place-items: center; color: #8e9893; }
.fc-shot img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 2px; }
.fc-shot svg { width: 28px; height: 28px; stroke-width: 1.5; }
.fc-meta { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.fc-meta > span { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.fc-meta strong { font-size: 1.05rem; }
.fc-meta .chev { margin-left: auto; }
.fc-state { font-size: .87rem; color: var(--muted); }
.fc-state::before, .dot::before {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 7px; vertical-align: .08em; background: var(--muted-2);
}
.frame-card.good .fc-state::before, .dot.ok::before { background: var(--ok); }
.frame-card.warn .fc-state::before, .dot.warn::before { background: var(--warn); }
.frame-card.bad .fc-state::before, .dot.bad::before { background: var(--bad); }
.frame-card.bad .fc-shot { aspect-ratio: auto; height: 0; margin: 0; padding: 0; box-shadow: none; }
.live-tag {
  position: absolute; left: 12px; top: 12px; display: flex; align-items: center; gap: 6px; padding: 5px 10px;
  border-radius: 99px; background: rgba(17, 19, 18, .68); color: #f1f3ef; font-size: .75rem; font-weight: 600;
}
.live-tag i { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.screen { position: relative; border-radius: 12px; overflow: hidden; background: var(--bezel); padding: 10px; margin-bottom: 12px;
  box-shadow: 0 18px 36px rgba(0, 0, 0, .2); }
.screen img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: contain; border-radius: 2px; background: #000; }
.screen-caption { position: absolute; right: 22px; bottom: 18px; font-size: .78rem; color: rgba(243, 242, 238, .88);
  text-shadow: 0 1px 3px rgba(0, 0, 0, .8); }
.screen-caption:empty { display: none; }
.pinned { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--accent-soft); margin-bottom: 4px; }
.pinned img { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; flex: 0 0 auto; background: var(--raised); }
.pinned > div { display: flex; flex-direction: column; min-width: 0; font-size: .85rem; color: var(--muted); }
.pinned > div strong { color: var(--ink); font-size: .95rem; }
.pinned .btn { margin-left: auto; white-space: nowrap; }
.status { margin: 0; }
.srow { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 50px; padding: 10px 16px; border-top: 1px solid var(--line); }
.srow:first-child { border-top: 0; }
.srow dt { color: var(--ink); flex: 0 0 auto; }
.srow dd { margin: 0; text-align: right; color: var(--muted); min-width: 0; overflow-wrap: anywhere; }
.srow.ok dd::before, .srow.warn dd::before, .srow.bad dd::before {
  content: ""; display: inline-block; width: .55em; height: .55em; border-radius: 50%; margin-right: .45em; vertical-align: .08em;
}
.srow.ok dd::before { background: var(--ok); }
.srow.warn dd::before { background: var(--warn); }
.srow.bad dd::before { background: var(--bad); }
.srow.warn dd { color: var(--warn); }
.srow.bad dd { color: var(--bad); }
.tech-group { margin-top: 22px; }

/* Einstellungen als Listen */
.settings .group .row { min-height: 52px; }
.slider-row { display: block; padding: 12px 16px 6px; }
.slider-row + .row, .row + .slider-row, .slider-row + .slider-row { border-top: 1px solid var(--line); }
.slider-head { display: flex; justify-content: space-between; }
.slider-head output { color: var(--muted); font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; accent-color: var(--accent); height: 34px; margin: 2px 0 0; }

/* Schalter */
input[role="switch"], .switch {
  -webkit-appearance: none; appearance: none; flex: 0 0 auto; width: 51px; height: 31px; margin: 0 0 0 auto; border-radius: 99px;
  background: var(--track); position: relative; cursor: pointer; transition: background .2s;
}
input[role="switch"]::before, .switch::before {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .2s;
}
input[role="switch"]:checked, .switch:checked { background: var(--accent); }
input[role="switch"]:checked::before, .switch:checked::before { transform: translateX(20px); background: var(--accent-ink); }
input[role="switch"]:disabled { opacity: .45; cursor: default; }
.switch-line { cursor: pointer; }
.switches .switch-row { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 9px 16px; border-top: 1px solid var(--line); cursor: pointer; }
.switches .switch-row:first-child { border-top: 0; }
.switch-row > span { display: flex; flex-direction: column; min-width: 0; }
.switch-row strong { font-weight: 400; }
.switch-row small { color: var(--muted-2); font-size: .8rem; }

/* ---------- Familie ---------- */
.people > li + li { border-top: 1px solid var(--line); }
.member {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-align: left;
  border: 0; background: none; color: var(--ink); font: inherit;
}
button.member { cursor: pointer; }
button.member:active { background: var(--raised); }
.member-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.member-text strong { font-size: 1rem; }
/* lange Namen ohne Leerzeichen brechen um, statt über den Rand zu laufen */
.member-text strong, .profile strong, .fc-meta strong, .person-head h2, .sheet-top h2, .pinned > div strong { overflow-wrap: anywhere; }
.member-text strong small { font-weight: 500; color: var(--muted-2); font-size: .82rem; }
.member-frames { font-size: .87rem; color: var(--muted); line-height: 1.35; }
.member-state { font-size: .8rem; color: var(--muted-2); }
.member-state.warn { color: var(--warn); }
.member-state.warn::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--warn); margin-right: 6px; vertical-align: .1em; }

/* ---------- Konto ---------- */
.profile { display: flex; align-items: center; gap: 14px; margin: 0 4px 10px; }
.profile > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.profile strong { font-size: 1.25rem; }
.devices li { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 16px; }
.devices li + li { border-top: 1px solid var(--line); }
.devices .dev-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.devices .dev-text small { color: var(--muted-2); font-size: .8rem; }
.devices .now { color: var(--ok); font-size: .85rem; }
.devices .btn { min-height: 36px; padding: 4px 12px; font-size: .85rem; font-weight: 500; border-radius: 10px; }
.version { text-align: center; color: var(--muted-2); font-size: .78rem; margin: 16px 0 0; letter-spacing: .02em; }

/* ---------- Ergebnislisten (pro Rahmen) ---------- */
.frame-results { list-style: none; margin: 10px 0 0; padding: 0; }
.frame-results li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 4px; border-top: 1px solid var(--line); font-size: .9rem; }
.frame-results li:first-child { border-top: 0; }
.frame-results li span { text-align: right; color: var(--muted); }
.frame-results li.ok span { color: var(--ok); }
.frame-results li.warn span { color: var(--warn); }

/* ---------- Blätter von unten ---------- */
dialog { color: var(--ink); }
/* Tastatur offen: iPhone (und Chrome auf Android) verkleinern nur den sichtbaren Ausschnitt, nicht die Seite – Blätter und
   Foto-Ansicht rücken in diesen Ausschnitt über der Tastatur (--vv-top, --kb, --vvh setzt app.js; ohne Tastatur ganzer Bildschirm) */
.sheet, .photo-view { top: var(--vv-top, 0px); bottom: var(--kb, 0px); }
.sheet {
  width: 100%; max-width: 560px; max-height: calc(var(--vvh, 100%) * .92); margin: auto auto 0; padding: 0; border: 0;
  border-radius: 22px 22px 0 0; background: var(--card); border-top: 1px solid var(--line); overflow: auto;
  /* von unten herein (iPhone-Kurve), schneller wieder hinaus */
  transform: translateY(100%);
  transition: transform 220ms var(--ease-out), display 220ms allow-discrete, overlay 220ms allow-discrete;
}
.sheet.tall { min-height: calc(var(--vvh, 100%) * .7); }
.sheet[open] { display: flex; flex-direction: column; transform: none; transition-duration: 420ms; transition-timing-function: var(--ease-drawer); }
@starting-style { .sheet[open] { transform: translateY(100%); } }
.sheet[open] > .sheet-body, .sheet[open] > form.sheet-body { flex: 1; }
.sheet::backdrop { background: rgba(0, 0, 0, 0); transition: background-color 220ms ease, display 220ms allow-discrete, overlay 220ms allow-discrete; }
.sheet[open]::backdrop { background: rgba(0, 0, 0, .45); transition-duration: 320ms; }
@starting-style { .sheet[open]::backdrop { background: rgba(0, 0, 0, 0); } }
/* offenes Blatt: die Seite dahinter scrollt nicht mit */
html:has(dialog[open]), html:has(dialog[open]) body { overflow: hidden; }
dialog { overscroll-behavior: contain; }
@media (min-width: 600px) {
  .sheet { margin: auto; border-radius: 22px; border: 1px solid var(--line); transform: translateY(16px) scale(.97); opacity: 0;
    transition: transform 220ms var(--ease-out), opacity 220ms var(--ease-out), display 220ms allow-discrete, overlay 220ms allow-discrete; }
  .sheet[open] { transform: none; opacity: 1; }
  @starting-style { .sheet[open] { transform: translateY(16px) scale(.97); opacity: 0; } }
}
.sheet-body { padding: 10px 18px calc(18px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 10px; }
.sheet-body > h2 { margin: 4px 0 0; font-size: 1.15rem; }
.sheet-body > .btn.text.big { min-height: 46px; font-weight: 500; }
.sheet-body > .btn.text.big:not(.danger) { color: var(--ink); }
.sheet-body .label { margin: 14px 4px 0; }
.sheet .group { background: var(--bg); }
.grabber { width: 40px; height: 5px; border-radius: 3px; background: var(--track); align-self: center; margin-bottom: 4px; }
.sheet-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; }
/* Textknöpfe am Rand: Text bündig mit dem Inhalt, Polster bleibt beidseitig (Fokus-/Druckpille mittig um den Text) */
.sheet-top > .btn:first-child { margin-left: -14px; padding-left: 14px; padding-right: 14px; }
.sheet-top > .btn:last-child { margin-right: -14px; padding-left: 14px; padding-right: 14px; }
.sheet-top > .btn:focus-visible { outline-offset: -3px; }
.sheet-top > span:empty { min-width: 1px; }
.sheet-top h2 { margin: 0; font-size: 1.05rem; }
.sheet-top .btn.text:not(.strong) { color: var(--muted); font-weight: 500; }
.person-head { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; margin-top: -8px; }
.person-head h2 { margin: 4px 0 0; font-size: 1.35rem; }
.person-head p { margin: 0; }
.person-head p.warn { color: var(--warn); }
#person .field.compact { margin-top: 4px; }
#person-create { margin-top: 8px; }
#ask-ok.danger { background: var(--danger); border-color: var(--danger); color: var(--accent-ink); }
#ask-ok:not(.danger) { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
#ask-text { margin: 0 0 8px; line-height: 1.5; }
.choice { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 8px 16px; border: 0;
  background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.choice + .choice { border-top: 1px solid var(--line); }
.choice svg { margin-left: auto; color: var(--accent); width: 20px; height: 20px; stroke-width: 2.4; visibility: hidden; }
.choice[aria-checked="true"] svg { visibility: visible; }
.search {
  display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 0 14px; border-radius: 12px;
  background: var(--bg); border: 1px solid var(--line);
}
.search:focus-within { border-color: var(--accent); }
.search svg { color: var(--muted-2); }
.search input { flex: 1; min-width: 0; border: 0; background: none; color: var(--ink); font: inherit; outline: none; }
.place-res { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.place-res small { color: var(--muted-2); font-size: .82rem; }
.link-box { padding: 12px 14px; border-radius: 14px; background: var(--accent-soft); }
.link-url { display: block; margin: 6px 0 4px; font: .82rem ui-monospace, "SF Mono", Consolas, monospace;
  word-break: break-all; user-select: all; -webkit-user-select: all; background: none; padding: 0; }
.link-box .hint { margin: 8px 0 0; }
.more { margin-top: 6px; border-top: 1px solid var(--line); padding-top: 10px; }
.more summary { cursor: pointer; font-weight: 600; color: var(--accent); min-height: 36px; display: flex; align-items: center; }
#pair h2 { margin-top: 0; }
#pair-scan { margin: 8px 0 4px; }
.scan-video { position: relative; background: #000; aspect-ratio: 1 / 1; overflow: hidden; border-radius: 22px 22px 0 0; }
.scan-video video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; inset: 16%; border: 3px solid rgba(255, 255, 255, .9); border-radius: 18px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, .28); }
.scan-frame.found { border-color: #6fd39a; }

/* ---------- Verbindung ---------- */
.nethelp { margin-bottom: 12px; }
.nethelp ol { margin: 8px 0 14px; padding-left: 1.4em; }
.nethelp li { margin: 6px 0; }
.netbar {
  position: sticky; top: calc(56px + env(safe-area-inset-top, 0px)); z-index: 4;
  margin: 0; padding: 8px 16px; font-size: .85rem; text-align: center;
  background: color-mix(in srgb, var(--warn) 16%, var(--bg)); color: var(--ink); border-bottom: 1px solid var(--line);
}

/* ---------- Navigation unten ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; justify-content: center;
  padding: 0 8px env(safe-area-inset-bottom, 0px);
  background: color-mix(in srgb, var(--card) 94%, transparent); border-top: 1px solid var(--line);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.tabs a {
  flex: 1; max-width: 200px; height: var(--tabs-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--muted-2); text-decoration: none; font-size: .72rem; font-weight: 500;
}
.tabs a svg { width: 52px; height: 30px; padding: 3px 14px; border-radius: 99px; stroke-width: 1.75;
  transition: background-color .2s ease, color .2s ease, transform 160ms var(--ease-out); }
.tabs a:active svg { transform: scale(.94); }
/* gewählter Reiter: in Tinte, kräftigere Linie */
.tabs a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.tabs a[aria-current="page"] svg { stroke-width: 2.3; }

/* ---------- Rückmeldung: dunkel, eine Zeile, über der Leiste ---------- */
.toast {
  position: fixed; left: 50%; transform: translate(-50%, 0); z-index: 20;
  bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom, 0px) + 14px);
  width: max-content; max-width: calc(100% - 32px); display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; border-radius: 14px; background: var(--ink); color: var(--accent-ink); font-size: .92rem;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .45);
  transition: transform 400ms ease, opacity 400ms ease;   /* kommt von unten, gleitet unten wieder hinaus */
}
@starting-style { .toast { transform: translate(-50%, 100%); opacity: 0; } }
.toast.out { transform: translate(-50%, 100%); opacity: 0; transition-duration: 200ms; }
body.no-tabs .toast { bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
.toast-action { border: 0; background: none; color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; font: inherit; font-weight: 600; padding: 4px 0; cursor: pointer; white-space: nowrap; }

/* Bewegung reduzieren: nichts gleitet oder schrumpft, Ein- und Ausblenden bleibt */
@media (prefers-reduced-motion: reduce) {
  .btn, .chip, .seg-mini button, .icon-btn, .pv-btn, .pv-act span, .qremove, .frame-card, .tile, .avatar-btn, .pic-btn, .toast-action, .tabs a svg { transition: none; }
  .btn:active, .chip:active, .seg-mini button:active, .pv-act:active span, .toast-action:active, .icon-btn:active, .pv-btn:active, .qremove:active, .avatar-btn:active, .pic-btn:active, .frame-card:active, .tile:active, .tabs a:active svg { transform: none; }
  .sheet, .sheet[open] { transform: none; opacity: 0;
    transition: opacity 200ms ease, display 200ms allow-discrete, overlay 200ms allow-discrete; }
  .sheet[open] { opacity: 1; }
  @starting-style { .sheet[open] { transform: none; opacity: 0; } }
  .toast, .toast.out { transform: translate(-50%, 0); }
  @starting-style { .toast { transform: translate(-50%, 0); } }
}
#view-familie > [data-pair] { margin-top: 14px; }
.install-steps { margin: 4px 0 18px; padding-left: 22px; line-height: 1.5; }
.install-steps li { margin: 6px 0; }
