/* ==========================================================================
   OPTIMUS INSTRUMENTE – RECHENSCHIEBER & SCHIEBELEHRE (DIN 862)
   Mobile-First & Touch-Optimiert • 100% Breiten-Sicherheit • Null Horizontales Überlaufen
   ========================================================================== */

:root {
  --bg-workspace: #0b0f17;
  --bg-card: #131a26;
  --border-card: #202b3c;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --accent-gold: #f59e0b;
  --accent-blue: #38bdf8;
  --accent-red: #ef4444;
  --accent-green: #22c55e;

  /* Theme: Classic Faber-Castell / Mahagoni */
  --rule-body-bg: #f9f7f1;
  --rule-wood-border: #5c3a21;
  --rule-wood-light: #7c4d29;
  --rule-slot-bg: #e2dcd2;
  --rule-slide-bg: #fffdf9;
  --rule-slide-grip: #5c3a21;
  --rule-hairline: #dc2626;
  --scale-label-color: #1e293b;
  --cursor-frame: #94a3b8;
  --cursor-screw: #e2e8f0;
}

/* Theme: Aristo Studio */
body[data-theme="aristo"] {
  --rule-body-bg: #ffffff;
  --rule-wood-border: #334155;
  --rule-wood-light: #475569;
  --rule-slot-bg: #cbd5e1;
  --rule-slide-bg: #ffffff;
  --rule-slide-grip: #334155;
  --rule-hairline: #e11d48;
  --scale-label-color: #0f172a;
  --cursor-frame: #64748b;
  --cursor-screw: #cbd5e1;
}

/* Theme: Pickett N3-T */
body[data-theme="pickett"] {
  --rule-body-bg: #fef08a;
  --rule-wood-border: #292524;
  --rule-wood-light: #44403c;
  --rule-slot-bg: #facc15;
  --rule-slide-bg: #fef9c3;
  --rule-slide-grip: #292524;
  --rule-hairline: #dc2626;
  --scale-label-color: #1c1917;
  --cursor-frame: #a8a29e;
  --cursor-screw: #e7e5e4;
}

/* --- Globale Breiten- & Box-Sicherheit (Verhindert 100% Horizontal-Overflow) --- */
html {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  position: relative;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-workspace);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image: 
    radial-gradient(circle at 50% 0%, #1e293b 0%, transparent 70%),
    linear-gradient(to right, rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 100% 100%, 40px 40px, 40px 40px;
}

svg {
  display: block;
  pointer-events: none;
}

/* --- Mobile-First Header (Kein Umbruchsalat) --- */
.app-header {
  width: 100%;
  max-width: 100vw;
  padding: 10px 14px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-card);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 50;
}

.brand-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 3px 8px rgba(245, 158, 11, 0.3);
}

.brand h1 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: #fff;
  line-height: 1.2;
}

.brand-sub {
  font-size: 10px;
  color: var(--text-muted);
}

.header-quick-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-tool-btn {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-card);
  border-radius: 6px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.icon-tool-btn:hover { background: #1e293b; border-color: #3b82f6; }
.icon-tool-btn.active { background: #0284c7; border-color: #38bdf8; color: #fff; }
.icon-tool-btn.muted { color: #ef4444; border-color: #ef4444; }

.header-sub-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.header-theme-select {
  flex: 1;
  max-width: 220px;
  height: 32px;
  font-size: 11px;
}

.mobile-quick-readout {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  background: #0f172a;
  border: 1px solid var(--border-card);
  padding: 4px 10px;
  border-radius: 6px;
  color: var(--accent-blue);
  white-space: nowrap;
}

.tool-select, .tool-btn {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-card);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.tool-btn.mini {
  padding: 4px 8px;
  font-size: 10px;
  height: 28px;
}

.tool-btn.active {
  background: #0284c7;
  border-color: #38bdf8;
  color: white;
}

/* --- Instrument Tabs (50/50 Mobil-Grid) --- */
.instrument-selector-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  max-width: 100vw;
  background: #090e17;
  border-bottom: 1px solid var(--border-card);
  padding: 0;
}

.inst-tab {
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-bottom: 3px solid transparent;
  padding: 10px 4px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.inst-tab.active {
  color: #38bdf8;
  border-bottom-color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
}

/* --- Hauptarbeitsfläche --- */
.workbench-container {
  flex: 1;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
}

/* --- Floating Touch Inspector (über dem Finger) --- */
.touch-floating-inspector {
  position: fixed;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid var(--accent-blue);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  border-radius: 8px;
  padding: 8px 12px;
  pointer-events: none;
}
.touch-floating-inspector.hidden { display: none; }

.insp-title {
  font-size: 9px;
  font-weight: 700;
  color: var(--accent-gold);
  margin-bottom: 2px;
}

.insp-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  color: #fff;
}
.insp-row.highlight { color: var(--accent-blue); }

/* --- Rechenschieber Stage Card --- */
.slide-rule-stage-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 10px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.stage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.stage-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--accent-gold);
  display: flex;
  align-items: center;
  gap: 6px;
}

