:root {
  --bg: #111317; --surface: #1b1e24; --surface-2: #242830; --border: #2f343d;
  --text: #e8eaed; --muted: #9aa0a6; --accent: #4f8cff; --accent-text: #fff;
  --danger: #e5484d; --warn: #ffd166; --radius: 12px; --gutter: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
a { color: inherit; }
[x-cloak] { display: none !important; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px;
  padding: 12px var(--gutter); background: var(--bg); border-bottom: 1px solid var(--border); }
.topbar h1 { font-size: 18px; margin: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back { display: inline-flex; align-items: center; justify-content: center; min-width: 64px; min-height: 64px;
  margin-left: -14px; text-decoration: none; font-size: 52px; line-height: 1; padding: 0 0 8px 0; }
main { padding: var(--gutter); max-width: 900px; margin: 0 auto; }
.muted { color: var(--muted); font-size: 14px; }
.tabs { display: flex; gap: 8px; padding: 10px var(--gutter) 0; max-width: 900px; margin: 0 auto; }
.tab { flex: 1; min-height: 44px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; }
.tab.on { background: var(--surface-2); color: var(--text); border-color: var(--accent); }
.footer-link { text-align: center; padding: 24px 0 8px; }
.footer-link a { color: var(--muted); font-size: 14px; }
.devcard h2 { margin-bottom: 2px; }
table.specs { width: 100%; border-collapse: collapse; font-size: 13px; }
table.specs th, table.specs td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--border); }
table.specs th { color: var(--muted); font-weight: 500; }
table.specs tr.used td { color: var(--text); font-weight: 600; }
table.specs tr:not(.used) td { color: var(--muted); }
.missing { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.missing code { display: block; margin-top: 6px; font-size: 12px; word-break: break-all; color: var(--warn); }
.row-between { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.photo-row { display: flex; align-items: center; gap: 10px; }
.photo-row img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; background: var(--surface-2); flex: none; }
.photo-row .grow { flex: 1; min-width: 0; }
.photo-row .label { font-weight: 600; }
.stack { display: grid; gap: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > .btn { flex: 1; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  padding: 10px 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; text-align: center; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.danger { color: var(--danger); }
.btn.block { width: 100%; }
.btn.small { min-height: 44px; padding: 6px 12px; font-size: 14px; }
input[type=text], textarea, select { width: 100%; min-height: 44px; padding: 10px 12px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; }
textarea { min-height: 72px; resize: vertical; }
label.field { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
.card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; text-decoration: none; }
.card h2 { margin: 0 0 4px; font-size: 17px; }
.thumbstrip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
.thumbstrip img, .tile img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px;
  background: var(--surface-2); display: block; }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; cursor: pointer; }
.tile { position: relative; }
.tile .select { position: absolute; top: 0; right: 0; width: 56px; height: 56px; padding: 0; border: 0;
  background: transparent; cursor: pointer; z-index: 2; }
.tile .select::before { content: ""; position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; border-radius: 50%;
  border: 3px solid #fff; background: rgba(0,0,0,.45); box-sizing: border-box; box-shadow: 0 0 4px rgba(0,0,0,.6); }
.tile .select.on::before { background: var(--accent); border-color: var(--accent); }
.tile .select.on::after { content: "✓"; position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; line-height: 40px;
  text-align: center; color: #fff; font-size: 24px; font-weight: 700; }
/* Vorlagen-Sucher */
.finder { position: fixed; inset: 0; z-index: 60; background: #000; display: flex; flex-direction: column; }
.finder-stage { position: relative; flex: 1; min-height: 0; }
.finder-stage video, .finder-ref { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.finder-hint { position: absolute; left: 16px; right: 16px; top: 16px; padding: 10px 12px; border-radius: 8px;
  background: rgba(0,0,0,.7); color: #fff; font-size: 14px; }
.finder-bar { display: grid; gap: 10px; padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom)); background: var(--bg); }
.finder-bar input[type=range] { width: 100%; }
@media (orientation: landscape) {
  .finder { flex-direction: row; }
  .finder-bar { width: 240px; align-content: center; }
}
.tile .label { font-weight: 600; margin-top: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .model, .tile .keyline { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.placeholder { display: flex; align-items: center; justify-content: center; aspect-ratio: 1; border-radius: 8px;
  background: var(--surface-2); color: var(--muted); font-size: 13px; text-align: center; padding: 8px; }
.errorbar { position: fixed; left: 0; right: 0; top: 0; z-index: 50; padding: 12px var(--gutter);
  background: var(--danger); color: #fff; font-weight: 600; }
.progress { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); transition: width .15s; }
.preview-img { width: 100%; max-height: 55vh; object-fit: contain; border-radius: var(--radius); background: #000; }
.overlay { position: fixed; inset: 0; z-index: 40; background: var(--bg); overflow-y: auto; }
table.meta { width: 100%; border-collapse: collapse; font-size: 14px; }
table.meta th, table.meta td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border);
  vertical-align: top; word-break: break-word; }
table.meta th { color: var(--muted); font-weight: 500; width: 32%; }
table.meta thead th { color: var(--text); font-weight: 700; width: auto; }
table.meta tr.differs td { color: var(--warn); }
details summary { cursor: pointer; padding: 8px 0; color: var(--muted); }
pre.raw { white-space: pre-wrap; word-break: break-word; font-size: 12px; background: var(--surface); padding: 10px; border-radius: 8px; }
/* Vergleich */
.compare-main { padding: 0; max-width: none; }
.compare-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px var(--gutter); }
.frame { position: relative; overflow: hidden; width: 100%; height: calc(100dvh - 270px); min-height: 280px;
  background: #000; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.pane { position: absolute; inset: 0; }
.pane.b { clip-path: inset(0 0 0 50%); }
.layer { position: absolute; inset: 0; transform-origin: 0 0; will-change: transform; }
.layer img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; -webkit-user-drag: none; }
.layer .outline { position: absolute; box-sizing: border-box; border: 2px solid rgba(255,255,255,.9); pointer-events: none; }
.layer[data-img="b"] .outline { border-color: var(--warn); }
.divider { position: absolute; top: 0; bottom: 0; left: 50%; width: 0; border-left: 2px solid #fff;
  box-shadow: 0 0 4px rgba(0,0,0,.8); pointer-events: none; }
.divider::after { content: "◀ ▶"; position: absolute; top: 50%; left: 0; transform: translate(-50%, -50%);
  background: #fff; color: #000; font-size: 11px; padding: 6px 8px; border-radius: 999px; white-space: nowrap; }
.badge { position: absolute; top: 8px; padding: 4px 8px; border-radius: 6px; background: rgba(0,0,0,.65); color: #fff;
  font-size: 12px; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; pointer-events: none; }
.badge.a { left: 8px; }
.badge.b { right: 8px; }
.compare-bar { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px var(--gutter) 4px; }
.compare-bar .btn { flex: 1 1 40%; }
.align-status { margin: 0; padding: 0 var(--gutter) 10px; min-height: 20px; }
.compare-table { padding: 0 var(--gutter) var(--gutter); }
