:root {
  color-scheme: dark;
  --base: #0b0d10;
  --paper: #14171d;
  --line: #2a2f3a;
  --ink: #f0f1f5;
  --muted: #a6acbb;
  --accent: #b9f274;
  --tint: #252e26;
}

body { background: radial-gradient(ellipse at 70% 0%, #171b24, transparent 52%), var(--base); }
.masthead { padding-inline: clamp(16px, 2.3vw, 38px); height: 59px; background: #101218; }
.mark { background: var(--accent); border-radius: 5px; }
.mark::before, .mark::after { border-color: #182318; }
.mark::after { background: #182318; }
.edition { display: none; }

main {
  display: grid;
  grid-template-columns: clamp(164px, 14vw, 224px) minmax(0, 1fr);
  max-width: 1820px;
  padding: 0 clamp(14px, 2.3vw, 38px);
  gap: clamp(14px, 2vw, 32px);
}
.library {
  align-self: start;
  position: sticky;
  top: 12px;
  padding: 25px 14px 17px 0;
  border-right: 1px solid var(--line);
  min-width: 0;
}
.library h2 {
  margin: 0 0 13px 8px;
  color: var(--muted);
  font: 600 .76rem 'Space Grotesk', sans-serif;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.catalog { display: grid; grid-template-columns: 1fr; gap: 5px; }
.catalog a {
  position: relative;
  display: block;
  font-size: .91rem;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 10px 9px 9px 11px;
  background: transparent;
}
.catalog a:hover { border-color: #464d5b; background: #1a1e26; }
.catalog a[aria-current] { color: var(--accent); background: #202720; border-color: #3c4b37; box-shadow: inset 2px 0 var(--accent); }
.catalog small { color: var(--muted); font-size: .73rem; line-height: 1.35; }

.workspace { min-width: 0; }
.object-heading { padding: clamp(22px, 3vw, 44px) 0 20px; }
#object-category {
  margin: 0 0 9px;
  color: var(--accent);
  font: 600 .76rem 'Space Grotesk', sans-serif;
  text-transform: uppercase;
  letter-spacing: .10em;
}
#title { font-size: clamp(2.4rem, 5vw, 5.15rem); letter-spacing: -.075em; line-height: .97; }
#object-summary { margin: 11px 0 0; max-width: 66ch; color: var(--muted); line-height: 1.45; }

.workbench { grid-template-columns: minmax(0, 1fr) minmax(218px, 27%); gap: 10px; }
.viewer, .inspector { border-radius: 10px; }
.stage {
  height: clamp(360px, 43vw, 660px);
  background: radial-gradient(ellipse at 47% 43%, #414956 0%, #222732 50%, #11151d 90%);
}
.stage-top { padding-bottom: 10px; border-bottom: 1px solid #b9c6db21; }
.stage-top h2 {
  color: #d5dbe6;
  font: 600 .77rem 'Space Grotesk', sans-serif;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.stage-actions button, .camera-views button { background: #141921e8; border-color: #414a5b; color: #e9edf5; }
.stage-bottom { color: #bdc6d5; }
#mode { color: var(--accent); }
#part-callout {
  position: absolute; z-index: 1; pointer-events: none;
  padding: 5px 8px; border: 1px solid #a9ce79; border-radius: 4px;
  color: #eefbe0; background: #141d14ec; font-size: .75rem; white-space: nowrap;
  transform: translate(-50%, calc(-100% - 10px));
}
#part-callout::after {
  content: ''; position: absolute; inset: 100% auto auto 50%;
  height: 10px; border-left: 1px solid #b9f274;
}
.camera-views {
  position: absolute;
  z-index: 2;
  display: flex;
  gap: 3px;
  bottom: 39px;
  left: 18px;
  border: 1px solid #464d5c;
  border-radius: 7px;
  padding: 3px;
  background: #10141bdd;
}
.camera-views button { border: 0; border-radius: 4px; padding: 5px 8px; font-size: .75rem; }
.camera-views button:hover:enabled { background: #364050; }
.controls { padding: 12px; border-top: 1px solid #424856; }
.view-switch { display: flex; padding: 2px; border: 1px solid var(--line); border-radius: 7px; background: #101218; }
.view-switch button { border: 0; border-radius: 5px; background: transparent; color: var(--muted); padding: 7px 8px; font-size: .75rem; }
.view-switch button[aria-pressed=true] { background: #303a2d; color: var(--accent); }
.view-switch button:hover:enabled { color: var(--ink); }
.action:hover:enabled, .practice-actions button:hover:enabled, #inspect:hover:enabled { border-color: var(--accent); }
#practice-start { color: #182318; }
.inspector-header { border-bottom: 0; padding-bottom: 10px; }
.part-search { display: block; margin: 0 10px 4px; }
.part-search span { display: block; margin: 0 0 5px; color: var(--muted); font-size: .75rem; }
.part-search input { width: 100%; padding: 8px 9px; color: var(--ink); background: #0e1117; border: 1px solid var(--line); border-radius: 6px; font: inherit; font-size: .83rem; }
.parts { max-height: clamp(220px, 26vw, 390px); scrollbar-color: #434b5d transparent; }
.part:hover { background: #222732; }
.part[aria-pressed=true] { background: #242b22; border-color: #3c4b37; color: var(--accent); }
.chip { box-shadow: inset 0 0 0 1px #ffffff38; }
.detail { border-color: #303746; background: #101319; min-height: 93px; }
#no-parts { margin: 9px 10px; color: var(--muted); font-size: .85rem; }
#inspect[aria-pressed=true] { color: var(--accent); border-color: var(--accent); }
footer { padding-bottom: 12px; }

@media (max-width: 970px) {
  main { grid-template-columns: 1fr; gap: 0; }
  .library { position: static; padding: 15px 0 9px; border-right: 0; border-bottom: 1px solid var(--line); }
  .library h2 { margin: 0 0 7px; }
  .catalog { display: flex; overflow: auto; padding-bottom: 4px; }
  .catalog a { flex: 0 0 auto; min-width: 137px; }
  .catalog small { max-width: 19ch; margin-top: 3px; }
}
@media (max-width: 800px) {
  .workbench { grid-template-columns: 1fr; }
  .stage { height: clamp(330px, 65vw, 540px); }
  .parts { max-height: 225px; }
}
@media (max-width: 540px) {
  .camera-views { left: 10px; }
  .view-switch { order: 2; }
  .range-control { flex-basis: 100%; order: 1; }
  .controls .action { order: 3; }
}
