:root {
  --bg: #ffffff;
  --surface: #f5f4f0;
  --ink: #1b1b1b;
  --ink-soft: #3a3a3a;
  --muted: #6b6b6b;
  --rule: #dcdcdc;
  --rule-strong: #1b1b1b;
  --accent: #0b4f7c;
  --star: #c48a12;
  --mark: #fff0a0;
  --warn: #a3261b;
  --chip-bg: #e3edf5;
  --chip-bg-hover: #d2e2ee;
  --chip-ink: #0b4f7c;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: Inter, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --gutter: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --surface: #1c1c1c;
    --ink: #ebebeb;
    --ink-soft: #cfcfcf;
    --muted: #9a9a9a;
    --rule: #2f2f2f;
    --rule-strong: #ebebeb;
    --accent: #7cb8e4;
    --star: #e2ad3b;
    --mark: #5c4d00;
    --warn: #ff8a7d;
    --chip-bg: #1d3142;
    --chip-bg-hover: #26405a;
    --chip-ink: #a9d2f0;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { max-width: 100%; height: auto; }
code { font-size: .9em; background: var(--surface); padding: .1em .3em; border-radius: 3px; overflow-wrap: anywhere; }
.small { font-size: .85rem; color: var(--muted); }
.warn { color: var(--warn); }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 var(--gutter); }
@media (min-width: 768px) { :root { --gutter: 28px; } }

/* ---------- Kopf ---------- */
.masthead { background: var(--bg); }
.masthead-top {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 10px; font-size: .8rem; color: var(--muted);
}
.masthead-tools { display: flex; gap: 14px; }
.tool { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); }
.tool svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.tool-label { display: none; }
@media (min-width: 768px) { .tool-label { display: inline; font-size: .85rem; } }
.wordmark {
  display: block; text-align: center;
  font-family: var(--serif); font-weight: 700; font-optical-sizing: auto;
  font-size: clamp(2.3rem, 7vw, 3.8rem); letter-spacing: -.02em; line-height: 1.05;
  padding: 6px 0 14px;
}
.wordmark:hover { text-decoration: none; }
.sections {
  border-top: 1px solid var(--rule-strong); border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; z-index: 10; background: var(--bg);
}
.sections-inner {
  display: flex; gap: 22px; overflow-x: auto; scrollbar-width: none;
  white-space: nowrap; font-size: .92rem; font-weight: 500;
}
.sections-inner::-webkit-scrollbar { display: none; }
.sections a { padding: 11px 0 9px; border-bottom: 3px solid transparent; color: var(--ink-soft); }
.sections a:hover { text-decoration: none; color: var(--ink); }
.sections a.is-active { border-bottom-color: var(--ink); color: var(--ink); }
.count {
  display: inline-block; min-width: 1.6em; padding: 0 .4em; margin-left: 2px;
  border-radius: 9px; background: var(--surface); font-size: .75rem; text-align: center;
}

main.wrap { padding-top: 22px; padding-bottom: 48px; min-height: 60vh; }

/* ---------- Seitentitel ---------- */
.page-head {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: baseline; justify-content: space-between;
  border-bottom: 1px solid var(--rule-strong); margin-bottom: 20px; padding-bottom: 8px;
}
.page-title { font-family: var(--serif); font-size: clamp(1.7rem, 4vw, 2.4rem); margin: 0; line-height: 1.15; }

/* ---------- Karten ---------- */
.kicker {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: .76rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--accent);
  margin-bottom: 4px;
}
.kicker .sep { color: var(--muted); }
.kicker .pub { font-weight: 700; }
.kicker .via {
  text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--muted); font-size: .74rem;
}
.kicker .via a { color: inherit; }

