.stl-viewer {
  background: #0f1320;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  box-sizing: border-box;
  color: #f2f5ff;
  padding: 12px;
}

.stl-viewer *,
.stl-viewer *::before,
.stl-viewer *::after {
  box-sizing: border-box;
}

body.stl-viewer-lock {
  overflow: hidden;
}

.viewer-toolbar {
  align-items: center;
  background: rgba(10, 15, 28, 0.78);
  border: 1px solid rgba(205, 214, 244, 0.12);
  border-radius: 8px;
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 10px;
  scrollbar-width: thin;
}

.viewer-toolbar-main {
  align-items: center;
  display: flex;
  flex: 1 1 auto;
  flex-wrap: nowrap;
  gap: 8px;
  min-width: 0;
}

.viewer-file-group {
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(205, 214, 244, 0.14);
  border-radius: 8px;
  display: flex;
  flex: 0 1 250px;
  gap: 8px;
  min-height: 38px;
  min-width: 210px;
  padding: 4px;
}

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

.viewer-toolbar .btn,
.viewer-file-button,
.viewer-fullscreen-button {
  align-items: center;
  background: #1a2035;
  border: 1px solid #2a2f45;
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  gap: 6px;
  justify-content: center;
  line-height: 1.2;
  min-height: 32px;
  padding: 7px 9px;
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
}

.viewer-toolbar .btn:hover,
.viewer-file-button:hover,
.viewer-fullscreen-button:hover {
  background: #243054;
  color: #ffffff;
  transform: translateY(-1px);
}

.viewer-file-input:focus-visible + .viewer-file-button,
.viewer-toolbar .btn:focus-visible,
.viewer-fullscreen-button:focus-visible {
  outline: 3px solid rgba(255, 208, 44, 0.38);
  outline-offset: 2px;
}

.viewer-file-name {
  color: #cdd6f4;
  flex: 1 1 auto;
  font-size: 13px;
  line-height: 1.25;
  max-width: 128px;
  min-width: 0;
  overflow: hidden;
  padding-right: 8px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-action-group {
  align-items: center;
  display: inline-flex;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  gap: 6px;
  justify-content: flex-start;
}

.viewer-toggle-group {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  gap: 6px;
  justify-content: flex-end;
  min-width: 0;
}

.viewer-button-icon {
  flex: 0 0 auto;
  font-size: 14px;
  line-height: 1;
}

.viewer-button-text {
  line-height: 1.2;
}

.axis-toggle {
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(205, 214, 244, 0.14);
  border-radius: 6px;
  color: #d8def6;
  display: inline-flex;
  font-size: 13px;
  gap: 6px;
  line-height: 1.2;
  min-height: 32px;
  padding: 7px 8px;
  white-space: nowrap;
}

.axis-toggle input {
  accent-color: #ffd02c;
  flex: 0 0 auto;
  height: 15px;
  margin: 0;
  width: 15px;
}

.viewer-canvas {
  aspect-ratio: 16 / 9;
  background: linear-gradient(180deg, #0f1320, #0b0f1a);
  border-radius: 8px;
  min-height: 360px;
  overflow: hidden;
  width: 100%;
}

.viewer-canvas canvas {
  display: block;
  height: 100%;
  width: 100%;
}

.viewer-dims {
  color: #cdd6f4;
  font-size: 14px;
  margin-top: 10px;
}

.viewer-fullscreen-icon {
  display: inline-flex;
  flex: 0 0 auto;
  height: 19px;
  width: 19px;
}

.viewer-fullscreen-icon svg {
  display: block;
  fill: none;
  height: 100%;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 100%;
}

.viewer-fullscreen-text {
  font-size: 13px;
  line-height: 1;
}

.viewer-fullscreen-icon--collapse,
.stl-viewer.is-fullscreen .viewer-fullscreen-icon--expand {
  display: none;
}

.stl-viewer.is-fullscreen .viewer-fullscreen-icon--collapse {
  display: inline-flex;
}

.stl-viewer.is-fullscreen {
  background: #0f1320;
  border: 0;
  border-radius: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100vh;
  height: 100dvh;
  inset: 0;
  margin: 0;
  max-width: none;
  padding: 14px;
  position: fixed;
  width: 100vw;
  z-index: 2147483647;
}

.stl-viewer.is-fullscreen .viewer-toolbar {
  justify-content: space-between;
}

.stl-viewer.is-fullscreen .viewer-canvas {
  aspect-ratio: auto;
  border-radius: 8px;
  height: 100%;
  min-height: 0;
}

.stl-viewer.is-fullscreen .viewer-fullscreen-button {
  background: rgba(255, 208, 44, 0.96);
  border-color: rgba(255, 208, 44, 0.96);
  color: #102437;
}

@media (max-width: 640px) {
  .viewer-toolbar {
    justify-content: flex-start;
  }

  .viewer-toolbar-main {
    flex: 0 0 auto;
  }

  .viewer-canvas {
    min-height: 300px;
  }

  .stl-viewer.is-fullscreen {
    padding: 10px;
  }
}
