/* KI-Briefing – Styles. Hell/Dunkel über CSS-Variablen; Dunkel folgt dem System, Umschalter überschreibt. */

:root {
  color-scheme: light;
  --bg: #f6f6f4;
  --surface: #ffffff;
  --surface-2: #efefec;
  --border: #e2e2de;
  --text: #191919;
  --text-2: #5f5f5f;
  --text-3: #8a8a8a;
  --accent: #257de0;
  --accent-soft: #e3effc;
  --bar-muted: #a9c9f1;
  --good: #008a17;
  --warn: #b37a00;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04);
  --radius: 14px;
  --maxw: 980px;
  --player-h: 0px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #111214; --surface: #1a1b1e; --surface-2: #232428; --border: #2c2d32;
    --text: #efefef; --text-2: #a8a8a8; --text-3: #7c7c7c;
    --accent: #338ced; --accent-soft: #16263a; --bar-muted: #2a4a70;
    --good: #0aac23; --warn: #d28e05;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 18px rgba(0,0,0,.25);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111214; --surface: #1a1b1e; --surface-2: #232428; --border: #2c2d32;
  --text: #efefef; --text-2: #a8a8a8; --text-3: #7c7c7c;
  --accent: #338ced; --accent-soft: #16263a; --bar-muted: #2a4a70;
  --good: #0aac23; --warn: #d28e05;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 18px rgba(0,0,0,.25);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); overflow-x: hidden; }
body { overflow-wrap: break-word; }
.card, .grid > * { min-width: 0; }
code { overflow-wrap: anywhere; }
body { line-height: 1.5; -webkit-font-smoothing: antialiased; padding-bottom: calc(var(--player-h) + 72px + env(safe-area-inset-bottom)); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: clamp(1.45rem, 3.6vw, 2.05rem); letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; margin: 2rem 0 .75rem; display: flex; align-items: center; gap: .5rem; }
h3 { font-size: 1rem; }
p { margin: .4rem 0; }
ul, ol { padding-left: 1.2rem; margin: .4rem 0; }
li { margin: .2rem 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* Kopfzeile */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem;
  padding: .7rem max(1rem, calc((100vw - var(--maxw)) / 2)); padding-top: calc(.7rem + env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--text); font-size: 1.05rem; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: .25rem; margin-left: auto; }
.nav a { color: var(--text-2); padding: .35rem .7rem; border-radius: 999px; font-size: .92rem; }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { color: var(--text); background: var(--surface-2); font-weight: 600; }
.icon-btn { background: transparent; border: 0; border-radius: 10px; padding: .35rem .55rem; color: var(--text-2); font-size: .95rem; min-width: 36px; min-height: 36px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* Untere Tab-Leiste (Handy) */
.tabbar { display: none; }
@media (max-width: 760px) {
  .nav { display: none; }
  #theme-toggle { margin-left: auto; }
  .tabbar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px);
    border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: .45rem 0 .5rem; font-size: .7rem; color: var(--text-3); }
  .tabbar a span { font-size: 1.1rem; line-height: 1.2; }
  .tabbar a.active { color: var(--accent); }
  .tabbar a:hover { text-decoration: none; }
  .player { bottom: calc(56px + env(safe-area-inset-bottom)) !important; }
}

main { max-width: var(--maxw); margin: 0 auto; padding: 1.25rem 1rem 2rem; outline: none; }
.loading, .empty { color: var(--text-2); padding: 3rem 0; text-align: center; }

