/* Keine externen Schriften oder CDNs: alles kommt vom eigenen Server (Datenschutz). */
:root {
  --bg: #f5f6f4;
  --card: #ffffff;
  --text: #1d2321;
  --muted: #5d6763;
  --line: #dde2df;
  --accent: #23845a;
  --accent-text: #ffffff;
  --accent-soft: #e3f3eb;
  --warn: #9a5b00;
  --warn-soft: #fff4e0;
  --error: #b42318;
  --viewer-bg: #e9ecea;
  --model: #d9822b;
  --grid: #c9cfcc;
  --grid-strong: #a3aba7;
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121615;
    --card: #1b2120;
    --text: #e6ebe8;
    --muted: #9aa5a0;
    --line: #2d3532;
    --accent: #3fb47f;
    --accent-text: #08130e;
    --accent-soft: #1d3329;
    --warn: #f0b34a;
    --warn-soft: #33281a;
    --error: #ff7b6e;
    --viewer-bg: #161b1a;
    --model: #e39243;
    --grid: #2c3431;
    --grid-strong: #46504c;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; }
small, .hint { color: var(--muted); font-size: 0.875rem; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Kopf und Fuß */
.site-header { border-bottom: 1px solid var(--line); background: var(--card); }
.header-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; min-height: 56px; padding: 8px 16px; }
.tool-nav { display: flex; gap: 4px; margin-right: auto; }
.tool-nav a { padding: 6px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.9375rem; white-space: nowrap; }
.tool-nav a:hover { color: var(--text); }
.tool-nav a[aria-current] { background: var(--accent-soft); color: var(--accent); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.125rem; }
.lang-switch { display: flex; gap: 4px; }
.lang-switch a { padding: 4px 8px; border-radius: 6px; color: var(--muted); text-decoration: none; font-size: 0.875rem; font-weight: 600; }
.lang-switch a[aria-current] { background: var(--accent-soft); color: var(--accent); }
.site-footer { margin-top: 48px; padding: 24px 0 32px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.875rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.footer-links + .footer-links { margin-top: 10px; }
.footer-links a { color: var(--muted); }
.disclaimer { margin: 16px 0 0; font-size: 0.75rem; letter-spacing: 0.02em; }

/* Bausteine */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin: 24px 0; }
.narrow { max-width: 560px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 16px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--text); font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: 0.55; cursor: wait; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.big { padding: 12px 28px; font-size: 1.0625rem; }
.btn.small { padding: 4px 10px; font-size: 0.8125rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Startseite */
.hero { padding: 40px 0 8px; }
.hero h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); margin: 0 0 12px; }
.lead { font-size: 1.125rem; color: var(--muted); max-width: 680px; margin: 0; }
.step + .step { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.step h2 { display: flex; align-items: center; gap: 10px; font-size: 1.25rem; margin: 0 0 16px; }
.num {
  display: inline-grid; place-items: center; width: 28px; height: 28px; flex: none;
  border-radius: 50%; background: var(--accent); color: var(--accent-text); font-size: 0.9375rem;
}
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  padding: 36px 16px; border: 2px dashed var(--line); border-radius: var(--radius); cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.over, .dropzone:focus-within { border-color: var(--accent); background: var(--accent-soft); }
.dropzone span { color: var(--muted); font-size: 0.9375rem; }
.status { min-height: 1.5em; margin: 12px 0 0; }
.status.busy::before {
  content: ""; display: inline-block; width: 0.9em; height: 0.9em; margin-right: 8px; vertical-align: -0.1em;
  border: 2px solid var(--accent); border-right-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite;
}
.status.error { color: var(--error); font-weight: 600; }
@keyframes spin { to { transform: rotate(360deg); } }
.file-summary { margin: -6px 0 16px; color: var(--muted); overflow-wrap: anywhere; }

.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-weight: 600; }
select {
  font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--text);
}
.checks { display: grid; gap: 8px; margin: 20px 0; }
.checks label { display: flex; gap: 10px; align-items: flex-start; }
.checks input { margin-top: 0.3em; }
input[type="checkbox"] { accent-color: var(--accent); width: 1.05em; height: 1.05em; flex: none; }

