:root {
  --bg: #15161a;
  --panel: #1d1f25;
  --panel2: #252831;
  --line: #333743;
  --text: #e8e9ee;
  --muted: #9a9fae;
  --accent: #f2b53c;
  --accent2: #5cc8ff;
  --danger: #ff6b6b;
  --ok: #6fd08c;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}

h1 { font-size: 1.35rem; margin: 0; letter-spacing: .01em; }
h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 1.2rem 0 .6rem; }
h2:first-child { margin-top: 0; }
.sub { margin: .2rem 0 0; color: var(--muted); font-size: .9rem; }

.top {
  display: flex; gap: 1rem; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--line);
}

button, select {
  font: inherit; color: var(--text); background: var(--panel2);
  border: 1px solid var(--line); border-radius: 8px; padding: .5rem .8rem; cursor: pointer;
}
button:hover:not(:disabled), select:hover { border-color: #4a5063; }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }
button.primary { background: var(--accent); border-color: var(--accent); color: #1a1405; font-weight: 600; }
button.primary:hover:not(:disabled) { filter: brightness(1.08); border-color: var(--accent); }
button.wide { width: 100%; margin-top: .9rem; }

.msg {
  margin: 0; padding: .6rem 1.25rem; background: #2b2417; color: #f6d68a;
  border-bottom: 1px solid #4a3d1c; font-size: .9rem;
}
.msg.error { background: #2f1b1b; color: #ffb1b1; border-color: #5a2d2d; }
.msg.ok { background: #182a1f; color: #a9e7bb; border-color: #2b5139; }

/* Startfläche */
.drop {
  margin: 1.5rem; border: 2px dashed var(--line); border-radius: 14px;
  min-height: 55vh; display: grid; place-items: center; text-align: center; padding: 2rem;
  transition: border-color .15s, background .15s;
}
.drop.over { border-color: var(--accent); background: rgba(242, 181, 60, .06); }
.drop-inner { max-width: 640px; }
.drop-title { font-size: 1.4rem; margin: 0 0 .3rem; }
.notes { text-align: left; color: var(--muted); font-size: .9rem; margin: 1.5rem 0 0; padding-left: 1.2rem; }
.notes li { margin: .35rem 0; }

/* Arbeitsfläche */
.workspace {
  display: grid; grid-template-columns: 190px minmax(0, 1fr) 300px; gap: 0;
  height: calc(100vh - 78px); min-height: 520px;
}
.workspace[hidden], .msg[hidden], .drop[hidden] { display: none; }

.list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--panel); }
.list-head { padding: .6rem .8rem; font-size: .8rem; color: var(--muted); border-bottom: 1px solid var(--line); }
.thumbs { overflow: auto; padding: .5rem; display: grid; gap: .5rem; align-content: start; }
.thumb {
  display: block; width: 100%; padding: 4px; text-align: left; background: var(--panel2);
  border: 2px solid transparent; border-radius: 8px; position: relative;
}
.thumb.cur { border-color: var(--accent); }
.thumb.skip { opacity: .4; }
.thumb img, .thumb .ph {
  display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 5px; background: #0e0f12;
}
.thumb .nm { display: block; font-size: .72rem; color: var(--muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb .flag { position: absolute; top: 8px; right: 8px; font-size: .68rem; padding: 1px 6px; border-radius: 999px; background: rgba(0, 0, 0, .7); color: var(--accent); }
.thumb .flag.warn { color: var(--danger); }

.stage { padding: 1rem 1.25rem; overflow: auto; min-width: 0; }
.stage-bar { display: flex; align-items: center; gap: .6rem; margin-bottom: .8rem; }
.stage-bar button { padding: .3rem .8rem; font-size: 1.2rem; line-height: 1; }
.counter { color: var(--muted); font-variant-numeric: tabular-nums; }
.fname { margin-left: .4rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.view-wrap { position: relative; background: #0e0f12; border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
#view { display: block; width: 100%; height: auto; max-height: 56vh; object-fit: contain; cursor: ew-resize; touch-action: none; border-radius: 4px; }
#view.h { cursor: ns-resize; }
.view-err { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--danger); background: rgba(14, 15, 18, .85); border-radius: 10px; }
.view-err[hidden] { display: none; }

.hint { color: var(--muted); font-size: .82rem; margin: .5rem 0 0; }

.results { display: flex; gap: 1rem; margin-top: .8rem; flex-wrap: wrap; }
.results figure { margin: 0; }
.results canvas { display: block; max-width: 260px; max-height: 220px; width: auto; height: auto; background: #0e0f12; border: 1px solid var(--line); border-radius: 6px; }
.results figcaption { font-size: .8rem; color: var(--muted); margin-top: .25rem; }

.controls { border-left: 1px solid var(--line); padding: 1rem; overflow: auto; background: var(--panel); }
.field { display: block; margin: .7rem 0; }
.field > span { display: flex; justify-content: space-between; font-size: .85rem; color: var(--muted); margin-bottom: .25rem; }
.field output { color: var(--text); font-variant-numeric: tabular-nums; }
.field select { width: 100%; }
.field input[type=range] { width: 100%; accent-color: var(--accent); }
.check { display: flex; gap: .5rem; align-items: center; margin: .5rem 0; font-size: .9rem; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.btn-col { display: grid; gap: .5rem; margin-top: 1rem; }
.btn-col button { text-align: left; }

progress { width: 100%; height: 10px; margin-top: .8rem; accent-color: var(--ok); }
progress[hidden], #progText[hidden], #btnCancel[hidden] { display: none; }
#btnCancel { margin-top: .5rem; }

@media (max-width: 1000px) {
  .workspace { grid-template-columns: 1fr; height: auto; }
  .list { border-right: 0; border-bottom: 1px solid var(--line); max-height: 190px; }
  .thumbs { grid-auto-flow: column; grid-auto-columns: 110px; overflow-x: auto; }
  .controls { border-left: 0; border-top: 1px solid var(--line); }
  .top { flex-direction: column; align-items: flex-start; }
}
