:root {
  color-scheme: dark;
  --bg: #0b1120;
  --panel: #131c30;
  --panel-2: #1b2740;
  --border: #243047;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #3b82f6;
  --accent-h: #2563eb;
  --green: #22c55e;
  --red: #ef4444;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* Topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .8rem 1.2rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; letter-spacing: .3px; color: var(--text); text-decoration: none; }
.topbar nav { display: flex; align-items: center; gap: 1rem; }
.topbar nav a { color: var(--muted); text-decoration: none; }
.topbar nav a:hover { color: var(--text); }
.who { color: var(--muted); font-size: .9rem; }
.inline { display: inline; margin: 0; }
.linkbtn {
  background: none; border: none; color: var(--accent);
  cursor: pointer; font: inherit; padding: 0;
}
.linkbtn:hover { color: var(--accent-h); }

/* Layout */
.wrap { max-width: 880px; margin: 2rem auto; padding: 0 1.2rem; }
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.8rem;
}
.card.narrow { max-width: 420px; margin: 3rem auto; }
h1 { font-size: 1.4rem; margin: 0 0 1rem; }
.row-between { display: flex; align-items: center; justify-content: space-between; }
.hint { color: var(--muted); font-weight: 400; font-size: .85rem; }

/* Forms */
label { display: block; margin: 0 0 1rem; font-size: .9rem; color: var(--muted); }
input, select {
  display: block; width: 100%; margin-top: .35rem;
  padding: .6rem .7rem;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text); font: inherit;
}
input:focus, select:focus { outline: 2px solid var(--accent); border-color: transparent; }
.btn {
  display: inline-block;
  padding: .6rem 1.1rem;
  background: var(--accent); color: #fff;
  border: none; border-radius: 9px;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--accent-h); }

/* Table */
table.grid { width: 100%; border-collapse: collapse; margin-top: 1rem; }
table.grid th, table.grid td {
  text-align: left; padding: .6rem .5rem;
  border-bottom: 1px solid var(--border); font-size: .9rem;
}
table.grid th { color: var(--muted); font-weight: 600; }