.zoom-controls-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.zoom-btn-group {
  display: inline-flex;
  background: #0f172a;
  border: 1px solid var(--border-card);
  border-radius: 6px;
  overflow: hidden;
}

.zoom-mode-btn {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  border-right: 1px solid var(--border-card);
}
.zoom-mode-btn:last-child { border-right: none; }
.zoom-mode-btn.active { background: #0284c7; color: #fff; }

/* Horizontal scrollbarer Schieber-Bereich */
.slide-rule-scroll-wrapper {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 16px 2px;
  scrollbar-width: thin;
  position: relative;
  -webkit-overflow-scrolling: touch;
}

.slide-rule-scaler {
  transform-origin: top left;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  width: 1500px;
}

.slide-rule-assembly {
  position: relative;
  width: 1500px;
  height: 360px;
  margin: 0 auto;
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

/* Stator */
.stator-casing {
  position: absolute;
  top: 0;
  left: 0;
  width: 1500px;
  height: 100%;
  background: var(--rule-body-bg);
  border-top: 10px solid var(--rule-wood-border);
  border-bottom: 10px solid var(--rule-wood-border);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
}

.metal-bracket {
  position: absolute;
  width: 14px;
  height: calc(100% - 20px);
  top: 10px;
  background: linear-gradient(to right, #64748b, #94a3b8, #64748b);
  z-index: 10;
  border-radius: 2px;
}
.metal-bracket.left { left: 0; }
.metal-bracket.right { right: 0; }

.stator-top {
  height: 76px;
  border-bottom: 2px solid #cbd5e1;
  background: var(--rule-body-bg);
  position: relative;
  z-index: 2;
}

.slide-channel {
  height: 110px;
  background: var(--rule-slot-bg);
  position: relative;
  overflow: visible;
}

.slide-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 1500px;
  height: 110px;
  background: var(--rule-slide-bg);
  cursor: grab;
  z-index: 5;
  touch-action: none;
}

.slide-grip {
  position: absolute;
  top: 15px;
  width: 28px;
  height: 80px;
  background: linear-gradient(to right, var(--rule-wood-border), var(--rule-wood-light), var(--rule-wood-border));
  border-radius: 6px;
  cursor: grab;
  touch-action: none;
}
.slide-grip.left { left: -18px; }
.slide-grip.right { right: -18px; }

.stator-bottom {
  height: 140px;
  border-top: 2px solid #cbd5e1;
  background: var(--rule-body-bg);
  position: relative;
  z-index: 2;
}

/* Läufer */
.cursor-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 84px;
  height: 346px;
  z-index: 20;
  cursor: ew-resize;
  pointer-events: all;
  touch-action: none;
}

.cursor-glass {
  position: absolute;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 4px;
}

.hairline {
  position: absolute;
  top: 0;
  left: 42px;
  width: 1.5px;
  height: 100%;
  background: var(--rule-hairline);
  pointer-events: none;
}

.cursor-bracket {
  position: absolute;
  width: 100%;
  height: 22px;
  background: linear-gradient(to bottom, #94a3b8, #64748b);
  border-radius: 2px;
}
.cursor-bracket.top { top: 0; }
.cursor-bracket.bottom { bottom: 0; }

.cursor-loupe {
  position: absolute;
  top: 90px;
  left: 0;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 5px solid #d97706;
  background: rgba(255, 255, 255, 0.25);
  z-index: 25;
  pointer-events: none;
}
.cursor-loupe.hidden { display: none; }

/* --- Mobile Touch Dock (Jog-Ribbons) --- */
.mobile-touch-dock {
  background: #090e17;
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 10px;
  margin-top: 10px;
  width: 100%;
}

.dock-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-gold);
  margin-bottom: 8px;
}

