/* Layout and instrument styling for Mechsim. Instruments stay light in dark mode (they are steel). */

:root {
  --hg: #f4f6f9;
  --flaeche: #ffffff;
  --text: #1f2933;
  --leise: #5b6673;
  --linie: #d7dde5;
  --akzent: #2563eb;
  --akzent-text: #ffffff;
  --richtig: #15803d;
  --falsch: #b91c1c;
  --treffer: #dc2626;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --hg: #12161c;
    --flaeche: #1b2129;
    --text: #e6eaef;
    --leise: #9aa5b1;
    --linie: #2e3742;
    --akzent: #60a5fa;
    --akzent-text: #0b1220;
    --richtig: #4ade80;
    --falsch: #f87171;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --hg: #12161c;
  --flaeche: #1b2129;
  --text: #e6eaef;
  --leise: #9aa5b1;
  --linie: #2e3742;
  --akzent: #60a5fa;
  --akzent-text: #0b1220;
  --richtig: #4ade80;
  --falsch: #f87171;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--hg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--akzent); }

.kopf {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--flaeche);
  border-bottom: 1px solid var(--linie);
  position: sticky;
  top: 0;
  z-index: 10;
}
.marke-name { font-weight: 700; font-size: 1.15rem; color: var(--text); text-decoration: none; }
.untertitel { color: var(--leise); font-size: 0.9rem; }
.menu-knopf {
  display: none;
  font-size: 1.3rem;
  background: none;
  border: 1px solid var(--linie);
  border-radius: 8px;
  color: var(--text);
  padding: 2px 10px;
  cursor: pointer;
}

.rahmen { display: flex; min-height: calc(100vh - 54px); }

.seitenleiste {
  width: 240px;
  flex-shrink: 0;
  padding: 16px 12px;
  background: var(--flaeche);
  border-right: 1px solid var(--linie);
}
.seitenleiste a { display: block; padding: 6px 10px; border-radius: 6px; color: var(--text); text-decoration: none; }
.seitenleiste a:hover { background: var(--hg); }
.seitenleiste a.aktiv { background: var(--akzent); color: var(--akzent-text); }
.seitenleiste ul { list-style: none; margin: 0 0 0 12px; padding: 0; }
.seitenleiste .gruppe { margin-top: 10px; }
.seitenleiste .gruppe > a { font-weight: 600; }
.seitenleiste .geplant { display: block; padding: 0 22px; color: var(--leise); font-size: 0.8rem; }

.inhalt { flex: 1; min-width: 0; padding: 20px 24px 48px; max-width: 1000px; }
h1 { margin: 0 0 6px; font-size: 1.6rem; }
.einleitung { color: var(--leise); margin-top: 0; }
.leise { color: var(--leise); }

.raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-top: 16px; }
.karte {
  display: block;
  padding: 14px 16px;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
}
a.karte:hover { border-color: var(--akzent); }
.karte h2 { margin: 0 0 4px; font-size: 1.1rem; }
.karte p { margin: 0; color: var(--leise); font-size: 0.92rem; }
.karte.geplant { opacity: 0.7; }
.marke { display: inline-block; margin-top: 8px; font-size: 0.75rem; color: var(--leise); border: 1px solid var(--linie); border-radius: 99px; padding: 0 8px; }

