:root {
  --bg-core: #07080a;
  --bg-surface: #0e1116;
  --bg-panel: rgba(14, 17, 23, 0.82);
  --bg-panel-solid: #11141b;
  --bg-element: rgba(255, 255, 255, 0.05);
  --bg-element-hover: rgba(255, 255, 255, 0.10);
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-panel: rgba(255, 255, 255, 0.12);
  --border-focus: #ffffff;
  
  --white: #ffffff;
  --silver-100: #f1f3f6;
  --silver-300: #d0d5dd;
  --silver-500: #949ca8;
  --silver-700: #555d69;
  --silver-900: #22262e;
  
  /* Precision functional accents */
  --stroke-intake: #38bdf8;
  --stroke-comp: #fbbf24;
  --stroke-power: #ef4444;
  --stroke-exhaust: #f97316;
  --glow-white: rgba(255, 255, 255, 0.28);
  
  --font-ui: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-data: "JetBrains Mono", "DM Mono", Consolas, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  overflow: hidden;
  color: var(--silver-100);
  background: var(--bg-core);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
input {
  font: inherit;
}

button,
label {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
label:has(input:focus-visible) {
  outline: 2px solid var(--white);
  outline-offset: 2px;
}

#app-container {
  position: relative;
  display: grid;
  grid-template-rows: 62px minmax(0, 1fr) auto;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg-core);
}

/* =========================================================
   TOP HEADER
========================================================= */
.top-header {
  position: relative;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(210px, 1fr) auto minmax(210px, 1fr);
  align-items: center;
  gap: 16px;
  min-width: 0;
  padding: 0 24px;
  color: var(--white);
  background: rgba(11, 13, 17, 0.94);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-panel);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}

