:root {
  color-scheme: dark;
  --bg: #070c16;
  --panel: #0b1322;
  --panel-2: #0f1a2e;
  --line: #26344f;
  --text: #f2f0e8;
  --muted: #aaa79b;
  --soft: #d8d2bd;
  --accent: #33b4f5;
  --accent-2: #d99a4d;
  --danger: #d85d70;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.34);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: #242828;
  color: var(--text);
  min-height: 34px;
  border-radius: 6px;
  padding: 0 11px;
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
  background: #2c3332;
}

.viewer-shell {
  display: grid;
  grid-template-columns: minmax(270px, 320px) minmax(0, 1fr) minmax(280px, 340px);
  height: 100%;
  min-height: 0;
}

.panel {
  min-height: 0;
  overflow: auto;
  background: var(--panel);
  border-color: var(--line);
  border-style: solid;
  scrollbar-width: thin;
}

.panel-left {
  border-width: 0 1px 0 0;
}

.panel-right {
  border-width: 0 0 0 1px;
}

.panel-header,
.control-block,
.detail-panel {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.panel-header {
  background: #151818;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  line-height: 1.4;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 25px;
  line-height: 1.1;
  font-weight: 780;
}

h2 {
  font-size: 14px;
  line-height: 1.2;
  font-weight: 760;
}

.status {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.status.ready {
  color: #93ddc5;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.button-pair {
  display: flex;
  gap: 6px;
}

.button-pair button,
.section-title button {
  min-height: 28px;
  padding: 0 9px;
  font-size: 12px;
}

.toggle-list {
  display: grid;
  gap: 7px;
}

.toggle-row {
  display: grid;
  grid-template-columns: 18px 1fr auto auto;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 8px;
  background: var(--panel-2);
  border: 1px solid transparent;
  border-radius: 7px;
}

.toggle-row:hover {
  border-color: #3f4746;
}

.toggle-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.toggle-label {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
  font-size: 13px;
  line-height: 1.2;
}

.toggle-label span:last-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.swatch {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}

.count {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.mini-button {
  min-height: 25px;
  padding: 0 8px;
  font-size: 12px;
}

.stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)),
    #101212;
}

#modelCanvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}

.topbar {
  position: absolute;
  z-index: 3;
  inset: 14px 14px auto 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}

.metric-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(92px, auto);
  gap: 8px;
  max-width: 100%;
}