.modi { display: flex; gap: 6px; margin: 14px 0 10px; flex-wrap: wrap; }
.tab {
  padding: 7px 16px;
  border: 1px solid var(--linie);
  border-radius: 99px;
  background: var(--flaeche);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.tab.aktiv { background: var(--akzent); border-color: var(--akzent); color: var(--akzent-text); }

.zeile { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.zeile input[type="range"] { flex: 1; min-width: 140px; }
.feld { display: inline-flex; align-items: center; gap: 6px; }
.feld.breit { flex: 1; min-width: 200px; }
.feld.breit input { flex: 1; }
select, .eingabe {
  font: inherit;
  padding: 6px 8px;
  border: 1px solid var(--linie);
  border-radius: 6px;
  background: var(--flaeche);
  color: var(--text);
}
.eingabe { width: 9em; font-size: 1.1rem; }

.knopf {
  font: inherit;
  min-width: 44px;
  min-height: 40px;
  padding: 6px 12px;
  border: 1px solid var(--linie);
  border-radius: 8px;
  background: var(--flaeche);
  color: var(--text);
  cursor: pointer;
}
.knopf:hover:not(:disabled) { border-color: var(--akzent); }
.knopf.haupt { background: var(--akzent); border-color: var(--akzent); color: var(--akzent-text); }
.knopf.richtig { border-color: var(--richtig); box-shadow: inset 0 0 0 2px var(--richtig); }
.knopf.falsch { border-color: var(--falsch); box-shadow: inset 0 0 0 2px var(--falsch); }

.antworten { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-width: 440px; }
.antwort { font-size: 1.1rem; }

.buehne {
  background: #fbfcfd;
  border: 1px solid var(--linie);
  border-radius: 10px;
  padding: 10px;
  margin: 10px 0;
}
.buehne .zeile { color: #1f2933; }
.buehne select { background: #fff; color: #1f2933; border-color: #c5ccd6; }

.ausgabe { min-height: 3em; }
.messwert { font-size: 1.5rem; font-weight: 700; margin: 6px 0; }
.richtig { color: var(--richtig); font-weight: 600; }
.falsch { color: var(--falsch); font-weight: 600; }
p.richtig, p.falsch { margin: 8px 0 4px; }
.erklaerung { margin: 4px 0 12px; padding-left: 20px; }
.hinweis { color: var(--leise); font-size: 0.92rem; margin: 4px 0; }

/* Instruments */
svg.instrument { display: block; width: 100%; height: auto; touch-action: none; user-select: none; cursor: grab; }
svg.instrument.zieht { cursor: grabbing; }
.nicht-interaktiv svg.instrument { touch-action: auto; cursor: default; }
svg.uebersicht { max-height: 150px; }
svg.messuhr { max-width: 420px; margin: 0 auto; }
svg text { font-family: system-ui, sans-serif; }
.stahl { fill: #c9ced6; stroke: #6b7480; stroke-width: 0.6; }
svg:not(.uebersicht) .stahl { stroke-width: 2; }
.stahl.hell { fill: #dfe3e8; }
.schieber { fill: #e9edf2; stroke: #6b7480; stroke-width: 0.6; }
.lupe .schieber { stroke-width: 2; }
.fenster { fill: #f7f9fb; stroke: #8b939d; stroke-width: 0.4; }
.huelse { fill: #e4e8ec; stroke: #6b7480; stroke-width: 2; }
.trommel { stroke: #6b7480; stroke-width: 2; }
.werkstueck { fill: rgba(245, 158, 11, 0.45); stroke: #b45309; stroke-width: 0.8; }
.messschraube .werkstueck, svg:not(.uebersicht) .werkstueck { stroke-width: 2; }
.strich { stroke: #111827; stroke-width: 2.4; }
.strich.duenn { stroke-width: 0.5; }
.strich.treffer { stroke: var(--treffer); stroke-width: 4; }
.zahl { fill: #111827; font-size: 30px; text-anchor: middle; }
.zahl.klein { font-size: 22px; fill: #4b5563; }
.zahl.mini { font-size: 16px; }
.zahl.rechts { text-anchor: end; }
.zahl.treffer { fill: var(--treffer); font-weight: 700; }
.zifferblatt { fill: #ffffff; stroke: #9aa2ad; stroke-width: 2; }
.zeiger { stroke: #dc2626; stroke-width: 5; stroke-linecap: round; }
.zeiger.klein { stroke: #1f2937; stroke-width: 4; }
.nabe { fill: #1f2937; }

@media (max-width: 760px) {
  .menu-knopf { display: block; }
  .untertitel { display: none; }
  .rahmen { display: block; }
  .seitenleiste { display: none; width: auto; border-right: none; border-bottom: 1px solid var(--linie); }
  body.menu-offen .seitenleiste { display: block; }
  .inhalt { padding: 16px 16px 40px; }
  .zahl { font-size: 34px; }
}
