:root {
  --akzent: #5b4cf0; --akzent-2: #7a6cff; --akzent-hell: #eeebff;
  --rot: #e5484d; --gruen: #2f9e5b; --gelb: #e9a23b;
  --hg: #f6f6f9; --flaeche: #ffffff; --flaeche-2: #f0f0f5; --linie: #e3e3ec;
  --text: #1c1c28; --grau: #6b6b80; --schatten: 0 1px 2px rgba(20,20,40,.06), 0 4px 16px rgba(20,20,40,.06);
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --akzent: #8b7dff; --akzent-2: #a094ff; --akzent-hell: #2a2550;
    --hg: #121218; --flaeche: #1b1b24; --flaeche-2: #24242f; --linie: #30303d;
    --text: #ececf3; --grau: #9a9ab0; --schatten: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--hg); color: var(--text); }
a { color: var(--akzent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 .5rem; line-height: 1.25; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .6rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
.grau { color: var(--grau); }
.klein { font-size: .85rem; }
.versteckt { display: none !important; }
code, pre { font-family: ui-monospace, Consolas, monospace; font-size: .85em; }
pre { background: var(--flaeche-2); padding: .8rem; border-radius: 8px; overflow: auto; white-space: pre-wrap; }

/* Kopf */
.kopf { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1.5rem; padding: .6rem 1.25rem;
  background: var(--flaeche); border-bottom: 1px solid var(--linie); }
.marke { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.1rem; color: var(--text); }
.marke:hover { text-decoration: none; }
.kopf nav { display: flex; gap: .25rem; }
.kopf nav a { padding: .4rem .75rem; border-radius: 8px; color: var(--grau); font-weight: 500; }
.kopf nav a.aktiv, .kopf nav a:hover { background: var(--flaeche-2); color: var(--text); text-decoration: none; }
.kopf-rechts { margin-left: auto; display: flex; align-items: center; gap: .75rem; }
.menue { position: relative; }
.menue summary { list-style: none; width: 34px; height: 34px; border-radius: 50%; background: var(--akzent); color: #fff;
  display: grid; place-items: center; font-weight: 700; cursor: pointer; text-transform: uppercase; }
.menue summary::-webkit-details-marker { display: none; }
.menue-inhalt { position: absolute; right: 0; top: 42px; background: var(--flaeche); border: 1px solid var(--linie); border-radius: 10px;
  box-shadow: var(--schatten); min-width: 220px; padding: .5rem; display: flex; flex-direction: column; }
.menue-inhalt > div { padding: .4rem .6rem .6rem; border-bottom: 1px solid var(--linie); margin-bottom: .3rem; }
.menue-inhalt a { padding: .45rem .6rem; border-radius: 6px; color: var(--text); }
.menue-inhalt a:hover { background: var(--flaeche-2); text-decoration: none; }

.seite { max-width: 1280px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
.schmal { max-width: 440px; margin: 8vh auto; padding: 0 1rem; }

/* Knöpfe & Formulare */
.knopf { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .5rem .95rem; border-radius: 9px;
  border: 1px solid var(--linie); background: var(--flaeche); color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
  white-space: nowrap; transition: background .12s, border-color .12s, transform .05s; }
.knopf:hover { background: var(--flaeche-2); text-decoration: none; }
.knopf:active { transform: translateY(1px); }
.knopf:disabled { opacity: .5; cursor: default; }
.knopf.primaer { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.knopf.primaer:hover { background: var(--akzent-2); }
.knopf.gefahr { color: var(--rot); }
.knopf.gefahr.voll { background: var(--rot); border-color: var(--rot); color: #fff; }
.knopf.klein { padding: .3rem .6rem; font-size: .85rem; border-radius: 7px; }
.knopf.rund { border-radius: 999px; }
.knopf .punkt, .punkt { width: 10px; height: 10px; border-radius: 50%; background: #ff5a5f; display: inline-block; }
.knopf.primaer .punkt { background: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,.35); }
label { display: block; font-weight: 600; font-size: .9rem; margin: .8rem 0 .3rem; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=search], input[type=datetime-local], input[type=number], select, textarea {
  width: 100%; padding: .55rem .7rem; border-radius: 8px; border: 1px solid var(--linie); background: var(--flaeche); color: var(--text); font: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--akzent); outline-offset: -1px; border-color: transparent; }
textarea { min-height: 80px; resize: vertical; }
.schalter { display: flex; align-items: center; gap: .6rem; font-weight: 500; margin: .6rem 0; cursor: pointer; }
.schalter input { width: 18px; height: 18px; accent-color: var(--akzent); }
.karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--schatten); }
.meldung { padding: .7rem .9rem; border-radius: 8px; margin: .8rem 0; background: var(--akzent-hell); }
.meldung.fehler { background: color-mix(in srgb, var(--rot) 15%, var(--flaeche)); color: var(--rot); }
.meldung.ok { background: color-mix(in srgb, var(--gruen) 15%, var(--flaeche)); }
.reihe { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.zwischen { justify-content: space-between; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid var(--linie); vertical-align: top; }
th { font-size: .8rem; color: var(--grau); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }

/* Bibliothek */
.bibliothek { display: grid; grid-template-columns: 220px 1fr; gap: 1.75rem; }
.seitenleiste a { display: flex; justify-content: space-between; padding: .45rem .7rem; border-radius: 8px; color: var(--text); }
.seitenleiste a.aktiv, .seitenleiste a:hover { background: var(--flaeche); text-decoration: none; box-shadow: var(--schatten); }
.seitenleiste h3 { font-size: .75rem; text-transform: uppercase; color: var(--grau); letter-spacing: .05em; margin: 1.2rem .7rem .4rem; }
.suche { display: flex; gap: .6rem; margin-bottom: 1.25rem; }
.suche input { max-width: 420px; }
.raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.25rem; }
.vkarte { background: var(--flaeche); border-radius: var(--radius); overflow: hidden; box-shadow: var(--schatten); border: 1px solid var(--linie);
  display: flex; flex-direction: column; position: relative; }
.vkarte:hover { border-color: var(--akzent); }
.vkarte .bild { position: relative; aspect-ratio: 16/9; background: linear-gradient(135deg, #2b2650, #5b4cf0); display: block; overflow: hidden; }
.vkarte .bild img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vkarte .bild .vorschau { position: absolute; inset: 0; opacity: 0; transition: opacity .15s; }
.vkarte:hover .bild .vorschau { opacity: 1; }
.vkarte .dauer { position: absolute; right: 8px; bottom: 8px; background: rgba(0,0,0,.75); color: #fff; font-size: .78rem; padding: 1px 6px; border-radius: 5px; font-weight: 600; }
.vkarte .status { position: absolute; left: 8px; top: 8px; }
.vkarte .text { padding: .75rem .9rem .85rem; }
.vkarte .titel { font-weight: 600; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vkarte .meta { font-size: .8rem; color: var(--grau); margin-top: .25rem; display: flex; gap: .6rem; flex-wrap: wrap; }
.vkarte .aktionen { position: absolute; top: 8px; right: 8px; display: none; gap: 4px; }
.vkarte:hover .aktionen { display: flex; }
.vkarte .aktionen button { background: rgba(0,0,0,.65); color: #fff; border: 0; border-radius: 7px; padding: 4px 8px; cursor: pointer; font-size: .8rem; }
.platzhalter-bild { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255,255,255,.85); font-size: .85rem; font-weight: 600; }
.abzeichen { display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--flaeche-2); color: var(--grau); }
.abzeichen.lauf { background: #fff4d6; color: #8a5a00; }
.abzeichen.fehler { background: #ffe1e1; color: #b42318; }
.abzeichen.privat { background: var(--flaeche-2); }
.leer { text-align: center; padding: 4rem 1rem; color: var(--grau); }
.leer .knopf { margin-top: 1rem; }

/* Videoseite */
.ansicht { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 1.5rem; max-width: 1500px; margin: 0 auto; padding: 1.25rem; }
.spieler-huelle { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16/9; }
.spieler-huelle video.haupt { width: 100%; height: 100%; display: block; background: #000; }
.spieler-huelle video::cue { background: rgba(0,0,0,.72); color: #fff; font-size: 1.05em; }
.blase-live { position: absolute; width: 22%; aspect-ratio: 1; border-radius: 50%; overflow: hidden; border: 3px solid #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,.4); pointer-events: none; }
.blase-live video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.blase-live.unten_links { left: 3%; bottom: 14%; } .blase-live.unten_rechts { right: 3%; bottom: 14%; }
.blase-live.oben_links { left: 3%; top: 3%; } .blase-live.oben_rechts { right: 3%; top: 3%; }
.blase-live.rund { border-radius: 18%; }
.cta { position: absolute; right: 16px; top: 16px; z-index: 3; }
.zeitleiste { position: relative; height: 26px; margin: .5rem 0 0; }
.zeitleiste .spur { position: absolute; left: 0; right: 0; top: 11px; height: 4px; background: var(--linie); border-radius: 2px; }
.zeitleiste .marke-k { position: absolute; top: 2px; transform: translateX(-50%); font-size: 13px; cursor: pointer; line-height: 1; }
.zeitleiste .marke-kap { position: absolute; top: 8px; width: 2px; height: 10px; background: var(--akzent); }
.zeitleiste .marke-schnitt { position: absolute; top: 9px; height: 8px; background: color-mix(in srgb, var(--rot) 55%, transparent); border-radius: 2px; }
.steuer { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: .6rem; }
.tempo button { border: 1px solid var(--linie); background: var(--flaeche); color: var(--text); padding: .25rem .5rem; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: .82rem; }
.tempo button.aktiv { background: var(--akzent); color: #fff; border-color: var(--akzent); }
.reaktionen { display: flex; gap: .2rem; margin-left: auto; }
.reaktionen button { border: 0; background: var(--flaeche); border-radius: 999px; width: 36px; height: 36px; font-size: 18px; cursor: pointer; box-shadow: var(--schatten); }
.reaktionen button:hover { transform: scale(1.12); }
.flieg { position: absolute; bottom: 60px; font-size: 32px; animation: flieg 1.6s ease-out forwards; pointer-events: none; z-index: 5; }
@keyframes flieg { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-160px); opacity: 0; } }
.titelzeile { margin-top: 1rem; display: flex; align-items: flex-start; gap: 1rem; }
.titelzeile h1 { flex: 1; }
.titelzeile h1[contenteditable=true] { outline: none; border-radius: 6px; padding: 0 .2rem; margin-left: -.2rem; }
.titelzeile h1[contenteditable=true]:hover, .titelzeile h1[contenteditable=true]:focus { background: var(--flaeche-2); }
.unterzeile { color: var(--grau); font-size: .88rem; display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.block { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: 1rem 1.1rem; margin-top: 1rem; }
.block h2 { margin-top: 0; font-size: 1rem; }
.zusammenfassung { white-space: pre-wrap; }
.leiste { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); display: flex; flex-direction: column;
  max-height: calc(100vh - 100px); position: sticky; top: 76px; overflow: hidden; }
.reiter { display: flex; border-bottom: 1px solid var(--linie); overflow-x: auto; scrollbar-width: none; }
.reiter::-webkit-scrollbar { display: none; }
.reiter button { flex: 1 0 auto; border: 0; background: none; padding: .7rem .55rem; font-size: .88rem; cursor: pointer; font: inherit; font-weight: 600; color: var(--grau);
  border-bottom: 2px solid transparent; white-space: nowrap; }
.reiter button.aktiv { color: var(--akzent); border-bottom-color: var(--akzent); }
.reiterinhalt { overflow: auto; padding: .75rem; flex: 1; }
.segment { display: flex; gap: .6rem; padding: .35rem .4rem; border-radius: 6px; cursor: pointer; }
.segment:hover { background: var(--flaeche-2); }
.segment.jetzt { background: var(--akzent-hell); }
.segment .zeit, .zeitlink { color: var(--akzent); font-variant-numeric: tabular-nums; font-size: .82rem; font-weight: 600; min-width: 42px; padding-top: 2px; cursor: pointer; }
.segment mark { background: #ffe58a; color: inherit; border-radius: 2px; }
.kommentar { padding: .6rem .3rem; border-bottom: 1px solid var(--linie); }
.kommentar .kopfzeile { display: flex; gap: .5rem; align-items: baseline; font-size: .85rem; }
.kommentar .name { font-weight: 700; }
.kommentar .antworten { margin-left: 1.2rem; border-left: 2px solid var(--linie); padding-left: .6rem; }
.kommentar .text { white-space: pre-wrap; margin-top: .15rem; }
.kommentar-form { border-top: 1px solid var(--linie); padding: .7rem; }
.kommentar-form textarea { min-height: 60px; }
.kapitel-eintrag { display: flex; gap: .7rem; padding: .45rem .4rem; border-radius: 6px; cursor: pointer; }
.kapitel-eintrag:hover { background: var(--flaeche-2); }
.ki-ergebnis { border: 1px solid var(--linie); border-radius: 10px; padding: .8rem; margin: .6rem 0; }
.ki-ergebnis .md { font-size: .9rem; }
.md h1, .md h2, .md h3 { font-size: 1rem; margin: .8rem 0 .3rem; }
.md ul, .md ol { padding-left: 1.3rem; margin: .3rem 0; }
.md p { margin: .4rem 0; }

/* Dialog */
dialog { border: 0; border-radius: 14px; padding: 0; background: var(--flaeche); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.35); width: min(560px, 94vw); }
dialog::backdrop { background: rgba(10,10,20,.5); }
dialog .d-kopf { padding: 1rem 1.25rem; border-bottom: 1px solid var(--linie); display: flex; justify-content: space-between; align-items: center; }
dialog .d-kopf h2 { margin: 0; }
dialog .d-inhalt { padding: .5rem 1.25rem 1.25rem; max-height: 70vh; overflow: auto; }
dialog .d-fuss { padding: .9rem 1.25rem; border-top: 1px solid var(--linie); display: flex; justify-content: flex-end; gap: .6rem; }
.x { border: 0; background: none; font-size: 1.4rem; cursor: pointer; color: var(--grau); }
.linkfeld { display: flex; gap: .5rem; }
.linkfeld input { font-family: ui-monospace, monospace; font-size: .85rem; }
.wahl { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.wahl label { margin: 0; border: 1px solid var(--linie); border-radius: 10px; padding: .6rem; cursor: pointer; font-weight: 500; font-size: .85rem; }
.wahl label:has(input:checked) { border-color: var(--akzent); background: var(--akzent-hell); }
.wahl input { display: none; }
.wahl b { display: block; font-size: .92rem; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: #1c1c28; color: #fff; padding: .65rem 1rem;
  border-radius: 10px; opacity: 0; pointer-events: none; transition: all .2s; z-index: 100; font-weight: 500; }
.toast.zeigen { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Aufnahme */
.rekorder { max-width: 980px; margin: 0 auto; padding: 1.5rem 1.25rem; display: grid; grid-template-columns: 1fr 340px; gap: 1.5rem; }
.vorschau-buehne { position: relative; background: #0c0c14; border-radius: var(--radius); aspect-ratio: 16/9; overflow: hidden; display: grid; place-items: center; color: #aaa; }
.vorschau-buehne video { max-width: 100%; max-height: 100%; }
.vorschau-buehne .blase-live { pointer-events: auto; cursor: move; width: 24%; }
.modi { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.modi button { border: 1px solid var(--linie); background: var(--flaeche); border-radius: 10px; padding: .7rem .4rem; cursor: pointer; font: inherit; font-weight: 600; font-size: .85rem; color: var(--text); }
.modi button.aktiv { border-color: var(--akzent); background: var(--akzent-hell); color: var(--akzent); }
.modi .sym { display: block; font-size: 1.4rem; margin-bottom: .2rem; }
.pegel { height: 6px; background: var(--flaeche-2); border-radius: 3px; overflow: hidden; margin-top: .3rem; }
.pegel div { height: 100%; width: 0; background: var(--gruen); transition: width .08s; }
.grosser-start { width: 100%; padding: .9rem; font-size: 1.05rem; margin-top: 1.2rem; }
.countdown { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(10,10,20,.55); z-index: 200; color: #fff; font-size: 9rem; font-weight: 800; }
.aufnahme-leiste { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #1c1c28; color: #fff; border-radius: 999px;
  padding: .5rem .6rem .5rem 1rem; display: flex; align-items: center; gap: .6rem; z-index: 150; box-shadow: 0 8px 30px rgba(0,0,0,.4); }
.aufnahme-leiste .uhr { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 52px; }
.aufnahme-leiste button { border: 0; background: rgba(255,255,255,.12); color: #fff; border-radius: 999px; height: 36px; min-width: 36px; padding: 0 .7rem; cursor: pointer; font: inherit; font-weight: 600; }
.aufnahme-leiste button.stopp { background: #ff5a5f; }
.aufnahme-leiste .rotpunkt { width: 10px; height: 10px; border-radius: 50%; background: #ff5a5f; animation: puls 1.2s infinite; }
.aufnahme-leiste.pausiert .rotpunkt { animation: none; background: #e9a23b; }
@keyframes puls { 50% { opacity: .3; } }
.hochlade-status { font-size: .8rem; opacity: .8; }
.notizen { width: 100%; min-height: 120px; }

@media (max-width: 960px) {
  .ansicht, .rekorder { grid-template-columns: 1fr; }
  .leiste { position: static; max-height: none; }
  .bibliothek { grid-template-columns: 1fr; }
  .seitenleiste { display: flex; gap: .3rem; overflow-x: auto; }
  .seitenleiste h3 { display: none; }
  .kopf { gap: .8rem; padding: .6rem .8rem; }
  .kopf nav { display: none; }
}

/* Einbettung */
body.einbettung { background: #000; }
body.einbettung .spieler-huelle { border-radius: 0; height: 100vh; aspect-ratio: auto; }