/* Stichwort-Chips */
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 0 0 8px; }
.chip {
  display: inline-block; font: 500 .72rem/1.2 var(--sans); padding: 3px 9px; border-radius: 999px;
  background: var(--chip-bg); color: var(--chip-ink); white-space: nowrap;
}
.chip:hover { text-decoration: none; background: var(--chip-bg-hover); }
.story-head .chips { margin: -4px 0 12px; }
.count-accent { background: var(--chip-bg); color: var(--chip-ink); }
.page-sub { font-family: var(--sans); font-size: .9rem; font-weight: 500; color: var(--muted); margin-left: 8px; }
.page-note { margin: -10px 0 20px; color: var(--muted); font-size: .9rem; }
.page-note a { color: var(--accent); }
.panel-wide { max-width: none; }
.kw-form { display: grid; gap: 8px; max-width: 520px; margin: 12px 0 8px; }
.kw-form label { font-size: .85rem; color: var(--muted); }
.kw-form textarea {
  font: .95rem/1.5 var(--sans); padding: 10px 12px; border: 1px solid var(--rule-strong); border-radius: 3px;
  background: var(--bg); color: var(--ink); resize: vertical;
}
.kw-form .button { justify-self: start; }
.kw-rules { margin: 0; padding-left: 1.1em; }
.kw-rules li { margin-bottom: 2px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.card { border-top: 1px solid var(--rule); padding-top: 14px; min-width: 0; }
.card-media { display: block; overflow: hidden; background: var(--surface); margin-bottom: 10px; }
.card-media img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.card-title {
  font-family: var(--serif); font-weight: 700; font-size: 1.22rem; line-height: 1.22;
  margin: 0 0 6px; letter-spacing: -.005em; overflow-wrap: break-word;
  hyphens: auto; -webkit-hyphens: auto;
}
.card-teaser { font-family: var(--serif); color: var(--ink-soft); margin: 0 0 8px; font-size: 1rem; line-height: 1.45; overflow-wrap: break-word; }
.card-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: .8rem; color: var(--muted); }
.card.is-read .card-title, .result.is-read .result-title { color: var(--muted); }
.card.is-read .card-media img { opacity: .75; }

