/* myNews – App-Shell */
:root {
    --bg: #f3f4f8;
    --surface: #ffffff;
    --surface-2: #f6f7fb;
    --text: #0f1115;
    --muted: #5d6475;
    --line: rgba(15, 17, 21, .08);
    --shadow: 0 1px 2px rgba(15, 17, 21, .04), 0 8px 24px rgba(15, 17, 21, .06);
    --shadow-lg: 0 24px 64px rgba(15, 17, 21, .22);
    --radius: 16px;
    --accent: #3b5bdb;
    --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
    --top-h: 64px;
    --nav-h: 64px;
    --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0b0c10;
        --surface: #15171d;
        --surface-2: #1c1f27;
        --text: #f2f4f8;
        --muted: #9aa2b4;
        --line: rgba(255, 255, 255, .08);
        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
        --shadow-lg: 0 24px 64px rgba(0, 0, 0, .6);
        --accent-soft: color-mix(in srgb, var(--accent) 18%, transparent);
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    display: flex; flex-direction: column;
    height: 100vh; height: 100dvh;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.45 var(--font);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }

/* ---------- Kopfzeile ---------- */
.top {
    flex: 0 0 auto;
    display: flex; align-items: center; gap: 16px;
    height: calc(var(--top-h) + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left));
    background: color-mix(in srgb, var(--surface) 85%, transparent);
    backdrop-filter: saturate(180%) blur(16px);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    border-bottom: 1px solid var(--line);
    position: relative; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: -.03em; }
.brand img { border-radius: 9px; box-shadow: var(--shadow); }
.brand b { color: var(--accent); font-weight: 800; transition: color .3s; }