.dock-tracks-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

@media (min-width: 640px) {
  .dock-tracks-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

.dock-track-box {
  width: 100%;
}

.dock-track-box label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.jog-ribbon {
  height: 44px;
  width: 100%;
  background: linear-gradient(to bottom, #1e293b, #0f172a);
  border: 1px solid #334155;
  border-radius: 6px;
  position: relative;
  overflow: hidden;
  cursor: ew-resize;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.jog-ribbon.active {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.jog-pattern {
  position: absolute;
  width: 200%;
  height: 100%;
  background-image: repeating-linear-gradient(90deg, rgba(255,255,255,0.08) 0px, rgba(255,255,255,0.08) 2px, transparent 2px, transparent 10px);
  pointer-events: none;
}

.jog-text {
  position: relative;
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
  pointer-events: none;
}

/* --- Feintrieb Steuerung (Volle Breiten-Nutzung, kein Überlauf) --- */
.controls-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-card);
  width: 100%;
}

.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 8px;
}

.control-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

.step-btn-group {
  display: flex;
  flex: 1;
  max-width: 260px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border-card);
}

.step-btn-group button {
  background: #1e293b;
  color: #e2e8f0;
  border: none;
  flex: 1;
  min-width: 0;
  height: 38px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border-right: 1px solid var(--border-card);
  touch-action: none;
}
.step-btn-group button:last-child { border-right: none; }
.step-btn-group button:active { background: #0284c7; color: white; }

/* --- HUD Readouts (3 Spalten Mobil, kein Überlauf) --- */
.scale-readouts-wrapper {
  margin-top: 12px;
  width: 100%;
}

.hud-section-label {
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.hud-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: 100%;
}

.hud-pill {
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 6px;
  padding: 5px 6px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.hud-pill.highlight {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.08);
}

.hud-pill .scale-tag {
  font-size: 9px;
  font-family: monospace;
  font-weight: 700;
  color: var(--accent-blue);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-pill .scale-val {
  font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-pill.red .scale-tag, .hud-pill.red .scale-val {
  color: var(--accent-red);
}

/* Formula HUD */
.formula-hud-wrapper {
  margin-top: 10px;
  width: 100%;
}

.formula-hud-card {
  background: #090e17;
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  font-size: 11px;
}

.hud-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  padding-bottom: 3px;
}
.hud-item:last-child { border-bottom: none; }

.hud-item.highlight {
  color: var(--accent-blue);
  background: rgba(56, 189, 248, 0.08);
  padding: 4px 6px;
  border-radius: 4px;
}

/* --- Features Grid (Seminar & Rechner) --- */
.features-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  width: 100%;
}

@media (min-width: 900px) {
  .features-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 12px;
  width: 100%;
  overflow: hidden;
}

.card-header h2 {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.card-header p {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  margin-bottom: 10px;
}

.lesson-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 10px;
  scrollbar-width: none;
  width: 100%;
}

.lesson-tab {
  background: #1e293b;
  color: #94a3b8;
  border: 1px solid transparent;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
}

.lesson-tab.active {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border-color: #38bdf8;
}

.tutorial-body {
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 8px;
  padding: 10px;
}

.tutorial-h3 {
  font-size: 13px;
  margin-bottom: 6px;
  color: #38bdf8;
}

.tutorial-theory {
  font-size: 11px;
  line-height: 1.4;
  color: #cbd5e1;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #1e293b;
}

.tutorial-step-box {
  background: rgba(245, 158, 11, 0.08);
  border-left: 3px solid #f59e0b;
  padding: 8px 10px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.tutorial-step-text {
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}

.tutorial-step-hint {
  font-size: 10px;
  color: #fbbf24;
  margin-top: 4px;
}

.tutorial-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.tut-nav-btns {
  display: flex;
  gap: 6px;
  align-items: center;
}

.tut-counter {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
}

.primary-btn {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.secondary-btn {
  background: #1e293b;
  color: #cbd5e1;
  border: 1px solid #334155;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

/* Schnellrechner Form */
.solver-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.form-group label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.form-control {
  width: 100%;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 8px 10px;
  color: #fff;
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
}

.solver-submit-btn {
  width: 100%;
  padding: 10px;
  font-size: 12px;
}

.solver-result-box {
  background: #090e17;
  border: 1px solid #1e293b;
  border-radius: 6px;
  padding: 10px;
  font-size: 12px;
  color: #38bdf8;
  min-height: 38px;
}

/* ==========================================================================
   BÜHNE 2: SCHIEBELEHRE (DIN 862) • 100% BREITENSICHERHEIT
   ========================================================================== */

.caliper-wrapper {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 100%;
}

.caliper-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  background: #090e17;
  border: 1px solid var(--border-card);
  padding: 10px 12px;
  border-radius: 8px;
  width: 100%;
}

.caliper-readout-main {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.readout-mm {
  font-family: 'JetBrains Mono', monospace;
  font-size: 24px;
  font-weight: 800;
  color: #38bdf8;
  display: flex;
  align-items: baseline;
  gap: 3px;
}

.readout-mm .unit {
  font-size: 13px;
  color: #94a3b8;
  font-weight: 600;
}

.readout-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-muted);
}

.caliper-zoom-bar {
  display: flex;
  align-items: center;
  gap: 6px;
}

.caliper-zoom-btn {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  border-right: 1px solid var(--border-card);
}
.caliper-zoom-btn:last-child { border-right: none; }
.caliper-zoom-btn.active { background: #0284c7; color: #fff; }

.caliper-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.tool-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
}

.tool-item label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
}

.mobile-select {
  width: 100%;
  height: 34px;
  font-size: 11px;
}

/* Scrollbarer Caliper-Bereich */
.caliper-stage-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 12px 2px;
  scrollbar-width: thin;
  position: relative;
  -webkit-overflow-scrolling: touch;
}

