:root {
  --bg: #15171b;
  --bg2: #1e2126;
  --bg3: #272b32;
  --line: #343941;
  --text: #e8e9ec;
  --muted: #9aa0aa;
  --accent: #4f8cff;
  --danger: #e5484d;
  --mask: #c77dff;
  --bleep: #ff9f43;
  --mute: #48c9b0;
  --outro: #7f8c8d;
  --uncertain: #ff4d4f;
  --cut: #f1c40f;
  --cut-removed: #3a3d44;
  --ok: #3ecf8e;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text);
}
[hidden] { display: none !important; }
button, .btn, select, input, textarea {
  font: inherit; color: inherit;
}
button, .btn {
  background: var(--bg3); border: 1px solid var(--line); border-radius: 6px;
  padding: 6px 12px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
button:hover, .btn:hover { border-color: var(--muted); }
button:disabled { opacity: .45; cursor: default; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.ghost, .btn.ghost { background: transparent; }
button.icon { padding: 4px 9px; }
button.small, .btn.small { padding: 3px 9px; font-size: 12px; }
select, input[type=text], input[type=number], input[type=password], input:not([type]), textarea {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px;
}
textarea { width: 100%; resize: vertical; font-family: ui-monospace, Consolas, monospace; }
.spacer { flex: 1; }
.hint { color: var(--muted); font-size: 12px; margin: 4px 0 8px; }
.error { color: var(--danger); font-size: 13px; margin: 6px 0; }
.row { display: flex; gap: 8px; align-items: center; }
.row.right { justify-content: flex-end; margin-top: 10px; }

/* prekrytia */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex;
  align-items: center; justify-content: center; z-index: 50;
}
.dialog {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 10px;
  padding: 24px; width: 360px; max-width: 95vw; display: flex; flex-direction: column; gap: 12px;
}
.dialog.wide { width: 640px; }
.dialog h1, .dialog h2 { margin: 0 0 6px; font-size: 18px; }
.dialog label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }

/* rozloženie */
#app { height: 100%; display: grid; grid-template-rows: auto auto 1fr auto; }
header {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px;
  background: var(--bg2); border-bottom: 1px solid var(--line);
}
header .brand { font-weight: 700; font-size: 16px; margin-right: 6px; }
header .title { font-weight: 600; margin-left: 8px; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
header .status { font-size: 12px; color: var(--muted); padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px; }
header .status.ready, header .status.done { color: var(--ok); border-color: var(--ok); }
header .status.error { color: var(--danger); border-color: var(--danger); }
header .status.analyzing, header .status.rendering, header .status.uploaded { color: var(--bleep); border-color: var(--bleep); }
header .user { color: var(--muted); font-size: 13px; }
label.upload input { display: none; }
label.check { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; max-width: 220px; line-height: 1.15; }
label.check.small span { font-size: 11px; }
#job-select { max-width: 260px; }

.banner { padding: 6px 14px; background: #2b2f38; border-bottom: 1px solid var(--line); font-size: 13px; }
.banner.error { background: #3a1f22; color: #ffb4b6; }
.banner .bar { display: inline-block; vertical-align: middle; width: 160px; height: 6px; background: var(--bg); border-radius: 3px; margin-left: 10px; overflow: hidden; }
.banner .bar i { display: block; height: 100%; background: var(--accent); }
.banner button { margin-left: 12px; }

main { display: grid; grid-template-columns: 1fr 340px; min-height: 0; }
#player-area { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.empty { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--muted); }
#stage { position: relative; flex: 1; min-height: 0; background: #000; overflow: hidden; }
#stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
#stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#stage.drawing canvas { cursor: crosshair; }
.draw-hint {
  position: absolute; left: 50%; top: 12px; transform: translateX(-50%);
  background: rgba(0,0,0,.7); padding: 6px 12px; border-radius: 6px; font-size: 12px; pointer-events: none;
}
#controls { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--line); background: var(--bg2); }
.time { font-variant-numeric: tabular-nums; font-family: ui-monospace, Consolas, monospace; }
.sep { color: var(--muted); }

aside#panel { border-left: 1px solid var(--line); background: var(--bg2); overflow-y: auto; padding: 8px 12px; }
.block { padding: 10px 0; border-bottom: 1px solid var(--line); }
.block:last-child { border-bottom: 0; }
.block h3 { margin: 0 0 4px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.block h3 .count { margin-left: auto; color: var(--text); font-size: 13px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 6px; }
.list li:hover { background: var(--bg3); }
.list li.selected { outline: 1px solid var(--accent); background: var(--bg3); }
.list.compact li { padding: 3px 6px; font-size: 13px; }
.list .t { color: var(--muted); font-variant-numeric: tabular-nums; font-family: ui-monospace, Consolas, monospace; font-size: 12px; min-width: 62px; }
.list .w { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .x { color: var(--muted); }
.list .x:hover { color: var(--danger); }
.list select.small { padding: 2px 4px; font-size: 12px; }
.list .state { font-size: 11px; color: var(--muted); }
.list .state.uncertain { color: var(--uncertain); }
.list .state.ok { color: var(--ok); }
.list .state.tracking { color: var(--bleep); }
.faces { display: flex; flex-wrap: wrap; gap: 8px; }
.face { position: relative; width: 74px; height: 74px; border-radius: 8px; overflow: hidden; cursor: pointer; border: 2px solid transparent; background: var(--bg3); }
.face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.face.hidden img { filter: blur(3px) brightness(.8); }
.face.visible { border-color: var(--ok); }
.face .lbl { position: absolute; left: 0; right: 0; bottom: 0; font-size: 10px; text-align: center; background: rgba(0,0,0,.6); padding: 1px 0; }
.face.hidden .lbl { color: var(--mask); }
.face.visible .lbl { color: var(--ok); }
.transcript { font-size: 12px; color: var(--muted); max-height: 160px; overflow: auto; margin-top: 6px; line-height: 1.5; }
.transcript .hit { color: var(--bleep); font-weight: 600; }
details summary { cursor: pointer; font-size: 12px; color: var(--muted); margin-top: 6px; }
.kv { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0; }
.kv .k { width: 70px; color: var(--muted); font-size: 12px; padding-top: 6px; }
.kv .v { flex: 1; min-width: 0; }
.kv select.v { flex: 1; }
.gain { display: flex; align-items: center; gap: 8px; }
.gain input[type=range] { flex: 1; min-width: 0; }
.gain .k.small { width: auto; padding: 0; font-size: 11px; }
.gain .t { min-width: 46px; font-size: 12px; color: var(--muted); }

footer#timeline-area { border-top: 1px solid var(--line); background: var(--bg2); padding: 6px 12px 4px; }
#timeline { width: 100%; height: 114px; display: block; cursor: pointer; border-radius: 6px; background: var(--bg); }
.legend { display: flex; gap: 14px; align-items: center; margin-top: 4px; font-size: 11px; color: var(--muted); }
.lg::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.lg.masks::before { background: var(--mask); }
.lg.bleeps::before { background: var(--bleep); }
.lg.mutes::before { background: var(--mute); }
.lg.outro::before { background: var(--outro); }
.lg.uncertain::before { background: var(--uncertain); }
.lg.cuts::before { background: var(--cut); }
.lg.title::before { background: #ffc300; border: 1px solid #000; }
#title-style-row { margin: 6px 0; }
@font-face { font-family: "Montserrat"; src: url("/static/fonts/Montserrat-SemiBold.ttf") format("truetype"); font-weight: 600; }
#title-text { margin-bottom: 6px; }
.row.wrap { flex-wrap: wrap; margin-bottom: 6px; }
.list li.removed { opacity: .5; text-decoration: line-through; }
.list .ord { min-width: 18px; color: var(--cut); font-weight: 600; }
.save-state { color: var(--muted); }
.shortcuts { color: var(--muted); }

#toasts { position: fixed; right: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--bg3); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; max-width: 420px; box-shadow: 0 4px 16px rgba(0,0,0,.4); }
.toast.error { border-color: var(--danger); color: #ffb4b6; }
.toast.ok { border-color: var(--ok); }

@media (max-width: 900px) {
  main { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  aside#panel { border-left: 0; border-top: 1px solid var(--line); max-height: 40vh; }
  .shortcuts { display: none; }
}
