html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #15181c;
  color: #d0d4d8;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  line-height: 1.45;
  letter-spacing: -0.005em;
  font-feature-settings: "cv11", "ss01";  /* Inter: cleaner "1", stylistic set */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

canvas {
  display: block;
}

code {
  font-family: "JetBrains Mono", "SF Mono", Consolas, Menlo, monospace;
  font-size: 11px;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.07);
  color: #c8dcf0;
  padding: 1px 5px;
  border-radius: 3px;
}

/* ----- Main panel (top-left) --------------------------------------- */
#panel {
  position: absolute;
  top: 14px;
  left: 14px;
  min-width: 200px;
  padding: 0;
  background: rgba(24, 27, 32, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 10;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.panel-title {
  font-weight: 600;
  font-size: 13px;
  color: #6a9adb;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

button.action.subtle {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.06);
  color: #a0a8b0;
  font-size: 11px;
}
button.action.subtle:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.15);
  color: #e0e4e8;
}

/* Primary action: bigger text + green hover tint. */
button.action.primary {
  font-size: 13px;
  font-weight: 500;
}
button.action.primary:hover {
  background: rgba(80, 200, 120, 0.14);
  border-color: rgba(80, 200, 120, 0.4);
  color: #a8ebc0;
}

.panel-section {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.panel-section + .panel-section {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
}

button.action {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  color: #e0e4e8;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 6px;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-align: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
button.action:hover {
  background: rgba(106, 154, 219, 0.14);
  border-color: rgba(106, 154, 219, 0.35);
  color: #c8dcf0;
}

input[type=checkbox] {
  margin: 0;
  cursor: pointer;
  accent-color: #6a9adb;
}
input[type=checkbox]:disabled { cursor: not-allowed; }


label {
  cursor: pointer;
  user-select: none;
  color: #d0d4d8;
  font-size: 12px;
  font-weight: 400;
}

#vehiclePicker {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  color: #e0e4e8;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 7px 10px;
  border-radius: 6px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
#vehiclePicker:hover:not(:disabled) {
  border-color: rgba(106, 154, 219, 0.35);
  color: #c8dcf0;
}
#vehiclePicker:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}
#vehiclePicker option {
  background: #1a1d22;
  color: #e0e4e8;
}

button.action:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
button.action:disabled:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
  color: #e0e4e8;
}

/* ----- Right-side column (ViewCube slot + Reset/Help panel) -------
   Invisible flex container. Width/height match gizmo.js GIZMO_SIZE=120
   and GIZMO_PAD=10. pointer-events:none lets the WebGL cube handle its
   own clicks through the invisible layout. */
#viewColumn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 120px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;      /* panel below is narrower than cube → center it */
  gap: 12px;
  pointer-events: none;
}
#viewCubeSlot {
  width: 120px;
  height: 120px;
}

#viewPanel {
  width: 100px;
  padding: 6px;
  box-sizing: border-box;   /* padding + border count toward the 100px width */
  background: rgba(24, 27, 32, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  gap: 5px;
  pointer-events: auto;     /* re-enable clicks after column opted out */
}

#viewPanel button {
  width: 100%;
  padding: 7px 0;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #e0e4e8;
  cursor: pointer;
  border-radius: 6px;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
#viewPanel button:hover {
  background: rgba(106, 154, 219, 0.14);
  border-color: rgba(106, 154, 219, 0.35);
  color: #c8dcf0;
}

/* ----- Status bar (bottom) ----------------------------------------- */
#statusBar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 7px 14px;
  background: rgba(20, 23, 28, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  color: #a0a8b0;
  font-size: 12px;
  line-height: 1.4;
  z-index: 10;
  pointer-events: none;
}
#statusMsg { flex: 1; min-width: 0; }
#statusBar.err #statusMsg { color: #ff8080; }
#statusBar.ok  #statusMsg { color: #80d890; }

/* ----- Help modal --------------------------------------------------- */
#helpModal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  /* Closed: visibility deferred until the opacity transition ends so the fade is actually visible. */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1),
              visibility 0s linear 0.45s;
}
#helpModal.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1),
              visibility 0s linear 0s;
}
.help-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}
.help-dialog {
  position: relative;
  max-width: 460px;
  width: 85%;
  background: #1a1d22;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  color: #d0d4d8;
  /* Slide-in from above the viewport, easeOutQuint. No bounce. */
  transform: translateY(-120vh);
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}
#helpModal.open .help-dialog {
  transform: translateY(0);
}
.help-dialog h3 {
  margin: 0 0 12px 0;
  color: #6a9adb;
  font-size: 15px;
  font-weight: 600;
}
.help-dialog ul {
  margin: 0;
  padding-left: 20px;
  font-size: 12px;
  line-height: 1.65;
}
.help-dialog ul ul { margin: 4px 0; }
.help-dialog b     { color: #e0e4e8; }
.help-dialog .action {
  margin-top: 16px;
  width: auto;
  padding: 7px 24px;
  float: right;
}