.brand-badge {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.brand-logo {
  display: grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #000000;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.25);
}

.piston-icon {
  font-family: var(--font-data);
  font-size: 15px;
  font-weight: 700;
  color: #000000;
  line-height: 1;
}

.brand-title {
  color: var(--white);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.brand-subtitle {
  margin-top: 2px;
  color: var(--silver-500);
  font-family: var(--font-data);
  font-size: 8.5px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Collection / Philosophy Selector */
.philosophy-selector {
  min-width: 0;
  padding: 3px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 24px;
}

.selector-label { display: none; }

.btn-group {
  display: flex;
  min-width: 0;
  gap: 3px;
}

.philo-btn,
.action-btn,
.view-btn,
.cyl-btn,
.btn-ctrl {
  border: 0;
  cursor: pointer;
  transition: all 0.16s ease;
}

.philo-btn {
  padding: 6px 11px;
  color: var(--silver-500);
  background: transparent;
  border-radius: 18px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.philo-btn:hover {
  color: var(--white);
  background: var(--bg-element-hover);
}

.philo-btn.active {
  color: #000000;
  background: var(--white);
  font-weight: 700;
  box-shadow: 0 1px 8px rgba(255, 255, 255, 0.2);
}

.header-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.action-btn {
  min-height: 32px;
  padding: 0 13px;
  color: var(--silver-300);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.action-btn:hover {
  color: var(--white);
  border-color: var(--border-panel);
  background: rgba(255, 255, 255, 0.12);
}

.action-btn.cinematic-btn {
  color: var(--white);
  border-color: var(--border-panel);
  background: rgba(255, 255, 255, 0.08);
}

.action-btn.cinematic-btn.active {
  color: #000000;
  background: var(--white);
  border-color: var(--white);
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.3);
}

/* =========================================================
   MAIN VIEWPORT (3D WORKSPACE)
========================================================= */
.main-viewport {
  position: relative;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
  background: radial-gradient(circle at 50% 45%, #14171d 0%, #08090c 70%, #040507 100%);
}

#canvas3d-container {
  position: absolute;
  z-index: 1;
  inset: 0;
}

#canvas3d-container canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* Common HUD Card Styling (Clean Glass, No Artificial Screws) */
.hud-panel,
.camera-controls-hud,
.inspector-drawer {
  position: absolute;
  z-index: 10;
  color: var(--silver-100);
  background: var(--bg-panel);
  border: 1px solid var(--border-panel);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

/* =========================================================
   TOP-LEFT TELEMETRY HUD
========================================================= */
.telemetry-hud-left {
  top: 20px;
  left: 20px;
  display: flex;
  width: 320px;
  padding: 18px;
  flex-direction: column;
  gap: 14px;
}

.telemetry-top {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.telemetry-badge,
.drawer-tag {
  color: var(--silver-300);
  font-family: var(--font-data);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.telemetry-badge::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 6px #ffffff;
}

#engineNameDisplay {
  color: var(--white);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

#engineShortDesc {
  color: var(--silver-500);
  font-size: 11px;
  line-height: 1.45;
}

/* Firing Sequence Strip */
.firing-strip-wrap,
.drawer-specs {
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
}

.firing-strip-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.firing-header,
.slider-header,
.hud-header,
.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.label-mini,
.metric-name,
.control-label,
.deck-title,
.cycle-sub,
.dial-sub {
  color: var(--silver-500);
  font-family: var(--font-data);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.firing-seq-badge,
.metric-val,
.value-badge,
#dialDegrees {
  font-family: var(--font-data);
  font-variant-numeric: tabular-nums;
}

.firing-seq-badge {
  padding: 2px 7px;
  color: var(--white);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 4px;
  font-size: 9.5px;
  font-weight: 600;
}

.cylinder-pills-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.cyl-pill {
  flex: 1 1 34px;
  min-width: 32px;
  padding: 5px 2px;
  cursor: pointer;
  text-align: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  transition: all 0.15s ease;
}

.cyl-pill .cyl-num {
  display: block;
  color: var(--silver-300);
  font-family: var(--font-data);
  font-size: 8.5px;
  font-weight: 600;
}

.cyl-pill .cyl-phase {
  display: block;
  margin-top: 2px;
  color: var(--silver-700);
  font-size: 7px;
  font-weight: 500;
  text-transform: uppercase;
}

.cyl-pill.firing {
  color: #000000 !important;
  background: #ffffff !important;
  border-color: #ffffff !important;
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.45);
  transform: translateY(-1px);
}

.cyl-pill.firing .cyl-num,
.cyl-pill.firing .cyl-phase {
  color: #000000 !important;
  font-weight: 700 !important;
}

.live-telemetry-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.metric-box {
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
}

.metric-name { display: block; }
.metric-val {
  display: block;
  margin-top: 4px;
  color: var(--white);
  font-size: 13px;
  font-weight: 700;
}
.metric-val.text-fire {
  color: #ff9b60;
}

/* =========================================================
   TOP-CENTER CAMERA CONTROLS HUD
========================================================= */
.camera-controls-hud {
  top: 20px;
  left: 50%;
  display: flex;
  gap: 3px;
  padding: 3px;
  transform: translateX(-50%);
  background: rgba(14, 17, 23, 0.88);
  border: 1px solid var(--border-panel);
  border-radius: 24px;
}

.view-btn {
  min-height: 28px;
  padding: 0 12px;
  color: var(--silver-500);
  background: transparent;
  border-radius: 18px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.view-btn:hover {
  color: var(--white);
  background: var(--bg-element-hover);
}

.view-btn.active {
  color: #000000;
  background: #ffffff;
  font-weight: 700;
  box-shadow: 0 1px 8px rgba(255, 255, 255, 0.25);
}

#resetCamBtn {
  color: var(--silver-300);
  border-left: 1px solid var(--border-subtle);
  border-radius: 0 18px 18px 0;
}

/* =========================================================
   TOP-RIGHT 4-STROKE CYCLE MONITOR
========================================================= */
.stroke-monitor-hud {
  top: 20px;
  right: 20px;
  width: 290px;
  padding: 16px;
}

.dial-title-group h3 {
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 8px #ffffff;
  animation: pulseLive 2s infinite ease-in-out;
}

@keyframes pulseLive {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.stroke-cards-grid {
  display: flex;
  margin-top: 10px;
  flex-direction: column;
  gap: 5px;
}

.stroke-badge {
  display: flex;
  align-items: center;
  min-height: 34px;
  padding: 5px 8px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid transparent;
  border-radius: 6px;
  opacity: 0.55;
  transition: all 0.16s ease;
}

.stroke-badge.active-stroke {
  opacity: 1;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateX(-2px);
}

.stroke-color-bar {
  width: 3px;
  height: 20px;
  margin-right: 8px;
  border-radius: 2px;
  flex: 0 0 auto;
}

.intake-bar { background: var(--stroke-intake); }
.compression-bar { background: var(--stroke-comp); }
.power-bar { background: var(--stroke-power); }
.exhaust-bar { background: var(--stroke-exhaust); }

.stroke-info {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.stroke-name {
  color: var(--white);
  font-family: var(--font-data);
  font-size: 8px;
  font-weight: 600;
}

.stroke-detail {
  overflow: hidden;
  color: var(--silver-500);
  font-size: 8px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.crank-dial-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.dial-meter {
  position: relative;
  width: 58px;
  height: 58px;
}

.dial-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.dial-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 6;
}

.dial-arc {
  fill: none;
  stroke-width: 5;
}

.arc-intake { stroke: var(--stroke-intake); }
.arc-comp { stroke: var(--stroke-comp); }
.arc-power { stroke: var(--stroke-power); }
.arc-exhaust { stroke: var(--stroke-exhaust); }

.dial-needle {
  stroke: #ffffff;
  stroke-width: 2;
  stroke-linecap: round;
  transform-origin: 50px 50px;
}

.dial-center-text {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  pointer-events: none;
}

#dialDegrees {
  color: var(--white);
  font-size: 9.5px;
  font-weight: 700;
}

.dial-sub {
  margin-top: 1px;
  font-size: 6px;
  color: var(--silver-500);
}

.active-stroke-label {
  max-width: 140px;
  padding: 6px 9px;
  color: var(--white);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  font-family: var(--font-data);
  font-size: 8px;
  font-weight: 600;
  text-align: center;
}

/* =========================================================
   COMPONENT CAD INSPECTOR (RIGHT-DOCKED DRAWER)
========================================================= */
.inspector-drawer {
  top: 228px;
  right: 20px;
  width: 290px;
  padding: 16px;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.inspector-drawer.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(12px);
}

.drawer-header {
  margin-bottom: 8px;
}

.drawer-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-icon {
  font-size: 16px;
  filter: grayscale(1);
}

#inspectTitle {
  margin-top: 2px;
  color: var(--white);
  font-size: 12.5px;
  font-weight: 700;
}

.close-drawer-btn {
  padding: 2px 6px;
  color: var(--silver-500);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 12px;
}

.close-drawer-btn:hover {
  color: var(--white);
}

#inspectDescription {
  margin-bottom: 9px;
  color: var(--silver-500);
  font-size: 9.5px;
  line-height: 1.45;
}

.drawer-specs {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.spec-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 8.5px;
}

.sk {
  color: var(--silver-500);
}

.sv {
  color: var(--silver-100);
  font-weight: 500;
  text-align: right;
}

.click-hint-badge {
  display: none;
}

/* =========================================================
   BOTTOM INTERACTIVE DECK
========================================================= */
.bottom-controls {
  position: relative;
  z-index: 30;
  display: flex;
  padding: 10px 24px 14px;
  flex-direction: column;
  gap: 10px;
  color: var(--white);
  background: rgba(11, 13, 17, 0.94);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-panel);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.6);
}

/* Row 1: Cylinder Selectors */
.cylinder-selector-deck {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.mobile-engine-picker {
  display: none;
}

.cylinder-buttons-scroll {
  display: flex;
  min-width: 0;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  overscroll-behavior-inline: contain;
}

.cylinder-buttons-scroll::-webkit-scrollbar {
  display: none;
}

.cyl-btn {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 0 10px;
  color: var(--silver-500);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  font-family: var(--font-data);
  font-size: 9px;
  font-weight: 600;
  white-space: nowrap;
}

.cyl-btn:hover {
  color: var(--white);
  background: var(--bg-element-hover);
  border-color: var(--border-panel);
}

.cyl-btn.active {
  color: #000000;
  background: #ffffff;
  border-color: #ffffff;
  font-weight: 700;
  box-shadow: 0 1px 8px rgba(255, 255, 255, 0.25);
}

/* Row 2: Playback & Toggles */
.playback-hud-row {
  display: grid;
  grid-template-columns: auto minmax(210px, 1fr) minmax(210px, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.playback-buttons {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-ctrl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 11px;
  color: var(--silver-300);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  font-size: 9.5px;
  font-weight: 700;
}

.btn-ctrl:hover {
  color: var(--white);
  border-color: var(--border-panel);
  background: rgba(255, 255, 255, 0.12);
}

.btn-ctrl.primary {
  color: #000000;
  background: #ffffff;
  border-color: #ffffff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.25);
}

.btn-ctrl.primary:hover {
  background: #e6e8eb;
}

.btn-ctrl.highlight-ctrl {
  color: var(--white);
  background: rgba(255, 255, 255, 0.08);
}

#playIcon {
  margin-right: 5px;
  font-family: var(--font-data);
}

.slider-control-group {
  display: flex;
  min-width: 0;
  padding: 5px 10px;
  flex-direction: column;
  gap: 4px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
}

.value-badge {
  color: var(--white);
  font-size: 10px;
  font-weight: 600;
}

.rpm-number-control {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  overflow: hidden;
  color: var(--white);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
}

.rpm-number-control input {
  width: 60px;
  padding: 2px 4px 2px 6px;
  color: #ffffff;
  background: transparent;
  border: 0;
  outline: 0;
  font-family: var(--font-data);
  font-size: 10px;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.rpm-number-control span {
  padding-right: 6px;
  color: var(--silver-500);
  font-family: var(--font-data);
  font-size: 7.5px;
}

.rpm-number-control:focus-within {
  border-color: #ffffff;
}

.styled-slider {
  width: 100%;
  height: 3px;
  appearance: none;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  outline: none;
}

.styled-slider::-webkit-slider-thumb {
  width: 12px;
  height: 12px;
  appearance: none;
  cursor: pointer;
  background: #ffffff;
  border: 2px solid #000000;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.4);
}

.styled-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  cursor: pointer;
  background: #ffffff;
  border: 2px solid #000000;
  border-radius: 50%;
}

.styled-slider.secondary::-webkit-slider-thumb {
  background: #ffffff;
}

.slider-ticks {
  display: flex;
  justify-content: space-between;
  color: var(--silver-700);
  font-family: var(--font-data);
  font-size: 6.5px;
}

/* Cutaway Toggles */
.visual-toggles-group {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.toggle-pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  cursor: pointer;
  color: var(--silver-500);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  font-size: 8.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.toggle-pill:hover {
  color: var(--white);
  background: var(--bg-element-hover);
}

.toggle-pill input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.pill-slider {
  width: 7px;
  height: 7px;
  background: var(--silver-700);
  border-radius: 2px;
  transition: all 0.15s ease;
}

.toggle-pill input:checked + .pill-slider {
  background: #ffffff;
  box-shadow: 0 0 6px #ffffff;
}

.toggle-pill:has(input:checked) {
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.2);
}

/* =========================================================
   ENGINEERING GUIDE MODAL
========================================================= */
.guide-modal {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.guide-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 6, 8, 0.82);
  backdrop-filter: blur(12px);
}

.modal-dialog {
  position: relative;
  display: flex;
  width: min(820px, calc(100% - 28px));
  max-height: min(84vh, 760px);
  flex-direction: column;
  overflow: hidden;
  color: var(--silver-100);
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-panel);
  border-radius: 14px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.8);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h2 {
  font-size: 15px;
  font-weight: 700;
}

.modal-close {
  color: var(--silver-500);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 16px;
}

.modal-close:hover {
  color: var(--white);
}

.modal-content {
  display: flex;
  padding: 22px;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
}

.guide-section h3 {
  margin-bottom: 8px;
  color: var(--white);
  font-size: 13px;
  font-weight: 700;
}

.guide-section > p {
  margin-bottom: 10px;
  color: var(--silver-500);
  font-size: 11px;
  line-height: 1.5;
}

.strokes-explainer,
.comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stroke-box,
.comp-col {
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--white);
  border-radius: 8px;
}

