/* News – eine schmale Lesespalte wie am Handy.
   Drei Designs, gesetzt über data-theme am <html> (siehe Skript in index.html):
   light = Standard hell, orf = an ORF.at angelehnt, dark = dunkel. */
:root {
  --paper: #f3f5f4;
  --surface: #ffffff;
  --ink: #17202a;
  --muted: #5b6672;
  --line: #dde2e1;
  --accent: #24557f;
  --accent-ink: #ffffff;
  --new: #c97f00;
  --new-soft: #fbefd6;
  --swipe: #2f7a55;
  --warn-bg: #fdf1e7;
  --warn-ink: #8a3d00;
  --shadow: 0 1px 2px rgb(23 32 42 / .06), 0 8px 24px rgb(23 32 42 / .08);
  --head-bg: var(--paper);
  --head-ink: var(--ink);
  --head-muted: var(--muted);
  --head-ctl-bg: var(--surface);
  --head-ctl-line: var(--line);
  --head-new: var(--new);
  --row-ink: var(--ink);
  --row-sep: 1px solid var(--line);
  --f-head: "Newsreader", "Iowan Old Style", Georgia, serif;
  --f-row: var(--f-head);
  --f-text: var(--f-head);
  --f-ui: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
:root[data-theme="orf"] {
  --paper: #ffffff;
  --surface: #ffffff;
  --ink: #222222;
  --muted: #84868c;
  --line: #e5e5e9;
  --accent: #466199;
  --accent-ink: #ffffff;
  --new: #c74e56;
  --new-soft: #f8e4e5;
  --swipe: #466199;
  --head-bg: #5286c1;
  --head-ink: #ffffff;
  --head-muted: rgb(255 255 255 / .82);
  --head-ctl-bg: rgb(255 255 255 / .14);
  --head-ctl-line: rgb(255 255 255 / .4);
  --head-new: #ffe559;
  --row-ink: #466199;
  --row-sep: 3px solid #f0f1f4;
  --f-head: "Roboto Condensed", "Avenir Next Condensed", "Arial Narrow", sans-serif;
  --f-row: Roboto, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  --f-text: Roboto, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  --f-ui: Roboto, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper: #111519; --surface: #1a2026; --ink: #e6eaee; --muted: #98a3ae; --line: #2a333c;
  --accent: #86b6e3; --accent-ink: #0e1a26; --new: #f0b445; --new-soft: #3a2e14; --swipe: #4fa97a;
  --warn-bg: #3a2414; --warn-ink: #f3c39a;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px rgb(0 0 0 / .35);
  --head-bg: #111519; --head-ink: #e6eaee; --head-muted: #98a3ae; --head-ctl-bg: #1a2026; --head-ctl-line: #2a333c; --head-new: #f0b445;
  --row-ink: #e6eaee; --row-sep: 1px solid #2a333c;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  /* nur falls das Skript nicht läuft */
  :root:not([data-theme]) {
    --paper: #111519; --surface: #1a2026; --ink: #e6eaee; --muted: #98a3ae; --line: #2a333c;
    --accent: #86b6e3; --accent-ink: #0e1a26; --new: #f0b445; --new-soft: #3a2e14; --swipe: #4fa97a;
    --warn-bg: #3a2414; --warn-ink: #f3c39a;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px rgb(0 0 0 / .35);
    --head-bg: #111519; --head-ink: #e6eaee; --head-muted: #98a3ae; --head-ctl-bg: #1a2026; --head-ctl-line: #2a333c; --head-new: #f0b445;
    --row-ink: #e6eaee; --row-sep: 1px solid #2a333c;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink); font-family: var(--f-ui); font-size: 15px; line-height: 1.45;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 0 calc(48px + env(safe-area-inset-bottom, 0px));
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--head-bg); }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.col { max-width: 560px; margin: 0 auto; }

/* Kopf */
.apphead { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--head-bg); color: var(--head-ink); padding-block: 14px 10px; border-bottom: 1px solid var(--line); display: grid; gap: 10px;
  box-shadow: 0 0 0 100vmax var(--head-bg); clip-path: inset(0 -100vmax); }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { font-family: var(--f-head); font-weight: 600; font-size: 26px; letter-spacing: -.01em; line-height: 1; }
