:root {
  color-scheme: dark;
  --bg: #0f1115;
  --bg2: #13161c;
  --panel: #181b22;
  --panel2: #20242d;
  --line: #2b303b;
  --text: #e9ebf1;
  --muted: #9aa3b4;
  --accent: #6c8cff;
  --accent2: #a77bff;
  --good: #2fbf71;
  --bad: #ef5350;
  --move: #4c9aff;
  --cut: #f5a524;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; width: 100%; }
[hidden] { display: none !important; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
p { margin: 0; }
a { color: inherit; }
code { background: var(--panel2); padding: 1px 6px; border-radius: 6px; font-size: .9em; }
kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0 .4em;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--panel2);
  font: 600 .75rem/1.6 ui-monospace, Consolas, monospace;
  text-align: center;
  color: var(--muted);
}
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.error { color: var(--bad); }
.visually-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(15, 17, 21, .85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; font-size: 1.15rem; letter-spacing: -.01em; }
.logo b { font-weight: 700; }
.logo .tld { color: var(--muted); }
.logo-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: grid; place-items: center;
}
.logo-mark svg { width: 16px; height: 16px; fill: #fff; }
.privacy-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .85rem; color: var(--muted);
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px;
}
.privacy-pill svg { width: 14px; height: 14px; fill: var(--good); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--text);
  font: inherit; font-weight: 600;
  cursor: pointer;
  transition: transform .08s ease, background .15s ease, border-color .15s ease, opacity .15s;
}
.btn:hover:not(:disabled) { border-color: #3a4150; background: #262b35; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:focus-visible, .chip:focus-visible, .trim-handle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.btn-small { padding: 6px 10px; font-size: .85rem; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); border-color: transparent; color: #fff; }
.btn-primary:hover:not(:disabled) { background: linear-gradient(135deg, #7d9aff, #b38dff); border-color: transparent; }
.btn-primary svg { fill: #fff; stroke: none; }
.btn-xl { padding: 16px 28px; font-size: 1.1rem; border-radius: 14px; box-shadow: 0 10px 30px rgba(108, 140, 255, .3); }
.btn-good { background: var(--good); border-color: transparent; color: #04170c; }
.btn-good:hover:not(:disabled) { background: #3dd081; border-color: transparent; }
.btn-bad { background: transparent; border-color: rgba(239, 83, 80, .55); color: #ff8a87; }
.btn-bad:hover:not(:disabled) { background: rgba(239, 83, 80, .12); border-color: var(--bad); }
.btn-cut { background: var(--cut); border-color: transparent; color: #241600; }
.btn-cut:hover:not(:disabled) { background: #ffb53d; border-color: transparent; }
.btn-cut-outline { background: transparent; border-color: rgba(245, 165, 36, .55); color: #ffc463; }
.btn-cut-outline:hover:not(:disabled), .btn-cut-outline.active { background: rgba(245, 165, 36, .12); border-color: var(--cut); }
.btn-good kbd { background: rgba(0, 0, 0, .15); border-color: rgba(0, 0, 0, .2); color: #04170c; }

/* ---------- Start ---------- */
#screen-start { max-width: 1040px; margin: 0 auto; padding: 56px 24px 40px; }
.hero { text-align: center; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.4rem); letter-spacing: -.03em; font-weight: 800; }
.grad { background: linear-gradient(90deg, var(--accent), var(--accent2) 60%, #ff7ab6); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 640px; margin: 18px auto 0; }
.lead strong { color: var(--text); font-weight: 600; }
.dropzone {
  margin: 36px auto 0;
  max-width: 620px;
  padding: 36px 24px 26px;
  border: 2px dashed var(--line);
  border-radius: 20px;
  background: radial-gradient(ellipse at top, rgba(108, 140, 255, .08), transparent 70%), var(--bg2);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  transition: border-color .15s, background .15s;
}
.dropzone.drag { border-color: var(--accent); background: rgba(108, 140, 255, .1); }
.drop-hint { color: var(--muted); }
.basic-pick { font-size: .85rem; color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.basic-pick input { display: none; }
.basic-pick:hover { color: var(--text); }
.compat-note {
  max-width: 620px; margin: 16px auto 0; padding: 12px 16px;
  border-radius: 12px; background: rgba(245, 165, 36, .1); border: 1px solid rgba(245, 165, 36, .35);
  color: #ffd38a; font-size: .92rem;
}
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 64px; }
.step { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.step-n {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: rgba(108, 140, 255, .15); color: var(--accent); font-weight: 700; margin-bottom: 12px;
}
.step h3 { font-size: 1.05rem; margin-bottom: 6px; }
.step p { color: var(--muted); font-size: .95rem; }
.tag { display: inline-block; padding: 0 8px; border-radius: 6px; font-size: .85rem; font-weight: 600; }
.tag.good { background: rgba(47, 191, 113, .15); color: #6fe0a2; }
.tag.move { background: rgba(76, 154, 255, .15); color: #8bbcff; }
.tag.cut { background: rgba(245, 165, 36, .15); color: #ffc463; }
.tag.bad { background: rgba(239, 83, 80, .15); color: #ff8a87; }
.info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 16px; }
.info-card { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.info-card h3 { font-size: 1rem; margin-bottom: 6px; }
.info-card p { color: var(--muted); font-size: .92rem; }

/* ---------- Sorteren ---------- */
#screen-sort { padding: 20px 24px 32px; }
.sort-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; max-width: 1500px; margin: 0 auto; align-items: start; }
.stage { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.stage-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; }
.stage-title { min-width: 0; }
.stage-title h2 { font-size: 1.25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-title p { font-size: .9rem; }
.counter { font-weight: 700; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.progress { height: 6px; background: var(--panel2); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: inherit; transition: width .25s ease; }
.player-wrap {
  position: relative;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  max-height: 62vh;
  width: 100%;
  border: 1px solid var(--line);
}
.player-wrap video { width: 100%; height: 100%; display: block; object-fit: contain; background: #000; }
.player-error {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 6px; padding: 24px; background: rgba(0, 0, 0, .85);
}

.actions { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; }
.btn-action { padding: 14px 16px; font-size: 1.05rem; border-radius: 12px; }
.btn-action kbd { margin-left: 4px; }

.move-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
}
.move-label { font-weight: 600; color: #8bbcff; margin-right: 4px; }
.folder-chips { display: contents; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 10px;
  border: 1px solid rgba(76, 154, 255, .4); background: rgba(76, 154, 255, .1); color: #cfe2ff;
  font: inherit; font-size: .92rem; font-weight: 600; cursor: pointer; max-width: 240px;
  transition: background .15s, border-color .15s;
}
.chip:hover:not(:disabled) { background: rgba(76, 154, 255, .2); border-color: var(--move); }
.chip:disabled { opacity: .45; cursor: not-allowed; }
.chip .chip-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip kbd { flex: none; }
.chip-add { background: transparent; border-style: dashed; border-color: var(--line); color: var(--muted); }
.chip-add:hover:not(:disabled) { color: var(--text); background: var(--panel2); border-color: #3a4150; }
.chip .ext { color: var(--muted); font-weight: 400; }

/* Knippen */
.trim-panel { background: var(--panel); border: 1px solid rgba(245, 165, 36, .35); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.trim-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.trim-head h3 { font-size: 1.05rem; color: #ffc463; }
.trim-track {
  position: relative; height: 44px; border-radius: 10px; background: var(--panel2); cursor: pointer;
  touch-action: none; user-select: none; margin: 0 10px;
}
.trim-sel { position: absolute; top: 0; bottom: 0; background: rgba(245, 165, 36, .25); border-top: 2px solid var(--cut); border-bottom: 2px solid var(--cut); }
.trim-playhead { position: absolute; top: -4px; bottom: -4px; width: 2px; background: #fff; border-radius: 2px; pointer-events: none; transform: translateX(-1px); }
.trim-handle {
  position: absolute; top: 50%; width: 20px; height: 52px; margin-left: -10px; transform: translateY(-50%);
  background: var(--cut); border-radius: 8px; cursor: ew-resize; box-shadow: 0 2px 8px rgba(0, 0, 0, .4);
}
.trim-handle::after { content: ""; position: absolute; left: 50%; top: 14px; bottom: 14px; width: 2px; margin-left: -1px; background: rgba(0, 0, 0, .35); }
.trim-controls { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.trim-point { display: flex; align-items: center; gap: 10px; }
.trim-point strong { font-variant-numeric: tabular-nums; min-width: 64px; }
.trim-save { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 14px; }
.trim-buttons { display: flex; gap: 8px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: .92rem; }
.check input { width: 16px; height: 16px; accent-color: var(--cut); }
.trim-progress { display: flex; flex-direction: column; gap: 6px; }
.trim-progress .progress > div { background: var(--cut); }
.trim-note { margin-top: -4px; }

/* Wachtrij */
.queue {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column; max-height: calc(100vh - 110px); position: sticky; top: 84px;
}
.queue-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.queue-head h3 { font-size: 1rem; word-break: break-all; }
.badge { font-size: .75rem; padding: 2px 8px; border-radius: 999px; background: rgba(245, 165, 36, .15); color: #ffc463; white-space: nowrap; }
.queue-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; }
.queue-list li {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; cursor: pointer; font-size: .9rem;
}
.queue-list li:hover { background: var(--panel2); }
.queue-list li.current { background: rgba(108, 140, 255, .15); outline: 1px solid rgba(108, 140, 255, .4); }
.queue-list li.gone { cursor: default; opacity: .55; }
.queue-list li.gone:hover { background: transparent; }
.q-icon { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: .7rem; font-weight: 700; background: var(--panel2); color: var(--muted); }
.q-icon.kept { background: rgba(47, 191, 113, .2); color: #6fe0a2; }
.q-icon.moved { background: rgba(76, 154, 255, .2); color: #8bbcff; }
.q-icon.deleted { background: rgba(239, 83, 80, .2); color: #ff8a87; }
.q-icon.trimmed { background: rgba(245, 165, 36, .2); color: #ffc463; }
.q-text { min-width: 0; flex: 1; }
.q-name { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-sub { display: block; font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-foot { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }

/* ---------- Klaar ---------- */
#screen-done { padding: 64px 24px; }
.done { max-width: 680px; margin: 0 auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.done-icon { font-size: 3rem; }
.done h1 { font-size: 2.2rem; letter-spacing: -.02em; }
.done .lead { margin-top: 0; }
.done-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; width: 100%; margin-top: 8px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 10px; }
.stat b { display: block; font-size: 1.8rem; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .9rem; }
.stat.good b { color: var(--good); } .stat.move b { color: var(--move); } .stat.cut b { color: var(--cut); } .stat.bad b { color: var(--bad); }
.done-trash { width: 100%; background: rgba(239, 83, 80, .06); border: 1px solid rgba(239, 83, 80, .3); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.done-basic { width: 100%; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; font-size: .92rem; }
.done-basic h3 { font-size: 1rem; margin: 12px 0 4px; }
.done-basic h3:first-child { margin-top: 0; }
.done-basic ul { margin: 0; padding-left: 20px; color: var(--muted); }
.done-buttons { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); padding: 18px 24px; text-align: center; color: var(--muted); font-size: .85rem; }

/* ---------- Dialogen, toast, busy ---------- */
.dialog {
  border: 1px solid var(--line); border-radius: 16px; background: var(--panel); color: var(--text);
  padding: 22px; width: min(440px, calc(100vw - 32px)); box-shadow: var(--shadow);
}
.dialog::backdrop { background: rgba(0, 0, 0, .6); backdrop-filter: blur(2px); }
.dialog form { display: flex; flex-direction: column; gap: 12px; }
.dialog input[type="text"] {
  width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2);
  color: var(--text); font: inherit;
}
.dialog input[type="text"]:focus { outline: 2px solid var(--accent); border-color: transparent; }
.dialog-buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #2a2f3a; color: var(--text); border: 1px solid #3a4150; border-radius: 12px; padding: 11px 16px;
  box-shadow: var(--shadow); transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); z-index: 50; font-size: .95rem;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: rgba(239, 83, 80, .6); }
.busy {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .55); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; z-index: 40; color: var(--text); font-weight: 600;
}
.spinner { width: 40px; height: 40px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, .2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Responsief ---------- */
@media (max-width: 980px) {
  .sort-layout { grid-template-columns: 1fr; }
  .queue { position: static; max-height: 360px; }
}
@media (max-width: 720px) {
  .topbar { padding: 12px 16px; }
  .privacy-pill { display: none; }
  #screen-start { padding: 36px 16px 32px; }
  #screen-sort { padding: 14px 16px 24px; }
  .steps, .info-grid { grid-template-columns: 1fr; }
  .steps { margin-top: 40px; }
  .actions { grid-template-columns: 1fr 1fr; }
  .actions #btn-keep { grid-column: 1 / -1; }
  .btn-action kbd, .chip kbd { display: none; }
  .done-stats { grid-template-columns: repeat(2, 1fr); }
}
