/* Politik Lernportal: Stylesheet. Farben als Variablen oben, helles und dunkles Design. */
[hidden] { display: none !important; }
/* Layout: Kopfzeile mit Countdown, Hauptbereich mit Inhaltsspalte; mobil Tab-Leiste unten.
   Palette: Tafelgrün-Petrol (Kap. 2) und Kreide-Orange (Kap. 3), Neutrals mit Petrol-Stich.
   Schrift: Space Grotesk für Überschriften, Inter für Text. */
:root {
  color-scheme: light;
  --bg: #eef3f4; --surface: #ffffff; --surface2: #e5edef; --ink: #11262c; --ink2: #50666d; --line: #d2dee1;
  --accent: #0b7a83; --accent-ink: #ffffff; --accent-soft: #d5edef;
  --k2: #0b7a83; --k2-soft: #d5edef; --k3: #c5600f; --k3-soft: #fbe5d3; --k0: #5b6b9a; --k0-soft: #e1e5f2;
  --good: #23803a; --good-soft: #dcf0e0; --bad: #bb3326; --bad-soft: #f8dfdb; --warn: #94650f; --warn-soft: #f6e9c8;
  --shadow: 0 1px 2px rgba(17,38,44,.06), 0 6px 18px rgba(17,38,44,.06);
  --f-head: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-body: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --nav-h: 62px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0c181c; --surface: #14262b; --surface2: #1c3238; --ink: #e6f1f3; --ink2: #9fb6bc; --line: #2b454c;
  --accent: #4fc3cc; --accent-ink: #062a2e; --accent-soft: #14393f;
  --k2: #4fc3cc; --k2-soft: #14393f; --k3: #f0985a; --k3-soft: #442a16; --k0: #9fb0e6; --k0-soft: #252c4a;
  --good: #6cc77a; --good-soft: #17381f; --bad: #f08376; --bad-soft: #451e19; --warn: #e5b85c; --warn-soft: #3d2f10;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 18px rgba(0,0,0,.25); color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #0c181c; --surface: #14262b; --surface2: #1c3238; --ink: #e6f1f3; --ink2: #9fb6bc; --line: #2b454c;
  --accent: #4fc3cc; --accent-ink: #062a2e; --accent-soft: #14393f;
  --k2: #4fc3cc; --k2-soft: #14393f; --k3: #f0985a; --k3-soft: #442a16; --k0: #9fb0e6; --k0-soft: #252c4a;
  --good: #6cc77a; --good-soft: #17381f; --bad: #f08376; --bad-soft: #451e19; --warn: #e5b85c; --warn-soft: #3d2f10;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 18px rgba(0,0,0,.25); color-scheme: dark; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.55; -webkit-text-size-adjust: 100%; }
h1, h2, h3, h4 { font-family: var(--f-head); line-height: 1.2; margin: 0; text-wrap: balance; letter-spacing: -.01em; }
h1 { font-size: 1.9rem; } h2 { font-size: 1.35rem; } h3 { font-size: 1.1rem; } h4 { font-size: 1rem; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink2); }
.small { font-size: .85rem; }
.tiny { font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; font-weight: 600; color: var(--ink2); }
.num { font-variant-numeric: tabular-nums; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.sm { gap: 8px; } .stack.lg { gap: 24px; }
.grow { flex: 1 1 0; min-width: 0; }

/* Header + nav */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--surface); }
.top-in { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; gap: 14px; min-height: 56px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.brand { font-family: var(--f-head); font-weight: 700; font-size: 1.1rem; display: flex; align-items: center; gap: 9px; white-space: nowrap; background: none; border: 0; padding: 0; }
.brand svg { color: var(--accent); }
.countdown-pill { margin-left: auto; font-size: .82rem; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 4px 11px; font-weight: 600; white-space: nowrap; border: 0; }
.iconbtn { background: none; border: 1px solid var(--line); border-radius: 8px; width: 36px; height: 36px; display: grid; place-items: center; color: var(--ink2); }
.iconbtn:hover { background: var(--surface2); }
nav.tabs { display: flex; }
nav.tabs button { background: none; border: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px 4px; font-size: .68rem; font-weight: 600; color: var(--ink2); flex: 1 1 0; min-width: 0; }
nav.tabs button svg { width: 22px; height: 22px; }
nav.tabs button[aria-current="page"] { color: var(--accent); }
@media (max-width: 859px) {
  nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: var(--surface); border-top: 1px solid var(--line); padding: 0 env(safe-area-inset-left, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-right, 0px); height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px)); }
  main { padding-bottom: calc(var(--nav-h) + 24px); }
}
@media (min-width: 860px) {
  nav.tabs { order: 2; gap: 2px; margin-left: 12px; }
  nav.tabs button { flex-direction: row; font-size: .88rem; padding: 8px 12px; gap: 7px; border-radius: 8px; flex: 0 0 auto; }
  nav.tabs button svg { width: 18px; height: 18px; }
  nav.tabs button[aria-current="page"] { background: var(--accent-soft); }
  .countdown-pill { margin-left: 12px; order: 3; }
  .top-in .iconbtn { order: 4; }
  .top-in .spacer { order: 1; flex: 1; }
}
@media (max-width: 859px) { .top-in .spacer { display: none; } }

