:root {
  --bg: #f4f6f4; --card: #fff; --text: #17201b; --muted: #5d6b63; --line: #dde3df;
  --accent: #1f7a4d; --accent-text: #fff; --error: #b3261e; --band: rgba(255, 196, 0, .28); --mark: #ffc400;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1411; --card: #18201b; --text: #e6ece8; --muted: #9aa8a0; --line: #2a352f;
          --accent: #3fb47a; --accent-text: #08130d; --error: #ff8a80; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
.wrap { max-width: 760px; margin: 0 auto; padding: 16px 16px 40px; }
.top { display: flex; gap: 12px; align-items: center; margin: 8px 0 16px; }
.top h1 { margin: 0; font-size: 1.6rem; line-height: 1.1; }
.sub { margin: 2px 0 0; color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; margin-bottom: 14px; }
.card h2 { margin: 0 0 8px; font-size: 1.2rem; }
.card p { margin: 0 0 12px; }
.primary, .ghost { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 20px;
  border-radius: 999px; font: inherit; font-weight: 700; cursor: pointer; border: 0; }
.primary { background: var(--accent); color: var(--accent-text); }
.primary:disabled { opacity: .45; cursor: default; }
.ghost { background: none; border: 1px solid var(--line); color: var(--text); font-weight: 600; }
.file input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file:focus-within { outline: 3px solid var(--mark); outline-offset: 2px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.error { color: var(--error); font-weight: 600; }
.small { color: var(--muted); font-size: .88rem; }
.meta { color: var(--muted); font-size: .9rem; margin-top: 8px !important; }
.tips { margin-top: 14px; }
.tips summary { cursor: pointer; font-weight: 600; }
.tips ul { padding-left: 1.2em; margin: 8px 0 0; }
.tips li { margin-bottom: 6px; }
.stage { position: relative; border-radius: 10px; overflow: hidden; background: #000; }
#canvas { display: block; width: 100%; height: auto; touch-action: none; cursor: crosshair; }
.progress { height: 12px; background: var(--line); border-radius: 6px; overflow: hidden; margin: 6px 0 4px; }
#bar { height: 100%; width: 0; background: var(--accent); transition: width .4s; }
.big { font-size: 1.1rem; margin: 4px 0 0 !important; }
.big b { font-size: 3rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ca, #rUnit { color: var(--muted); }
.range { color: var(--muted); }
.notes { padding-left: 1.2em; margin: 12px 0; }
.notes li { margin-bottom: 4px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .bar { fill: var(--accent); }
.chart text { fill: var(--muted); font-size: 11px; }
.chart .axis { stroke: var(--line); }
.foot { text-align: center; color: var(--muted); font-size: .9rem; margin-top: 20px; }
.foot a { color: var(--muted); }
.legal h1 { font-size: 1.5rem; }
.legal h2 { font-size: 1.15rem; margin-top: 1.6em; }

/* job list */
.joblist { list-style: none; padding: 0; margin: 0 0 8px; }
.joblist li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.joblist li:last-child { border-bottom: 0; }
.joblist a { flex: 1; min-width: 0; text-decoration: none; color: var(--text); }
.joblist .name { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.joblist .state { display: block; color: var(--muted); font-size: .88rem; }
.joblist .x { background: none; border: 0; color: var(--muted); font-size: 1.3rem; cursor: pointer; padding: 4px 8px; }

/* steps */
.steps { list-style: none; padding: 0; margin: 10px 0 4px; }
.steps li { display: grid; grid-template-columns: 1.6em 1fr auto; align-items: center; gap: 2px 8px; padding: 6px 0; }
.steps .ic { grid-row: span 2; text-align: center; font-weight: 700; color: var(--muted); }
.steps .lb { font-weight: 600; min-width: 0; }
.steps .pc { color: var(--muted); font-size: .88rem; font-variant-numeric: tabular-nums; }
.steps .sb { grid-column: 2 / 4; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.steps .sb i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .4s; }
.steps li.done .ic { color: var(--accent); }
.steps li.done .sb i { width: 100%; }
.steps li.wait .lb, .steps li.wait .pc { color: var(--muted); font-weight: 400; }
.steps li.active .ic { color: var(--accent); }
.steps li.failed .ic { color: var(--error); }
.steps .sub { color: var(--muted); font-weight: 400; font-size: .88rem; }

/* preview */
.preview { margin: 12px 0; }
.preview img { display: block; width: 100%; height: auto; border-radius: 10px; background: #000; }
.preview figcaption { display: flex; gap: 4px 18px; flex-wrap: wrap; margin-top: 6px; color: var(--muted); font-size: .9rem; }
.preview figcaption b { color: var(--text); font-size: 1.15rem; font-variant-numeric: tabular-nums; }

/* result */
.rating { margin: 6px 0 0 !important; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-weight: 700; font-size: .9rem; }
.badge.gut { background: #d6f2e2; color: #145c38; }
.badge.mittel { background: #fff0c2; color: #7a5600; }
.badge.schwach { background: #ffd9d6; color: #8c1d18; }
@media (prefers-color-scheme: dark) {
  .badge.gut { background: #173d29; color: #9fe3bd; }
  .badge.mittel { background: #3d3214; color: #ffd978; }
  .badge.schwach { background: #47201d; color: #ffb4ab; }
}
.linkbox { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 10px; }
.linkbox .row { margin: 6px 0 0; flex-wrap: nowrap; }
#jobLink { flex: 1; min-width: 0; font: inherit; font-size: .88rem; padding: 0 12px; min-height: 46px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); }

/* perspective */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.persp { border: 0; padding: 0; margin: 0 0 8px; display: grid; gap: 6px; }
.persp label { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.persp label:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.persp input { margin-top: 4px; accent-color: var(--accent); }
.persp span { color: var(--muted); font-size: .92rem; }
.persp b { display: block; color: var(--text); font-size: 1rem; }
.hint { color: var(--muted); font-size: .92rem; }
.warn { background: #fff0c2; color: #6b4b00; border-radius: 10px; padding: 10px 12px; font-size: .92rem; }
@media (prefers-color-scheme: dark) { .warn { background: #3d3214; color: #ffd978; } }
.card h2 + .persp { margin-top: 4px; }
#draw h2:not(:first-child) { margin-top: 18px; }