.tabs {
    display: flex; gap: 4px; margin: 0 auto;
    padding: 4px; border-radius: 14px;
    background: var(--surface-2); border: 1px solid var(--line);
}
.tab {
    position: relative;
    display: flex; align-items: center; gap: 8px;
    padding: 8px 16px; border-radius: 10px;
    color: var(--muted); font-weight: 600; font-size: 14px;
    transition: background .2s, color .2s, box-shadow .2s;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.tab.active .i { color: var(--accent); }
.tab[data-cat="morgenpost"] { --c: #3b5bdb; }
.tab[data-cat="narrativ"]   { --c: #7048e8; }
.tab[data-cat="vfb"]        { --c: #e32219; }
.dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--c); box-shadow: 0 0 0 2px var(--surface-2);
}

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-width: 40px; height: 40px; padding: 0 10px;
    border-radius: 12px; color: var(--text);
    background: var(--surface); border: 1px solid var(--line);
    font-weight: 600; font-size: 14px;
    transition: background .15s, transform .1s, border-color .15s;
}
.icon-btn:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.icon-btn:active { transform: scale(.96); }
.icon-btn.disabled { opacity: .35; pointer-events: none; }
.share-top { background: var(--accent); border-color: transparent; color: #fff; padding: 0 14px; }
.share-top:hover { filter: brightness(1.08); }
.share-bar { display: none; }

/* ---------- Ausgaben-Leiste ---------- */
.bar {
    flex: 0 0 auto;
    display: flex; align-items: center; gap: 16px;
    padding: 12px max(20px, env(safe-area-inset-right)) 12px max(20px, env(safe-area-inset-left));
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: relative; z-index: 10;
}
.bar::before {
    content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
    background: var(--accent);
}
.meta { flex: 1; min-width: 0; }
.kicker { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.kicker .date { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.title {
    margin: 3px 0 0; font-size: 18px; font-weight: 750; letter-spacing: -.015em; line-height: 1.25;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 2px 10px; border-radius: 99px;
    font-size: 12px; font-weight: 700; letter-spacing: .01em;
    background: var(--accent-soft); color: var(--accent);
}
.pill.live::before {
    content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor;
    animation: pulse 2s infinite;
}
.pill.back { background: var(--accent); color: #fff; }
.pill.sm { font-size: 11px; padding: 0 8px; font-style: normal; vertical-align: 1px; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.actions { display: flex; gap: 6px; flex: 0 0 auto; }
.count {
    font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 99px;
    background: var(--surface-2); color: var(--muted);
}

/* ---------- Ausgabe ---------- */
.stage { flex: 1 1 auto; position: relative; min-height: 0; background: var(--bg); }
.edition { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; opacity: 0; transition: opacity .35s; }
.edition.ready { opacity: 1; }
.loader { position: absolute; inset: 0; display: grid; place-items: center; }
.loader span {
    width: 34px; height: 34px; border-radius: 50%;
    border: 3px solid var(--line); border-top-color: var(--accent);
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Leerer Zustand ---------- */
.empty { flex: 1; display: grid; place-items: center; padding: 24px; }
.empty-card {
    text-align: center; padding: 40px 32px; max-width: 360px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow);
}
.empty-ic {
    display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 20px;
    background: var(--accent-soft); color: var(--accent);
}
.empty-ic .i { width: 30px; height: 30px; }
.empty h1 { margin: 16px 0 6px; font-size: 22px; letter-spacing: -.02em; }
.empty p { margin: 0; color: var(--muted); }

/* ---------- Sheets (Archiv / Teilen) ---------- */
.sheet {
    width: min(440px, calc(100vw - 32px));
    max-height: min(78vh, 680px);
    padding: 0; border: 1px solid var(--line); border-radius: 22px;
    background: var(--surface); color: var(--text);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.sheet[open] { display: flex; flex-direction: column; animation: pop .22s cubic-bezier(.2, .9, .3, 1.2); }
.sheet::backdrop { background: rgba(8, 10, 14, .45); backdrop-filter: blur(3px); animation: fade .2s; }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes fade { from { opacity: 0; } }
.sheet-head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
    padding: 20px 20px 14px; border-bottom: 1px solid var(--line);
}
.sheet-head h2 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.sheet-head p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.sheet-body { overflow-y: auto; padding: 8px 12px 20px; overscroll-behavior: contain; }

.month {
    position: sticky; top: -8px; z-index: 1;
    margin: 8px 0 4px; padding: 10px 8px 6px;
    background: var(--surface);
    font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.list { list-style: none; margin: 0; padding: 0; }
.list a {
    display: flex; align-items: center; gap: 14px;
    padding: 10px 8px; border-radius: 12px;
    transition: background .15s;
}
.list a:hover { background: var(--surface-2); }
.list a.sel { background: var(--accent-soft); }
.day {
    flex: 0 0 44px; height: 44px; border-radius: 12px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: var(--surface-2); line-height: 1.05;
}
.list a.sel .day { background: var(--accent); color: #fff; }
.day b { font-size: 16px; font-weight: 800; }
.day small { font-size: 11px; font-weight: 600; opacity: .7; }
.txt { font-weight: 550; font-size: 14.5px; line-height: 1.35; }

.preview {
    display: flex; gap: 14px; align-items: center;
    margin: 8px 8px 18px; padding: 14px;
    border-radius: 16px; background: var(--surface-2);
}
.preview img { border-radius: 12px; }
.preview small { display: block; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.preview strong { display: block; margin-top: 2px; font-size: 15px; line-height: 1.3; }
.share-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 10px; padding: 0 8px; }
.share-opt {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 14px 6px; border-radius: 16px;
    font-size: 13px; font-weight: 600; text-align: center;
    background: var(--surface-2); border: 1px solid var(--line);
    transition: transform .12s, border-color .15s;
}
.share-opt em { font-style: normal; }
.share-opt:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.share-opt:active { transform: scale(.96); }
.share-opt > span {
    display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%;
    color: #fff; background: var(--accent);
}
.share-opt .i { width: 24px; height: 24px; }
.share-opt.wa > span { background: #25d366; }
.share-opt.mail > span { background: #3b82f6; }
.share-opt.copy > span { background: #64748b; }
.share-opt.native > span { background: var(--text); color: var(--surface); }
.open-full {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    margin: 18px 8px 0; padding: 12px; border-radius: 12px;
    color: var(--muted); font-size: 13.5px; font-weight: 600;
}
.open-full:hover { color: var(--text); background: var(--surface-2); }
.open-full .i { width: 16px; height: 16px; }

/* ---------- Toast ---------- */
.toast {
    position: fixed; left: 50%; bottom: 24px; z-index: 50;
    transform: translateX(-50%);
    display: flex; align-items: center; gap: 12px;
    padding: 10px 10px 10px 18px; border-radius: 14px;
    background: var(--text); color: var(--surface);
    font-weight: 600; font-size: 14px; box-shadow: var(--shadow-lg);
    animation: pop .25s;
}
.toast button, .toast a { padding: 6px 12px; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 700; }

/* ---------- Mobil: Tabs als untere Navigation ---------- */
@media (max-width: 760px) {
    :root { --top-h: 56px; }
    /* kein backdrop-filter hier: er würde die fixierte Tab-Leiste im Kopf einsperren */
    .top { gap: 10px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; }
    .brand { font-size: 19px; margin-right: auto; }
    .share-top span { display: none; }
    .share-top { padding: 0 10px; }
    .tabs {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
        margin: 0; gap: 0; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
        border-radius: 0; border: 0; border-top: 1px solid var(--line);
        background: color-mix(in srgb, var(--surface) 88%, transparent);
        backdrop-filter: saturate(180%) blur(16px);
        -webkit-backdrop-filter: saturate(180%) blur(16px);
    }
    .tab {
        flex: 1; flex-direction: column; gap: 3px;
        padding: 6px 4px; font-size: 11.5px; border-radius: 12px;
    }
    .tab .i { width: 23px; height: 23px; }
    .tab.active { background: none; box-shadow: none; color: var(--accent); }
    .tab.active .i { background: var(--accent-soft); border-radius: 99px; padding: 3px 14px; width: 52px; height: 28px; box-sizing: border-box; }
    .dot { position: absolute; top: 5px; left: calc(50% + 12px); }
    body { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
    .bar { flex-wrap: wrap; gap: 10px; padding-top: 10px; padding-bottom: 10px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
    .kicker .sep, .kicker .sub { display: none; }
    .title { font-size: 16px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
    .actions { width: 100%; }
    .actions .wide { flex: 1; }
    .toast { bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px); width: max-content; max-width: calc(100vw - 24px); }

    .sheet {
        width: 100vw; max-width: 100vw; max-height: 86vh;
        margin: auto 0 0; border-radius: 22px 22px 0 0; border-bottom: 0;
        padding-bottom: env(safe-area-inset-bottom);
    }
    .sheet[open] { animation: up .28s cubic-bezier(.2, .9, .3, 1); }
    .sheet-head { position: relative; padding-top: 26px; }
    .sheet-head::before {
        content: ""; position: absolute; top: 9px; left: 50%; width: 40px; height: 5px;
        margin-left: -20px; border-radius: 99px; background: var(--line);
    }
    @keyframes up { from { transform: translateY(100%); } }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
