:root{
  --three-brand1: #d08752;
  --three-brand2: #cbd5e1;
  --three-bg: #090a0b;
  --three-panel: rgba(18, 20, 22, 0.94);
  --three-panel-2: rgba(25, 28, 31, 0.92);
  --three-line: rgba(203, 213, 225, 0.14);
  --three-text: #f8fafc;
  --three-muted: rgba(226, 232, 240, 0.62);
  --three-soft: rgba(208, 135, 82, 0.12);
  --brand1: var(--three-brand1);
  --brand2: var(--three-brand2);
}

html,
body{
  min-height: 100%;
  background: var(--three-bg);
  color: var(--three-text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body{
  margin: 0;
  overflow: hidden;
}

button,
input,
select{
  font: inherit;
}

button{
  cursor: pointer;
}

.threeStudioPage{
  position: relative;
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr) minmax(260px, 340px);
  gap: 12px;
  width: 100%;
  min-height: calc(100vh - var(--nav-height, 68px));
  height: calc(100vh - var(--nav-height, 68px));
  padding: 12px;
  box-sizing: border-box;
  overflow: hidden;
  background:
    radial-gradient(circle at 22% 18%, rgba(208, 135, 82, 0.13), transparent 30%),
    radial-gradient(circle at 76% 14%, rgba(203, 213, 225, 0.1), transparent 28%),
    linear-gradient(180deg, #0f1113 0%, #08090a 100%);
  isolation: isolate;
}

.threeStudioPage:before{
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.42;
  background-image:
    linear-gradient(rgba(203, 213, 225, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(203, 213, 225, 0.055) 1px, transparent 1px);
  background-size: 68px 68px;
  transform: perspective(900px) rotateX(64deg) translateY(24%);
  transform-origin: center bottom;
}

.threeStudioRail,
.threeStudioInspector,
.threeStudioWorkbench{
  min-height: 0;
  border: 1px solid var(--three-line);
  background: linear-gradient(180deg, rgba(20, 23, 26, 0.96), rgba(11, 12, 14, 0.94));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.threeStudioRail,
.threeStudioInspector{
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(208, 135, 82, 0.78) rgba(255, 255, 255, 0.08);
}

.threeStudioTitle{
  display: inline-flex;
  align-items: center;
  gap: 9px;
  width: max-content;
  max-width: 100%;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid rgba(203, 213, 225, 0.14);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.045);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.threeStudioTitleIcon{
  width: 17px;
  height: 17px;
  color: var(--three-brand1);
}

.threeStudioTitleIcon svg,
.threeToolButton svg,
.threeStudioPanelHead svg{
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.threeStudioImportCard{
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 8px;
  min-height: 132px;
  border: 1px solid rgba(203, 213, 225, 0.22);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(208, 135, 82, 0.2), rgba(203, 213, 225, 0.06)),
    rgba(255, 255, 255, 0.045);
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  transition: border-color .18s ease, background-color .18s ease, transform .18s ease;
}

.threeStudioImportCard:hover,
.threeStudioImportCard:focus-visible{
  border-color: rgba(208, 135, 82, 0.72);
  background-color: rgba(208, 135, 82, 0.08);
  transform: translateY(-1px);
  outline: none;
}

.threeStudioImportPlus{
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--three-brand2);
  font-size: 22px;
  line-height: 1;
}

.threeStudioImportCard small{
  color: var(--three-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

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

.threeStudioPanel{
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(203, 213, 225, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.threeStudioPanelHead{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 28px;
  color: rgba(248, 250, 252, 0.9);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.threeStudioPanelHead button{
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid rgba(203, 213, 225, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--three-muted);
}

.threeStudioPanelHead button:hover{
  color: #fff;
  border-color: rgba(208, 135, 82, 0.58);
}

.threeStudioPanelHead button svg{
  width: 15px;
  height: 15px;
}

.threePrimitiveGrid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.threePrimitiveGrid button,
.threeOutlinerButton,
.threeRecentItem,
.threeInspectorHeader button,
.threeToolbarTextButton{
  min-height: 36px;
  border: 1px solid rgba(203, 213, 225, 0.14);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.045);
  color: rgba(248, 250, 252, 0.9);
  font-size: 12px;
  font-weight: 850;
  transition: border-color .18s ease, background-color .18s ease, color .18s ease;
}

.threePrimitiveGrid button:hover,
.threeOutlinerButton:hover,
.threeOutlinerButton.isActive,
.threeRecentItem:hover,
.threeInspectorHeader button:hover,
.threeToolbarTextButton:hover{
  border-color: rgba(208, 135, 82, 0.56);
  background: rgba(208, 135, 82, 0.11);
  color: #fff;
}

.threeOutlinerList,
.threeRecentList{
  display: grid;
  gap: 7px;
}

.threeOutlinerButton,
.threeRecentItem{
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  text-align: left;
}

.threeOutlinerButton span,
.threeRecentItem span{
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.threeOutlinerButton small,
.threeRecentItem small{
  color: var(--three-muted);
  font-size: 10px;
  font-weight: 850;
}

.threeEmptyList{
  color: var(--three-muted);
  font-size: 12px;
  line-height: 1.45;
}

.threeStudioWorkbench{
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  border-radius: 16px;
  overflow: hidden;
}

.threeStudioToolbar,
.threeStudioStatusbar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
  background: rgba(10, 11, 13, 0.78);
  border-bottom: 1px solid rgba(203, 213, 225, 0.1);
}

.threeStudioStatusbar{
  min-height: 38px;
  border-top: 1px solid rgba(203, 213, 225, 0.1);
  border-bottom: 0;
  color: var(--three-muted);
  font-size: 12px;
  font-weight: 800;
}

.threeStudioStatusbar span{
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.threeToolbarGroup{
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.threeToolButton{
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(203, 213, 225, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
  color: rgba(248, 250, 252, 0.82);
  transition: border-color .18s ease, background-color .18s ease, color .18s ease;
}

.threeToolButton svg{
  width: 18px;
  height: 18px;
}

.threeToolButton:hover,
.threeToolButton:focus-visible,
.threeToolButton.isActive{
  color: #fff;
  border-color: rgba(208, 135, 82, 0.64);
  background: linear-gradient(135deg, rgba(208, 135, 82, 0.18), rgba(203, 213, 225, 0.08));
  outline: none;
}

.threeToolbarExportGroup{
  margin-left: auto;
}

.threeToolbarExportGroup select{
  height: 38px;
  min-width: 118px;
  padding: 0 10px;
  border: 1px solid rgba(203, 213, 225, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
  color: #fff;
  font-size: 12px;
  font-weight: 850;
}

.threeToolbarTextButton{
  min-height: 38px;
  padding: 0 12px;
  white-space: nowrap;
}

.threeToolbarTextButtonPrimary{
  color: #0a0b0c;
  border-color: transparent;
  background: linear-gradient(135deg, var(--three-brand1), var(--three-brand2));
}

.threeToolbarTextButtonPrimary:hover{
  color: #0a0b0c;
  background: linear-gradient(135deg, #e4a36d, #f1f5f9);
}

.threeViewportWrap{
  position: relative;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 42%, rgba(208, 135, 82, 0.12), transparent 38%),
    #050607;
}

.threeViewport{
  position: absolute;
  inset: 0;
}

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

.threeViewportFallback{
  position: absolute;
  inset: 24px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  text-align: center;
  color: var(--three-muted);
}

.threeViewportFallback strong{
  color: #fff;
  font-size: 18px;
}

.threeViewportHint{
  position: absolute;
  left: 14px;
  bottom: 14px;
  max-width: min(520px, calc(100% - 28px));
  padding: 9px 11px;
  border: 1px solid rgba(203, 213, 225, 0.12);
  border-radius: 10px;
  background: rgba(10, 11, 13, 0.74);
  color: rgba(248, 250, 252, 0.72);
  font-size: 12px;
  font-weight: 780;
  pointer-events: none;
}

.threeStudioInspector{
  align-content: stretch;
}

.threeInspectorHeader{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
}

.threeInspectorHeader button{
  min-height: 32px;
  padding: 0 10px;
}

.threeField,
.threeColorField,
.threeRangeField,
.threeCheckField{
  display: grid;
  gap: 7px;
  color: rgba(248, 250, 252, 0.86);
  font-size: 12px;
  font-weight: 850;
}

.threeField input,
.threeVectorGrid input{
  width: 100%;
  min-width: 0;
  height: 34px;
  box-sizing: border-box;
  padding: 0 9px;
  border: 1px solid rgba(203, 213, 225, 0.14);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.045);
  color: #fff;
  outline: none;
}

.threeField input:focus,
.threeVectorGrid input:focus{
  border-color: rgba(208, 135, 82, 0.66);
}

.threeInspectorSection{
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(203, 213, 225, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.threeInspectorSection h2{
  margin: 0;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.threeVectorGrid{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.threeVectorGrid label{
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--three-muted);
  font-size: 10px;
  font-weight: 900;
}

.threeColorField{
  grid-template-columns: 1fr auto;
  align-items: center;
}

.threeColorField input{
  width: 44px;
  height: 32px;
  border: 1px solid rgba(203, 213, 225, 0.14);
  border-radius: 9px;
  background: transparent;
}

.threeRangeField input{
  width: 100%;
  accent-color: var(--three-brand1);
  cursor: pointer;
}

.threeCheckField{
  grid-template-columns: auto 1fr;
  align-items: center;
}

.threeCheckField input{
  width: 16px;
  height: 16px;
  accent-color: var(--three-brand1);
  cursor: pointer;
}

.threeInspectorEmpty{
  color: var(--three-muted);
  line-height: 1.45;
}

.threeInspectorEmpty p{
  margin: 0;
  font-size: 12px;
}

.threeStudioInspector[data-has-selection="true"] .threeInspectorEmpty{
  display: none;
}

.threeStudioInspector[data-has-selection="false"] .threeField,
.threeStudioInspector[data-has-selection="false"] .threeInspectorSection:not(.threeInspectorEmpty),
.threeStudioInspector[data-has-selection="false"] .threeInspectorHeader button{
  opacity: .45;
  pointer-events: none;
}

@media (max-width: 1180px){
  body{
    overflow: auto;
  }

  .threeStudioPage{
    grid-template-columns: minmax(190px, 240px) minmax(0, 1fr);
    grid-template-rows: minmax(560px, calc(100vh - var(--nav-height, 68px) - 24px)) auto;
    height: auto;
    min-height: calc(100vh - var(--nav-height, 68px));
    overflow: visible;
  }

  .threeStudioInspector{
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: start;
  }

  .threeInspectorHeader,
  .threeField{
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px){
  .threeStudioPage{
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(520px, 72vh) auto;
    padding: 8px;
  }

  .threeStudioToolbar{
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .threeToolbarExportGroup{
    width: 100%;
    margin-left: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .threeToolbarExportGroup select,
  .threeToolbarExportGroup .threeToolbarTextButtonPrimary{
    grid-column: 1 / -1;
  }

  .threeStudioInspector{
    grid-template-columns: 1fr;
  }

  .threeStudioStatusbar{
    display: grid;
    justify-items: start;
  }
}