.blocks-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.blocks-head h3 { margin: 0; font-size: 1.0625rem; }
.blocks-head h3 small { font-weight: 400; margin-left: 6px; }
.block-list {
  max-height: 340px; overflow-y: auto; margin-top: 8px;
  border: 1px solid var(--line); border-radius: 8px;
}
.block-row {
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px;
  padding: 7px 12px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.block-row:last-child { border-bottom: 0; }
.block-row:hover { background: var(--accent-soft); }
.block-name { overflow-wrap: anywhere; }
.block-count { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 4.5em; text-align: right; }
.badge { font-size: 0.75rem; padding: 2px 8px; border-radius: 999px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.badge.kind-stairs, .badge.kind-slab { background: var(--accent-soft); color: var(--accent); }

.content { margin-top: 40px; }
.content h2 { margin-top: 32px; }
.how { padding-left: 1.25em; }
.how li { margin-bottom: 10px; }
details { border-bottom: 1px solid var(--line); padding: 12px 0; }
summary { cursor: pointer; font-weight: 600; }
details p { margin: 8px 0 0; color: var(--muted); }

/* Ergebnisseite */
.result-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 24px; margin-top: 24px; }
.result-grid .card { margin: 0; }
.viewer-card { padding: 12px; }
.viewer { position: relative; height: 440px; border-radius: 8px; overflow: hidden; background: var(--viewer-bg); }
.viewer canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.viewer-msg { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; padding: 16px; text-align: center; color: var(--muted); }
.viewer-card .hint { margin: 8px 4px 0; }
.facts h1 { font-size: 1.5rem; margin: 0 0 16px; }
.facts dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0 0 20px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.facts .btn.primary { width: 100%; }
.facts .hint { margin: 8px 0 16px; }
.tips ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.tips li { padding: 10px 14px; border-radius: 8px; background: var(--accent-soft); }
.tips li.tip-warn { background: var(--warn-soft); color: var(--warn); font-weight: 600; }

/* Anleitungen */
.breadcrumb { margin: 20px 0 0; font-size: 0.875rem; color: var(--muted); }
.breadcrumb a { color: var(--muted); }
.guide { max-width: 820px; }
.guide h1 { margin-top: 0; font-size: clamp(1.5rem, 3.4vw, 2.1rem); }
.guide h2 { margin-top: 32px; font-size: 1.3125rem; }
.guide-meta { color: var(--muted); font-size: 0.875rem; margin-top: -8px; }
.guide .lead { font-size: 1.0625rem; }
.toc { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; margin: 20px 0; }
.toc ol { margin: 0; padding-left: 1.25em; }
.steps { padding-left: 1.4em; }
.steps li { margin-bottom: 10px; }
code, kbd {
  font: 0.875em ui-monospace, SFMono-Regular, Consolas, monospace; padding: 1px 6px; border-radius: 5px;
  background: var(--bg); border: 1px solid var(--line); overflow-wrap: anywhere;
}
kbd { box-shadow: 0 1px 0 var(--line); }
.compare { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 0.9375rem; display: block; overflow-x: auto; }
.compare th, .compare td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.compare thead th { color: var(--muted); font-weight: 600; }
.cta { margin-top: 32px; padding: 18px; border-radius: var(--radius); background: var(--accent-soft); }
.cta p { margin: 0 0 12px; }
.related h2 { font-size: 1.1875rem; }
.guide-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.guide-list p { margin: 4px 0 0; color: var(--muted); }
.guide-cards .card { margin: 0; }
.guide-cards h2 { margin: 0; font-size: 1.1875rem; }

/* Pflichtseiten */
.legal { max-width: 760px; }
.legal h1 { margin-top: 0; }
.legal h2 { font-size: 1.1875rem; margin-top: 28px; }
.legal mark { background: var(--warn-soft); color: var(--warn); padding: 0 4px; border-radius: 4px; }
.draft-note { padding: 10px 14px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); font-weight: 600; }

.size-input { display: flex; align-items: center; gap: 10px; }
.size-input input[type="range"] { flex: 1; accent-color: var(--accent); }
.size-input input[type="number"] {
  width: 5.5em; font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--text);
}

@media (max-width: 760px) {
  .card { padding: 18px; }
  .tool-nav { order: 3; width: 100%; margin-right: 0; }
  .result-grid { grid-template-columns: 1fr; }
  .viewer { height: 320px; }
  .block-row { grid-template-columns: auto 1fr auto; }
  .block-row .badge { display: none; }
}