.lead-block { display: grid; gap: 24px; margin-bottom: 28px; }
.card.lead { border-top: 0; padding-top: 0; }
.card.lead .card-title { font-size: clamp(1.7rem, 4.2vw, 2.5rem); line-height: 1.12; letter-spacing: -.015em; }
.card.lead .card-teaser { font-size: 1.12rem; }
.card.lead .card-media img { aspect-ratio: 16 / 9; }
.lead-side .card:first-child { border-top: 0; padding-top: 0; }
.lead-side .card { padding-bottom: 14px; }
/* Nebenartikel mit kleinem Bild rechts */
.lead-side .card { display: grid; grid-template-columns: minmax(0, 1fr) 92px; grid-template-areas: "body media"; gap: 0 14px; }
.lead-side .card-media { grid-area: media; margin: 4px 0 0; align-self: start; }
.lead-side .card-media img { aspect-ratio: 1 / 1; }
.lead-side .card-body { grid-area: body; }
.lead-side .card-teaser { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
@media (min-width: 900px) {
  .lead-block { grid-template-columns: 2fr 1fr; gap: 32px; }
  .lead-side { border-left: 1px solid var(--rule); padding-left: 28px; }
}
@media (max-width: 899px) {
  .lead-side .card:first-child { border-top: 1px solid var(--rule); padding-top: 14px; }
}

.grid { display: grid; gap: 22px 28px; }
@media (min-width: 600px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* Smartphone: Liste mit Vorschaubild rechts */
@media (max-width: 599px) {
  .grid .card { display: grid; grid-template-columns: minmax(0, 1fr) 96px; grid-template-areas: "body media"; gap: 0 14px; }
  .grid .card-media { grid-area: media; margin: 4px 0 0; align-self: start; }
  .grid .card-media img { aspect-ratio: 1 / 1; }
  .grid .card-body { grid-area: body; }
  .grid .card-title { font-size: 1.12rem; }
  .grid .card-teaser { font-size: .95rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
}

/* ---------- Stern und Lesezeichen ---------- */
.marks { display: inline-flex; gap: 10px; align-items: center; }
.mark {
  border: 0; background: none; padding: 4px; margin: -4px; cursor: pointer; color: var(--muted);
  display: inline-flex; border-radius: 4px;
}
.mark svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.mark:hover { color: var(--ink); }
.mark.is-on svg { fill: currentColor; }
.star.is-on { color: var(--star); }
.later.is-on { color: var(--accent); }
.mark:focus-visible, .button:focus-visible, .button-quiet:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Teilen ---------- */
.share-panel { background: var(--surface); padding: 12px 14px; margin: -8px 0 20px; font-size: .88rem; }
.share-text { margin: 0 0 8px; color: var(--ink-soft); }
.share-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.share-row input {
  flex: 1; min-width: 0; font: .85rem var(--sans); padding: 9px 10px;
  border: 1px solid var(--rule); border-radius: 3px; background: var(--bg); color: var(--ink);
}
.share-row-small { margin-top: 8px; gap: 16px; }
.warnlink { color: var(--warn); }

/* ---------- Geteilte Seite ---------- */
.shared-masthead { border-bottom: 1px solid var(--rule-strong); margin-bottom: 8px; }
.shared-top { display: flex; justify-content: space-between; align-items: baseline; padding-top: 8px; }
.wordmark-small { font-size: 1.9rem; padding: 6px 0 10px; text-align: left; }
.shared-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.gone-text { font-family: var(--serif); font-size: 1.1rem; text-align: center; color: var(--ink-soft); }

/* ---------- Artikel ---------- */
.story { max-width: 720px; margin: 0 auto; }
.kicker-lg { font-size: .82rem; }
.story-title {
  font-family: var(--serif); font-weight: 700; font-optical-sizing: auto;
  font-size: clamp(1.9rem, 5vw, 2.9rem); line-height: 1.1; letter-spacing: -.018em;
  margin: 6px 0 14px; overflow-wrap: break-word;
  hyphens: auto; -webkit-hyphens: auto;
}
.story-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .88rem; color: var(--muted); }
.story-meta .author { color: var(--ink); font-weight: 500; }
.story-actions {
  display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center;
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  margin: 14px 0 20px; padding: 10px 0;
}
.story-actions .marks { margin-right: 4px; }
.story-actions .mark { margin: 0; }
.story-hero { margin: 0 0 18px; }
.story-hero img { width: 100%; display: block; }
.fulltext-note { font-size: .82rem; color: var(--muted); margin-bottom: 14px; }
.fulltext-note.is-loading::before {
  content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 8px; vertical-align: -1px;
  border: 2px solid var(--rule); border-top-color: var(--accent); border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .fulltext-note.is-loading::before { animation: none; } }

.story-body {
  font-family: var(--serif); font-size: 1.16rem; line-height: 1.65; color: var(--ink);
  overflow-wrap: break-word;
}
@media (min-width: 768px) { .story-body { font-size: 1.22rem; } }
.story-body p { margin: 0 0 1.05em; }
.story-body h2, .story-body h3, .story-body h4 { font-family: var(--serif); line-height: 1.25; margin: 1.6em 0 .5em; }
.story-body h2 { font-size: 1.35em; }
.story-body h3 { font-size: 1.15em; }
.story-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.story-body img { display: block; margin: 1.2em 0 .4em; width: auto; max-width: 100%; }
.story-body img[width="1"], .story-body img[height="1"] { display: none; }
.story-body figure { margin: 1.4em 0; }
.story-body figcaption { font-family: var(--sans); font-size: .82rem; color: var(--muted); line-height: 1.4; }
.story-body blockquote { margin: 1.4em 0; padding-left: 1em; border-left: 3px solid var(--rule-strong); font-style: italic; }
.story-body ul, .story-body ol { padding-left: 1.3em; margin: 0 0 1.05em; }
.story-body li { margin-bottom: .35em; }
.story-body pre { font-size: .8em; overflow-x: auto; background: var(--surface); padding: 12px; }
.story-body table { display: block; overflow-x: auto; border-collapse: collapse; font-family: var(--sans); font-size: .85rem; margin: 1.2em 0; }
.story-body td, .story-body th { border: 1px solid var(--rule); padding: 6px 8px; }
.story-body hr { border: 0; border-top: 1px solid var(--rule); margin: 2em 0; }
.story-foot { border-top: 1px solid var(--rule-strong); margin-top: 32px; padding-top: 14px; font-size: .92rem; }
.story-foot a { color: var(--accent); }

/* ---------- Schaltflaechen ---------- */
.button, .button-quiet, .searchbar button {
  font: 500 .88rem/1 var(--sans); cursor: pointer; border-radius: 3px; padding: 10px 14px;
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
}
.button, .searchbar button { background: var(--ink); color: var(--bg); border: 1px solid var(--ink); }
.button:hover, .searchbar button:hover { text-decoration: none; opacity: .88; }
.button-quiet { background: transparent; color: var(--ink); border: 1px solid var(--rule); padding: 8px 12px; }
.button-quiet:hover { border-color: var(--ink); text-decoration: none; }
.linkbutton { border: 0; background: none; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actions form, .page-action { margin: 0; }

/* ---------- Suche ---------- */
.searchbar { display: flex; gap: 8px; margin-bottom: 8px; }
.searchbar input {
  flex: 1; min-width: 0; font: 1.1rem var(--serif); padding: 10px 12px;
  border: 1px solid var(--rule-strong); border-radius: 3px; background: var(--bg); color: var(--ink);
}
.search-hint { font-size: .82rem; color: var(--muted); margin: 0 0 22px; }
.search-tools { display: flex; justify-content: space-between; align-items: center; font-size: .88rem; color: var(--muted); border-bottom: 1px solid var(--rule); padding-bottom: 8px; }
.sortswitch { display: flex; gap: 12px; }
.sortswitch a.is-active { color: var(--ink); font-weight: 600; }
.results { list-style: none; margin: 0; padding: 0; max-width: 820px; }
.result { border-bottom: 1px solid var(--rule); padding: 16px 0; }
.result-title { font-family: var(--serif); font-size: 1.25rem; line-height: 1.25; margin: 0 0 6px; }
.result-snippet { font-family: var(--serif); color: var(--ink-soft); margin: 0 0 8px; }
mark { background: var(--mark); color: inherit; padding: 0 1px; }

/* ---------- Status, Tabellen ---------- */
.panel { border-top: 1px solid var(--rule); padding: 16px 0 22px; max-width: 880px; }
.panel h2 { font-family: var(--serif); font-size: 1.3rem; margin: 0 0 10px; }
.panel h3 { font-size: .95rem; margin: 18px 0 6px; }
.notice { background: var(--surface); border-left: 3px solid var(--accent); padding: 10px 14px; margin-bottom: 18px; }
.facts { display: grid; grid-template-columns: minmax(0, 13em) minmax(0, 1fr); gap: 6px 16px; margin: 0; font-size: .92rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
@media (max-width: 520px) { .facts { grid-template-columns: 1fr; gap: 0; } .facts dd { margin-bottom: 8px; } }
.meter { height: 8px; background: var(--surface); border-radius: 4px; overflow: hidden; margin-bottom: 14px; max-width: 420px; }
.meter-bar { height: 100%; width: 0; background: var(--accent); }
.table-wrap { overflow-x: auto; }
.datatable { width: 100%; border-collapse: collapse; font-size: .88rem; }
.datatable th { text-align: left; font-weight: 600; border-bottom: 1px solid var(--rule-strong); padding: 6px 10px 6px 0; white-space: nowrap; }
.datatable td { border-bottom: 1px solid var(--rule); padding: 7px 10px 7px 0; vertical-align: top; }
.datatable .num { text-align: right; font-variant-numeric: tabular-nums; }
.datatable a { color: var(--accent); }
.errorlist { margin: 0; padding-left: 1.1em; font-size: .9rem; }
.errorlist a { color: var(--accent); }
.raw { font-size: .78rem; background: var(--surface); padding: 14px; overflow-x: auto; white-space: pre-wrap; word-break: break-word; }

.empty { padding: 40px 0; font-family: var(--serif); font-size: 1.15rem; color: var(--ink-soft); }
.empty a { color: var(--accent); text-decoration: underline; }

.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 32px; border-top: 1px solid var(--rule-strong); padding-top: 12px; font-weight: 500; }
.pager a { color: var(--accent); }
.pager-num { color: var(--muted); font-size: .88rem; }

.site-footer { border-top: 1px solid var(--rule); color: var(--muted); font-size: .8rem; padding: 18px 0 calc(18px + env(safe-area-inset-bottom)); }
.footer-inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.footer-inner form { margin: 0; }

/* ---------- Anmeldung ---------- */
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-box { width: 100%; max-width: 340px; }
.login-box .wordmark { padding-bottom: 24px; }
.login-box form { display: grid; gap: 10px; }
.login-box label { font-size: .85rem; color: var(--muted); }
.login-box input {
  font: 1rem var(--sans); padding: 11px 12px; border: 1px solid var(--rule-strong);
  border-radius: 3px; background: var(--bg); color: var(--ink);
}
.login-box .button { justify-content: center; padding: 12px; }
