:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1e222b;
  --line: #2a2f3a;
  --text: #e6e8ee;
  --muted: #8b93a5;
  --accent: #5b8cff;
  --accent-2: #3d6fe6;
  --ok: #3ccf8e;
  --warn: #f5b84b;
  --danger: #ff6b6b;
  --marker: #ffcc4d;
  --radius: 8px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.btn { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; white-space: nowrap; }
.btn:hover { border-color: #3a4150; background: #252a35; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { color: var(--danger); }
.btn.icon { padding: 6px 9px; min-width: 34px; }
.btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=password], input[type=number], select, textarea {
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; gap: 8px; align-items: center; }
.grow { flex: 1; }
.tc { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; }

/* Kopfzeile */
.top { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel); min-height: 52px; }
.top .crumbs { display: flex; gap: 6px; align-items: center; min-width: 0; flex: 1; }
.top .crumbs a, .top .crumbs span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .crumbs .sep { color: var(--muted); }
.brand { font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }
.brand::before { content: ""; width: 22px; height: 22px; border-radius: 6px; background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M12 9l11 7-11 7z' fill='white'/%3E%3C/svg%3E") center/18px no-repeat; }

.page { max-width: 1280px; margin: 0 auto; padding: 24px 16px 64px; }
h1 { font-size: 20px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 24px 0 10px; }

/* Login */
.login { max-width: 340px; margin: 12vh auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 28px; display: grid; gap: 12px; }
.login h1 { text-align: center; }
.error { color: var(--danger); min-height: 1.2em; }

/* Listen / Karten */
.list { display: grid; gap: 8px; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.list-item:hover { border-color: #3a4150; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: var(--text); display: flex; flex-direction: column; }
.card:hover { border-color: var(--accent); text-decoration: none; }
.card .thumb { aspect-ratio: 9 / 16; background: #000 center/cover no-repeat; position: relative; }
.card .thumb .badge { position: absolute; top: 8px; left: 8px; }
.card .thumb .dur { position: absolute; bottom: 8px; right: 8px; background: #000a; padding: 1px 6px; border-radius: 4px; font-size: 12px; }
.card .meta { padding: 10px 12px; display: grid; gap: 2px; }
.card .meta b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); }
.badge.v { background: var(--accent); border-color: var(--accent); color: #fff; }
.badge.ok { color: var(--ok); }
.badge.warn { color: var(--warn); }
.badge.err { color: var(--danger); }

.drop { border: 2px dashed var(--line); border-radius: 12px; padding: 22px; text-align: center; color: var(--muted); margin-bottom: 20px; transition: .15s; }
.drop.over { border-color: var(--accent); color: var(--text); background: #5b8cff14; }
.uploads { display: grid; gap: 6px; margin-bottom: 16px; }
.up { display: grid; grid-template-columns: 1fr 160px 60px; gap: 10px; align-items: center; font-size: 13px; }
.bar { height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }

/* Player-Seite */
.player-page { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.stage { flex: 1; display: grid; grid-template-columns: 1fr 380px; min-height: 0; }
.viewer { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #08090c; }
.videos { flex: 1; min-height: 0; display: flex; justify-content: center; align-items: center; gap: 12px; padding: 14px; }
.vwrap { position: relative; height: 100%; max-width: 100%; aspect-ratio: 9 / 16; background: #000; }
.videos.compare .vwrap { max-width: calc(50% - 6px); }
.vwrap video { width: 100%; height: 100%; display: block; object-fit: contain; }
.vwrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.vwrap canvas.drawing { pointer-events: auto; cursor: crosshair; outline: 2px solid var(--marker); }
.vwrap .vlabel { position: absolute; top: 8px; left: 8px; }
.vwrap .placeholder { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 10px; padding: 20px; color: var(--muted); background: #000 center/cover; }
.vwrap .placeholder .bar { width: 180px; margin: 0 auto; }

.controls { padding: 6px 16px 12px; background: var(--panel); border-top: 1px solid var(--line); }
.timeline { position: relative; height: 34px; cursor: pointer; user-select: none; touch-action: none; }
.timeline .track { position: absolute; left: 0; right: 0; top: 18px; height: 6px; background: var(--panel-2); border-radius: 3px; }
.timeline .buffered { position: absolute; left: 0; top: 18px; height: 6px; background: #343a48; border-radius: 3px; }
.timeline .played { position: absolute; left: 0; top: 18px; height: 6px; background: var(--accent); border-radius: 3px; }
.timeline .sel { position: absolute; top: 15px; height: 12px; background: #ffcc4d40; border: 1px solid var(--marker); border-radius: 3px; pointer-events: none; }
.timeline .playhead { position: absolute; top: 12px; width: 2px; height: 18px; background: #fff; margin-left: -1px; pointer-events: none; }
.timeline .mk { position: absolute; top: 2px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--marker); border: 2px solid var(--panel); z-index: 2; }
.timeline .mk.resolved { background: var(--ok); opacity: .6; }
.timeline .mk.active { outline: 2px solid #fff; }
.timeline .mk-range { position: absolute; top: 7px; height: 3px; background: var(--marker); opacity: .7; border-radius: 2px; pointer-events: none; }
.timeline .hover { position: absolute; bottom: 38px; transform: translateX(-50%); pointer-events: none; background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 4px; text-align: center; z-index: 5; }
.timeline .hover .spr { background-repeat: no-repeat; border-radius: 3px; margin-bottom: 3px; }
.timeline .hover .txt { font-size: 12px; max-width: 220px; white-space: normal; }
.ctrl-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ctrl-row .time { padding: 0 8px; font-size: 15px; }
.ctrl-row select { padding: 5px 6px; }
.ctrl-row input[type=range] { width: 90px; accent-color: var(--accent); }

/* Kommentare */
.comments { display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--panel); min-height: 0; }
.comments .head { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.comments .head b { flex: 1; }
.clist { flex: 1; overflow-y: auto; padding: 8px; display: grid; gap: 6px; align-content: start; }
.cm { padding: 10px 12px; border-radius: var(--radius); background: var(--panel-2); border: 1px solid transparent; cursor: pointer; }
.cm:hover { border-color: var(--line); }
.cm.sel { border-color: var(--accent); }
.cm.current { box-shadow: inset 3px 0 0 var(--marker); }
.cm.resolved { opacity: .55; }
.cm .chead { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.cm .chead .author { font-weight: 600; }
.cm .chead .when { color: var(--muted); font-size: 12px; margin-left: auto; }
.cm .tcb { background: #ffcc4d22; color: var(--marker); border-radius: 4px; padding: 0 5px; font-size: 12px; }
.cm .body { white-space: pre-wrap; word-wrap: break-word; }
.cm .actions { display: flex; gap: 12px; margin-top: 6px; font-size: 12px; }
.cm .actions button { background: none; border: 0; padding: 0; color: var(--muted); }
.cm .actions button:hover { color: var(--text); }
.cm .replies { margin-top: 8px; padding-left: 10px; border-left: 2px solid var(--line); display: grid; gap: 6px; }
.cm .replies .author { font-weight: 600; }
.cm .reply-box { margin-top: 8px; display: flex; gap: 6px; }
.cm .reply-box input { flex: 1; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

.composer { border-top: 1px solid var(--line); padding: 10px; display: grid; gap: 8px; }
.composer textarea { resize: vertical; min-height: 64px; width: 100%; }
.composer .chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip { display: inline-flex; gap: 6px; align-items: center; background: var(--panel-2); border: 1px solid var(--line); border-radius: 99px; padding: 2px 10px; font-size: 12px; cursor: pointer; }
.chip.on { border-color: var(--marker); color: var(--marker); }
.chip .x { color: var(--muted); }
.swatch { width: 18px; height: 18px; border-radius: 50%; border: 2px solid transparent; padding: 0; }
.swatch.on { border-color: #fff; }

/* Dialoge */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 20px; width: min(480px, calc(100vw - 32px)); }
dialog::backdrop { background: #0009; }
dialog h3 { margin: 0 0 14px; }
dialog .form { display: grid; gap: 10px; }
dialog label.chk { display: flex; gap: 8px; align-items: center; }
dialog .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.copy { display: flex; gap: 6px; }
.copy input { flex: 1; }
.menu { position: relative; }
.menu .pop { position: absolute; right: 0; top: calc(100% + 4px); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 4px; z-index: 20; min-width: 240px; display: grid; }
.menu .pop a, .menu .pop button { padding: 8px 10px; border-radius: 6px; color: var(--text); background: none; border: 0; text-align: left; }
.menu .pop a:hover, .menu .pop button:hover { background: var(--panel); text-decoration: none; }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--panel-2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 8px; z-index: 100; box-shadow: 0 8px 30px #0008; }

table { width: 100%; border-collapse: collapse; }
td, th { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }

.kbd { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13px; }
.kbd kbd { background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; font-family: inherit; }

@media (max-width: 900px) {
  .player-page { height: auto; min-height: 100dvh; }
  .stage { grid-template-columns: 1fr; }
  .videos { height: 70dvh; flex: none; padding: 8px; }
  .comments { border-left: 0; border-top: 1px solid var(--line); }
  .clist { max-height: none; }
  .hide-mobile { display: none !important; }
  .top { flex-wrap: wrap; }
  .top .crumbs { flex-basis: 100%; }
}

/* Claude-Auftrag */
.rev { display: flex; gap: 10px; align-items: center; padding: 8px 16px; background: #5b8cff1a; border-bottom: 1px solid var(--line); font-size: 13px; }
.rev.failed { background: #ff6b6b1a; }
.rev.done { background: #3ccf8e1a; }

/* Warteschlange des Render-PCs */
.qchip { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted, #888); flex: none; }
.dot.on { background: var(--ok); }
.dot.busy { background: var(--warn); animation: qpulse 1.2s ease-in-out infinite; }
.dot.off { background: var(--danger); }
@keyframes qpulse { 50% { opacity: .35; } }
dialog.wide { width: min(640px, calc(100vw - 32px)); }
dialog h4 { margin: 14px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted, #888); }
.qw { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 8px 10px; background: var(--panel-2); border-radius: 8px; margin-bottom: 6px; }
.qw .grow { flex-basis: 100%; }
.qj { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; display: grid; gap: 5px; }
.qj.running { border-color: var(--accent); }
.qj.failed .small { color: var(--danger); }
.qh { display: flex; align-items: center; gap: 8px; }
.qh .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 640px) { .qchip span { display: none; } }
.rev .bar { margin-top: 6px; max-width: 420px; }
dialog.wide { max-height: 85vh; overflow: auto; }

/* Skript-Panel an der linken Kante des Vorschaubereichs */
.videos { position: relative; }
.script-tab { position: absolute; left: 0; top: 50%; transform: translateY(-50%); z-index: 4; writing-mode: vertical-rl; rotate: 180deg;
  padding: 14px 6px; border: 1px solid var(--line); border-left: 0; border-radius: 8px 0 0 8px; background: var(--panel); color: var(--text); font: inherit; font-size: 12px; letter-spacing: .08em; cursor: pointer; }
.script-tab:hover, .script-tab.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.script { position: absolute; left: 0; top: 0; bottom: 0; z-index: 5; width: min(400px, 92%); display: flex; flex-direction: column;
  background: color-mix(in srgb, var(--panel) 96%, transparent); border-right: 1px solid var(--line); box-shadow: 8px 0 24px #0006; }
.script[hidden] { display: none; }
.shead { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.shead select { max-width: 170px; }
.slegend { display: flex; gap: 6px; padding: 6px 12px; border-bottom: 1px solid var(--line); }
.slegend .sx { padding: 1px 6px; border-radius: 4px; cursor: default; }
.slist { flex: 1; overflow: auto; padding: 6px 8px 12px; }
.spara { margin: 12px 4px 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.sx { display: block; padding: 5px 8px; border-radius: 6px; color: var(--muted); cursor: pointer; line-height: 1.4; font-size: 13px; border-left: 3px solid transparent; }
.sx:hover { background: var(--panel-2); }
.sx .st { font-size: 10px; margin-right: 6px; opacity: .7; }
.sx.used { color: var(--text); background: #5b8cff14; border-left-color: var(--accent); }
.sx.marked { color: var(--text); background: #ffcc4d1f; border-left-color: var(--marker, #ffcc4d); }
.sx.cur { background: #5b8cff40; border-left-color: #fff; color: #fff; box-shadow: inset 0 0 0 1px var(--accent); }
.sx .mk { display: block; color: var(--marker, #ffcc4d); margin-top: 2px; }
.sfoot { padding: 10px 12px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.mlist { margin: 6px 0 0; padding-left: 18px; max-height: 140px; overflow: auto; }
@media (max-width: 900px) { .script { width: 100%; } }
@media (min-width: 901px) { .videos.with-script { padding-left: calc(min(400px, 50%) + 14px); } .videos.with-script .script { width: min(400px, 50%); } }