.status { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--head-muted); font-variant-numeric: tabular-nums; }
.refresh { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--head-ctl-line); background: var(--head-ctl-bg); color: var(--head-ink); display: grid; place-items: center; font-size: 16px; line-height: 1; }
.refresh.spin span { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.summary-text { font-size: 14px; min-width: 0; }
.summary-text strong { font-weight: 600; }
.summary-text .n { color: var(--head-new); font-weight: 600; }
.apphead .pill, .apphead .chip { background: var(--head-ctl-bg); border-color: var(--head-ctl-line); color: var(--head-ink); }
.pill { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.pill.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 10px; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.chip .cnt { font-weight: 600; }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--head-new); }

.banner { margin-top: 12px; background: var(--warn-bg); color: var(--warn-ink); border-radius: 8px; padding: 10px 12px; font-size: 13px; }

/* Rubriken */
.sec { margin-top: 22px; scroll-margin-top: 150px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding-bottom: 6px; border-bottom: 2px solid var(--ink); }
.sec-title { font-family: var(--f-head); font-size: 20px; font-weight: 600; margin: 0; }
.sec-count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; flex: 1; }
.sec-count .n { color: var(--new); font-weight: 600; }
.link { border: 0; background: none; padding: 4px 0; color: var(--accent); font-size: 13px; font-weight: 500; white-space: nowrap; }
.sec-more { padding-top: 4px; }
.sec-done { margin-top: 10px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; padding-block: 8px; border-bottom: 1px solid var(--line); scroll-margin-top: 150px; }
.sec-done .sec-title { font-size: 16px; color: var(--muted); font-weight: 500; }
.sec-done .ok { font-size: 13px; color: var(--muted); flex: 1; }

.rw { position: relative; overflow: hidden; border-bottom: var(--row-sep); }
.rbg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: flex-end; padding-right: 18px; background: var(--swipe); color: #fff; font-weight: 600; font-size: 14px; opacity: 0; }
.rw:has(.row.dragging) .rbg { opacity: .55; }
.rw.armed .rbg { opacity: 1; }
.row { position: relative; background: var(--paper); display: grid; grid-template-columns: 12px 1fr auto; gap: 8px; align-items: start; padding: 11px 2px; touch-action: pan-y; cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; transition: transform .2s ease; }
.row.dragging { transition: none; }
.mark { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; }
.mark.new { background: var(--new); }
.rmain { min-width: 0; display: grid; gap: 3px; }
.rtitle { font-family: var(--f-row); color: var(--row-ink); font-size: 17px; line-height: 1.25; font-weight: 500; overflow-wrap: anywhere; }
.rmeta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.newlbl { color: var(--new); font-weight: 600; text-transform: uppercase; font-size: 10.5px; letter-spacing: .07em; }
.tag { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; font-size: 11px; color: var(--muted); }
.tag svg { width: 9px; height: 9px; fill: currentColor; }
.tag.live { border-color: var(--new); color: var(--new); }
.row.is-read .rtitle { color: var(--muted); font-weight: 400; }
.mini { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 9px; font-size: 12px; color: var(--muted); align-self: center; }

.empty { margin-top: 28px; text-align: center; display: grid; gap: 8px; justify-items: center; padding-inline: 12px; padding-bottom: 8px; }
.empty .big { font-family: var(--f-head); font-size: 28px; font-weight: 500; }
.empty p { margin: 0; color: var(--muted); max-width: 34ch; }
.foot { margin-top: 28px; font-size: 12px; color: var(--muted); text-align: center; display: grid; gap: 4px; }

.keyform { margin-top: 32px; display: grid; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.keyform h2 { margin: 0; font-family: var(--f-head); font-size: 22px; }
.keyform p { margin: 0; color: var(--muted); font-size: 14px; }
.keyform input { font: inherit; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); width: 100%; }
.loading { margin-top: 40px; text-align: center; color: var(--muted); }

/* Artikel-Overlay */
.ov { position: fixed; inset: 0; z-index: 20; }
.ov-back { position: absolute; inset: 0; background: rgb(10 14 18 / .45); opacity: 0; transition: opacity .2s; }
.ov.show .ov-back { opacity: 1; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 600px; top: calc(env(safe-area-inset-top, 0px) + 20px);
  background: var(--surface); border-radius: 16px 16px 0 0; display: grid; grid-template-rows: auto 1fr auto; transform: translateY(100%); transition: transform .25s cubic-bezier(.2,.8,.2,1); box-shadow: var(--shadow); }
