.handle-trigger-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.handle-trigger-row #handle-trigger {
  flex: 1;
  min-width: 0;
}

.handle-3d-trigger[hidden] {
  display: none;
}

.handle-3d-trigger,
.handle-detail button {
  min-height: 42px;
  font: inherit;
  font-size: .875rem;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
}

.handle-3d-trigger {
  max-width: 38%;
  padding: 0 13px;
  background: #1c1c1c;
  border: 1px solid #1c1c1c;
  color: #fff;
}

.handle-3d-trigger:not(:disabled):hover,
.handle-3d-trigger:focus-visible {
  background: #ffdc58;
  color: #161616;
  border-color: #a17c00;
}

body:has(.handle-detail[open]) {
  overflow: hidden;
}

.handle-detail {
  width: min(58rem, calc(100vw - 24px));
  max-width: none;
  max-height: calc(100dvh - 24px);
  box-sizing: border-box;
  padding: 0;
  overflow-y: auto;
  border: 1px solid #868686;
  border-radius: 16px;
  background: #fff;
  color: #171717;
}

.handle-detail::backdrop {
  background: rgb(0 0 0 / .65);
}

.handle-detail-header,
.handle-detail-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  flex-wrap: wrap;
  padding: 12px 16px;
}

.handle-detail-header {
  background: #141414;
  color: #fff;
}

.handle-detail-header h2 {
  margin: 0;
  color: inherit;
  font: inherit;
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  font-weight: 800;
}

.handle-detail-back {
  padding: 0 12px;
  border: 1px solid #787878;
  background: #252525;
  color: #fff;
}

.handle-detail-models {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
  gap: 6px;
  padding: 9px 12px;
  background: #f6f6f6;
}

.handle-detail-models button {
  padding: 5px 8px;
  border: 1px solid #c4c4c4;
  background: #fff;
  color: #171717;
}

.handle-detail-models button[aria-pressed="true"] {
  border-color: #9e7900;
  background: #ffda55;
}

.handle-detail-stage {
  position: relative;
  isolation: isolate;
  height: min(60dvh, 38rem);
  min-height: 200px;
  overflow: hidden;
  background: #c3c3c3;
}

.handle-detail [hidden] {
  display: none;
}

.handle-detail-canvas,
.handle-detail-canvas canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.handle-detail-canvas canvas {
  display: block;
  cursor: grab;
}

.handle-detail-canvas canvas:active {
  cursor: grabbing;
}

.handle-detail-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.handle-detail-controls {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  gap: 5px;
}

.handle-detail-controls button {
  min-width: 44px;
  border: 1px solid #9b9b9b;
  background: #fff;
  color: #111;
  font-size: 1.1rem;
}

.handle-detail-status {
  position: absolute;
  top: 10px;
  left: 10px;
  margin: 0;
  padding: 7px 10px;
  border-radius: 6px;
  background: #fff;
  color: #171717;
  pointer-events: none;
  font-size: .875rem;
}

.handle-detail-status:empty {
  display: none;
}

.handle-detail-footer p {
  margin: 0;
  color: #454545;
  font-size: .85rem;
}

.handle-detail-apply {
  min-width: 10rem;
  padding: 0 14px;
  border: 1px solid #987506;
  background: #ffda55;
  color: #171717;
}

.handle-detail button:focus-visible {
  outline: 2px solid #a57d00;
  outline-offset: 2px;
}

@media (max-width: 560px) {
  .handle-detail-header,
  .handle-detail-footer {
    padding: 10px 12px;
  }

  .handle-detail-stage {
    height: 48dvh;
  }

  .handle-detail-models {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
