:root {
  color-scheme: dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0b0d10;
  color: #f4f7fb;
}

* {
  box-sizing: border-box;
}

html,
body,
.viewer-shell {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
}

.viewer-shell {
  position: relative;
  background:
    radial-gradient(circle at 12% 16%, rgba(65, 91, 128, 0.22), transparent 28rem),
    linear-gradient(145deg, #0b0d10 0%, #14191f 48%, #0c1013 100%);
}

#scene {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}

.toolbar {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}

.model-select,
.nav-mode,
.toolbar button,
.file-picker {
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(11, 13, 16, 0.72);
  color: #f4f7fb;
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.24);
}

.model-select {
  min-width: 0;
  width: min(220px, 36vw);
  overflow: hidden;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  pointer-events: auto;
}

.nav-mode {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0 11px;
  border-radius: 8px;
  color: #a8d5ff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  pointer-events: auto;
}

.nav-mode {
  color: #d7ffba;
}

.toolbar button:not(.nav-mode),
.file-picker {
  display: grid;
  flex: 0 0 auto;
  min-width: 40px;
  width: auto;
  place-items: center;
  padding: 0 12px;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  pointer-events: auto;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    transform 160ms ease;
}

.toolbar button:hover,
.file-picker:hover {
  border-color: rgba(255, 255, 255, 0.38);
  background: rgba(25, 31, 37, 0.86);
}

.toolbar button:active,
.file-picker:active {
  transform: translateY(1px);
}

.toolbar svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

#resetView {
  width: 40px;
  padding: 0;
}

.file-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.command-modal {
  position: absolute;
  top: 16px;
  right: 16px;
  width: min(300px, calc(100vw - 32px));
  padding: 13px 14px 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(11, 13, 16, 0.72);
  color: rgba(244, 247, 251, 0.92);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(14px);
  pointer-events: auto;
  transition:
    width 180ms ease,
    transform 180ms ease,
    padding 180ms ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}

.command-title {
  color: #f4f7fb;
  font-size: 13px;
  font-weight: 800;
}

.modal-collapse {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(25, 31, 37, 0.92);
  color: #f4f7fb;
  cursor: pointer;
  font: 900 18px/1 Inter, ui-sans-serif, system-ui, sans-serif;
}

.command-modal.is-collapsed {
  width: 44px;
  min-height: 44px;
  padding: 8px;
  transform: translateX(10px);
}

.command-modal.is-collapsed .command-title,
.command-modal.is-collapsed dl {
  display: none;
}

.command-modal.is-collapsed .modal-header {
  margin: 0;
}

.command-modal.is-collapsed .modal-collapse {
  transform: rotate(180deg);
}

.command-modal dl {
  display: grid;
  gap: 7px;
  margin: 0;
}

.command-modal dl > div {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
}

.command-modal dt,
.command-modal dd {
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
}

.command-modal dt {
  color: rgba(244, 247, 251, 0.62);
  font-weight: 700;
}

kbd {
  display: inline-block;
  min-width: 20px;
  padding: 1px 5px 2px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-bottom-color: rgba(255, 255, 255, 0.28);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
  color: #f4f7fb;
  font: 700 11px/1.35 Inter, ui-sans-serif, system-ui, sans-serif;
}

.status {
  position: absolute;
  left: 50%;
  bottom: 24px;
  max-width: min(520px, calc(100vw - 32px));
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(11, 13, 16, 0.72);
  color: rgba(244, 247, 251, 0.92);
  font-size: 14px;
  transform: translateX(-50%);
  backdrop-filter: blur(14px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.status.is-hidden {
  opacity: 0;
  transform: translate(-50%, 8px);
  pointer-events: none;
}

.is-ui-hidden {
  display: none !important;
}

.categorizer-panel {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: min(360px, calc(100vw - 32px));
  max-height: max(240px, calc(100vh - 336px));
  overflow: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(11, 13, 16, 0.78);
  color: rgba(244, 247, 251, 0.94);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(14px);
}


.panel-header,
.measure-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-title {
  color: #f4f7fb;
  font-size: 14px;
  font-weight: 800;
}

.panel-subtitle,
.hint {
  color: rgba(244, 247, 251, 0.58);
  font-size: 12px;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: rgba(244, 247, 251, 0.66);
  font-size: 12px;
  font-weight: 700;
}

.demo-mode {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  padding: 9px 10px;
  border: 1px solid rgba(120, 190, 255, 0.22);
  border-radius: 8px;
  background: rgba(120, 190, 255, 0.08);
  font-size: 12px;
}

.demo-mode span {
  color: rgba(244, 247, 251, 0.58);
  font-weight: 700;
}

.demo-mode strong {
  min-width: 0;
  color: #f4f7fb;
  font-weight: 800;
}

.field select,
.categorizer-panel button {
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(25, 31, 37, 0.92);
  color: #f4f7fb;
  font: inherit;
}

.field select {
  width: 100%;
  padding: 0 10px;
}

.categorizer-panel button {
  padding: 0 12px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.categorizer-panel button.is-active {
  border-color: rgba(120, 190, 255, 0.72);
  background: rgba(36, 84, 116, 0.92);
}

.measure-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 10px;
  margin-bottom: 14px;
  font-size: 12px;
}

.field-grid label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.aspect-list {
  display: grid;
  gap: 7px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  font-size: 12px;
}

.aspect-list li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.aspect-list input {
  margin: 0;
}

.aspect-list span {
  min-width: 0;
}

.aspect-list .aspect-name {
  display: block;
  color: #f4f7fb;
  font-weight: 800;
  line-height: 1.25;
}

.aspect-list .aspect-value {
  display: block;
  margin-top: 2px;
  color: rgba(244, 247, 251, 0.62);
  font-size: 11px;
  line-height: 1.3;
}

.aspect-list button {
  width: 28px;
  height: 26px;
  padding: 0;
}

@media (max-width: 640px) {
  .toolbar {
    top: 12px;
    left: 12px;
    right: 12px;
    max-width: calc(100vw - 24px);
  }

  .model-select {
    font-size: 13px;
  }

  .status {
    bottom: 16px;
    font-size: 13px;
  }

  .command-modal {
    top: 64px;
    right: 12px;
    width: min(300px, calc(100vw - 24px));
  }

  .categorizer-panel {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    max-height: 42vh;
  }
}