main { max-width: 1100px; margin: 0 auto; padding-top: 22px; padding-bottom: 60px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); min-height: 70vh; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.view-head p { color: var(--ink2); max-width: 60ch; margin-top: 4px; }

/* Surfaces */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.panel.flat { box-shadow: none; }
.panel.tint { background: var(--accent-soft); border-color: transparent; box-shadow: none; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); }
.split { display: grid; gap: 18px; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
@media (max-width: 859px) { .split { grid-template-columns: minmax(0, 1fr); } }

/* Buttons */
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 9px; padding: 9px 15px; font-weight: 600; font-size: .92rem; display: inline-flex; align-items: center; gap: 8px; justify-content: center; text-align: center; transition: background .12s, transform .06s; }
.btn:hover { background: var(--surface2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.soft { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 5px 10px; font-size: .82rem; }
.btn.lg { padding: 12px 20px; font-size: 1rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; flex: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 10px; font-size: .78rem; font-weight: 600; background: var(--surface2); color: var(--ink2); border: 0; white-space: nowrap; }
.chip.k2 { background: var(--k2-soft); color: var(--k2); } .chip.k3 { background: var(--k3-soft); color: var(--k3); } .chip.k0 { background: var(--k0-soft); color: var(--k0); }
.chip.good { background: var(--good-soft); color: var(--good); } .chip.bad { background: var(--bad-soft); color: var(--bad); } .chip.warn { background: var(--warn-soft); color: var(--warn); }
button.chip { cursor: pointer; } button.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

/* Tabs inside view */
.subtabs { display: flex; gap: 4px; background: var(--surface2); padding: 4px; border-radius: 10px; width: fit-content; max-width: 100%; overflow-x: auto; }
.subtabs button { background: none; border: 0; padding: 7px 14px; border-radius: 7px; font-weight: 600; font-size: .88rem; color: var(--ink2); white-space: nowrap; }
.subtabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* Meters */
.bar { height: 8px; background: var(--surface2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s; }
.bar.k3 > i { background: var(--k3); } .bar.k0 > i { background: var(--k0); }
.bar.good > i { background: var(--good); } .bar.bad > i { background: var(--bad); } .bar.warn > i { background: var(--warn); }

/* Hero */
.hero { display: grid; gap: 22px; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px; box-shadow: var(--shadow); }
@media (max-width: 700px) { .hero { grid-template-columns: minmax(0, 1fr); } }
.cd { display: flex; gap: 10px; margin: 12px 0; }
.cd div { background: var(--surface2); border-radius: 10px; padding: 8px 12px; min-width: 66px; text-align: center; }
.cd b { display: block; font-family: var(--f-head); font-size: 1.9rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.cd span { font-size: .7rem; color: var(--ink2); text-transform: uppercase; letter-spacing: .06em; }
.ringwrap { display: flex; gap: 16px; align-items: center; justify-content: center; }
.ring { width: 130px; height: 130px; flex: none; }
.ring text { font-family: var(--f-head); font-weight: 700; fill: var(--ink); }

/* Topic tiles */
.tile { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
button.tile:hover { border-color: var(--accent); }
.tile h4 { font-size: .95rem; }
.tile .nr { font-size: .72rem; font-weight: 700; letter-spacing: .05em; }
.tile.k2 .nr { color: var(--k2); } .tile.k3 .nr { color: var(--k3); } .tile.k0 .nr { color: var(--k0); }

/* Plan */
.plan-day { border-left: 3px solid var(--line); padding-left: 14px; display: flex; flex-direction: column; gap: 8px; }
.plan-day.today { border-color: var(--accent); }
.task { display: flex; gap: 10px; align-items: flex-start; }
.task input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.task.done label { text-decoration: line-through; color: var(--ink2); }
.task label { cursor: pointer; flex: 1; min-width: 0; }

/* Accordions */
details.know { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
details.know + details.know { margin-top: 8px; }
details.know summary { cursor: pointer; padding: 12px 16px; font-weight: 600; font-family: var(--f-head); list-style: none; display: flex; align-items: center; gap: 10px; }
details.know summary::-webkit-details-marker { display: none; }
details.know summary::before { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--ink2); border-bottom: 2px solid var(--ink2); transform: rotate(-45deg); transition: transform .15s; flex: none; }
details.know[open] summary::before { transform: rotate(45deg); }
details.know .body { padding: 0 16px 14px; max-width: 72ch; }
details.know .body ul, details.know .body ol { margin: 8px 0; padding-left: 20px; }
details.know .body li { margin: 4px 0; }

/* Quiz */
.qwrap { max-width: 760px; margin: 0 auto; }
.qhead { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.qhead .bar { flex: 1; }
.qtext { font-size: 1.2rem; font-family: var(--f-head); font-weight: 500; line-height: 1.35; }
.opts { display: flex; flex-direction: column; gap: 9px; margin-top: 16px; }
.opt { text-align: left; background: var(--surface); border: 1.5px solid var(--line); border-radius: 11px; padding: 12px 14px; display: flex; gap: 12px; align-items: flex-start; }
.opt:hover:not([disabled]) { border-color: var(--accent); background: var(--accent-soft); }
.opt .k { flex: none; width: 24px; height: 24px; border-radius: 6px; background: var(--surface2); display: grid; place-items: center; font-size: .78rem; font-weight: 700; color: var(--ink2); }
.opt.right { border-color: var(--good); background: var(--good-soft); } .opt.right .k { background: var(--good); color: #fff; }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); } .opt.wrong .k { background: var(--bad); color: #fff; }
.opt[disabled] { cursor: default; }
.fb { margin-top: 16px; border-radius: 12px; padding: 14px 16px; }
.fb.good { background: var(--good-soft); } .fb.bad { background: var(--bad-soft); }
.fb h4 { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.fb.good h4 { color: var(--good); } .fb.bad h4 { color: var(--bad); }
input.txt, textarea.txt, select.txt { width: 100%; border: 1.5px solid var(--line); background: var(--surface); border-radius: 10px; padding: 10px 12px; }
textarea.txt { min-height: 130px; resize: vertical; }
input.txt:focus, textarea.txt:focus { outline: none; border-color: var(--accent); }
.vizbox { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 14px; overflow-x: auto; }
.vizbox svg { display: block; max-width: 100%; height: auto; }
.vizbox .cap { font-size: .78rem; color: var(--ink2); margin-top: 6px; }
svg text { font-family: var(--f-body); fill: var(--ink2); }
.sortcard { background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; padding: 16px 18px; font-size: 1.05rem; min-height: 80px; display: flex; align-items: center; }
.buckets { display: grid; gap: 9px; margin-top: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.seq { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.seqitem { display: flex; gap: 10px; align-items: center; background: var(--surface); border: 1.5px solid var(--line); border-radius: 10px; padding: 9px 12px; }
.seqitem .n { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; font-size: .8rem; flex: none; }
.seqitem.ok { border-color: var(--good); background: var(--good-soft); } .seqitem.no { border-color: var(--bad); background: var(--bad-soft); }
.pool { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.pool button { background: var(--surface2); border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 12px; text-align: left; }
.pool button:hover { border-color: var(--accent); }

/* Flashcards */
.flash { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; min-height: 260px; padding: 28px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 14px; cursor: pointer; box-shadow: var(--shadow); width: 100%; }
.flash .front { font-family: var(--f-head); font-size: 1.6rem; font-weight: 700; }
.flash .back { font-size: 1.08rem; max-width: 52ch; }
.rate { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.boxes { display: flex; gap: 6px; align-items: flex-end; height: 56px; }
.boxes div { flex: 1; background: var(--accent-soft); border-radius: 6px 6px 0 0; display: flex; align-items: flex-start; justify-content: center; font-size: .72rem; font-weight: 700; color: var(--accent); padding-top: 3px; min-height: 18px; }

/* Chat */
.chat { display: flex; flex-direction: column; gap: 12px; height: min(50vh, 460px); min-height: 280px; overflow-y: auto; padding: 14px; background: var(--surface2); border-radius: 14px; }
.msg { max-width: 88%; padding: 10px 14px; border-radius: 14px; font-size: .95rem; overflow-wrap: anywhere; }
.msg.me { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.msg.ai { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg p + p, .msg ul + p, .msg p + ul { margin-top: 8px; } .msg ul, .msg ol { margin: 6px 0; padding-left: 20px; }
.compose { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; }
.compose textarea { flex: 1; min-height: 46px; max-height: 160px; resize: none; border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 13px; background: var(--surface); }
.compose textarea:focus { outline: none; border-color: var(--accent); }
.md p + p { margin-top: 8px; } .md ul, .md ol { margin: 6px 0; padding-left: 20px; } .md h4 { margin-top: 10px; }

/* Misc */
.stat b { font-family: var(--f-head); font-size: 1.7rem; display: block; line-height: 1.1; font-variant-numeric: tabular-nums; }
.badge { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.badge .ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--surface2); color: var(--ink2); flex: none; }
.badge.on .ic { background: var(--warn-soft); color: var(--warn); }
.badge:not(.on) { opacity: .6; }
table.t { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.t th, table.t td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink2); }
.scroll-x { overflow-x: auto; }
.diag3 { display: flex; gap: 4px; }
.diag3 button { width: 34px; height: 30px; border-radius: 7px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 700; }
.diag3 button[aria-pressed="true"].p { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.diag3 button[aria-pressed="true"].m { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.diag3 button[aria-pressed="true"].n { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 22px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 50; font-size: .9rem; box-shadow: var(--shadow); max-width: 90vw; }
@media (min-width: 860px) { .toast { bottom: 24px; } }
.spin { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.timer { font-family: var(--f-head); font-weight: 700; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.timer.low { color: var(--bad); }
.ew { display: flex; gap: 9px; align-items: flex-start; padding: 6px 0; }
.ew input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--ink2); margin-top: 6px; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.ai-tag { font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--k0); background: var(--k0-soft); padding: 2px 8px; border-radius: 99px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } html { scroll-behavior: auto; } }