/* Bausteine */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.muted { color: var(--text-2); }
.small { font-size: .85rem; }
.tiny { font-size: .76rem; }
.row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.spacer { flex: 1; }
.card > .row:first-child { flex-wrap: nowrap; align-items: flex-start; }
.card > .row:first-child > h3 { flex: 1 1 auto; min-width: 0; }
.card > .row:first-child > .spacer { display: none; }
.card > .row:first-child > .status { margin-top: .15rem; flex: none; }
.grid { display: grid; gap: .8rem; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .6rem; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: .78rem; border: 1px solid transparent; white-space: nowrap; }
button.chip:hover { border-color: var(--border); color: var(--text); }
.chip.on { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.badge { display: inline-block; padding: .05rem .45rem; border-radius: 6px; font-size: .72rem; font-weight: 600; background: var(--surface-2); color: var(--text-2); }
.badge.rel-hi { background: var(--accent-soft); color: var(--accent); }
.pill-btn { background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: .25rem .7rem; font-size: .82rem; font-weight: 600; }
.pill-btn:hover { border-color: var(--text-3); }
.btn { display: inline-flex; align-items: center; gap: .4rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: .4rem .8rem; font-size: .88rem; color: var(--text); }
.btn:hover { border-color: var(--text-3); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.on { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }

/* Tageskopf */
.daybar { display: flex; align-items: center; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
@media (max-width: 600px) { .daybar input[type=date] { width: 2.6rem; padding: .3rem; color: transparent; } .daybar input[type=date]::-webkit-datetime-edit { display: none; } }
.daybar .date-label { font-weight: 600; color: var(--text-2); font-size: .95rem; }
.daybar input[type=date] { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: .3rem .5rem; font: inherit; font-size: .85rem; }
.hero { padding: 1.4rem 1.4rem 1.2rem; }
.hero .kicker { text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; color: var(--accent); font-weight: 700; margin-bottom: .4rem; }
.hero .summary { color: var(--text-2); margin: .7rem 0 1rem; font-size: 1.02rem; }
.top3 { counter-reset: t; list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: .55rem; }
.top3 li { counter-increment: t; display: grid; grid-template-columns: 1.8rem 1fr; gap: .4rem; align-items: start; }
.top3 li::before { content: counter(t); width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .8rem; display: grid; place-items: center; margin-top: .1rem; }
.listen { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.listen .btn.primary { padding: .6rem 1.1rem; font-size: .95rem; }

/* Video-Karten */
.video { display: grid; grid-template-columns: 168px 1fr; gap: .9rem; padding: .85rem; }
.video .thumb { position: relative; display: block; border-radius: 10px; overflow: hidden; aspect-ratio: 16/9; background: var(--surface-2); }
.video .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.video .thumb .dur { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.78); color: #fff; font-size: .72rem; padding: 0 .35rem; border-radius: 4px; }
.video h3 { font-size: 1rem; margin: .15rem 0 .25rem; }
.video .orig { font-size: .78rem; color: var(--text-3); }
.video .kern { margin: .35rem 0; }
.video details { margin-top: .4rem; }
.video summary { cursor: pointer; color: var(--accent); font-size: .88rem; list-style: none; }
.video summary::-webkit-details-marker { display: none; }
.video summary::before { content: "▸ "; }
.video details[open] summary::before { content: "▾ "; }
.video .section-title { font-weight: 600; font-size: .85rem; margin: .8rem 0 .2rem; color: var(--text); }
.video .hype { margin-top: .6rem; padding: .45rem .7rem; border-radius: 8px; background: color-mix(in srgb, var(--warn) 12%, transparent); color: var(--text); font-size: .85rem; }
.video .actions { margin-top: .6rem; display: flex; gap: .4rem; flex-wrap: wrap; }
.video.seen { opacity: .62; }
@media (max-width: 600px) {
  .video { grid-template-columns: 1fr; }
  .hero { padding: 1.1rem; }
}
.moment { display: inline-flex; gap: .4rem; }
.moment a { font-variant-numeric: tabular-nums; font-weight: 600; }

/* Chancen */
.opp h3 { margin-bottom: .3rem; }
.opp .meta { display: flex; gap: .4rem; flex-wrap: wrap; margin: .3rem 0 .5rem; }
.opp ol { margin-top: .3rem; }
.level { font-weight: 600; }
.star { background: none; border: 0; font-size: 1.15rem; color: var(--text-3); padding: 0 .2rem; }
.star.on { color: var(--warn); }

/* Trends (Mini-Balken) */
.trend-row { display: grid; grid-template-columns: minmax(120px, 1.1fr) 3fr 4.5rem 4.5rem; gap: .8rem; align-items: center; padding: .55rem .2rem; border-bottom: 1px solid var(--border); }
.trend-row:last-child { border-bottom: 0; }
.trend-row .name { font-weight: 600; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trend-row .num { text-align: right; font-variant-numeric: tabular-nums; font-size: .9rem; }
.trend-head { font-size: .75rem; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.spark { display: flex; align-items: flex-end; gap: 2px; height: 30px; }
.spark .bar { flex: 1; min-width: 3px; background: var(--bar-muted); border-radius: 2px 2px 0 0; position: relative; }
.spark .bar.recent { background: var(--accent); }
.spark .bar.zero { background: var(--border); height: 2px !important; border-radius: 1px; }
.spark .hit { position: absolute; inset: -16px -1px 0; }
@media (max-width: 600px) { .trend-row { grid-template-columns: 1fr 2fr 3rem; } .trend-row .num.total { display: none; } }
.status { font-size: .72rem; font-weight: 600; padding: .05rem .45rem; border-radius: 6px; background: var(--surface-2); color: var(--text-2); }
.tooltip { position: fixed; z-index: 100; pointer-events: none; background: var(--text); color: var(--bg); font-size: .78rem; padding: .3rem .55rem; border-radius: 6px; white-space: nowrap; box-shadow: var(--shadow); }

/* Suche */
.searchbox { width: 100%; font: inherit; font-size: 1.05rem; padding: .7rem .9rem; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.result { padding: .7rem 0; border-bottom: 1px solid var(--border); }
.result:last-child { border-bottom: 0; }
mark { background: color-mix(in srgb, var(--accent) 25%, transparent); color: inherit; border-radius: 3px; padding: 0 .1rem; }

/* Archiv */
.tabs { display: flex; gap: .3rem; margin: .5rem 0 1rem; flex-wrap: wrap; }
.archive-item { display: grid; grid-template-columns: 9.5rem 1fr auto; gap: .8rem; align-items: center; padding: .7rem .2rem; border-bottom: 1px solid var(--border); color: var(--text); }
.archive-item:hover { background: var(--surface-2); text-decoration: none; }
.archive-item .when { font-weight: 600; font-size: .9rem; }
@media (max-width: 600px) { .archive-item { grid-template-columns: 1fr auto; } .archive-item .when { grid-column: 1 / -1; } }

/* Player */
.player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: color-mix(in srgb, var(--surface) 96%, transparent); backdrop-filter: blur(14px);
  border-top: 1px solid var(--border); padding: 0 max(.8rem, calc((100vw - var(--maxw)) / 2)) calc(.5rem + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 20px rgba(0,0,0,.08);
}
.player-progress input { width: 100%; margin: 0; accent-color: var(--accent); height: 18px; }
.player-row { display: flex; align-items: center; gap: .4rem; }
.play-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; font-size: 1.05rem; flex: none; }
.player-info { min-width: 0; flex: 1; padding: 0 .3rem; }
.player-title { font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-meta { font-size: .76rem; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.player-chapters { list-style: none; margin: .3rem 0 .2rem; padding: 0; max-height: 40vh; overflow: auto; border-top: 1px solid var(--border); }
.player-chapters li button { width: 100%; text-align: left; background: none; border: 0; padding: .45rem .3rem; display: flex; gap: .6rem; border-radius: 8px; font-size: .88rem; }
.player-chapters li button:hover { background: var(--surface-2); }
.player-chapters li.current button { color: var(--accent); font-weight: 600; }
.player-chapters .t { color: var(--text-3); font-variant-numeric: tabular-nums; min-width: 3.2rem; }
@media (max-width: 600px) { #p-back, #p-fwd { display: none; } }

.section-note { font-size: .85rem; color: var(--text-2); margin-top: -.4rem; margin-bottom: .8rem; }
.kurz-list { list-style: none; padding: 0; margin: 0; }
.kurz-list li { padding: .4rem 0; border-bottom: 1px solid var(--border); font-size: .92rem; }
.kurz-list li:last-child { border-bottom: 0; }
.footer-note { margin-top: 2.5rem; color: var(--text-3); font-size: .78rem; text-align: center; }

/* Einstellungen und Steuerung */
#settings-link { display: inline-grid; place-items: center; }
#settings-link:hover { text-decoration: none; }
#settings-link.active { color: var(--accent); background: var(--accent-soft); }
.page-title { font-size: 1.5rem; margin: .25rem 0 1rem; }
.settings-card { margin-bottom: 1rem; }
.settings-card h3 { margin: 0 0 .3rem; }
.settings-card .row { flex-wrap: nowrap; align-items: flex-start; }
.settings-card .grow { flex: 1; min-width: 0; }
.settings-card .pause-row { flex-wrap: wrap; align-items: center; margin-top: .6rem; }
.settings-card .pause-row input { font: inherit; padding: .25rem .4rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--text); }
.state-line { margin: .6rem 0 0; font-weight: 600; }
.switch { position: relative; display: inline-block; width: 48px; height: 28px; flex: none; margin-top: .15rem; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .slider { position: absolute; inset: 0; background: var(--border); border-radius: 999px; transition: background .2s; pointer-events: none; }
.switch .slider::before { content: ""; position: absolute; width: 22px; height: 22px; left: 3px; top: 3px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(20px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled + .slider { opacity: .5; }
.status-list { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1rem; margin: .4rem 0 0; font-size: .9rem; }
.status-list dt { color: var(--text-2); }
.status-list dd { margin: 0; }
@media (max-width: 600px) { .status-list { grid-template-columns: 1fr; gap: .1rem; } .status-list dd { margin-bottom: .5rem; } }
.banner { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); border-radius: var(--radius); padding: .7rem .9rem; margin: 0 0 1rem; font-size: .92rem; }
.banner.muted { background: var(--surface-2); border-color: var(--border); color: var(--text-2); }
.banner-text { flex: 1; min-width: 12rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
