:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #16181d;
  --muted: #5d6470;
  --line: #dfe3e8;
  --accent: #1d4ed8;
  --accent-text: #ffffff;
  --accent-soft: #e5edff;
  --danger: #b42318;
  --check-a: #eceef1;
  --check-b: #ffffff;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317;
    --surface: #1a1d23;
    --text: #e8eaee;
    --muted: #9aa1ad;
    --line: #2c313a;
    --accent: #6d95ff;
    --accent-text: #0b1020;
    --accent-soft: #1f2a46;
    --danger: #ff8a7a;
    --check-a: #22262d;
    --check-b: #1a1d23;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.top {
  display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap;
  padding: 18px 24px; border-bottom: 1px solid var(--line); background: var(--surface);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; color: var(--text); text-decoration: none; align-self: center; }
.tagline { color: var(--muted); }
.tools { display: flex; gap: 4px; align-self: center; flex-wrap: wrap; }
.tools a { color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: 8px; font-size: 14px; }
.tools a:hover { color: var(--text); background: var(--bg); }
.tools a[aria-current="page"] { color: var(--text); background: var(--accent-soft); font-weight: 600; }
.seg.seg-4 { grid-template-columns: repeat(4, 1fr); }
.seg.seg-4 label:not(:first-of-type):not(:last-of-type) span { border-radius: 0; border-left: 0; }
.field input[type=number], .field input[type=color] { font: inherit; width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); }
.field input[type=color] { height: 38px; padding: 3px; }
.drop-small { min-height: 160px; }
.table-wrap { overflow-x: auto; }
.files { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.files th, .files td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.files th { font-size: 12px; color: var(--muted); }
.files .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.files .name { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files .err { color: var(--danger); }
.files .ok { color: var(--muted); }
.files a { color: var(--accent); font-weight: 600; }

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 24px;
  padding: 24px;
  max-width: 1400px; width: 100%; margin: 0 auto;
  align-content: start;
}

.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; display: flex; flex-direction: column; gap: 18px; align-self: start;
}

.seg { border: 0; padding: 0; margin: 0; }
.seg legend, .field label { font-weight: 600; font-size: 13px; margin-bottom: 6px; display: flex; justify-content: space-between; width: 100%; }
.seg legend { padding: 0; }
.seg { display: grid; grid-template-columns: 1fr 1fr; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span {
  display: block; text-align: center; padding: 8px 6px; border: 1px solid var(--line);
  background: var(--bg); cursor: pointer; font-size: 14px;
}
.seg label:first-of-type span { border-radius: 8px 0 0 8px; }
.seg label:last-of-type span { border-radius: 0 8px 8px 0; border-left: 0; }
.seg input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--text); font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.field output { font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }
.field input[type=range] { width: 100%; accent-color: var(--accent); }
.hint { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
[hidden] { display: none !important; }

button, .secondary { font: inherit; border-radius: 8px; padding: 10px 14px; cursor: pointer; text-align: center; }
.primary { background: var(--accent); color: var(--accent-text); border: 0; font-weight: 600; }
.primary:disabled { opacity: .45; cursor: not-allowed; }
.secondary { border: 1px solid var(--accent); color: var(--accent); text-decoration: none; font-weight: 600; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font-size: 13px; text-decoration: underline; }
.status { margin: 0; min-height: 1.5em; font-size: 13px; color: var(--muted); }
.status.error { color: var(--danger); }

.stage { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 340px; border: 2px dashed var(--line); border-radius: var(--radius);
  background: var(--surface); cursor: pointer; padding: 24px; text-align: center;
  transition: border-color .15s, background .15s;
}
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop-title { font-size: 17px; font-weight: 600; }
.drop-sub { color: var(--muted); font-size: 13px; }

.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.compare figure { margin: 0; min-width: 0; }
.compare figcaption { font-weight: 600; font-size: 13px; margin-bottom: 6px; display: flex; gap: 10px; align-items: baseline; }
.compare figcaption span { color: var(--muted); font-weight: 400; }
.canvas {
  border: 1px solid var(--line); border-radius: var(--radius); height: min(62vh, 640px);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: repeating-conic-gradient(var(--check-a) 0 25%, var(--check-b) 0 50%) 0 0 / 20px 20px;
}
.canvas img { max-width: 100%; max-height: 100%; object-fit: contain; }
.canvas.busy { opacity: .55; }
.placeholder { color: var(--muted); font-size: 14px; background: var(--surface); padding: 4px 10px; border-radius: 6px; }

.notice { margin: 0; font-size: 12px; color: var(--muted); }
.group { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.group-title { font-weight: 600; font-size: 13px; margin: 0; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.pick-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.small { padding: 5px 10px; font-size: 13px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.small[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 999px; padding: 2px 4px 2px 6px; font-size: 12px; font-family: ui-monospace, monospace; }
.chip i { width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--line); display: inline-block; }
.chip button { background: none; border: 0; padding: 0 4px; color: var(--muted); font-size: 14px; line-height: 1; }
.canvas.picking img { cursor: crosshair; }
dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); max-width: 360px; width: calc(100% - 32px); padding: 20px; }
dialog::backdrop { background: rgb(0 0 0 / .45); }
dialog h2 { margin: 0 0 8px; font-size: 18px; }
dialog p { font-size: 14px; }
dialog img { display: block; margin: 8px 0; background: #fff; border-radius: 8px; padding: 8px; }
dialog code { font-size: 13px; word-break: break-all; }
dialog .primary, dialog .secondary { display: inline-block; text-decoration: none; margin-top: 8px; }
dialog form { margin-top: 14px; }
.notice a { color: inherit; }

.legal { flex: 1; max-width: 760px; width: 100%; margin: 0 auto; padding: 24px; }
.legal h1 { font-size: 26px; margin: 8px 0 16px; }
.legal h2 { font-size: 17px; margin: 28px 0 8px; }
.legal .lead { font-size: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.legal a { color: var(--accent); }
.legal ul { padding-left: 20px; }
.legal li { margin-bottom: 6px; }
@media (max-width: 860px) {
  .files { font-size: 13px; }
  .files th:nth-child(2), .files td:nth-child(2) { display: none; }  /* Originalgröße: am Handy verzichtbar */
  .files th, .files td { padding: 8px 6px; }
  .files .name { max-width: 110px; } .legal { padding: 16px; } }
.foot { padding: 16px 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; display: flex; gap: 16px; flex-wrap: wrap; }
.foot a { color: inherit; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; padding: 16px; gap: 16px; }
  .stage { order: -1; }
  .top { padding: 14px 16px; }
  .compare { grid-template-columns: 1fr; }
  .canvas { height: 46vh; }
  .drop { min-height: 220px; }
}
