:root {
  --bg: #0c0b09;
  --ink: #f2ede3;
  --muted: rgba(242, 237, 227, 0.56);
  --dim: rgba(242, 237, 227, 0.34);
  --brass: #c7a468;
  --brass-bright: #e0c18b;
  --brass-soft: rgba(199, 164, 104, 0.16);
  --line: rgba(242, 237, 227, 0.13);
  --line-soft: rgba(242, 237, 227, 0.075);
  --glass: rgba(18, 16, 13, 0.66);
  --glass-deep: rgba(12, 11, 9, 0.82);
  --sans: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.46);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

#app { position: fixed; inset: 0; }

#scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
  touch-action: none;
}

.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background:
    radial-gradient(ellipse at 50% 42%, transparent 36%, rgba(0, 0, 0, 0.34) 100%),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.22) 0%, transparent 20%, transparent 74%, rgba(0, 0, 0, 0.38) 100%);
}

.label-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  overflow: hidden;
}

/* Masthead */
.masthead {
  position: absolute;
  top: 28px;
  left: 32px;
  z-index: 10;
  max-width: 330px;
  pointer-events: none;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.55);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--brass);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.eyebrow span {
  display: inline-block;
  width: 24px;
  height: 1px;
  background: var(--brass);
  opacity: 0.8;
}

.masthead h1 {
  margin: 12px 0 8px;
  font-family: var(--serif);
  font-size: 58px;
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: -0.035em;
}

.masthead p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
  letter-spacing: 0.015em;
}

/* Mode switch */
.mode-switch {
  position: absolute;
  top: 28px;
  right: 82px;
  z-index: 12;
  display: flex;
  padding: 4px;
  border: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(16px) saturate(1.1);
  box-shadow: var(--shadow);
}

.mode-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 13px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: background 0.25s, color 0.25s;
}

.mode-btn span {
  color: var(--dim);
  font-size: 8px;
  letter-spacing: 0.04em;
}

.mode-btn:hover { color: var(--ink); }
.mode-btn.active { background: rgba(242, 237, 227, 0.09); color: var(--ink); }
.mode-btn.active span { color: var(--brass); }

.icon-btn {
  position: absolute;
  top: 28px;
  right: 32px;
  z-index: 12;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--glass);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 16px;
  font-style: italic;
  backdrop-filter: blur(16px);
  transition: border-color 0.25s, background 0.25s;
}

.icon-btn:hover { border-color: var(--brass); background: rgba(199, 164, 104, 0.12); }

/* Panel */
.panel {
  position: absolute;
  top: 92px;
  right: 32px;
  z-index: 11;
  width: 316px;
  max-height: calc(100vh - 130px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: linear-gradient(180deg, rgba(27, 24, 19, 0.76), rgba(14, 13, 11, 0.8));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px) saturate(1.12);
  scrollbar-width: thin;
  scrollbar-color: rgba(242, 237, 227, 0.18) transparent;
}

.panel::-webkit-scrollbar { width: 4px; }
.panel::-webkit-scrollbar-thumb { background: rgba(242, 237, 227, 0.18); }

.panel-block { padding: 16px 16px 17px; border-bottom: 1px solid var(--line-soft); }
.panel-block:last-child { border-bottom: 0; }

.block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
}

.note, .count {
  color: var(--dim);
  font-size: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.state {
  color: var(--brass-bright);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.current-color {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 11px;
}

.swatch {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.16), 0 8px 18px rgba(0, 0, 0, 0.3);
  background: #383e42;
  transition: background 0.3s;
}

.current-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.current-meta strong { font-size: 15px; font-weight: 600; letter-spacing: 0.02em; }
.current-meta span { color: var(--muted); font-size: 10px; letter-spacing: 0.04em; }

.quick-ral {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
  margin-bottom: 12px;
}

.quick-chip {
  height: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 1px;
  padding: 0;
  transition: transform 0.16s, box-shadow 0.16s;
}

.quick-chip:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45); }
.quick-chip.active { outline: 1px solid var(--brass-bright); outline-offset: 2px; }

.search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 9px;
  padding-bottom: 7px;
}

.search-row input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 11px;
  letter-spacing: 0.03em;
  padding: 2px 0;
}

.search-row input::placeholder { color: var(--dim); }

.ral-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  max-height: 196px;
  overflow-y: auto;
  padding-right: 3px;
  scrollbar-width: thin;
  scrollbar-color: rgba(242, 237, 227, 0.18) transparent;
}

.ral-grid::-webkit-scrollbar { width: 3px; }
.ral-grid::-webkit-scrollbar-thumb { background: rgba(242, 237, 227, 0.18); }