/* Badges */
.badge { padding: .15rem .55rem; border-radius: 999px; font-size: .75rem; }
.badge-active { background: rgba(34,197,94,.15); color: #4ade80; }
.badge-invited { background: rgba(59,130,246,.15); color: #60a5fa; }
.badge-disabled { background: rgba(148,163,184,.15); color: var(--muted); }

/* Flash */
.flash { padding: .7rem .9rem; border-radius: 9px; margin-bottom: 1rem; font-size: .9rem; }
.flash-error { background: rgba(239,68,68,.12); color: #fca5a5; border: 1px solid rgba(239,68,68,.3); }
.flash-success { background: rgba(34,197,94,.12); color: #86efac; border: 1px solid rgba(34,197,94,.3); }
.flash-info { background: rgba(59,130,246,.12); color: #93c5fd; border: 1px solid rgba(59,130,246,.3); }

.copybox {
  display: block; margin-top: .5rem; padding: .55rem .7rem;
  background: #0b1120; border: 1px solid var(--border); border-radius: 8px;
  font-family: ui-monospace, monospace; font-size: .82rem; word-break: break-all;
}

/* --- Phase 4 --- */
h2 { font-size: 1.1rem; margin: 1rem 0 .6rem; }
.muted { color: var(--muted); }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--panel-2); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
textarea {
  display: block; width: 100%; margin-top: .35rem; padding: .6rem .7rem;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px;
  color: var(--text); font: inherit; resize: vertical;
}
textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
.sep { border: none; border-top: 1px solid var(--border); margin: 1.6rem 0; }
.chapter-add { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-top: 1rem; }
.chapter-add input { margin-top: 0; width: auto; flex: 1 1 160px; }
.chapter-add .t-time { flex: 0 0 110px; }
.chapter-add .btn { flex: 0 0 auto; }
.linkbtn.danger { color: #f87171; }
code { background: #0b1120; padding: .1rem .35rem; border-radius: 5px; font-family: ui-monospace, monospace; font-size: .85em; }
.badge-uploaded { background: rgba(148,163,184,.15); color: #cbd5e1; }
.badge-transcoding { background: rgba(234,179,8,.15); color: #fcd34d; }
.badge-ready { background: rgba(34,197,94,.15); color: #4ade80; }
.badge-error { background: rgba(239,68,68,.15); color: #fca5a5; }

/* --- Phase 6: Galerie + Player --- */
.gallery-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }
.gallery-head h1 { margin: 0; }
.filter-input { width: auto; min-width: 240px; flex: 1 1 240px; max-width: 360px; margin: 0; }
.year { color: var(--muted); font-size: .95rem; text-transform: uppercase; letter-spacing: 1px; margin: 1.6rem 0 .8rem; border-bottom: 1px solid var(--border); padding-bottom: .4rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.2rem; }
.vcard { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.poster { position: relative; display: block; aspect-ratio: 16/9; background: #0b1120; }
.poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.poster img.noimg { visibility: hidden; }
.poster .dur { position: absolute; right: .5rem; bottom: .5rem; background: rgba(0,0,0,.75); color: #fff; font-size: .75rem; padding: .1rem .4rem; border-radius: 4px; }
.vbody { padding: .9rem 1rem 1rem; display: flex; flex-direction: column; gap: .3rem; }
.vtitle { font-weight: 600; color: var(--text); text-decoration: none; font-size: 1.05rem; }
.vtitle:hover { color: var(--accent); }
.talks { list-style: none; margin: .5rem 0 0; padding: 0; max-height: 220px; overflow: auto; }
.talks .talk a { display: flex; gap: .5rem; padding: .35rem .4rem; border-radius: 7px; text-decoration: none; font-size: .88rem; }
.talks .talk a:hover { background: var(--panel-2); }
.talks .t, .chlist .t { color: var(--accent); font-variant-numeric: tabular-nums; flex: 0 0 auto; min-width: 3.2rem; }
.talks .tt, .chlist .tt { color: var(--text); }

.watch .back { color: var(--muted); text-decoration: none; font-size: .9rem; }
.watch .back:hover { color: var(--text); }
.watch h1 { margin: .6rem 0 .2rem; }
.player-wrap { margin-top: 1rem; background: #000; border-radius: 12px; overflow: hidden; }
#player { width: 100%; max-height: 72vh; display: block; background: #000; }
.fallback { background: rgba(239,68,68,.12); color: #fca5a5; padding: .8rem; border-radius: 9px; margin-top: .8rem; }
.watch-grid { display: grid; grid-template-columns: 1fr 320px; gap: 1.5rem; margin-top: 1.2rem; align-items: start; }
.chapters-side { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 1rem; }
.chapters-side h2 { margin: 0 0 .6rem; font-size: 1rem; }
.chlist { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow: auto; }
.chlist a { display: flex; gap: .5rem; padding: .45rem .4rem; border-radius: 7px; text-decoration: none; }
.chlist a:hover { background: var(--panel-2); }
.desc p { color: var(--muted); }
@media (max-width: 760px) { .watch-grid { grid-template-columns: 1fr; } }

/* "Alle Vortraege"-Kachel (aufklappbar) */
.alltalks { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; margin: 0 0 1.4rem; overflow: hidden; }
.alltalks-head { width: 100%; display: flex; align-items: center; gap: .7rem; padding: 1rem 1.2rem; background: none; border: none; color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.alltalks-head:hover { background: var(--panel-2); }
.at-icon { font-size: 1.15rem; }
.at-title { font-weight: 600; font-size: 1.05rem; }
.at-count { background: var(--accent); color: #fff; border-radius: 999px; padding: .05rem .55rem; font-size: .8rem; }
.at-hint { color: var(--muted); font-size: .8rem; }
.at-chevron { margin-left: auto; transition: transform .3s ease; color: var(--muted); }
.alltalks.open .at-chevron { transform: rotate(180deg); }
.alltalks-body { max-height: 0; overflow: hidden; transition: max-height .35s ease; }
.alltalks.open .alltalks-body { max-height: 75vh; overflow: auto; }
.alltalks-inner { padding: .2rem 1.2rem 1.1rem; }
.at-group { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .5px; margin: 1rem 0 .35rem; padding-top: .6rem; border-top: 1px solid var(--border); }
.at-group:first-child { border-top: none; padding-top: 0; margin-top: .2rem; }
.at-talk { display: flex; gap: .6rem; padding: .4rem .5rem; border-radius: 7px; text-decoration: none; }
.at-talk:hover { background: var(--panel-2); }
.at-talk .t { color: var(--accent); font-variant-numeric: tabular-nums; flex: 0 0 auto; min-width: 3.2rem; }
.at-talk .tt { color: var(--text); }
@media (max-width: 560px) { .at-hint { display: none; } }
