:root {
  /* Brand purple shared with icons/mt.svg. */
  --mt-accent: #a855f7;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--vscode-editor-background, #1e1e1e);
  color: var(--vscode-foreground, #ccc);
  font-family: var(--vscode-font-family, sans-serif);
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  /* Narrow-layout rules below key off #app's own width (a container query),
     not the viewport's: in the VSCode webview build #app fills the whole
     panel so the two are equivalent, but the web build places #app beside an
     editor pane, where the viewport can stay wide while #app itself is
     narrow. */
  container-type: inline-size;
  container-name: mt-sim-app;
}

.mt-grid-host,
.mt-editor-grid,
.mt-simulator-grid {
  --dv-sash-color: transparent;
  --dv-active-sash-color: transparent;
  --dv-active-sash-transition-duration: 0.1s;
  --dv-active-sash-transition-delay: 0.12s;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

body .mt-grid-host .dv-split-view-container > .dv-sash-container > .dv-sash::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: var(--vscode-panel-border, #444);
  pointer-events: none;
  transition:
    background-color 0.1s ease 0.12s,
    box-shadow 0.1s ease 0.12s;
}

body .mt-grid-host .dv-split-view-container.dv-horizontal > .dv-sash-container > .dv-sash::after {
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  transform: translateX(-50%);
}

body .mt-grid-host .dv-split-view-container.dv-vertical > .dv-sash-container > .dv-sash::after {
  top: 50%;
  right: 0;
  left: 0;
  height: 1px;
  transform: translateY(-50%);
}

body .mt-grid-host .dv-split-view-container > .dv-sash-container > .dv-sash:hover::after {
  background-color: color-mix(in srgb, var(--mt-accent) 75%, transparent);
}

body .mt-grid-host .dv-split-view-container.dv-horizontal > .dv-sash-container > .dv-sash:hover::after {
  width: 2px;
}

body .mt-grid-host .dv-split-view-container.dv-vertical > .dv-sash-container > .dv-sash:hover::after {
  height: 2px;
}

body .mt-grid-host .dv-split-view-container > .dv-sash-container > .dv-sash:active::after {
  background-color: var(--mt-accent);
  box-shadow: 0 0 6px color-mix(in srgb, var(--mt-accent) 55%, transparent);
  transition-delay: 0s, 0s;
}

body .mt-editor-grid .dv-split-view-container.dv-vertical > .dv-sash-container > .dv-sash::before {
  content: "";
  position: absolute;
  inset: -3px 0;
}

.mt-grid-panel {
  min-width: 0;
  min-height: 0;
}

#app.mt-managed-layout {
  height: 100%;
}

#app.mt-managed-layout .mt-simulator-grid {
  flex: 1;
}

#app.mt-managed-layout .preview-column,
#app.mt-managed-layout .inspector,
#app.mt-managed-layout .output-values {
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: none !important;
  max-height: none !important;
  border: 0;
}

#app.mt-managed-layout .inspector-close-button,
#app.mt-managed-layout .output-values-collapse-button {
  display: none;
}

.fatal-error {
  margin: 16px;
  padding: 12px;
  overflow: auto;
  white-space: pre-wrap;
  border: 1px solid var(--vscode-inputValidation-errorBorder, #be1100);
  background: var(--vscode-inputValidation-errorBackground, #5a1d1d);
  color: var(--vscode-errorForeground, #f88);
}

.plugin-compatibility-notice {
  box-sizing: border-box;
  position: fixed;
  top: 56px;
  right: 16px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(400px, calc(100vw - 32px));
  padding: 16px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--mt-accent) 45%, transparent);
  border-radius: 12px;
  background:
    linear-gradient(
      135deg,
      color-mix(in srgb, var(--mt-accent) 13%, transparent),
      transparent 55%
    ),
    color-mix(in srgb, var(--vscode-editor-background, #1e1e1e) 94%, transparent);
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.42),
    0 1px 0 rgba(255, 255, 255, 0.06) inset;
  color: var(--vscode-foreground, #ddd);
  font-size: 12px;
  backdrop-filter: blur(18px);
}

.plugin-compatibility-notice::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--mt-accent), #7c3aed, transparent);
  content: "";
}

.plugin-compatibility-notice-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.plugin-compatibility-notice-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--mt-accent) 18%, transparent);
  color: var(--mt-accent);
  font-size: 16px;
  font-weight: 700;
}