.ral-chip {
  position: relative;
  height: 30px;
  padding: 0 3px 2px;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1px;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1;
  transition: transform 0.15s, border-color 0.15s;
}

.ral-chip:hover { transform: scale(1.05); border-color: rgba(255, 255, 255, 0.55); z-index: 2; }
.ral-chip.active { outline: 2px solid var(--brass-bright); outline-offset: 1px; z-index: 3; }

.fineprint {
  margin: 9px 0 0;
  color: var(--dim);
  font-size: 8px;
  line-height: 1.45;
  letter-spacing: 0.015em;
}

.finish-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 11px;
  padding-top: 11px;
  border-top: 1px solid var(--line-soft);
}

.mini-label {
  display: block;
  color: var(--dim);
  font-size: 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.segmented { display: flex; border: 1px solid var(--line); }
.segmented button {
  flex: 1;
  padding: 9px 4px;
  border: 0;
  border-right: 1px solid var(--line-soft);
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.05em;
  transition: background 0.2s, color 0.2s;
}
.segmented button:last-child { border-right: 0; }
.segmented button:hover { color: var(--ink); }
.segmented button:disabled { opacity: 0.32; cursor: default; }
.segmented button:disabled:hover { color: var(--muted); }
.segmented button.active { background: rgba(199, 164, 104, 0.16); color: var(--brass-bright); }

.segmented.small { flex: 0 0 auto; }
.segmented.small button { padding: 6px 8px; font-size: 9px; }

.door-actions { display: flex; gap: 8px; }

.btn {
  flex: 1;
  padding: 11px 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: background 0.22s, border-color 0.22s, color 0.22s;
}

.btn:hover { border-color: var(--brass); color: var(--brass-bright); }

.btn.primary {
  background: var(--brass);
  border-color: var(--brass);
  color: #17130d;
}
.btn.primary:hover { background: var(--brass-bright); border-color: var(--brass-bright); color: #17130d; }

.btn:disabled { opacity: 0.35; cursor: default; }

.hintline {
  margin: 9px 0 0;
  color: var(--dim);
  font-size: 9px;
  line-height: 1.45;
}

/* Parts */
.parts-panel {
  position: absolute;
  top: 216px;
  left: 32px;
  z-index: 9;
  width: 276px;
  max-height: calc(100vh - 382px);
  display: none;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(27, 24, 19, 0.72), rgba(14, 13, 11, 0.78));
  border: 1px solid var(--line);
  backdrop-filter: blur(18px) saturate(1.08);
  box-shadow: var(--shadow);
}

body[data-mode="xray"] .parts-panel,
body[data-mode="exploded"] .parts-panel { display: flex; }

@media (min-width: 901px) {
  body[data-mode="exploded"] .panel { width: 248px; }
  body[data-mode="exploded"] .panel-block { padding-left: 13px; padding-right: 13px; }
  body[data-mode="exploded"] .quick-ral { gap: 3px; }
  body[data-mode="exploded"] .ral-grid { gap: 3px; }
}

.parts-panel .block-head { padding: 14px 14px 0; margin-bottom: 9px; }

.parts-list {
  overflow-y: auto;
  padding: 0 7px 7px;
  scrollbar-width: thin;
  scrollbar-color: rgba(242, 237, 227, 0.18) transparent;
}

.parts-list::-webkit-scrollbar { width: 3px; }
.parts-list::-webkit-scrollbar-thumb { background: rgba(242, 237, 227, 0.16); }

.part-item {
  display: block;
  width: 100%;
  padding: 8px 8px 7px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  text-align: left;
  transition: background 0.2s;
}

.part-item:hover, .part-item.active { background: rgba(199, 164, 104, 0.12); }
.part-item strong { display: block; font-size: 10px; font-weight: 600; letter-spacing: 0.03em; color: var(--ink); }
.part-item span { display: block; margin-top: 2px; color: var(--dim); font-size: 8px; letter-spacing: 0.05em; }

.part-detail {
  padding: 12px 14px 14px;
  border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.14);
}

.part-detail h4 { margin: 5px 0 4px; font-size: 11px; font-weight: 600; }
.part-detail p { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.5; }

/* View dock */
.view-dock {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  display: flex;
  padding: 4px;
  border: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(16px) saturate(1.08);
  box-shadow: var(--shadow);
}

.view-btn {
  padding: 9px 14px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: color 0.2s, background 0.2s;
}

.view-btn:hover { color: var(--ink); }
.view-btn.active { color: var(--brass-bright); background: rgba(199, 164, 104, 0.12); }

/* Toggles */
.scene-toggles {
  position: absolute;
  bottom: 78px;
  left: 32px;
  z-index: 11;
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-items: flex-start;
}

.toggle-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  background: rgba(16, 14, 12, 0.55);
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  backdrop-filter: blur(12px);
  transition: color 0.2s, border-color 0.2s;
}

