/* Design nach steamkraft3d.de: dunkler Stahl, Messing-Akzent, Bebas Neue + Barlow.
   Die Schriftdateien liegen (falls vorhanden) in fonts/; sonst greifen die Ersatzschriften. */
@font-face { font-family: "Bebas Neue"; font-style: normal; font-weight: 400; font-display: swap;
  src: local("Bebas Neue"), url("../fonts/bebas-neue-regular.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 400; font-display: swap;
  src: local("Barlow"), url("../fonts/barlow-400.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 500; font-display: swap;
  src: local("Barlow Medium"), url("../fonts/barlow-500.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 600; font-display: swap;
  src: local("Barlow SemiBold"), url("../fonts/barlow-600.woff2") format("woff2"); }

:root {
  color-scheme: dark;
  --bg: #0c0e11;
  --bg-2: #13161b;
  --panel: #171a20;
  --panel2: #1e222a;
  --field: #0f1216;
  --line: #2a2f37;
  --line-2: #333a44;
  --steel-1: #e9ebee;
  --steel-2: #b9bec6;
  --steel-3: #8a9099;
  --text: #d9dce1;
  --muted: #9aa1ab;
  --brass: #a77a35;
  --brass-light: #d2a65a;
  --brass-dark: #6e4f1f;
  --glow: #8cc4ee;
  --accent: var(--brass-light);
  --display: "Bebas Neue", "Oswald", "Arial Narrow", "Roboto Condensed", sans-serif;
  --body: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 14px/1.4 var(--body); -webkit-font-smoothing: antialiased; }
#app { display: flex; height: 100%; }
a { color: var(--brass-light); }
a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible {
  outline: 2px solid var(--brass-light); outline-offset: 2px; }
input[type=range], input[type=checkbox] { accent-color: var(--brass-light); }
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 5px; border: 2px solid var(--bg-2); }
::-webkit-scrollbar-track { background: var(--bg-2); }

/* gebürstetes Metall für Schriftzüge */
.steel-text {
  background:
    repeating-linear-gradient(180deg, rgba(255,255,255,.18) 0 1px, rgba(0,0,0,.06) 1px 3px),
    linear-gradient(100deg, var(--steel-3) 0%, var(--steel-1) 22%, var(--steel-2) 45%, var(--steel-1) 68%, var(--steel-3) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* Seitenleisten */
.panel { flex: none; background: var(--bg-2); overflow-y: auto; padding: 0 14px 18px; }
#side { width: 300px; border-right: 1px solid var(--line); }
#right { width: 340px; border-left: 1px solid var(--line); padding-top: 14px; }
.titlebar { display: flex; align-items: center; justify-content: space-between; height: 56px;
  margin: 0 -14px; padding: 0 14px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 2; background: rgba(19, 22, 27, .92); backdrop-filter: blur(8px); }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; min-width: 0; }
#lang { flex: none; }
.iconlink { flex: none; margin-left: auto; margin-right: 8px; display: inline-flex; align-items: center;
  justify-content: center; width: 28px; height: 28px; border-radius: 50%; color: var(--steel-2);
  border: 1px solid var(--line-2); }
.iconlink:hover { color: var(--brass-light); border-color: var(--brass); }
.iconlink svg.ic { width: 18px; height: 18px; }
.brand svg { width: 24px; height: 24px; color: var(--brass-light); flex: none; }
.panel h1 { font-family: var(--display); font-weight: 400; font-size: 22px; line-height: 32px; margin: 0;
  overflow: hidden; white-space: nowrap; letter-spacing: .09em; text-transform: uppercase; padding-top: 3px; font-synthesis: none; }
/* Wortanfänge T und A größer (Kapitälchen-Wirkung), kleine Lücke vor dem zweiten Wort */
.panel h1 b { font-weight: 400; font-size: 31px; letter-spacing: .04em; }
.panel h1 b + b, .panel h1 b:nth-of-type(2) { margin-left: .12em; }
.panel h2 { font-family: var(--body); font-size: 11.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .18em; color: var(--brass-light); margin: 0 0 10px; }
section { border-top: 1px solid var(--line); padding: 14px 0; }
section.first, .titlebar + section { border-top: none; }
section.first { padding-top: 0; }
.row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.row:last-child { margin-bottom: 0; }
.muted { color: var(--muted); font-size: 13px; }

/* Bedienelemente */
button, select, input[type=text] { font: inherit; color: var(--steel-1); background: var(--panel2);
  border: 1px solid var(--line-2); border-radius: 6px; padding: 5px 10px;
  transition: border-color .15s ease, color .15s ease, background .15s ease, box-shadow .15s ease; }
select, input[type=text] { background: var(--field); }
select:focus, input[type=text]:focus { outline: none; border-color: var(--brass);
  box-shadow: 0 0 0 3px rgba(167, 122, 53, .18); }
button { cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-weight: 500; }
button > * { pointer-events: none; } /* Klick trifft immer den Button selbst */
button:hover { border-color: var(--brass); color: var(--brass-light); }
button.primary { color: #1a1206; border-color: var(--brass-dark); font-weight: 600;
  background: linear-gradient(180deg, var(--brass-light), var(--brass) 55%, var(--brass-dark));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 4px 12px rgba(167,122,53,.22); }
button.primary:hover { color: #1a1206; border-color: var(--brass-light);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 6px 16px rgba(167,122,53,.35); }
.seg { flex-wrap: nowrap; }
.seg button { flex: 1; min-width: 0; white-space: nowrap; }
.seg button.on { background: rgba(167, 122, 53, .16); border-color: var(--brass); color: var(--brass-light); }

/* Sprachumschalter wie auf der Webseite */
#lang { display: flex; border: 1px solid var(--line-2); border-radius: 999px; overflow: hidden; }
#lang button { flex: none; border: 0; border-radius: 0; background: none; color: var(--steel-3);
  font-family: var(--display); font-weight: 400; font-size: 14px; letter-spacing: .12em; line-height: 1;
  padding: 6px 10px 4px; }
#lang button:hover { color: var(--brass-light); }
#lang button.on { background: rgba(167, 122, 53, .16); color: var(--brass-light); }

svg.ic { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; }

/* Werkzeuge: großes Icon, Beschriftung darunter */
.tools button { flex-direction: column; gap: 3px; padding: 8px 2px 6px; font-size: 12px; min-width: 0; }
.tools button svg.ic { width: 22px; height: 22px; stroke-width: 1.8; }

label.line { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; color: var(--muted); }
label.line > input, label.line > select { flex: 1; min-width: 0; }
label.check { display: flex; align-items: flex-start; gap: 6px; margin-bottom: 6px; cursor: pointer; }
label.check input { margin-top: 3px; }
#planeTolVal { width: 30px; text-align: right; }

/* Hauptgruppen: Metallplatten */
.plane { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px;
  background: linear-gradient(180deg, #1b1f26, #15181d); }
.plane .phead { display: flex; align-items: center; gap: 6px; padding: 8px 9px 7px; cursor: pointer; user-select: none; }
.plane .caret { display: inline-flex; color: var(--brass); transition: transform .12s; }
.plane.collapsed .caret { transform: rotate(-90deg); }
.plane .ptitle { font-family: var(--display); font-size: 19px; letter-spacing: .1em; line-height: 1;
  padding-top: 3px; color: var(--steel-1); white-space: nowrap; text-transform: uppercase; }
.plane .pcount { color: var(--muted); font-size: 13px; flex: 1; white-space: nowrap; }
.plane .phead select, .plane .phead button { padding: 3px 5px; white-space: nowrap; }
.plane .phead select { min-width: 0; flex: 0 1 auto; }
.plane .phead button svg.ic { width: 13px; height: 13px; }
.plane .pbody { padding: 0 8px 2px; }
.plane .pbody > .muted { padding: 0 0 8px; }
.plane.collapsed .pbody { display: none; }

/* Sets */
.group { border: 1px solid var(--line); border-left: 4px solid var(--gc, #888); border-radius: 6px;
  padding: 8px; margin-bottom: 8px; background: var(--panel); cursor: pointer;
  transition: border-color .15s ease, background .15s ease; }
.group.active { border-color: var(--gc); background: #1d2129; box-shadow: 0 0 0 1px var(--gc) inset; }
.group .head { display: flex; gap: 5px; align-items: center; margin-bottom: 6px; }
.group .head input[type=text] { flex: 1; min-width: 0; }
.group .head button { padding: 4px 6px; }
.group .head button.off { opacity: .4; }
.group .head input[type=color] { width: 24px; height: 24px; padding: 0; border: 1px solid var(--line-2);
  border-radius: 4px; background: none; cursor: pointer; flex: none; }
.group .opts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.group .opts select { padding: 3px 4px; }
.group .opts label { display: flex; align-items: center; gap: 4px; color: var(--muted); }
.group .stats { margin-top: 6px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.group .stats b { color: var(--steel-1); font-weight: 600; }

#measure div { margin-bottom: 4px; font-variant-numeric: tabular-nums; }
#measure b { color: var(--steel-1); font-weight: 600; }
#measure .sw { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 3px; }

/* Datenschutz-Hinweis: alles läuft lokal */
.local { display: flex; align-items: flex-start; gap: 8px; margin-top: 10px; padding: 8px 10px;
  border: 1px solid rgba(96, 176, 120, .45); background: rgba(80, 160, 100, .10); border-radius: 6px;
  color: #bfe3c8; font-size: 13px; line-height: 1.35; cursor: help; }
.local svg.ic { width: 18px; height: 18px; color: #7fd49a; margin-top: 1px; }
#empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 24px; pointer-events: none; }
#empty[hidden] { display: none; }
#empty .card { max-width: 520px; text-align: center; padding: 28px 30px 26px; border-radius: 10px;
  border: 1px solid var(--line); background: linear-gradient(180deg, rgba(27, 31, 38, .94), rgba(21, 24, 29, .94)); }
#empty .etitle { font-family: var(--display); font-size: 34px; line-height: 1; letter-spacing: .08em;
  text-transform: uppercase; color: var(--steel-1); font-synthesis: none; }
#empty p { margin: 10px 0 0; color: var(--muted); font-size: 15px; }
#empty .safe { display: flex; gap: 12px; align-items: flex-start; text-align: left; margin-top: 20px;
  padding: 12px 14px; border: 1px solid rgba(96, 176, 120, .45); background: rgba(80, 160, 100, .10);
  border-radius: 8px; color: #bfe3c8; font-size: 14px; line-height: 1.45; }
#empty .safe svg.ic { width: 30px; height: 30px; color: #7fd49a; stroke-width: 1.7; }
#empty .safe b { display: block; color: #e3f5e8; font-weight: 600; font-size: 15px; margin-bottom: 2px; }

/* Fußzeile der linken Leiste */
.foot { border-top: 1px solid var(--line); padding-top: 12px; font-size: 12.5px; color: var(--muted);
  display: flex; flex-wrap: wrap; gap: 4px 14px; }
.foot a { color: var(--steel-2); text-decoration: none; }
.foot a:hover { color: var(--brass-light); }

/* 3D-Ansicht */
#view { position: relative; flex: 1; min-width: 0; overflow: hidden; }
#gl, #overlay { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#overlay { pointer-events: none; }
#gl { touch-action: none; }
#status, #hint, #legend { position: absolute; left: 12px; padding: 5px 11px; border-radius: 6px;
  background: rgba(12, 14, 17, .82); border: 1px solid var(--line); pointer-events: none;
  max-width: calc(100% - 24px); }
#status { bottom: 12px; }
#hint { top: 12px; color: var(--muted); }
#legend { bottom: 12px; left: auto; right: 12px; color: var(--muted); }
.ax { font-weight: 600; margin-right: 6px; }
.ax.x { color: #ff5c5c; } .ax.y { color: #57d357; } .ax.z { color: #5c9cff; }
#drop { position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  font-family: var(--display); font-size: 34px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--brass-light); background: rgba(167, 122, 53, .14); border: 3px dashed var(--brass);
  pointer-events: none; }
#drop.show { display: flex; }