.caliper-scaler {
  transform-origin: top left;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  width: 1400px;
}

.caliper-stage {
  position: relative;
  width: 1400px;
  height: 270px;
  margin: 0 auto;
}

.caliper-depth-rod {
  position: absolute;
  top: 86px;
  left: 10px;
  width: 140px;
  height: 6px;
  background: linear-gradient(to bottom, #94a3b8, #64748b, #94a3b8);
  border-radius: 1px;
  z-index: 1;
}

.caliper-main-beam {
  position: absolute;
  top: 30px;
  left: 0;
  width: 1350px;
  height: 180px;
  z-index: 2;
  background: linear-gradient(to bottom, #cbd5e1 0%, #e2e8f0 15%, #f1f5f9 50%, #cbd5e1 100%);
  border-radius: 4px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.caliper-main-beam::before {
  content: '';
  position: absolute;
  top: 55px;
  left: 95px;
  width: 45px;
  height: 140px;
  background: linear-gradient(to right, #94a3b8, #e2e8f0);
  border-radius: 0 0 0 16px;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 88%);
}

.caliper-main-beam::after {
  content: '';
  position: absolute;
  top: -24px;
  left: 110px;
  width: 30px;
  height: 79px;
  background: linear-gradient(to right, #94a3b8, #e2e8f0);
  clip-path: polygon(0 20%, 100% 0, 100% 100%, 0 100%);
}

.caliper-workpiece-visual {
  position: absolute;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: 1px solid #b45309;
  border-radius: 4px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
}
.caliper-workpiece-visual.hidden { display: none; }

.wp-badge {
  font-size: 9px;
  font-weight: 700;
  color: #000;
  background: rgba(255,255,255,0.85);
  padding: 2px 4px;
  border-radius: 2px;
  white-space: nowrap;
}

.caliper-slider {
  position: absolute;
  top: 0;
  left: 0;
  width: 250px;
  height: 270px;
  z-index: 10;
  cursor: ew-resize;
  touch-action: none;
}

.slider-body {
  position: absolute;
  top: 75px;
  left: 0;
  width: 230px;
  height: 85px;
  background: linear-gradient(to bottom, #94a3b8, #cbd5e1, #94a3b8);
  border-radius: 4px;
  border: 1px solid #64748b;
  box-shadow: 0 6px 18px rgba(0,0,0,0.4);
}

.slider-jaw-external {
  position: absolute;
  top: 155px;
  left: 0;
  width: 45px;
  height: 100px;
  background: linear-gradient(to right, #e2e8f0, #94a3b8);
  border-radius: 0 0 16px 0;
  clip-path: polygon(0 0, 100% 0, 100% 88%, 0 100%);
}

.slider-jaw-internal {
  position: absolute;
  top: 6px;
  left: 0;
  width: 30px;
  height: 70px;
  background: linear-gradient(to right, #e2e8f0, #94a3b8);
  clip-path: polygon(0 0, 100% 20%, 100% 100%, 0 100%);
}

.slider-thumb-wheel {
  position: absolute;
  top: 150px;
  left: 90px;
  width: 60px;
  height: 26px;
  background: linear-gradient(to bottom, #334155, #475569, #334155);
  border-radius: 4px;
  cursor: ew-resize;
  touch-action: none;
  overflow: hidden;
}

.slider-thumb-wheel.active { box-shadow: 0 0 0 2px #38bdf8; }

.wheel-texture {
  width: 100%;
  height: 100%;
  background-image: repeating-linear-gradient(90deg, #1e293b 0px, #1e293b 2px, #64748b 2px, #64748b 4px);
}

.slider-screw {
  position: absolute;
  top: -12px;
  left: 100px;
  width: 26px;
  height: 14px;
  background: #475569;
  border-radius: 3px;
  cursor: pointer;
}
.slider-screw.locked { background: #ef4444; }

/* Caliper Analyse Card */
.caliper-analysis-card {
  background: #090e17;
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 10px;
  width: 100%;
}

.analysis-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.analysis-header .badge {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-gold);
}

.coincidence-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
}

.analysis-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  width: 100%;
}

@media (min-width: 640px) {
  .analysis-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.analysis-box {
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 6px;
  padding: 8px;
}
.analysis-box.highlight { border-color: #0284c7; background: rgba(2, 132, 199, 0.08); }
.analysis-box.total { border-color: #22c55e; background: rgba(34, 197, 94, 0.08); }

.an-lbl {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
}

.an-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  margin: 2px 0;
}
.analysis-box.highlight .an-val { color: #38bdf8; }
.analysis-box.total .an-val { color: #22c55e; }

.an-desc {
  font-size: 10px;
  color: #94a3b8;
}

/* Caliper Touch Steppers (Null Überlauf) */
.caliper-mobile-touch-dock {
  background: #090e17;
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.touch-jog-track {
  height: 44px;
  width: 100%;
  background: linear-gradient(to bottom, #1e293b, #0f172a);
  border: 1px solid #334155;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: ew-resize;
  touch-action: none;
  background-image: repeating-linear-gradient(90deg, rgba(255,255,255,0.06) 0px, rgba(255,255,255,0.06) 2px, transparent 2px, transparent 10px);
}
.touch-jog-track.active { border-color: #38bdf8; }

.caliper-touch-steppers-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.steppers-row {
  display: flex;
  gap: 4px;
  width: 100%;
}

.caliper-step-btn {
  flex: 1;
  min-width: 0;
  height: 38px;
  background: #1e293b;
  border: 1px solid var(--border-card);
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.caliper-step-btn:active { background: #0284c7; }

.steppers-actions-row {
  display: flex;
  gap: 6px;
  width: 100%;
}

.caliper-action-btn {
  flex: 1;
  min-width: 0;
  height: 38px;
  background: #1e293b;
  border: 1px solid var(--border-card);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}
.caliper-action-btn.accent {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  border: none;
}
.caliper-action-btn.active { background: #ef4444; border-color: #ef4444; }

/* Stage Shortcuts */
.stage-shortcuts-compact {
  font-size: 10px;
  color: var(--text-muted);
}

/* Footer */
.app-footer {
  margin-top: auto;
  padding: 12px 14px;
  border-top: 1px solid var(--border-card);
  text-align: center;
  font-size: 10px;
  color: var(--text-muted);
  background: rgba(15, 23, 42, 0.6);
  width: 100%;
}