.toggle-btn span {
  width: 6px;
  height: 6px;
  border: 1px solid var(--dim);
  border-radius: 50%;
  transition: background 0.2s, border-color 0.2s;
}

.toggle-btn:hover { color: var(--ink); border-color: var(--brass); }
.toggle-btn.active { color: var(--ink); border-color: rgba(199, 164, 104, 0.6); }
.toggle-btn.active span { background: var(--brass); border-color: var(--brass); box-shadow: 0 0 8px rgba(199, 164, 104, 0.5); }
.toggle-btn:disabled { opacity: 0.3; cursor: default; }

.hint {
  position: absolute;
  bottom: 28px;
  left: 32px;
  z-index: 10;
  margin: 0;
  color: var(--dim);
  font-size: 9px;
  line-height: 1.55;
  letter-spacing: 0.03em;
  pointer-events: none;
}

/* Tooltip */
.tooltip {
  position: fixed;
  z-index: 30;
  padding: 7px 9px;
  border: 1px solid rgba(199, 164, 104, 0.4);
  background: rgba(14, 12, 10, 0.9);
  color: var(--ink);
  font-size: 10px;
  letter-spacing: 0.03em;
  pointer-events: none;
  white-space: nowrap;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

/* Part toast */
.part-toast {
  position: absolute;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 14;
  display: flex;
  gap: 18px;
  align-items: flex-start;
  width: min(440px, calc(100vw - 40px));
  padding: 15px 16px;
  border: 1px solid rgba(199, 164, 104, 0.36);
  background: rgba(14, 12, 10, 0.9);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.part-toast h4 { margin: 4px 0 4px; font-size: 13px; font-weight: 600; letter-spacing: 0.02em; }
.part-toast p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.part-toast > div { flex: 1; }
.part-toast button {
  border: 0;
  background: transparent;
  color: var(--dim);
  font-size: 18px;
  line-height: 1;
  padding: 0 2px;
}
.part-toast button:hover { color: var(--ink); }

/* 3D labels */
.label-holder { position: relative; width: 0; height: 0; pointer-events: none; }
.label-holder .label-dot {
  position: absolute;
  left: -3px;
  top: -3px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brass-bright);
  box-shadow: 0 0 0 3px rgba(199, 164, 104, 0.18), 0 0 12px rgba(199, 164, 104, 0.45);
}

.label-holder .label-text {
  position: absolute;
  left: 14px;
  top: 0;
  transform: translateY(-50%);
  padding: 5px 8px;
  border: 1px solid rgba(199, 164, 104, 0.3);
  background: rgba(14, 12, 10, 0.82);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.05em;
  white-space: nowrap;
  backdrop-filter: blur(8px);
}

.label-holder .label-text::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 50%;
  width: 12px;
  height: 1px;
  background: rgba(199, 164, 104, 0.55);
}

.label-holder.flip .label-text { left: auto; right: 14px; }
.label-holder.flip .label-text::before { left: auto; right: -14px; }

.dim-holder { position: relative; width: 0; height: 0; pointer-events: none; }
.dim-holder span {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 3px 5px;
  background: rgba(12, 10, 8, 0.82);
  border: 1px solid rgba(199, 164, 104, 0.38);
  color: #e5c894;
  font-family: "Consolas", "SFMono-Regular", monospace;
  font-size: 9px;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(5, 5, 4, 0.66);
  backdrop-filter: blur(10px);
}

.modal-card {
  position: relative;
  width: min(760px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  padding: 38px 40px 28px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(31, 27, 22, 0.96), rgba(15, 13, 11, 0.97));
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6);
  scrollbar-width: thin;
  scrollbar-color: rgba(242, 237, 227, 0.18) transparent;
}

.modal-card::-webkit-scrollbar { width: 4px; }
.modal-card::-webkit-scrollbar-thumb { background: rgba(242, 237, 227, 0.18); }

.modal-card h2 {
  margin: 14px 0 10px;
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 400;
  letter-spacing: -0.02em;
}

.modal-card h3 {
  margin: 28px 0 10px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brass);
}

.modal-card .lead { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; max-width: 560px; }
.modal-card p { color: var(--muted); font-size: 11px; line-height: 1.65; }

.modal-close {
  position: absolute;
  top: 18px;
  right: 20px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}
.modal-close:hover { color: var(--ink); border-color: var(--brass); }

.spec-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin-top: 24px;
  border: 1px solid var(--line-soft);
  background: var(--line-soft);
}

.spec-grid div { padding: 12px 12px 13px; background: rgba(20, 17, 14, 0.86); }
.spec-grid span { display: block; color: var(--dim); font-size: 8px; letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 6px; }
.spec-grid strong { display: block; font-size: 12px; font-weight: 600; letter-spacing: 0.01em; }