.ov.show .sheet { transform: translateY(0); }
.sh-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px 8px 16px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.xbtn { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font-size: 18px; line-height: 1; display: grid; place-items: center; }
.sh-body { overflow-y: auto; padding: 16px 18px 24px; overscroll-behavior: contain; }
.sh-body h1 { font-family: var(--f-head); font-size: 26px; line-height: 1.15; font-weight: 600; margin: 4px 0 12px; text-wrap: balance; overflow-wrap: anywhere; }
.sh-body .lead { font-family: var(--f-head); font-size: 18px; line-height: 1.45; font-weight: 500; margin: 0 0 12px; }
.sh-text { font-family: var(--f-text); font-size: 17px; line-height: 1.55; max-width: 65ch; overflow-wrap: anywhere; }
.sh-text p { margin: 0 0 12px; }
.sh-text h2, .sh-text h3, .sh-text h4 { font-family: var(--f-ui); font-size: 15px; font-weight: 600; margin: 18px 0 6px; }
.sh-text a { color: var(--accent); }
.sh-text blockquote { margin: 0 0 12px; padding-left: 12px; border-left: 3px solid var(--line); }
.vnote { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 13px; color: var(--muted); margin: 6px 0 14px; }
.vnote svg { flex: none; width: 14px; height: 14px; margin-top: 2px; fill: currentColor; }
.vnote a, .orig { color: var(--accent); }
.orig { font-size: 13px; display: inline-block; margin-top: 4px; }
.sh-loading { color: var(--muted); font-size: 14px; }
.sh-foot { display: flex; gap: 8px; align-items: center; padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); }
.sh-foot .pill { padding: 10px 16px; font-size: 14px; flex: 1; }
.prog { font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

.toast { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); z-index: 30; background: var(--ink); color: var(--paper); border-radius: 10px; padding: 10px 12px 10px 14px; font-size: 14px; display: flex; gap: 14px; align-items: center; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); width: max-content; }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { border: 0; background: none; color: var(--new); font-weight: 600; padding: 2px 4px; }
/* Einstellungen */
.settings { display: grid; gap: 10px; padding: 12px; border-radius: 10px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.settings-row { display: grid; gap: 6px; }
.settings-label { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.seg button { border: 0; background: transparent; border-radius: 6px; padding: 7px 4px; font-size: 13px; font-weight: 500; color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.settings-note { font-size: 12px; color: var(--muted); margin: 0; }
.head-btns { display: flex; align-items: center; gap: 6px; }

/* ORF-Design: Rubriken als Etikett mit blauem Balken, Schlagzeilen in Blau */
:root[data-theme="orf"] .apphead { border-bottom-color: transparent; }
:root[data-theme="orf"] .brand { font-family: var(--f-head); font-weight: 700; letter-spacing: 0; font-size: 25px; }
:root[data-theme="orf"] .sec-head { border-bottom: 0; padding-bottom: 4px; align-items: center; }
:root[data-theme="orf"] .sec-title { font-family: var(--f-ui); text-transform: uppercase; letter-spacing: 1px; font-weight: 500; font-size: 15px; color: #222; background: #f0f1f4; padding: 4px 11px; border-left: 8px solid #4286c1; }
:root[data-theme="orf"] .sec-done .sec-title { font-size: 13px; color: #555; border-left-color: #aaadb5; }
:root[data-theme="orf"] .sec-done { border-bottom: 3px solid #f0f1f4; }
:root[data-theme="orf"] .rtitle { font-weight: 450; line-height: 1.3; }
:root[data-theme="orf"] .sh-body h1 { font-weight: 700; }
:root[data-theme="orf"] .sh-body .lead { font-weight: 400; }
:root[data-theme="orf"] .sh-text { line-height: 1.6; color: #222; }
:root[data-theme="orf"] .sh-text a { font-weight: 700; text-decoration: none; }
:root[data-theme="orf"] .sh-text h2, :root[data-theme="orf"] .sh-text h3, :root[data-theme="orf"] .sh-text h4 { font-family: var(--f-head); font-size: 19px; font-weight: 500; }

@media (prefers-reduced-motion: reduce) { .row, .sheet, .ov-back, .toast { transition: none; } .refresh.spin span { animation: none; } }