.plugin-compatibility-notice-header strong {
  font-size: 13px;
}

.plugin-compatibility-notice-badge {
  margin-left: auto;
  padding: 2px 7px;
  border: 1px solid color-mix(in srgb, var(--mt-accent) 38%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--mt-accent) 12%, transparent);
  color: color-mix(in srgb, var(--mt-accent) 76%, white);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.plugin-compatibility-notice-message {
  margin: 0;
  color: var(--vscode-descriptionForeground, #aaa);
  line-height: 1.55;
}

.plugin-compatibility-notice-actions {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.plugin-compatibility-notice-links {
  display: flex;
  align-items: center;
  gap: 10px;
}

.plugin-compatibility-notice-links a {
  color: color-mix(in srgb, var(--mt-accent) 76%, white);
  font-size: 11px;
  text-underline-offset: 2px;
}

.plugin-compatibility-notice-confirm {
  box-sizing: border-box;
  min-height: 28px;
  padding: 6px 10px;
  border: 1px solid color-mix(in srgb, var(--mt-accent) 65%, transparent);
  border-radius: 6px;
  background: var(--mt-accent);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--mt-accent) 28%, transparent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  line-height: 16px;
  cursor: pointer;
}

.plugin-compatibility-notice-confirm:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.plugin-compatibility-notice-links a:focus-visible,
.plugin-compatibility-notice-confirm:focus-visible {
  outline: 1px solid var(--vscode-focusBorder, #007fd4);
  outline-offset: 2px;
}

.toolbar {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  flex: none;
  gap: 6px;
  min-width: 0;
  padding: 6px 8px;
  border-bottom: 1px solid var(--vscode-panel-border, #3f3f46);
  background: var(--vscode-editorGroupHeader-tabsBackground, #252526);
}

.toolbar-control-group {
  display: flex;
  align-items: center;
  flex: none;
  gap: 6px;
}

.toolbar-viewport-controls {
  min-width: 0;
}

.toolbar-actions {
  margin-left: 2px;
}

.toolbar button,
.toolbar input {
  box-sizing: border-box;
  background: var(--vscode-dropdown-background, #3c3c3c);
  color: var(--vscode-dropdown-foreground, #ccc);
  border: 1px solid var(--vscode-dropdown-border, #555);
  border-radius: 5px;
  font-size: 12px;
  outline: none;
}

.toolbar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.toolbar button:hover {
  color: var(--vscode-foreground, #fff);
  background: var(--vscode-toolbar-hoverBackground, rgba(255, 255, 255, 0.1));
}

.toolbar button:disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

.toolbar button:focus-visible,
.toolbar input:focus-visible {
  outline: 1px solid var(--vscode-focusBorder, #007fd4);
  outline-offset: 1px;
}

.toolbar button svg {
  display: block;
  flex: none;
  pointer-events: none;
}

.toolbar-icon-button {
  width: 30px;
  height: 28px;
  padding: 5px;
  border-color: transparent !important;
  background: transparent !important;
}

.toolbar-icon-button:hover {
  background: var(--vscode-toolbar-hoverBackground, rgba(255, 255, 255, 0.1)) !important;
}

.toolbar-segment {
  display: inline-flex;
  align-items: center;
  flex: none;
  padding: 1px;
  border: 1px solid var(--vscode-dropdown-border, #555);
  border-radius: 6px;
  background: var(--vscode-dropdown-background, #3c3c3c);
}

.toolbar-segment .toolbar-mode-button {
  width: 28px;
  height: 24px;
  padding: 4px;
  border: 0 !important;
  border-radius: 4px;
}

.toolbar-segment .toolbar-mode-button.active {
  color: var(--mt-accent);
  background: color-mix(in srgb, var(--mt-accent) 14%, transparent) !important;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--mt-accent) 38%, transparent);
}

.toolbar-leading-control {
  flex: none;
  min-width: 50px;
  height: 28px;
  padding: 2px 7px;
  font-variant-numeric: tabular-nums;
}

.toolbar-part-count {
  width: 44px;
  height: 28px;
  padding: 2px 4px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.toolbar-copy-script-button.copy-succeeded {
  color: var(--mt-accent);
  background: color-mix(in srgb, var(--mt-accent) 18%, var(--vscode-dropdown-background)) !important;
  border-color: var(--mt-accent) !important;
}

.toolbar-copy-script-button.copy-failed {
  color: var(--vscode-errorForeground);
  background: color-mix(in srgb, var(--vscode-errorForeground) 12%, transparent) !important;
  border-color: var(--vscode-inputValidation-errorBorder, var(--vscode-errorForeground)) !important;
}

.topology-status {
  margin-left: auto;
  overflow: hidden;
  color: var(--vscode-descriptionForeground, #aaa);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toolbar-overflow {
  position: relative;
}

.toolbar-overflow-menu {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  z-index: 300;
  display: flex;
  min-width: 190px;
  padding: 4px;
  border: 1px solid var(--vscode-menu-border, var(--vscode-panel-border, #555));
  border-radius: 6px;
  background: var(--vscode-menu-background, #252526);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.toolbar-overflow-menu[hidden] {
  display: none;
}

.toolbar .toolbar-menu-item {
  width: 100%;
  min-height: 30px;
  justify-content: flex-start;
  gap: 8px;
  padding: 5px 8px;
  color: var(--vscode-menu-foreground, var(--vscode-foreground, #ccc));
  border-color: transparent;
  background: transparent;
  white-space: nowrap;
}

.toolbar .toolbar-menu-item:hover {
  color: var(--vscode-menu-selectionForeground, #fff);
  background: var(--vscode-menu-selectionBackground, #04395e);
}

.preview-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  min-height: 0;
  padding: 8px;
}

.preview-viewport {
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.preview-viewport.is-panning {
  cursor: grabbing;
}

.simulator-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.preview-column {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.inspector {
  /* Sash drags equate getBoundingClientRect() with style.height; border-box
     keeps the panel's border inside that equation. */
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  width: 280px;
  overflow: hidden;
  border-left: 1px solid var(--vscode-panel-border, #444);
  background: var(--vscode-sideBar-background, #252526);
}

.inspector-sections,
.output-values-table-host {
  scrollbar-width: thin;
  scrollbar-color:
    var(--vscode-scrollbarSlider-background, rgba(121, 121, 121, 0.4))
    transparent;
}

.inspector-sections::-webkit-scrollbar,
.output-values-table-host::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.inspector-sections::-webkit-scrollbar-track,
.output-values-table-host::-webkit-scrollbar-track,
.inspector-sections::-webkit-scrollbar-corner,
.output-values-table-host::-webkit-scrollbar-corner {
  background: transparent;
}

.inspector-sections::-webkit-scrollbar-thumb,
.output-values-table-host::-webkit-scrollbar-thumb {
  min-width: 28px;
  min-height: 28px;
  border: 2px solid transparent;
  border-radius: 999px;
  background:
    var(--vscode-scrollbarSlider-background, rgba(121, 121, 121, 0.4))
    content-box;
}

.inspector-sections::-webkit-scrollbar-thumb:hover,
.output-values-table-host::-webkit-scrollbar-thumb:hover {
  background:
    var(--vscode-scrollbarSlider-hoverBackground, rgba(100, 100, 100, 0.7))
    content-box;
}

.inspector-sections::-webkit-scrollbar-thumb:active,
.output-values-table-host::-webkit-scrollbar-thumb:active {
  background:
    var(--vscode-scrollbarSlider-activeBackground, rgba(191, 191, 191, 0.4))
    content-box;
}

.inspector-header {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
  padding: 0 8px;
  border-bottom: 1px solid var(--vscode-panel-border, #444);
  background: color-mix(
    in srgb,
    var(--vscode-sideBar-background, #252526) 92%,
    white
  );
}

.inspector-header button:not(.inspector-close-button) {
  padding: 2px 7px;
  border: 1px solid var(--vscode-button-border, transparent);
  border-radius: 3px;
  background: var(--vscode-button-secondaryBackground, #3a3d41);
  color: var(--vscode-button-secondaryForeground, #fff);
  cursor: pointer;
}

.inspector-header button:not(.inspector-close-button):hover {
  background: var(--vscode-button-secondaryHoverBackground, #45494e);
}

.panel-tabs {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--vscode-panel-border, #444);
}

.panel-tab {
  position: relative;
  min-width: 0;
  padding: 6px 8px;
  border: 0;
  background: transparent;
  color: var(--vscode-descriptionForeground, #aaa);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel-tab:hover {
  background: var(--vscode-list-hoverBackground, rgba(255, 255, 255, 0.06));
  color: var(--vscode-foreground, #ccc);
}

.panel-tab-active {
  color: var(--vscode-foreground, #fff);
}

.panel-tab-active::after {
  position: absolute;
  right: 5px;
  bottom: -1px;
  left: 5px;
  height: 2px;
  background: var(--vscode-focusBorder, #007acc);
  content: "";
}

.inspector-tabs {
  flex: none;
  background: var(--vscode-sideBar-background, #252526);
}

.inspector-tabs .panel-tab {
  flex: 1;
}

.inspector-sections {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.inspector-sections details {
  border-bottom: 1px solid var(--vscode-panel-border, #444);
  padding: 7px 8px;
}

.inspector summary {
  cursor: pointer;
  font-weight: 600;
  user-select: none;
}

.inspector-fields {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) minmax(100px, 1.2fr);
  gap: 5px 8px;
  align-items: center;
  margin-top: 7px;
}

.inspector-fields label {
  font-size: 12px;
}

.inspector-fields input,
.inspector-fields select,
.inspector-fields textarea {
  min-width: 0;
  box-sizing: border-box;
  width: 100%;
  padding: 2px 4px;
  border: 1px solid var(--vscode-input-border, #555);
  background: var(--vscode-input-background, #3c3c3c);
  color: var(--vscode-input-foreground, #ccc);
}

.inspector-fields textarea {
  min-height: 54px;
  resize: vertical;
}

.inspector-fields input[type="checkbox"] {
  justify-self: start;
  width: auto;
  accent-color: var(--mt-accent);
}

.inspector-control-disabled {
  opacity: 0.45;
}

.color-fields {
  display: grid;
  grid-template-columns: minmax(52px, 1fr) minmax(58px, 0.8fr);
  gap: 5px;
}

.color-fields input[type="color"] {
  height: 26px;
  padding: 1px 2px;
  cursor: pointer;
}

.font-fields {
  display: flex;
  min-width: 0;
  gap: 5px;
}

.font-fields select {
  flex: 1;
}

.font-fields button {
  flex: none;
  padding: 2px 6px;
  border: 1px solid var(--vscode-button-border, transparent);
  border-radius: 3px;
  background: var(--vscode-button-secondaryBackground, #3a3d41);
  color: var(--vscode-button-secondaryForeground, #fff);
  cursor: pointer;
}


.preview-canvas {
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.5);
  transform-origin: center;
  will-change: transform;
}

.preview-navigation-reset {
  min-width: 54px;
  margin-right: 2px;
  font-variant-numeric: tabular-nums;
}

/* SVG icons inherit the button's colour (fill="currentColor"), so the states
   below drive them the same way they drive the text-glyph buttons. */
.timeline button > svg {
  display: block;
  pointer-events: none;
}

/* The loop toggle carries its on/off state in colour: inactive is the same
   muted grey as the other transport icons, active picks up the accent. */
.timeline .loop-button {
  opacity: 0.5;
}

.timeline .loop-button.active {
  opacity: 1;
  color: var(--mt-accent);
}

/* Accent-coloured like the record button beside it: both are actions that
   produce a file from the scene, as opposed to the neutral transport
   controls. */
.timeline .capture-button {
  color: var(--mt-accent);
}

.status-bar {
  min-height: 18px;
  padding: 2px 10px;
  font-size: 12px;
  color: var(--vscode-errorForeground, #f88);
}

.timeline {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 12px;
}

.timeline button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 26px;
  background: transparent;
  color: var(--vscode-icon-foreground, #ccc);
  border: none;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
}

.timeline button:hover {
  background: var(--vscode-toolbar-hoverBackground, rgba(255, 255, 255, 0.1));
}

.timeline input[type="checkbox"] {
  accent-color: var(--mt-accent);
}

/* The playhead track sits in the upper part; the bottom padding reserves a
   separate lane for the recording range band and its grips, so the slider
   thumb and the range handles never share hit areas. */
.slider-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  align-self: stretch;
  display: flex;
  align-items: center;
  padding-bottom: 12px;
}

.slider-wrap input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  z-index: 0;
  width: 100%;
  height: 20px;
  margin: 0;
  background: transparent;
}

.slider-wrap input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: var(--vscode-scrollbarSlider-background, rgba(121, 121, 121, 0.4));
}

.slider-wrap input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -4px;
  border: none;
  border-radius: 50%;
  background: var(--mt-accent);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
  transition: transform 0.1s ease;
}

.slider-wrap input[type="range"]:hover::-webkit-slider-thumb {
  transform: scale(1.2);
}

.frame-label {
  font-size: 12px;
  min-width: 110px;
  text-align: right;
  color: var(--vscode-descriptionForeground, #aaa);
  font-variant-numeric: tabular-nums;
}

.seconds-label {
  display: inline-block;
  flex: none;
  font-size: 12px;
  color: var(--vscode-descriptionForeground, #aaa);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.output-values {
  /* See .inspector: border-box keeps measured and assigned heights equal. */
  box-sizing: border-box;
  display: flex;
  /* Shrinkable so an oversized restored height collapses into the viewport
     instead of pushing the panel stack below it. */
  flex: 0 1 auto;
  flex-direction: column;
  height: 27vh;
  min-height: 160px;
  max-height: 320px;
  overflow: hidden;
  border-top: 1px solid var(--vscode-panel-border, #444);
  background: var(--vscode-panel-background, #1e1e1e);
}

.output-values-header {
  display: flex;
  flex: none;
  align-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 30px;
  padding: 4px 8px;
  background: color-mix(
    in srgb,
    var(--vscode-sideBar-background, #252526) 92%,
    white
  );
}

.output-values-header strong {
  font-size: 12px;
  white-space: nowrap;
}

.output-values-tabs {
  flex: none;
  margin-left: auto;
  align-self: stretch;
  border-bottom: 0;
}

.output-values-table-host {
  flex: 1;
  overflow: auto;
}

.output-values-page {
  width: 100%;
  min-width: 0;
}

.output-values-page > .output-values-table,
.output-values-group {
  min-width: 100%;
}

.output-values-group h3 {
  position: sticky;
  z-index: 3;
  left: 0;
  width: max-content;
  margin: 0;
  padding: 6px 8px;
  color: var(--vscode-foreground, #ccc);
  font-size: 11px;
}

.output-values-group + .output-values-group {
  border-top: 1px solid var(--vscode-panel-border, #444);
}

.output-values-table {
  width: 100%;
  min-width: 100%;
  table-layout: fixed;
  border-spacing: 0;
  border-collapse: separate;
  font-family: var(--vscode-editor-font-family, monospace);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.output-values-table th,
.output-values-table td {
  max-width: 280px;
  padding: 4px 8px;
  overflow: hidden;
  border-right: 1px solid var(--vscode-panel-border, #333);
  border-bottom: 1px solid var(--vscode-panel-border, #333);
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.output-values-table thead th {
  position: sticky;
  z-index: 2;
  top: 0;
  background: var(--vscode-editorGroupHeader-tabsBackground, #252526);
  color: var(--vscode-descriptionForeground, #bbb);
}

.output-values-table tbody th {
  position: sticky;
  z-index: 1;
  left: 0;
  background: var(--vscode-sideBar-background, #252526);
  color: var(--vscode-descriptionForeground, #bbb);
}

.output-value-changed {
  background: color-mix(in srgb, var(--vscode-editorWarning-foreground, #cca700) 18%, transparent);
  color: var(--vscode-editorWarning-foreground, #cca700);
}

.output-color-content {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 4px;
}

.output-color-swatch {
  box-sizing: border-box;
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  border: 1px solid color-mix(in srgb, var(--vscode-foreground, #ccc) 45%, transparent);
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
}

.output-color-arrow {
  flex: 0 0 auto;
}

.output-color-label {
  min-width: 0;
  overflow: hidden;
  color: var(--vscode-foreground, #ccc);
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-height: 620px) {
  .output-values {
    height: 180px;
    min-height: 130px;
  }
}

.record-controls {
  display: flex;
  flex: none;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.record-frame-label {
  position: absolute;
  top: -6px;
  transform: translateX(-50%);
  font-size: 10px;
  line-height: 1;
  color: var(--mt-accent);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  pointer-events: none;
}

.record-band {
  position: absolute;
  bottom: 4px;
  z-index: 1;
  height: 4px;
  background: color-mix(in srgb, var(--mt-accent) 45%, transparent);
  border-radius: 2px;
  pointer-events: none;
}

/* Invisible 14x14 hit area centered on the marker in the range lane; the
   visible grip is the ::before bar so the drag target stays comfortably
   large. */
.record-handle {
  position: absolute;
  bottom: -1px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  transform: translateX(-50%);
  cursor: ew-resize;
  touch-action: none;
}

.record-handle::before {
  content: "";
  width: 4px;
  height: 10px;
  border-radius: 2px;
  background: var(--mt-accent);
  transition: height 0.1s ease;
}

.record-handle:hover::before {
  height: 14px;
}

.timeline .record-button {
  color: var(--mt-accent);
}

.recording-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
}

.recording-dialog {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 22px 32px;
  border: 1px solid var(--vscode-panel-border, #444);
  border-radius: 8px;
  background: var(--vscode-editor-background, #1e1e1e);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.recording-progress {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.recording-dialog button {
  padding: 4px 14px;
  background: var(--vscode-button-background, #0e639c);
  color: var(--vscode-button-foreground, #fff);
  border: none;
  border-radius: 3px;
  cursor: pointer;
}

/* Panel Resizing and Collapsing Styles */
.sash-vertical {
  width: 4px;
  cursor: ew-resize;
  touch-action: none;
  background-color: transparent;
  border-left: 1px solid var(--vscode-panel-border, #444);
  flex: 0 0 4px;
  position: relative;
  transition: background-color 0.1s ease, border-color 0.1s ease;
  transition-delay: 0s;
  z-index: 100;
}

.sash-vertical:hover {
  background-color: var(--mt-accent, #a855f7) !important;
  border-left-color: transparent !important;
  border-top-color: transparent !important;
  transition-delay: 0.15s;
}

body.is-dragging-vertical .sash-vertical,
body.is-dragging-horizontal .sash-vertical {
  background-color: var(--mt-accent, #a855f7) !important;
  border-left-color: transparent !important;
  border-top-color: transparent !important;
  transition-delay: 0s !important;
}

.sash-vertical::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -8px;
  right: -8px;
  cursor: ew-resize;
  z-index: 101;
}

.sash-horizontal {
  height: 4px;
  cursor: ns-resize;
  touch-action: none;
  background-color: transparent;
  border-top: 1px solid var(--vscode-panel-border, #444);
  flex: 0 0 4px;
  position: relative;
  transition: background-color 0.1s ease, border-color 0.1s ease;
  transition-delay: 0s;
  z-index: 100;
}

.sash-horizontal:hover {
  background-color: var(--mt-accent, #a855f7) !important;
  border-top-color: transparent !important;
  transition-delay: 0.15s;
}

body.is-dragging-horizontal .sash-horizontal {
  background-color: var(--mt-accent, #a855f7) !important;
  border-top-color: transparent !important;
  transition-delay: 0s !important;
}

.sash-horizontal::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -8px;
  bottom: -8px;
  cursor: ns-resize;
  z-index: 101;
}

.inspector.collapsed {
  width: 0 !important;
  min-width: 0 !important;
  padding: 0 !important;
  border-left: none !important;
  overflow: hidden !important;
}

.output-values.collapsed {
  height: 30px !important;
  min-height: 30px !important;
  max-height: 30px !important;
}

.output-values.collapsed .output-values-table-host {
  display: none !important;
}

.inspector-close-button {
  background: transparent;
  border: none;
  color: var(--vscode-icon-foreground, #ccc);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 3px;
}

.inspector-close-button::before {
  content: "▶";
}

.inspector-close-button:hover {
  background: var(--vscode-toolbar-hoverBackground, rgba(255, 255, 255, 0.1));
}

.inspector-open-button {
  position: absolute;
  top: 40px;
  right: 0;
  z-index: 100;
  background: var(--vscode-sideBar-background, #252526);
  color: var(--vscode-foreground, #ccc);
  border: 1px solid var(--vscode-panel-border, #444);
  border-right: none;
  border-radius: 4px 0 0 4px;
  padding: 6px 8px;
  cursor: pointer;
  font-size: 11px;
  display: flex;
  align-items: center;
  box-shadow: -2px 2px 6px rgba(0, 0, 0, 0.3);
}

.inspector-open-button:hover {
  background: var(--vscode-toolbar-hoverBackground, rgba(255, 255, 255, 0.1));
  color: var(--vscode-foreground, #fff);
}

.output-values-collapse-button {
  background: transparent;
  border: none;
  color: var(--vscode-icon-foreground, #ccc);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 3px;
}

.output-values-collapse-button:hover {
  background: var(--vscode-toolbar-hoverBackground, rgba(255, 255, 255, 0.1));
}

body.is-dragging-vertical {
  user-select: none !important;
  cursor: ew-resize !important;
}

body.is-dragging-horizontal {
  user-select: none !important;
  cursor: ns-resize !important;
}

@container mt-sim-app (max-width: 760px) {
  .simulator-body {
    display: contents;
  }

  .inspector {
    width: auto !important;
    max-height: 42vh;
    border-top: 1px solid var(--vscode-panel-border, #444);
    border-left: none;
  }

  .inspector.collapsed {
    width: auto !important;
    height: 32px !important;
    min-height: 32px !important;
    max-height: 32px !important;
    padding: 0 !important;
    overflow: hidden !important;
    border-bottom: none !important;
  }

  .sash-vertical {
    display: block !important;
    width: auto !important;
    height: 4px !important;
    cursor: ns-resize !important;
    background-color: transparent !important;
    border-top: 1px solid var(--vscode-panel-border, #444) !important;
    border-left: none !important;
    flex: 0 0 4px;
    z-index: 100 !important;
  }

  .sash-vertical::after {
    left: 0 !important;
    right: 0 !important;
    top: -8px !important;
    bottom: -8px !important;
    cursor: ns-resize !important;
    z-index: 101 !important;
  }

  .inspector-open-button {
    display: none !important;
  }

  .inspector-close-button::before {
    content: "▼" !important;
  }

  .inspector.collapsed .inspector-close-button::before {
    content: "▲" !important;
  }
}

@media (max-width: 760px) {
  .plugin-compatibility-notice {
    top: auto;
    right: 10px;
    bottom: 10px;
    left: 10px;
    width: auto;
    border-radius: 14px;
  }

  .plugin-compatibility-notice-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .plugin-compatibility-notice-links {
    justify-content: space-between;
  }

  .plugin-compatibility-notice-confirm {
    width: 100%;
  }
}

/* Keeping every transport item on one line starves the range input as the
   simulator narrows. Chromium may then scroll or clip the focused thumb's
   oversized intrinsic track, which makes forward playback look like the bar
   is moving backwards. Give the playhead a stable row of its own. */
@container mt-sim-app (max-width: 520px) {
  .toolbar {
    gap: 3px;
    padding-inline: 5px;
  }

  .toolbar-control-group {
    gap: 3px;
  }

  .topology-status {
    display: none;
  }

  .toolbar-icon-button {
    width: 27px;
  }

  .toolbar-segment .toolbar-mode-button {
    width: 25px;
  }

  .toolbar-leading-control {
    min-width: 45px;
    padding-inline: 4px;
  }

  .toolbar-part-count {
    width: 38px;
  }

  .timeline {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto auto;
    gap: 4px 8px;
  }

  .timeline > button:first-child {
    grid-row: 1;
    grid-column: 1;
  }

  .slider-wrap {
    grid-row: 1;
    grid-column: 2 / -1;
    width: auto;
  }

  .frame-label {
    grid-row: 2;
    grid-column: 1 / 3;
    min-width: 0;
    overflow: hidden;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .seconds-label {
    grid-row: 2;
    grid-column: 3;
  }

  .loop-button {
    grid-row: 2;
    grid-column: 4;
  }

  .record-controls {
    grid-row: 2;
    grid-column: 5;
  }
}