.stroke-box h4,
.comp-col h4 {
  margin-bottom: 5px;
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
}

.stroke-box p,
.comp-col ul {
  color: var(--silver-500);
  font-size: 10px;
  line-height: 1.5;
}

.comp-col ul {
  padding-left: 16px;
}

.stroke-box.blue { border-left-color: var(--stroke-intake); }
.stroke-box.yellow { border-left-color: var(--stroke-comp); }
.stroke-box.red { border-left-color: var(--stroke-power); }
.stroke-box.orange { border-left-color: var(--stroke-exhaust); }

/* =========================================================
   RESPONSIVE BREAKPOINTS
========================================================= */
@media (max-width: 1380px) {
  .top-header { grid-template-columns: 1fr auto; }
  .philosophy-selector { display: none; }
  .playback-hud-row { grid-template-columns: auto minmax(200px, 1fr) minmax(200px, 1fr); }
  .visual-toggles-group { display: none; }
}

@media (max-width: 980px) {
  .stroke-monitor-hud { display: none; }
  .telemetry-hud-left { width: 280px; }
  .playback-hud-row { grid-template-columns: auto 1fr; }
  .crank-group { display: none; }
}

@media (max-width: 700px) {
  #app-container { grid-template-rows: 52px minmax(0, 1fr) auto; }
  .top-header { grid-template-columns: 1fr auto; padding: 0 12px; gap: 8px; }
  .brand-logo { width: 28px; height: 28px; }
  .brand-title { font-size: 13px; }
  .brand-subtitle { display: none; }
  .header-actions .action-btn:not(.cinematic-btn) { display: none; }
  .action-btn.cinematic-btn { min-height: 32px; padding: 0 10px; font-size: 8.5px; }

  .telemetry-hud-left {
    top: 10px;
    left: 10px;
    width: min(235px, calc(100% - 108px));
    padding: 12px;
    gap: 8px;
  }
  .telemetry-badge { font-size: 7px; }
  #engineNameDisplay { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #engineShortDesc,
  .firing-strip-wrap { display: none; }
  .live-telemetry-metrics { gap: 5px; }
  .metric-box { padding: 6px 7px; }
  .metric-name { font-size: 6px; }
  .metric-val { margin-top: 3px; font-size: 9px; }

  .camera-controls-hud { top: 10px; right: 10px; left: auto; display: grid; padding: 2px; transform: none; }
  .view-btn { display: none; min-height: 30px; padding: 0 8px; font-size: 8px; }
  .view-btn.active,
  #resetCamBtn { display: block; }

  .inspector-drawer { right: 10px; bottom: 10px; left: 10px; top: auto; width: auto; }

  .bottom-controls {
    max-width: 100vw;
    padding: 8px 10px max(10px, env(safe-area-inset-bottom));
    gap: 8px;
  }
  .cylinder-selector-deck { display: block; }
  .deck-title,
  .cylinder-buttons-scroll { display: none; }
  .mobile-engine-picker {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
  }
  .mobile-engine-label {
    color: var(--silver-500);
    font-family: var(--font-data);
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  #mobileEngineSelect {
    width: 100%;
    min-height: 38px;
    padding: 0 12px;
    color: var(--white);
    background: var(--bg-surface);
    border: 1px solid var(--border-panel);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
  }
  .playback-hud-row { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .playback-buttons { display: grid; grid-template-columns: 1.15fr 0.8fr 0.8fr 1.2fr; }
  .btn-ctrl { min-height: 38px; font-size: 8.5px; }
  .rpm-group { padding: 6px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
