/* Winkelhalter-Konfigurator. Farben, Abstände und Schrift kommen aus dem
   Designsystem der Webseite (data-tb-design); hier stehen keine eigenen Farben. */

.hk { display: grid; gap: 20px; align-items: start; }
.hk *, .hk *::before, .hk *::after { box-sizing: border-box; }

/* ---- Vorschau und Ergebnis ---------------------------------------------- */
.hk-ansicht {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px; display: grid; gap: 14px; min-width: 0;
}
.hk-buehne-rahmen { position: relative; }
.hk-buehne {
  aspect-ratio: 4 / 3; width: 100%; border-radius: 10px; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--border);
}
.hk-buehne canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.hk-buehne canvas:active { cursor: grabbing; }
.hk-buehne canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hk-ohne { display: grid; place-items: center; height: 100%; margin: 0; padding: 16px; text-align: center;
  color: var(--text-muted); font-size: 14px; }
.hk-klein {
  position: absolute; right: 8px; top: 8px;
  font: inherit; font-size: 12.5px; line-height: 1.2; color: var(--text-secondary);
  background: color-mix(in srgb, var(--surface) 85%, transparent); border: 1px solid var(--border); border-radius: 8px; padding: 5px 9px; cursor: pointer;
}
.hk-klein:hover { color: var(--text-primary); border-color: var(--border-strong); }