.metric-strip div,
.top-actions {
  background: rgba(22, 24, 24, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  border-radius: 7px;
}

.metric-strip div {
  padding: 9px 11px;
}

.metric-strip span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.metric-strip strong {
  display: block;
  margin-top: 3px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.top-actions {
  display: flex;
  gap: 6px;
  padding: 6px;
  pointer-events: auto;
}

.mode-button.active {
  border-color: var(--accent);
  background: #1f3936;
  color: #d9fffa;
}

.view-cube {
  position: absolute;
  z-index: 3;
  right: 16px;
  bottom: 16px;
  width: 168px;
  padding: 8px;
  background: rgba(22, 24, 24, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  border-radius: 7px;
}

.view-cube-title {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  font-weight: 700;
  text-transform: uppercase;
}

.view-cube-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.view-cube button {
  min-height: 30px;
  padding: 0 8px;
  font-size: 12px;
}

.view-cube button.active {
  border-color: var(--accent);
  background: #1f3936;
  color: #d9fffa;
}

.loading {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-content: center;
  gap: 14px;
  background: rgba(17, 19, 19, 0.86);
}

.loading.hidden {
  display: none;
}

.loading p {
  color: var(--soft);
  font-size: 14px;
  text-align: center;
}

.loading-bar {
  width: min(420px, 54vw);
  height: 8px;
  overflow: hidden;
  background: #2c3030;
  border-radius: 999px;
}

.loading-bar span {
  display: block;
  width: 8%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: inherit;
  transition: width 160ms ease;
}

.range-field,
.check-field {
  display: grid;
  gap: 7px;
  margin-top: 11px;
  color: var(--soft);
  font-size: 13px;
}

.check-field {
  grid-template-columns: 18px 1fr;
  align-items: center;
}

.check-field input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.search {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  color: var(--text);
  background: #101212;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
}

.search:focus {
  border-color: var(--accent);
}

.object-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  max-height: 270px;
  overflow: auto;
  scrollbar-width: thin;
}

.object-list button {
  display: block;
  width: 100%;
  height: auto;
  min-height: 32px;
  padding: 7px 8px;
  text-align: left;
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.object-list button.active {
  border-color: var(--accent-2);
  background: #33291f;
}

.detail-panel {
  background: #151818;
}

.detail-panel h2 {
  margin-bottom: 10px;
}

.detail-panel p {
  color: var(--text);
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.35;
}

dl {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
}

dl div {
  display: grid;
  gap: 4px;
}

dt {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
}

dd {
  margin: 0;
  color: var(--soft);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

@media (max-width: 1120px) {
  .viewer-shell {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .panel-right {
    position: absolute;
    z-index: 5;
    right: 0;
    top: 0;
    bottom: 0;
    width: min(340px, 42vw);
    box-shadow: var(--shadow);
  }

  .metric-strip {
    grid-auto-flow: row;
    grid-template-columns: repeat(2, minmax(92px, 1fr));
  }
}

@media (max-width: 760px) {
  html,
  body {
    overflow: auto;
  }

  .viewer-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(520px, 72vh) auto;
    min-height: 100%;
    height: auto;
  }

  .panel {
    max-height: none;
    border-width: 0 0 1px;
  }

  .panel-right {
    position: static;
    width: auto;
    box-shadow: none;
  }

  .topbar {
    align-items: flex-start;
  }

  .metric-strip {
    grid-template-columns: repeat(2, minmax(90px, 1fr));
  }
}

.demo-nav{height:56px;display:flex;align-items:center;gap:28px;padding:0 24px;border-bottom:1px solid var(--line);font-size:14px}.demo-nav a{color:#c8ddf5;text-decoration:none}.demo-nav a:first-child{margin-right:auto;letter-spacing:.06em}.reference-notice{min-height:48px;padding:12px 24px;background:#102039;color:#9db2d0;font-size:13px;line-height:1.5}.reference-notice strong{color:#eaf1fb}.viewer-shell{height:calc(100dvh - 104px)}
@media(max-width:900px){html,body{height:auto;overflow:auto}.viewer-shell{height:auto;min-height:calc(100dvh - 104px)}.stage{min-height:480px}.demo-nav{gap:16px;padding:0 16px;font-size:12px}.reference-notice{padding:12px 16px}}
@media(max-width:1120px){html,body{height:auto;overflow:auto}.viewer-shell{height:auto;grid-template-columns:1fr 1fr;grid-template-rows:620px auto}.stage{grid-column:1/-1;grid-row:1;min-height:620px}.panel-left{grid-column:1;grid-row:2}.panel-right{position:static;grid-column:2;grid-row:2;width:auto;box-shadow:none}.panel{max-height:none;overflow:visible}}
@media(max-width:760px){.viewer-shell{grid-template-columns:1fr;grid-template-rows:520px auto auto}.stage{min-height:520px}.panel-left{grid-column:1;grid-row:2}.panel-right{grid-column:1;grid-row:3}.metric-strip{grid-template-columns:repeat(2,minmax(72px,1fr))}.topbar{gap:8px}.topbar .button-group{flex-wrap:wrap}.demo-nav a:first-child{font-size:11px}}
@media(max-width:520px){.topbar{align-items:flex-start}.top-actions{display:grid;grid-template-columns:1fr 1fr;gap:4px}.top-actions button{min-height:30px;font-size:12px;padding:0 8px}.metric-strip{grid-auto-columns:auto;gap:4px}.metric-strip div{padding:7px}.metric-strip strong{font-size:12px}.demo-nav{gap:12px}.reference-notice{font-size:12px}}