.spec-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line-soft); }
.spec-list li {
  padding: 8px 0 8px 18px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
  position: relative;
}
.spec-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 13px;
  width: 5px;
  height: 5px;
  border: 1px solid var(--brass);
  transform: rotate(45deg);
}

.modal-foot a { color: var(--brass-bright); text-decoration: none; border-bottom: 1px solid rgba(199, 164, 104, 0.4); }
.modal-foot a:hover { border-color: var(--brass-bright); }

.modal-foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 26px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Loader / error */
.loader {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: #0b0a08;
  transition: opacity 0.9s ease, visibility 0.9s ease;
}

.loader.is-hidden { opacity: 0; visibility: hidden; }

.loader-mark {
  font-family: var(--serif);
  font-size: 26px;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-align: center;
}

.loader-line {
  width: 180px;
  height: 1px;
  margin: 18px auto 12px;
  background: rgba(242, 237, 227, 0.15);
  overflow: hidden;
}

.loader-line span {
  display: block;
  width: 45%;
  height: 100%;
  background: var(--brass);
  animation: load 1.1s ease-in-out infinite;
}

@keyframes load {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(330%); }
}

.loader-sub {
  text-align: center;
  color: var(--dim);
  font-size: 8px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.webgl-error {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 40px;
  background: #0b0a08;
  color: var(--ink);
  font-size: 13px;
  text-align: center;
}

.panel-toggle { display: none; }

/* Responsive */
@media (max-width: 1180px) {
  .masthead h1 { font-size: 48px; }
  .panel { width: 296px; right: 20px; }
  .mode-switch { right: 70px; }
  .icon-btn { right: 20px; }
  .parts-panel { left: 20px; width: 260px; }
  .hint { left: 20px; }
  .scene-toggles { left: 20px; }
}

@media (max-width: 900px) {
  .masthead { top: 16px; left: 16px; max-width: 210px; }
  .masthead h1 { font-size: 34px; margin: 8px 0 5px; }
  .masthead p { display: none; }
  .eyebrow { font-size: 8px; letter-spacing: 0.16em; }
  .eyebrow span { width: 14px; }
  .icon-btn { top: 16px; right: 16px; width: 34px; height: 34px; }

  .mode-switch {
    top: 92px;
    left: 16px;
    right: auto;
    padding: 3px;
  }
  .mode-btn { padding: 7px 9px; font-size: 8px; gap: 5px; }

  .panel {
    top: auto;
    right: 12px;
    left: 12px;
    bottom: 66px;
    width: auto;
    max-height: 56vh;
    display: none;
    z-index: 22;
  }
  .panel.open { display: block; }

  .panel-toggle {
    display: block;
    position: fixed;
    right: 12px;
    bottom: 12px;
    left: 12px;
    z-index: 23;
    padding: 13px;
    border: 1px solid var(--line);
    background: var(--glass-deep);
    color: var(--ink);
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    backdrop-filter: blur(16px);
  }

  .parts-panel { display: none !important; }
  .hint { display: none; }
  .scene-toggles {
    display: flex;
    flex-direction: row;
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 64px;
    gap: 8px;
    z-index: 21;
  }
  .scene-toggles .toggle-btn {
    flex: 1;
    justify-content: center;
    padding: 9px 6px;
    background: var(--glass-deep);
    font-size: 8px;
  }

  .view-dock {
    top: auto;
    left: 50%;
    bottom: 120px;
    transform: translateX(-50%);
    padding: 3px;
  }
  .view-btn { padding: 7px 8px; font-size: 8px; white-space: nowrap; flex: 0 0 auto; }

  .part-toast { bottom: 184px; width: calc(100vw - 24px); }
  .label-holder .label-text { font-size: 8px; padding: 4px 6px; }

  .spec-grid { grid-template-columns: repeat(2, 1fr); }
  .modal { padding: 12px; }
  .modal-card { padding: 28px 22px 22px; }
  .modal-card h2 { font-size: 26px; }
  .modal-foot { flex-direction: column; gap: 5px; }
  .modal-card h3 { margin-top: 22px; }
}

@media (max-width: 560px) {
  .masthead { max-width: 180px; }
  .masthead h1 { font-size: 30px; }
  .mode-switch { top: 84px; }
  .view-dock { top: auto; bottom: 118px; }
  .mode-btn span { display: none; }
  .mode-btn { padding: 7px 7px; }
  .ral-grid { grid-template-columns: repeat(4, 1fr); max-height: 160px; }
  .quick-ral { grid-template-columns: repeat(8, 1fr); }
  .panel { max-height: 60vh; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
