/*
  ausrasten
  Hell: warmes Off-White, schwarze Konturen, harte Schatten, Pink als Akzent.
  Dunkelkammer: fast schwarz, helle Konturen, Prozess-Magenta als Akzent.
  Gelb markiert immer die Linie, die gerade angefasst wird.
*/

@font-face { font-family: "Archivo"; src: url("fonts/archivo-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Archivo"; src: url("fonts/archivo-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Archivo"; src: url("fonts/archivo-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Archivo"; src: url("fonts/archivo-latin-800-normal.woff2") format("woff2"); font-weight: 800; font-display: swap; }

:root {
  --bg: #F4F4F0;
  --surface: #FFFFFF;
  --ink: #000000;
  --muted: #4B4B47;
  --accent: #FF90E8;
  --on-accent: #000000;
  --select: #FFC900;
  --stage: #E6E5DE;
  --shadow: 3px 3px 0 var(--ink);
  color-scheme: light;
}
:root[data-look="dunkel"] {
  --bg: #0F0F0F;
  --surface: #1A1A1A;
  --ink: #F2F1EC;
  --muted: #A9A8A2;
  --accent: #EC008C;
  --on-accent: #0F0F0F;
  --stage: #060606;
  color-scheme: dark;
}

* { box-sizing: border-box; min-width: 0; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
}
button { font: inherit; color: inherit; }
button, label, .chip { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
[hidden] { display: none !important; }

/* Kopfzeile */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap;
  padding: 12px max(2vw, 16px);
  background: var(--surface);
  border-bottom: 2px solid var(--ink);
}
.logo {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 28px; letter-spacing: -0.03em; line-height: 1;
  color: var(--ink); text-decoration: none;
}
.logo-mark { width: 30px; height: 30px; flex: none; }
.logo-mark rect { fill: var(--accent); stroke: var(--ink); stroke-width: 3; }
.logo-mark path { stroke: var(--ink); stroke-width: 2.5; fill: none; }
.modes, .top-right { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.pill {
  border: 2px solid var(--ink); border-radius: 999px; background: var(--surface);
  padding: 6px 16px; min-height: 42px; font-weight: 500; cursor: pointer;
}
.pill[aria-selected="true"], .pill[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.soon { font-size: 12px; font-weight: 700; border: 1.5px solid currentColor; border-radius: 999px; padding: 0 7px; margin-left: 4px; vertical-align: 1px; }

.btn {
  border: 2px solid var(--ink); border-radius: 6px; background: var(--surface);
  padding: 8px 18px; min-height: 44px; font-weight: 700; cursor: pointer;
  transition: transform .08s ease, box-shadow .08s ease;
}
.btn-accent { background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow); }
.btn-accent:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.btn-accent:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.btn-small { padding: 5px 12px; min-height: 36px; font-size: 14px; font-weight: 500; }
.btn-small:hover { background: var(--bg); }
.btn-wide { width: 100%; }
.btn[aria-disabled="true"] { opacity: .45; cursor: default; }

/* Arbeitsfläche */
.app {
  flex: 1;
  display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; align-items: start;
  padding: 20px max(2vw, 16px);
}
.panel { display: flex; flex-direction: column; gap: 14px; }
.card { background: var(--surface); border: 2px solid var(--ink); border-radius: 8px; padding: 14px 16px; }
.card h2 { font-size: 16px; font-weight: 800; margin: 0 0 10px; letter-spacing: -0.01em; }
.hint { font-size: 13px; color: var(--muted); margin: 6px 0 4px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 2px solid var(--ink); border-radius: 999px; background: var(--surface);
  padding: 5px 13px; min-height: 38px; font-size: 14px; font-weight: 500; cursor: pointer;
}
.chip:hover { background: var(--bg); }
.chip.is-on { background: var(--accent); color: var(--on-accent); }

.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 0; }
.row small { font-size: 12px; color: var(--muted); font-weight: 400; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button {
  width: 38px; height: 38px; border: 2px solid var(--ink); border-radius: 6px; background: var(--surface);
  font-size: 20px; font-weight: 700; line-height: 1; cursor: pointer; padding: 0;
}
.stepper button.plus { background: var(--accent); color: var(--on-accent); }
.stepper output { min-width: 34px; text-align: center; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }

.switch-row { cursor: pointer; position: relative; }
.switch-row input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.switch {
  flex: none; width: 46px; height: 26px; border: 2px solid var(--ink); border-radius: 999px;
  background: var(--surface); position: relative; transition: background .15s;
}
.switch::after {
  content: ""; position: absolute; top: 4px; left: 4px; width: 14px; height: 14px;
  border-radius: 50%; background: var(--ink); transition: transform .15s;
}
.switch-row input:checked + .switch { background: var(--accent); }
.switch-row input:checked + .switch::after { transform: translateX(20px); background: var(--on-accent); }
.switch-row input:focus-visible + .switch { outline: 3px solid var(--ink); outline-offset: 2px; }

.swatches { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.swatch {
  width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--ink); cursor: pointer; padding: 0;
}
.swatch[aria-checked="true"] { outline: 3px solid var(--ink); outline-offset: 3px; }

.range { display: grid; grid-template-columns: 80px minmax(0, 1fr) 46px; align-items: center; gap: 10px; padding: 8px 0 2px; }
.range output { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 14px; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; cursor: pointer; margin: 0; }
input[type="range"]::-webkit-slider-runnable-track { height: 10px; border: 2px solid var(--ink); border-radius: 999px; background: var(--surface); }
input[type="range"]::-moz-range-track { height: 6px; border: 2px solid var(--ink); border-radius: 999px; background: var(--surface); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--ink); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px;
  border: 2px solid var(--ink); border-radius: 50%; background: var(--accent);
}
input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border: 2px solid var(--ink); border-radius: 50%; background: var(--accent); }

body[data-mode="raster"] [data-show="persp"],
body[data-mode="persp"] [data-show="raster"] { display: none !important; }
.btn[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.btn-row { display: flex; gap: 8px; margin-bottom: 10px; }
.btn-row .btn { flex: 1; }
.sel-title { font-weight: 700; margin: 0 0 4px; }
#del { margin-top: 10px; }
#komp-off { margin-top: 8px; }

.seg { display: flex; border: 2px solid var(--ink); border-radius: 6px; overflow: hidden; margin-bottom: 6px; }
.seg button { flex: 1; border: 0; background: var(--surface); min-height: 40px; padding: 0 6px; font-size: 14px; font-weight: 700; cursor: pointer; }
.seg button + button { border-left: 2px solid var(--ink); }
.seg button[aria-checked="true"] { background: var(--ink); color: var(--surface); }
#export { margin-top: 12px; }

/* Bühne */
.stage-wrap { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 12px; }
.stagebar { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; min-height: 36px; }
.file-info { font-weight: 700; font-size: 15px; overflow-wrap: anywhere; }
.file-info small { font-weight: 400; color: var(--muted); font-size: 14px; }
.stagebar-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.stage {
  position: relative; background: var(--stage); border: 2px solid var(--ink); border-radius: 8px;
  min-height: 460px; display: grid; place-items: center; padding: 18px; overflow: hidden;
}
#cv { display: block; touch-action: none; outline: 2px solid var(--ink); box-shadow: 5px 5px 0 var(--ink); background: var(--surface); }
.stage.is-persp #cv { outline: none; box-shadow: none; background: transparent; }

.drop { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 20px; }
.drop-art { width: min(230px, 60vw); height: auto; margin-bottom: 6px; }
.a-shadow { fill: var(--ink); }
.a-frame { fill: var(--accent); stroke: var(--ink); stroke-width: 3; }
.a-hill { fill: var(--surface); stroke: var(--ink); stroke-width: 3; }
.a-sun { fill: var(--select); stroke: var(--ink); stroke-width: 3; }
.a-grid { fill: none; stroke: var(--ink); stroke-width: 3; }
.a-knob { fill: var(--select); stroke: var(--ink); stroke-width: 3; }
.drop-title { font-size: clamp(30px, 4vw, 44px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; margin: 0 0 6px; }
kbd { font: 700 13px/1 "Archivo", system-ui, sans-serif; border: 2px solid var(--ink); border-bottom-width: 3px; border-radius: 5px; padding: 2px 6px; background: var(--surface); color: var(--ink); }

#cv:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.stage.is-persp #cv:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.noscript { margin: 0; padding: 14px max(2vw, 16px); background: var(--select); color: #000; font-weight: 700; border-top: 2px solid #000; }

/* Textteil */
.info { border-top: 2px solid var(--ink); padding: clamp(32px, 5vw, 64px) max(2vw, 16px); }
.info-in { max-width: 1240px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: clamp(28px, 4vw, 56px); align-items: start; }
.info h1 { font-size: clamp(30px, 3.6vw, 46px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; margin: 0 0 16px; text-wrap: balance; }
.info h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; margin: 32px 0 12px; }
.faq h2 { margin-top: 0; }
.info h3 { font-size: 16px; font-weight: 800; margin: 0 0 4px; }
.lead { font-size: 18px; line-height: 1.55; margin: 0; max-width: 62ch; }
.uses { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.use { background: var(--surface); border: 2px solid var(--ink); border-radius: 8px; padding: 14px 16px; }
.use p { margin: 0; font-size: 15px; color: var(--muted); }
.steps { margin: 0; padding-left: 1.3em; display: grid; gap: 8px; max-width: 62ch; }
.steps li::marker { font-weight: 800; }
.faq details { background: var(--surface); border: 2px solid var(--ink); border-radius: 8px; margin-bottom: 10px; }
.faq summary { cursor: pointer; list-style: none; padding: 12px 44px 12px 16px; font-weight: 700; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 22px; font-weight: 800; line-height: 1; }
.faq details[open] summary { background: var(--accent); color: var(--on-accent); border-radius: 6px 6px 0 0; border-bottom: 2px solid var(--ink); }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 0; padding: 12px 16px 14px; font-size: 15px; }

/* Fußzeile */
.foot {
  display: flex; justify-content: space-between; gap: 8px 20px; flex-wrap: wrap;
  padding: 14px max(2vw, 16px); border-top: 2px solid var(--ink); background: var(--surface);
  font-size: 14px; color: var(--muted);
}
.foot a { color: var(--ink); font-weight: 700; text-decoration-thickness: 2px; text-underline-offset: 3px; }

/* Einblendungen */
.dragover {
  position: fixed; inset: 0; z-index: 50; display: none; place-items: center;
  background: color-mix(in srgb, var(--accent) 88%, transparent);
  border: 8px dashed var(--ink);
}
.dragover.is-on { display: grid; }
.dragover span { font-size: clamp(32px, 6vw, 64px); font-weight: 800; letter-spacing: -0.03em; color: var(--on-accent); }
.toast {
  position: fixed; left: 50%; bottom: 22px; z-index: 60; transform: translate(-50%, 140%);
  max-width: min(560px, calc(100vw - 32px)); padding: 12px 18px;
  background: var(--surface); color: var(--ink); border: 2px solid var(--ink); border-radius: 8px; box-shadow: var(--shadow);
  font-weight: 500; font-size: 15px; opacity: 0; pointer-events: none;
  transition: transform .2s ease, opacity .2s ease;
}
.toast.is-on { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .stage-wrap { order: -1; position: static; }
  .panel { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
  .stage { min-height: 340px; padding: 12px; }
  .info-in { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  .logo { font-size: 24px; }
  .top { padding: 10px 12px; }
  .top-right { width: 100%; justify-content: space-between; }
  .app { padding: 12px; gap: 14px; }
  .stage { min-height: 280px; }
}
@media (prefers-reduced-motion: reduce) {
  .btn, .switch, .switch::after, .toast { transition: none; }
}