.hk-werte { display: grid; gap: 6px; margin: 0; font-size: 15px; color: var(--text-secondary); }
.hk-werte div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed var(--border); padding-bottom: 6px; }
.hk-werte dt { margin: 0; }
.hk-werte dd { margin: 0; color: var(--text-primary); font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.hk-werte:empty { display: none; }

.hk-meldungen { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.hk-meldungen:empty { display: none; }
.hk-meldungen li {
  font-size: 14px; color: var(--schlecht); padding: 8px 10px 8px 12px;
  border-left: 3px solid var(--schlecht); background: color-mix(in srgb, var(--schlecht) 8%, transparent); border-radius: 6px;
}

.hk-aktionen { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.hk .btn { cursor: pointer; font-family: inherit; }
.hk .btn:disabled { opacity: .45; cursor: not-allowed; }
.hk-zweit {
  display: inline-flex; align-items: center; font: inherit; font-weight: 600; font-size: 15px;
  padding: 10px 16px; border-radius: 10px; cursor: pointer; text-decoration: none;
  background: transparent; color: var(--accent); border: 1px solid var(--border-strong);
}
.hk-zweit:hover { border-color: var(--accent); }
.hk-haftung { font-size: 13px; color: var(--text-muted); margin: 0; }

.hk-unterstuetzen {
  border-top: 1px solid var(--border); padding-top: 14px; display: grid; gap: 8px; justify-items: start;
}
.hk-unterstuetzen h2 { font-size: 15px; margin: 0; letter-spacing: 0; }
.hk-unterstuetzen p { font-size: 14px; margin: 0; color: var(--text-secondary); }

.hk-werte dd small { display: block; font-weight: 400; font-size: 12.5px; color: var(--text-muted); }

/* Montage-Ampel */
.hk-montage { display: grid; gap: 8px; }
.hk-montage[hidden] { display: none; }
.hk-montage-titel { margin: 0; font-size: 15px; color: var(--text-secondary); }
.hk-ampel table { width: 100%; border-collapse: collapse; font-size: 14px; }
.hk-ampel th, .hk-ampel td { padding: 5px 6px; text-align: left; border-bottom: 1px dashed var(--border); }
.hk-ampel thead th { font-weight: 600; color: var(--text-muted); font-size: 13px; }
.hk-ampel tbody th { font-weight: 600; color: var(--text-primary); white-space: nowrap; }
.hk-ampel td { white-space: nowrap; }
.hk-punkt { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: currentColor; }
.hk-passt { color: var(--gut); }
.hk-knapp { color: var(--warn); }
.hk-nicht { color: var(--schlecht); }
.hk-leise { margin: 0; font-size: 14px; color: var(--text-muted); }
.hk-werkzeug { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 14px; }
.hk-werkzeug label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--text-secondary); }
.hk-werkzeug input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.hk-werkzeug select {
  font: inherit; font-size: 14px; color: var(--text-primary); background: var(--bg);
  border: 1px solid var(--border-strong); border-radius: 8px; padding: 6px 8px;
}

/* ---- Formular ----------------------------------------------------------- */
.hk-form { display: grid; gap: 14px; min-width: 0; }
.hk-gruppe[hidden] { display: none; }

/* Umschalter Einfach / Profi */
.hk-modus {
  margin: 0; padding: 4px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
}
.hk-modus input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.hk-modus label {
  display: block; text-align: center; padding: 9px 12px; border-radius: 9px; cursor: pointer;
  font-weight: 600; font-size: 15px; color: var(--text-secondary);
}
.hk-modus input:checked + label { background: var(--akzent-flaeche, var(--accent)); color: var(--auf-akzent, #fff); }
.hk-modus input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
.hk-gruppe {
  margin: 0; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px 18px;
}
.hk-gruppe legend {
  padding: 0 6px; margin-left: -6px; font-family: var(--kopf); font-size: 16px; font-weight: 700; color: var(--text-primary);
}
.hk-felder { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; margin-top: 6px; }
.hk-feld { display: grid; gap: 6px; align-content: start; min-width: 0; }
.hk-feld[hidden] { display: none; }
.hk-feld label { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.hk-feld small { font-size: 12.5px; color: var(--text-muted); }
.hk-eingabe { position: relative; display: block; }
.hk-eingabe input { padding-right: 42px; }
.hk-einheit {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font-size: 14px; color: var(--text-muted); pointer-events: none;
}
.hk-feld input[type="number"], .hk-feld input[type="text"], .hk-feld select {
  font: inherit; font-size: 16px; color: var(--text-primary); background: var(--bg);
  border: 1px solid var(--border-strong); border-radius: 8px; padding: 10px 12px; width: 100%; min-width: 0;
}
.hk-feld input:focus, .hk-feld select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.hk-fehler input, .hk-fehler select { border-color: var(--schlecht); }
.hk-schalter { grid-column: 1 / -1; }
.hk-schalter label { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.hk-schalter input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }

@media (max-width: 420px) {
  .hk-felder { grid-template-columns: 1fr; }
}

/* Breite Bildschirme: Vorschau links und mitlaufend, Einstellungen rechts */
@media (min-width: 900px) {
  .hk { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
  .hk-ansicht { position: sticky; top: 84px; }
}

/* ---- Schraubenkacheln ---------------------------------------------------- */
.hk-feld-breit { grid-column: 1 / -1; }
.hk-label { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.hk-kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.hk-kachel-wahl { position: absolute; opacity: 0; width: 1px; height: 1px; }
.hk-kachel {
  display: grid; gap: 4px; align-content: start; padding: 10px; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: 10px; background: var(--bg);
}
.hk-kachel strong { font-size: 13.5px; line-height: 1.25; color: var(--text-primary); }
.hk-kachel span { font-size: 12.5px; line-height: 1.35; color: var(--text-secondary); }
.hk-kachel small { font-size: 11.5px; color: var(--text-muted); font-family: var(--mono); }
.hk-kachel:hover { border-color: var(--accent); }
.hk-kachel-wahl:checked + .hk-kachel { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-weich); }
.hk-kachel-wahl:focus-visible + .hk-kachel { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Zeichnungen (SVG) --------------------------------------------------- */
.sk { display: block; width: 100%; height: auto; overflow: visible; }
.sk-kachel { max-width: 140px; }
.sk-text { fill: var(--text-secondary); font: 600 12px var(--schrift, system-ui, sans-serif); }
.sk-klein { fill: var(--text-muted); font: 11px var(--schrift, system-ui, sans-serif); }
.sk-gut-text { fill: var(--gut); }
.sk-schlecht-text { fill: var(--schlecht); }
.sk-teil { fill: var(--accent-weich); stroke: var(--accent); stroke-width: 1.5; stroke-linejoin: round; }
.sk-schicht { fill: var(--surface); stroke: var(--accent); stroke-width: 1; opacity: .75; }
.sk-platte { fill: var(--surface-3); stroke: var(--text-secondary); stroke-width: 1.2; }
.sk-loch { fill: var(--bg); stroke: var(--text-secondary); stroke-width: 1.2; }
.sk-schraube { fill: var(--surface-2); stroke: var(--text-primary); stroke-width: 1.2; stroke-linejoin: round; }
.sk-durchsicht { fill-opacity: .6; }
.sk-gewinde { stroke: var(--text-secondary); stroke-width: .9; }
.sk-antrieb { fill: var(--text-primary); stroke: none; }
.sk-mass, .sk-hilfslinie { fill: none; stroke: var(--text-muted); stroke-width: 1; }
.sk-hilfslinie { stroke-dasharray: 3 3; }
.sk-mass-spitze { fill: var(--text-muted); }
.sk-last { fill: none; stroke: var(--kupfer); stroke-width: 2.5; }
.sk-last-spitze { fill: var(--kupfer); }
.sk-schichtlinie { stroke: var(--accent); stroke-width: .8; opacity: .7; }
.sk-faser { fill: none; stroke: var(--gut); stroke-width: 2; stroke-dasharray: 6 4; }
.sk-riss { fill: none; stroke: var(--schlecht); stroke-width: 2.2; }
.sk-bett { fill: var(--surface-3); stroke: var(--border-strong); }
.sk-wand { stroke: var(--border-strong); }
.sk-schraffur { stroke: var(--border-strong); stroke-width: 1; }
.sk-griff { fill: var(--kupfer); stroke: var(--text-primary); stroke-width: 1; }
.sk-metall { fill: var(--surface-3); stroke: var(--text-primary); stroke-width: 1; }
.sk-riffel { stroke: var(--text-primary); stroke-width: .7; opacity: .5; }
.sk-seitlich { opacity: .55; }
.hk-skizze { margin: 4px 0 10px; max-width: 520px; }
.hk-montage-text { margin: 0; font-size: 14px; color: var(--text-secondary); }
.hk-montage-text:empty { display: none; }
.hk-werkzeug select { max-width: 100%; }

/* Bilder in den Erklärungen */
.bild { margin: 8px 0 16px; display: grid; gap: 6px; }
.bild figcaption { font-size: 13px; color: var(--text-muted); }
.bilder-reihe { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.druckbett { aspect-ratio: 16 / 10; width: 100%; max-width: 560px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.druckbett canvas { display: block; }
.bild > .sk { max-width: 560px; }
.bilder-reihe .sk { max-width: 100%; }
.hk { grid-template-columns: minmax(0, 1fr); }
.hk-ampel { overflow-x: auto; }
.hk-ampel th, .hk-ampel td { white-space: normal; }
.hk-ampel thead th { font-size: 12px; line-height: 1.25; vertical-align: bottom; }
@media (max-width: 480px) {
  .hk-ampel table { font-size: 13px; }
  .hk-ampel th, .hk-ampel td { padding: 4px 3px; }
}
@media (min-width: 900px) {
  .hk { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
}
.sk-schnitt { stroke: none; }
.sk-schraube { fill: color-mix(in srgb, var(--accent) 22%, var(--surface)); stroke: var(--accent); }
.sk-gewinde { stroke: var(--accent); opacity: .8; }
