/* mylegacy.ch – Designrichtung "Lebenslinie"
 * Mobile-first: Basis = Handy, ab 760px Desktop.
 * Seeblau als Grundfarbe, Sonnengelb für Einladungen (Neu, Lücken, Impulse).
 * Literata für Geschichten und Titel, Atkinson Hyperlegible für Bedienung.
 */

@font-face { font-family: "Literata"; src: url("/fonts/literata-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Literata"; src: url("/fonts/literata-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Literata"; src: url("/fonts/literata-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("/fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("/fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
    --footer-h: 32px;
    --ink: #1d2b3a;
    --muted: #586878;
    --lake: #24507a;
    --lake-deep: #183a5b;
    --sky: #e6eef6;
    --sun: #f2b33d;
    --sun-soft: #fdf2d8;
    --bg: #f4f6f8;
    --surface: #ffffff;
    --line: #d8e0e7;
    --moss: #3c7550;
    --moss-soft: #e5f1e8;
    --rose: #b3382a;
    --rose-soft: #fbe9e6;

    --serif: "Literata", Georgia, serif;
    --sans: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;

    --radius: 14px;
    --radius-s: 8px;
    --tap: 48px;
    --tabbar-h: 66px;
    --max: 1040px;
    --read: 38rem;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--sans);
    font-size: 1.125rem;
    line-height: 1.55;
    color: var(--ink);
    background: var(--bg);
}

a { color: var(--lake); text-underline-offset: 3px; }
img { max-width: 100%; height: auto; display: block; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.005em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; margin-top: 2rem; }

.container { max-width: var(--max); margin: 0 auto; padding: 0 20px; }

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

.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

/* ---------- Kopfzeile ---------- */

header.site {
    position: sticky; top: 0; z-index: 60;   /* Kopfzeile bleibt beim Scrollen stehen */
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding-top: env(safe-area-inset-top);
}
html { scroll-padding-top: 76px; }          /* Sprungziele nicht unter der Kopfzeile verstecken */
.header-inner { display: flex; align-items: center; gap: 8px; min-height: 60px; }

.brand {
    display: inline-flex; align-items: center; gap: 4px;
    margin-right: auto; padding-right: 28px;   /* Abstand zum Menü */
    font-family: var(--serif); font-weight: 600; font-size: 1.35rem;
    color: var(--lake-deep); text-decoration: none;
}
.brand-logo { width: 34px; height: 34px; flex-shrink: 0; }

.header-login {
    min-height: 40px; display: inline-flex; align-items: center;
    padding: 0 14px; border-radius: 999px;
    background: var(--lake); color: #fff; text-decoration: none; font-weight: 700; font-size: 1rem;
    white-space: nowrap;
}
@media (max-width: 400px) {
    .header-login { padding: 0 12px; font-size: .9rem; }
}

.lang-switch { display: flex; }
.lang-switch a {
    min-width: 40px; min-height: 40px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .9rem; text-decoration: none; color: var(--muted);
}
.lang-switch a.active { color: var(--lake-deep); font-weight: 700; }

/* ---------- Tab-Leiste: Handy unten, Desktop im Kopf ---------- */

.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    display: flex;
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
}
.tab, .tab-form { flex: 1; }
.tab-form { margin: 0; display: flex; }
.tab {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    width: 100%; height: var(--tabbar-h);
    color: var(--muted); text-decoration: none; text-align: center;
    font: inherit; font-size: .72rem; line-height: 1.1;
    background: none; border: 0; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab.active { color: var(--lake); font-weight: 700; }
.tab-add svg {
    width: 40px; height: 40px; padding: 8px; margin-top: -14px;
    background: var(--sun); stroke: var(--ink); stroke-width: 2.4;
    border-radius: 50%; box-shadow: 0 0 0 4px var(--surface);
}

body.has-tabbar main { padding-bottom: calc(var(--tabbar-h) + var(--footer-h) + 32px + env(safe-area-inset-bottom)); }
body.has-tabbar footer.site { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: 0; }

/* ---------- Grundgerüst ---------- */

main { padding: 28px 0 calc(48px + var(--footer-h)); min-height: 60vh; }

/* Fusszeile: schmal und fixiert – auf dem Handy direkt über der Tab-Leiste */
footer.site {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--surface); border-top: 1px solid var(--line);
    color: var(--muted); font-size: .8rem; line-height: 1;
    padding-bottom: env(safe-area-inset-bottom);
}
.footer-inner {
    display: flex; flex-wrap: nowrap; gap: 16px; justify-content: space-between; align-items: center;
    height: var(--footer-h); overflow-x: auto; white-space: nowrap; scrollbar-width: none;
}
.footer-copy { flex-shrink: 0; }
.footer-links { display: flex; gap: 0 16px; font-family: var(--sans); }
.footer-links a { color: var(--muted); height: var(--footer-h); display: inline-flex; align-items: center; text-decoration: none; }
.footer-links a:hover { color: var(--lake); text-decoration: underline; }
@media (max-width: 520px) {
    .footer-copy { display: none; }   /* auf schmalen Handys nur die Links */
    .footer-inner { justify-content: center; }
}

/* Rechtstexte */
.legal { max-width: var(--read); }
.legal h1 { margin-bottom: 8px; }
.legal h2 { font-size: 1.2rem; margin: 2rem 0 .5rem; }
.legal p, .legal li { line-height: 1.65; }
.legal ul { padding-left: 1.2em; }
.legal li { margin-bottom: .4em; }
.legal-meta { color: var(--muted); font-size: .95rem; }
.checkbox.terms { margin-top: 18px; font-size: 1rem; }
.entry-when, .memory-when, .story-sub, footer.site { font-family: var(--serif); }

.notice, .alert { padding: 14px 18px; border-radius: var(--radius-s); margin: 0 0 20px; }
.notice { background: var(--moss-soft); color: var(--moss); }
.alert { background: var(--rose-soft); color: var(--rose); }

.muted { color: var(--muted); }

/* ---------- Knöpfe und Links ---------- */

.button {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: var(--tap); padding: 10px 24px;
    border: 0; border-radius: 999px;
    background: var(--lake); color: #fff;
    font: inherit; font-weight: 700; font-size: 1.05rem;
    text-decoration: none; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.button:hover { background: var(--lake-deep); }
.button-sun { background: var(--sun); color: var(--ink); }
.button-sun:hover { background: #e7a52a; }
.button-quiet { background: var(--sky); color: var(--lake-deep); min-height: 40px; padding: 6px 18px; font-size: .95rem; }
.button-quiet:hover { background: #d6e3ef; }
.button-danger { background: transparent; color: var(--rose); box-shadow: inset 0 0 0 2px var(--rose); }
.button-danger:hover { background: var(--rose-soft); }

.text-link {
    display: inline-flex; align-items: center; min-height: 40px;
    background: none; border: 0; padding: 0;
    font: inherit; font-size: 1rem; color: var(--lake);
    text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.text-link.danger { color: var(--rose); font-size: .9rem; }

/* ---------- Startseite ---------- */

.hero { max-width: 44rem; }
.hero-welcome { color: var(--lake); font-weight: 700; margin: 0 0 8px; }
.hero-title { font-size: 2.4rem; line-height: 1.12; margin-bottom: 16px; }
.hero-lead { font-size: 1.2rem; color: var(--muted); max-width: 34rem; margin: 0 0 28px; }

/* Erinnerungsimpuls: das wiederkehrende Element der Seite */
.prompt-card {
    margin: 0 0 28px;
    padding: 24px 22px;
    background: var(--sun-soft);
    border-radius: var(--radius);
    border-left: 6px solid var(--sun);
}
.prompt-card figcaption { color: #7a5a14; font-size: .95rem; font-weight: 700; margin-bottom: 8px; }
.prompt-card blockquote {
    margin: 0 0 18px;
    font-family: var(--serif); font-style: italic; font-size: 1.45rem; line-height: 1.35;
}
.prompt-actions { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.prompt-card-lead { font-family: var(--serif); font-size: 1.25rem; margin: 0 0 18px; }
.prompt-card-inline blockquote { font-size: 1.25rem; margin-bottom: 4px; }
.prompt-card-inline { padding: 18px 20px 10px; }
.prompt-card blockquote.is-changing { opacity: 0; transform: translateY(4px); }
.prompt-card blockquote { transition: opacity .2s, transform .2s; }

.how { margin-top: 40px; max-width: 44rem; }
.how-steps { list-style: none; counter-reset: step; padding: 0; margin: 0; display: grid; gap: 14px; }
.how-steps li {
    counter-increment: step;
    display: grid; grid-template-columns: 44px 1fr; column-gap: 14px;
    align-items: start;
}
.how-steps li::before {
    content: counter(step);
    grid-row: span 2;
    width: 44px; height: 44px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--sky); color: var(--lake-deep);
    font-family: var(--serif); font-weight: 600; font-size: 1.2rem;
}
.how-steps strong { font-size: 1.1rem; }
.how-steps span { color: var(--muted); }

/* ---------- Meine Geschichte: Lebenslinie ---------- */

.story-head { margin-bottom: 28px; }
.story-head h1 { font-size: 2.2rem; margin-bottom: 6px; }
.story-sub { color: var(--muted); margin: 0 0 4px; }

.lifeline { list-style: none; margin: 0; padding: 0; position: relative; }
.lifeline::before {
    content: ""; position: absolute; left: 11px; top: 10px; bottom: 10px;
    width: 3px; border-radius: 2px; background: var(--sky);
}
.decade { position: relative; padding-left: 40px; padding-bottom: 28px; }
.decade::before {
    content: ""; position: absolute; left: 3px; top: 10px;
    width: 19px; height: 19px; border-radius: 50%;
    background: var(--lake); box-shadow: 0 0 0 4px var(--bg);
}
.decade.is-empty::before { background: var(--bg); box-shadow: inset 0 0 0 3px var(--sun), 0 0 0 4px var(--bg); }
.decade-label { font-size: 1.6rem; margin: 0 0 12px; color: var(--lake-deep); }
.decade.is-empty .decade-label { color: var(--muted); font-weight: 400; }
.decade.is-empty .decade-label { font-size: 1.3rem; }

.entries { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.entry-link {
    display: flex; align-items: center; gap: 14px;
    padding: 12px;
    background: var(--surface);
    border-radius: var(--radius);
    text-decoration: none; color: inherit;
    min-height: 76px;
}
.entry-link:hover { background: #fbfcfd; box-shadow: inset 0 0 0 2px var(--sky); }
.entry-photo { width: 64px; height: 64px; object-fit: cover; border-radius: var(--radius-s); flex-shrink: 0; }
.entry-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.entry-when { font-size: .9rem; color: var(--muted); }
.entry-title { font-family: var(--serif); font-weight: 600; font-size: 1.15rem; line-height: 1.3; }
.entry-place { font-size: .9rem; color: var(--muted); }
.entry-shared {
    align-self: flex-start; margin-top: 4px;
    font-size: .78rem; padding: 1px 10px; border-radius: 999px;
    background: var(--sky); color: var(--lake-deep);
}

.gap {
    display: flex; flex-direction: column; gap: 4px;
    padding: 14px 16px;
    border: 2px dashed #ebcf8f; border-radius: var(--radius);
    background: rgba(253, 242, 216, .5);
    color: var(--ink); text-decoration: none;
}
.gap:hover { background: var(--sun-soft); }
.gap-text { font-family: var(--serif); font-size: 1.1rem; }
.gap-action { color: var(--lake); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Stammbaum: Person im Mittelpunkt ---------- */

.family { max-width: 46rem; }
.family-back { margin: 0 0 12px; }
.family-intro { color: var(--muted); margin: 0 0 8px; }

.focus {
    display: flex; gap: 16px; align-items: center;
    margin: 8px 0 24px; padding: 20px;
    background: var(--surface); border-radius: var(--radius);
    box-shadow: inset 0 0 0 3px var(--sky);
}
.focus h1 { font-size: 1.7rem; margin: 0 0 2px; }
.focus-me { margin: 0; color: var(--lake); font-weight: 700; font-size: .95rem; }
.focus-years { margin: 0; color: var(--muted); font-family: var(--serif); }
.focus-avatar, .kin-avatar {
    flex-shrink: 0; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--serif); font-weight: 600; color: var(--lake-deep);
    background: var(--sky);
}
.focus-avatar { width: 72px; height: 72px; font-size: 1.6rem; background: var(--lake); color: #fff; }
.kin-avatar { width: 48px; height: 48px; font-size: 1.05rem; }
.kin-avatar.g-f { background: #fbe3d6; color: #8a3f1c; }
.kin-avatar.g-m { background: var(--sky); }
.focus-avatar.is-dead, .kin-avatar.is-dead { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px #b9c3cc; }

.kin-group { margin-bottom: 20px; }
.kin-group h2 { font-size: 1.15rem; margin: 0 0 10px; color: var(--muted); font-weight: 600; }
.kin-list { display: grid; gap: 10px; }
.kin {
    display: flex; align-items: center; gap: 12px;
    padding: 12px; min-height: 72px;
    background: var(--surface); border-radius: var(--radius);
    text-decoration: none; color: inherit;
}
.kin:hover { box-shadow: inset 0 0 0 2px var(--sky); }
.kin-text { display: flex; flex-direction: column; min-width: 0; }
.kin-rel { font-size: .85rem; color: var(--muted); }
.kin-name { font-family: var(--serif); font-weight: 600; font-size: 1.1rem; line-height: 1.25; }
.kin-years { font-size: .9rem; color: var(--muted); font-family: var(--serif); }
.kin-via { font-size: .85rem; color: var(--muted); }
.kin-wrap { display: flex; flex-direction: column; }
.kin-wrap .kin { flex: 1; }
.kin.is-readonly { opacity: .85; }
.kin-member {
    margin-left: auto; align-self: flex-start; flex-shrink: 0;
    font-size: .75rem; padding: 2px 10px; border-radius: 999px;
    background: var(--moss-soft); color: var(--moss);
}
.kin-invite {
    align-self: flex-start;
    margin: 4px 0 0 72px; min-height: 36px;
    display: inline-flex; align-items: center;
    font-size: .9rem; font-weight: 700; color: var(--lake);
}
.button-small-pill { min-height: 40px; padding: 6px 16px; font-size: .95rem; margin-top: 10px; }
.focus-text .kin-member { display: inline-block; margin: 10px 0 0; }
.share-panel { margin: 20px 0 28px; padding: 18px 20px; background: var(--sun-soft); border-radius: var(--radius); }
.share-panel h2 { margin-top: 0; font-size: 1.2rem; }
.share-panel label { font-weight: 700; display: block; margin-bottom: 6px; }
.share-panel textarea { min-height: 140px; font-family: var(--sans); font-size: 1rem; }
.invite-form h2 { font-size: 1.2rem; margin: 28px 0 4px; }
.invite-landing .prompt-card { margin-top: 8px; }
.kin-gen h2 { color: #7d8a96; }
.kin-gen .kin { background: rgba(255, 255, 255, .7); }
.kin-add-small { min-height: 56px; font-size: .95rem; }
.kin-add-small .kin-add-plus { width: 32px; height: 32px; font-size: 1.2rem; }
.kin-add {
    display: flex; align-items: center; gap: 12px;
    padding: 12px; min-height: 64px;
    border: 2px dashed #ebcf8f; border-radius: var(--radius);
    background: rgba(253, 242, 216, .5);
    color: var(--lake-deep); font-weight: 700; text-decoration: none;
}
.kin-add:hover { background: var(--sun-soft); }
.kin-add-plus {
    width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--sun); color: var(--ink); font-size: 1.5rem; line-height: 1;
}
.kin-hint { margin: -10px 0 20px; }

.manage { margin-top: 32px; padding-top: 12px; border-top: 1px solid var(--line); }
.manage summary { cursor: pointer; color: var(--lake); min-height: 44px; display: flex; align-items: center; }
.manage-list { list-style: none; padding: 0; margin: 8px 0 20px; }
.manage-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.manage-list form { margin: 0; }

.segmented { display: flex; flex-wrap: wrap; gap: 8px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented span {
    display: inline-flex; align-items: center; min-height: 44px; padding: 6px 16px;
    border-radius: 999px; background: var(--surface); box-shadow: inset 0 0 0 2px var(--line);
    cursor: pointer;
}
.segmented input:checked + span { background: var(--sky); box-shadow: inset 0 0 0 2px var(--lake); color: var(--lake-deep); font-weight: 700; }
.segmented input:focus-visible + span { outline: 3px solid var(--sun); outline-offset: 2px; }
.checkbox.living { margin-top: 18px; font-weight: 700; }
.death-fields { display: flex; flex-direction: column; gap: 8px; }
.death-fields[hidden] { display: none; }
.existing-person { padding: 16px; background: var(--surface); border-radius: var(--radius); }
.existing-person > label { margin-top: 0; }
.or-new { font-size: 1.2rem; margin-top: 28px; }

/* ---------- Formulare ---------- */

.form-page { max-width: 34rem; }
.form-wide { max-width: 40rem; }
.stack { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.stack > label { font-weight: 700; margin-top: 14px; }
.optional { font-weight: 400; color: var(--muted); font-size: .9rem; }

input[type=text], input[type=email], input[type=number], select, textarea {
    width: 100%;
    min-height: var(--tap);
    padding: 11px 14px;
    font: inherit; font-size: 1.05rem;   /* ≥16px: kein Auto-Zoom auf iPhone */
    color: var(--ink);
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: var(--radius-s);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--lake); }
textarea {
    min-height: 260px; resize: vertical;
    font-family: var(--serif); font-size: 1.15rem; line-height: 1.7;
}
input::placeholder, textarea::placeholder { color: #8a97a3; }

.field-hint { color: var(--muted); font-size: .95rem; margin: 2px 0 0; }

fieldset { border: 0; padding: 0; margin: 18px 0 0; min-width: 0; }
legend { font-weight: 700; padding: 0; margin-bottom: 8px; }

.date-row { display: grid; grid-template-columns: 1.2fr 1.6fr 1fr; gap: 8px; }
.date-row label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--muted); }

.photo-drop { margin-top: 18px; }
.photo-drop-label {
    display: flex; align-items: center; justify-content: center; gap: 12px;
    min-height: 88px; padding: 16px;
    border: 2px dashed var(--line); border-radius: var(--radius);
    background: var(--surface);
    color: var(--lake-deep); font-weight: 700; cursor: pointer;
}
.photo-drop-label:hover { border-color: var(--lake); background: #fafcfe; }
.photo-drop-label svg { width: 32px; height: 32px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.photo-drop input:focus-visible + .field-hint { outline: none; }
.photo-drop:focus-within .photo-drop-label { border-color: var(--lake); }

.upload-preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-top: 10px; }
.upload-preview img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-s); }
.preview-item { position: relative; }
.preview-remove {
    position: absolute; top: -8px; right: -8px;
    width: 32px; height: 32px; border-radius: 50%;
    border: 2px solid var(--surface); background: var(--ink); color: #fff;
    font: inherit; font-size: 1.1rem; line-height: 1; cursor: pointer;
}
.photo-drop-title { font-weight: 700; margin: 0 0 8px; }
.photo-drop .photo-grid { margin: 0 0 14px; }
.upload-preview .status { grid-column: 1 / -1; color: var(--muted); }

.choice {
    display: flex; gap: 14px; align-items: flex-start;
    padding: 14px; margin-bottom: 8px;
    background: var(--surface);
    border: 2px solid transparent; border-radius: var(--radius);
    cursor: pointer;
}
.choice input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--lake); flex-shrink: 0; }
.choice span { display: flex; flex-direction: column; }
.choice small { color: var(--muted); font-size: .95rem; }
.choice:has(input:checked) { border-color: var(--lake); }
.checkbox { display: flex; gap: 10px; align-items: flex-start; margin-top: 6px; }
.checkbox input { width: 22px; height: 22px; accent-color: var(--lake); flex-shrink: 0; }

.form-actions { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-top: 22px; }
.sticky-actions {
    position: sticky; bottom: calc(var(--tabbar-h) + var(--footer-h) + env(safe-area-inset-bottom));
    z-index: 10;
    margin-left: -20px; margin-right: -20px; padding: 12px 20px;
    background: rgba(244, 246, 248, .96);
    border-top: 1px solid var(--line);
}

.code-input { font-size: 1.8rem !important; letter-spacing: .35em; max-width: 240px; font-family: var(--serif) !important; }
.hint { color: var(--muted); margin-top: 24px; }

.danger-zone { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); }

/* ---------- Einzelne Erinnerung: wie eine Buchseite ---------- */

.memory { max-width: 44rem; }
.memory-tools { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }

.memory-cover { display: block; margin: 0 -20px 24px; }
.memory-cover img { width: 100%; max-height: 72vh; object-fit: cover; }

.memory-header { max-width: var(--read); margin-bottom: 24px; }
.memory-when { margin: 0 0 6px; color: var(--lake); font-weight: 700; }
.memory-header h1 { font-size: 2.1rem; margin-bottom: 10px; }
.memory-byline { color: var(--muted); margin: 0; }

.memory-body {
    max-width: var(--read);
    font-family: var(--serif); font-size: 1.22rem; line-height: 1.8;
}
.memory-body p { margin: 0 0 1.1em; }

.photo-grid { list-style: none; padding: 0; margin: 28px 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-s); }
.photo-grid.editable li { display: flex; flex-direction: column; gap: 2px; }
.photo-grid.editable form { margin: 0; }

.memory-visibility, .invite {
    margin-top: 36px; padding: 18px 20px;
    border-radius: var(--radius);
}
.memory-visibility { background: var(--sky); }
.memory-visibility p { margin: 0 0 10px; }
.memory-visibility label { display: block; font-weight: 700; margin-bottom: 6px; }
.share-row { display: flex; gap: 8px; }
.share-row input { font-size: .95rem; min-width: 0; }
.invite { background: var(--sun-soft); }
.invite p { font-family: var(--serif); font-size: 1.2rem; margin: 0 0 14px; }

.empty { text-align: center; padding: 36px 20px; background: var(--surface); border-radius: var(--radius); }

pre.debug { white-space: pre-wrap; background: var(--surface); border: 1px solid var(--line); padding: 12px; font-size: .85rem; }

/* ---------- Desktop ---------- */

/* ---------- Portraitfotos ---------- */
.kin-photo { object-fit: cover; background: var(--sky); padding: 0; }
.focus-photo { position: relative; flex-shrink: 0; display: inline-flex; }
.focus-photo-link {
    position: absolute; right: -9px; bottom: -5px; width: 22px; height: 22px; border-radius: 50%;
    display: grid; place-items: center; background: var(--sun); box-shadow: 0 0 0 2px var(--surface);
}
.focus-photo-link svg { width: 12px; height: 12px; fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linejoin: round; }
.portrait-box { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); }
.portrait-box h2 { margin-top: 0; }
.portrait-row { display: flex; gap: 18px; align-items: flex-start; }
.portrait-preview { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.portrait-empty {
    display: grid; place-items: center; background: var(--sky); color: var(--lake-deep);
    font-family: var(--serif); font-weight: 600; font-size: 1.8rem;
}
.portrait-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.portrait-actions form { margin: 0; }
.portrait-pick { cursor: pointer; }
.portrait-pick:focus-within { outline: 3px solid var(--sun); outline-offset: 2px; }
.story-head.has-portrait { display: grid; grid-template-columns: 88px 1fr; column-gap: 18px; align-items: start; }
.story-head.has-portrait > :not(.story-portrait) { grid-column: 2; }
.story-head.has-portrait .story-links { gap: 2px 16px; }
.story-portrait { grid-row: 1 / span 3; width: 88px; height: 88px; border-radius: 50%; object-fit: cover; }

/* ---------- Meldungen ---------- */
.report-link { margin-top: 32px; font-size: .9rem; }
.report-link a { color: var(--muted); }
.alarm-badge {
    display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
    border-radius: 999px; background: var(--rose); color: #fff; font-size: .75rem; font-weight: 700; line-height: 1;
}
.report-alarm { background: var(--rose-soft); border-radius: var(--radius); padding: 16px; margin: 0 0 24px; }
.report-alarm h2 { margin: 0 0 12px; color: var(--rose); }
.is-open-report { border-color: var(--rose); }

/* ---------- Stammbaum: Ansehen / Bearbeiten ---------- */
.family-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin: 0 0 20px; }
.mode-switch { display: inline-flex; margin-left: auto; padding: 3px; border-radius: 999px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.mode-switch a {
    padding: 7px 16px; border-radius: 999px; text-decoration: none; font-weight: 700; font-size: .95rem; color: var(--muted);
}
.mode-switch a.is-active { background: var(--lake); color: #fff; }
.family.is-editing .focus { box-shadow: inset 0 0 0 3px var(--sun); }

/* ---------- Admin ---------- */
.admin-page h2 { margin-top: 32px; }
.admin-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 24px; }
.admin-nav a {
    padding: 8px 14px; border-radius: 999px; text-decoration: none; font-weight: 700;
    background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink);
}
.admin-nav a.is-active { background: var(--sky); box-shadow: inset 0 0 0 2px var(--lake); color: var(--lake-deep); }
.admin-stats { list-style: none; padding: 0; margin: 0 0 8px; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.admin-stats li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; }
.admin-stats strong { font-family: var(--serif); font-size: 1.8rem; color: var(--lake-deep); }
.admin-stats span { color: var(--muted); font-size: .9rem; }
.admin-search { display: flex; gap: 8px; margin: 0 0 20px; }
.admin-search input { flex: 1; min-width: 0; }
.admin-inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex-basis: 100%; }
.admin-inline-form input[type="text"] { flex: 1 1 180px; min-height: 44px; }
.admin-danger { flex-basis: 100%; }
.admin-danger summary { cursor: pointer; list-style: none; display: inline-block; }
.admin-danger form { margin-top: 12px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.admin-table th, .admin-table td { text-align: left; vertical-align: top; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.admin-table td:first-child { white-space: nowrap; font-family: var(--serif); }
.admin-lang { margin: 0 0 20px; }
.admin-lang a { text-decoration: none; }
.admin-lang a span { display: inline-block; padding: 8px 16px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); }
.admin-lang a.is-active span { background: var(--sky); box-shadow: inset 0 0 0 2px var(--lake); font-weight: 700; }
.admin-add { margin-bottom: 24px; }
.admin-prompts { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.admin-prompts li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.admin-prompts li.is-inactive { opacity: .6; }
.admin-prompts textarea { width: 100%; }
.admin-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 8px; }
.admin-memory-body { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 20px; }
.entry-locked { background: var(--rose-soft); color: var(--rose); }

/* ---------- Datenbackup ---------- */
.export-help { margin: 28px 0 12px; }
.export-help dt { font-weight: 700; margin-top: 12px; }
.export-help dd { margin: 4px 0 0; color: var(--muted); }

/* ---------- Konto löschen ---------- */
.delete-summary { margin: 0 0 16px; padding-left: 1.2em; }
.delete-summary li { margin-bottom: 6px; }

/* ---------- Vertrauenspersonen & Todesfall ---------- */
.story-links { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0; }
.trust-context { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 16px; }
.trust-role {
    display: inline-block; padding: 2px 10px; border-radius: 999px;
    background: var(--sky); color: var(--lake-deep); font-size: .85rem; font-weight: 700;
}
.for-person { margin: -8px 0 20px; color: var(--muted); }
.gap-readonly { border-style: dotted; background: transparent; color: var(--muted); margin: 0; }
.death-banner {
    margin: 0 0 24px; padding: 18px; border-radius: var(--radius);
    background: var(--sun-soft); border-left: 6px solid var(--sun);
}
.death-banner p { margin: 0 0 14px; }
.trust-page h2 { margin-top: 32px; }
.trust-list { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 12px; }
.trust-item {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
    padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
}
.trust-item form { margin: 0; }
.trust-name { font-family: var(--serif); font-size: 1.15rem; font-weight: 700; color: var(--ink); flex: 1 1 60%; }
a.trust-name { text-decoration: none; }
.trust-pending { font-size: .85rem; color: var(--muted); }
.trust-status { flex-basis: 100%; margin: 0; color: var(--muted); font-size: .95rem; }
.trust-actions { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; }
.trust-role-form { display: flex; gap: 8px; align-items: center; }
.trust-role-form select { min-height: 44px; }
.trust-form { margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--line); }

@media (min-width: 760px) {
    .container { padding: 0 32px; }
    main { padding: 48px 0 calc(64px + var(--footer-h)); }
    h1 { font-size: 2.4rem; }
    .hero-title { font-size: 3.4rem; }
    .story-head h1 { font-size: 2.8rem; }
    .memory-header h1 { font-size: 2.6rem; }

    .tabbar { position: static; background: none; border: 0; padding: 0; gap: 2px; margin-right: 8px; }
    .tab, .tab-form { flex: 0 0 auto; }
    .tab {
        flex-direction: row; gap: 8px;
        width: auto; height: 44px; padding: 0 12px;
        font-size: 1rem; white-space: nowrap; border-radius: 999px;
    }
    .tab:hover { background: var(--bg); }
    .tab.active { background: var(--sky); }
    .tab svg { width: 20px; height: 20px; }
    .tab-add svg { width: 26px; height: 26px; padding: 4px; margin: 0; box-shadow: none; }

    body.has-tabbar main { padding-bottom: calc(64px + var(--footer-h)); }
    body.has-tabbar footer.site { bottom: 0; padding-bottom: env(safe-area-inset-bottom); }

    .prompt-card-hero { padding: 32px 36px; }
    .prompt-card-hero blockquote { font-size: 1.8rem; }

    .lifeline::before { left: 95px; }
    .decade { padding-left: 128px; }
    .decade::before { left: 87px; }
    .decade-label { position: absolute; left: 0; top: 4px; width: 76px; text-align: right; font-size: 1.35rem; }
    .entries { grid-template-columns: repeat(2, 1fr); }
    .entry-photo { width: 76px; height: 76px; }

    .memory-cover { margin: 0 0 32px; }
    .memory-cover img { border-radius: var(--radius); }
    .photo-grid { grid-template-columns: repeat(3, 1fr); }

    .sticky-actions { position: static; margin: 22px 0 0; padding: 0; background: none; border: 0; }

    .kin-list { grid-template-columns: repeat(2, 1fr); }
    .kin-parent .kin-list { grid-template-columns: repeat(2, 1fr); }
}

/* Mittlere Breiten (Tablet, kleines Fenster): Menü kompakter, damit es nicht abgeschnitten wird */
@media (min-width: 760px) and (max-width: 1099px) {
    .brand { font-size: 1.2rem; padding-right: 20px; }
    .brand-logo { width: 30px; height: 30px; }
    .tabbar { gap: 0; margin-right: 4px; }
    .tab { padding: 0 9px; font-size: .88rem; gap: 6px; }
    .tab svg { width: 17px; height: 17px; }
    .lang-switch a { min-width: 32px; }
}
@media (min-width: 760px) and (max-width: 939px) {
    .tab:not(.tab-add) svg { display: none; }   /* nur noch Text, das „+“ bleibt */
    .tab { padding: 0 8px; font-size: .85rem; }
}

