/* BridgeSketch 3D · 0.6.1 interface. Design tokens follow the QuickerBridge overhaul. */
:root {
  font-family: 'Segoe UI', Arial, sans-serif;
  color: #17374b;
  font-size: 14px;
  --navy: #102d41;
  --navy-hover: #1b4157;
  --ink: #17374b;
  --muted: #566e7c;
  --axis: #5d7684;
  --teal: #007f78;
  --teal-ink: #00564f;
  --focus: #007f78;
  --ring: #20adba;
  --amber: #b66c16;
  --amber-ink: #8a4f0c;
  --mint: #73e4c2;
  --mint-soft: #d9f5eb;
  --line: #dce5eb;
  --line-strong: #cbd8e1;
  --line-hover: #a9c0cc;
  --paper: #fff;
  --bg: #f0f4f7;
  --head-fill: #f3f7f9;
  --head-hover: #e8f0f4;
  --menu-hover: #eef6f8;
  --err-line: #d0675a;
  --err-bg: #fff6f4;
  --err-ink: #a33329;
  --radius-input: 7px;
  --radius-card: 9px;
  --shadow: 0 2px 7px #15354a08;
  --shadow-pop: 0 6px 12px #0b1e2b1f;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
}
button,
input,
select {
  font: inherit;
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 12px;
  color: var(--ink);
  background: var(--paper);
  font-size: 0.86rem;
  font-weight: 600;
  transition: background 0.15s;
}
button:hover:not(:disabled) {
  background: #f2f7f9;
}
button:disabled,
input:disabled,
select:disabled {
  opacity: 0.48;
  cursor: default;
}
:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}
[hidden] {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
button.primary {
  background: var(--navy);
  color: white;
  border-color: var(--navy);
}
button.primary:hover:not(:disabled) {
  background: var(--navy-hover);
  border-color: var(--navy-hover);
}
.topbar {
  height: 54px;
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid #365263;
  gap: 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 13px;
}
.brand h1 {
  font-size: 1.65rem;
  letter-spacing: -0.7px;
  font-weight: 650;
  margin: 0;
}
.brand h1 span {
  font-weight: 350;
  color: #9cdfcf;
}
.brand h1 em {
  font-size: 0.8rem;
  letter-spacing: 1px;
  font-weight: 500;
  font-style: normal;
  vertical-align: middle;
  border: 1px solid #497268;
  padding: 3px 5px;
  border-radius: 4px;
  color: var(--mint);
}
.brand small {
  display: block;
  font-size: 0.74rem;
  color: #a6c2ce;
  letter-spacing: 0.3px;
  margin-top: 4px;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 22px;
}
.header-right button {
  background: transparent;
  color: #d0e2e7;
  border-color: #456170;
}
.header-right button:hover:not(:disabled) {
  background: #1f4a62;
}
.topbar :focus-visible {
  outline-color: var(--ring);
}
.release-info {
  text-align: right;
  display: grid;
  gap: 4px;
  font-size: 0.85rem;
}
.release-info small {
  font-size: 0.75rem;
  color: #b5cbd6;
}
.workspace {
  height: calc(100dvh - 54px);
  display: grid;
  grid-template-columns: 365px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  min-height: 470px;
}

/* Sidebar card */
.sidebar {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  min-height: 0;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 8px;
}
.panel-heading h2 {
  font-size: 1.1rem;
  margin: 0;
  color: var(--navy);
}
.dirty-state {
  margin-left: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--amber-ink);
  white-space: nowrap;
}
.panel-heading > div {
  display: flex;
  gap: 12px;
}
.text-button {
  padding: 2px 0;
  border: 0;
  background: transparent;
  font-size: 0.77rem;
  color: var(--teal);
}
.text-button:hover:not(:disabled) {
  background: transparent;
  text-decoration: underline;
}
.variant-label {
  padding: 0 16px 10px;
  font-size: 0.8125rem;
}
.project-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px 12px;
}
.preset-label {
  flex: 1;
  min-width: 0;
}
.sidebar .preset-label select {
  font-size: 0.8125rem;
  margin: 0;
  min-height: 34px;
  height: 34px;
  padding-left: 6px;
}
.icon-button {
  padding: 6px 7px;
  line-height: 0;
  color: var(--muted);
}
.icon-button .mi-ico {
  width: 17px;
  height: 17px;
}

/* File menu */
.qb-menu {
  position: static;
}
.menu-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid #c9d8e1;
  border-radius: 8px;
  background: var(--paper);
  color: var(--navy);
  font-size: 0.8125rem;
  font-weight: 650;
  box-shadow: 0 1px 2px #15354a0d;
}
.menu-button:hover:not(:disabled) {
  border-color: #8fb2c2;
  background: #f6fafb;
}
.qb-menu.open > .menu-button {
  border-color: var(--teal);
  background: #eefaf6;
  color: var(--teal-ink);
}
.menu-button .caret {
  font-size: 0.7rem;
  color: var(--axis);
  transition: transform 0.15s;
}
.qb-menu.open .caret {
  transform: rotate(180deg);
}
.mi-ico {
  width: 18px;
  height: 18px;
  flex: none;
  color: currentColor;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.menu-pop {
  display: none;
  position: absolute;
  z-index: 40;
  left: 16px;
  right: 16px;
  top: calc(100% - 6px);
  padding: 6px;
  background: var(--paper);
  border: 1px solid #d3e0e7;
  border-radius: 11px;
  box-shadow: var(--shadow-pop);
}
.qb-menu.open > .menu-pop {
  display: block;
  animation: menu-in 0.14s ease-out;
}
@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.menu-pop button {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink);
  text-align: left;
  font-size: 0.8125rem;
  font-weight: 400;
}
.menu-pop button:hover:not(:disabled),
.menu-pop button:focus-visible {
  background: var(--menu-hover);
  outline: none;
}
.menu-pop button:focus-visible {
  box-shadow: inset 0 0 0 2px var(--focus);
}
.menu-pop button .mi-ico {
  color: var(--teal);
}
.mi-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.mi-text b {
  font-weight: 650;
}
.mi-text small {
  color: var(--muted);
  font-size: 0.7rem;
}
.menu-pop kbd {
  font: 600 0.6875rem 'Segoe UI', Arial, sans-serif;
  color: var(--axis);
  border: 1px solid #dbe5eb;
  border-radius: 4px;
  padding: 1px 5px;
  background: #f7fafb;
  white-space: nowrap;
}
.menu-foot {
  padding: 6px 10px 3px;
  font-size: 0.68rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  margin-top: 4px;
}

/* Restore strip */
#restore-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 16px 12px;
  padding: 8px 10px 8px 12px;
  background: var(--menu-hover);
  border: 1px solid #cfe0e7;
  border-radius: 8px;
  color: var(--ink);
}
#restore-bar .rb-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}
#restore-bar b {
  font-size: 0.8125rem;
  font-weight: 650;
}
#restore-bar small {
  font-size: 0.75rem;
  color: #4f6774;
  overflow-wrap: anywhere;
}
#restore-bar .rb-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
#restore-bar .rb-actions button.primary {
  padding: 5px 11px;
  font-size: 0.8125rem;
}

/* Tabs */
.input-tabs {
  display: flex;
  justify-content: space-between;
  gap: 2px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  background: var(--paper);
}
.input-tabs button {
  border: 0;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  padding: 11px 5px 9px;
  background: none;
  font-size: 0.83rem;
  color: var(--muted);
}
.input-tabs button:hover:not(:disabled) {
  background: none;
  color: var(--ink);
}
.input-tabs [aria-selected='true'] {
  color: var(--teal);
  border-bottom-color: var(--teal);
}
#parameters {
  overflow: auto;
  min-height: 0;
  flex: 1;
  background: var(--paper);
  scrollbar-width: thin;
  scrollbar-color: #a5becb transparent;
}
.parameter-panel {
  padding: 14px 16px 16px;
}

/* Collapsible parameter groups (all folded on load) */
.input-group {
  margin: 0 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--paper);
  overflow: hidden;
}
.input-group > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  cursor: pointer;
  list-style: none;
  background: var(--head-fill);
  user-select: none;
}
.input-group > summary::-webkit-details-marker {
  display: none;
}
.input-group > summary::before {
  content: '';
  flex: none;
  width: 7px;
  height: 7px;
  border-right: 2px solid #5d7d8c;
  border-bottom: 2px solid #5d7d8c;
  transform: rotate(-45deg);
  transition: transform 0.15s;
  margin-right: 2px;
}
.input-group[open] > summary::before {
  transform: rotate(45deg);
}
.input-group > summary:hover {
  background: var(--head-hover);
}
.input-group > summary:focus-visible {
  outline-offset: -3px;
}
.input-group[open] > summary {
  border-bottom: 1px solid var(--line);
}
.group-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
}
.group-meta {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 52%;
}
.input-group[open] > summary .group-meta {
  opacity: 0.6;
}
.group-body {
  padding: 12px 12px 4px;
}

/* Fields: label above, compact density */
.group-body > label,
.group-body > div > label {
  margin-bottom: 12px;
}
label {
  display: block;
  font-size: 0.8125rem;
  color: var(--muted);
}
#parameters label:focus-within {
  color: var(--teal);
}
.sidebar input[type='text'],
.sidebar select,
.variant-label input {
  width: 100%;
  min-height: 36px;
  margin-top: 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-input);
  background: #fff;
  color: var(--ink);
  padding: 6px 8px;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  transition:
    border-color 0.25s,
    box-shadow 0.25s,
    background 0.25s,
    color 0.25s;
}
.sidebar input[type='text']:not(:disabled):hover,
.sidebar select:not(:disabled):hover,
.variant-label input:hover {
  border-color: var(--line-hover);
}
.sidebar input[type='text']:focus,
.sidebar select:focus,
.variant-label input:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px #20adba2e;
  background: #fbfffd;
}
.sidebar input[type='text']:focus-visible,
.sidebar select:focus-visible,
.variant-label input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}
.sidebar input[data-num] {
  text-align: right;
  letter-spacing: 0.1px;
}
.sidebar input[data-num]:focus {
  color: var(--teal-ink);
  font-weight: 600;
}
.sidebar input:disabled,
.sidebar select:disabled {
  background: #f2f5f7;
  color: #7d929e;
  cursor: not-allowed;
  opacity: 1;
}
input:invalid {
  border-color: var(--err-line);
}
.sidebar input[type='text'].num-err:not(:disabled) {
  border-color: var(--err-line);
  background: var(--err-bg);
  color: var(--err-ink);
}
.sidebar input[type='text'].num-err:focus {
  box-shadow: 0 0 0 3px #d0675a2e;
}
.sidebar input.num-flash {
  animation: num-flash 0.8s ease;
}
@keyframes num-flash {
  0% {
    background: var(--mint-soft);
    box-shadow: 0 0 0 4px #00837840;
  }
  100% {
    background: #fff;
  }
}
#qb-num-tip {
  position: fixed;
  z-index: 200;
  padding: 5px 9px;
  border-radius: 6px;
  background: var(--err-ink);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.35;
  box-shadow: 0 3px 10px #0b1e2b29;
  pointer-events: none;
}
input[type='checkbox'] {
  accent-color: var(--teal);
  width: 17px;
  height: 17px;
  margin: 0 8px 0 0;
  vertical-align: middle;
}
.check {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px 0;
  font-size: 0.875rem;
  color: var(--ink);
}
.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
  gap: 0 10px;
  margin-bottom: 0;
}
.field-grid > label {
  margin-bottom: 12px;
}
.field-grid > .hint {
  grid-column: 1 / -1;
}
.hint {
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--muted);
  margin: 4px 0 12px;
}
.derived {
  display: flex;
  justify-content: space-between;
  background: #eaf6f2;
  border-radius: 5px;
  padding: 8px 10px;
  font-size: 0.8rem;
  color: #266556;
  margin: 4px 0 12px;
}
.derived strong {
  font-weight: 600;
  color: var(--teal-ink);
}
.input-footer {
  padding: 8px 16px;
  background: var(--head-fill);
  border-top: 1px solid var(--line);
  font-size: 0.72rem;
  color: var(--muted);
}

/* Crossing rows (generated) */
.span-row {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  margin-top: 4px;
  margin-bottom: 12px;
}
.span-row h3 {
  margin: 0 0 12px;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--teal);
}
.span-row > label {
  margin: 10px 0;
}
.span-row details {
  margin-top: 12px;
}
.span-row summary {
  font-size: 0.8rem;
  color: var(--teal);
  cursor: pointer;
}
.span-row details .field-grid {
  margin-top: 12px;
}
#steel-swatch,
.fascia-swatch {
  height: 22px;
  border-radius: 4px;
  border: 1px solid #102d4133;
  margin: 7px 0;
}
#viewport {
  position: relative;
  min-width: 0;
  min-height: 0;
  border-radius: 10px;
  overflow: hidden;
  color: #e6f4f8;
  background: radial-gradient(ellipse at 45% 12%, #5e7b8b 0%, #35566c 52%, #203d51 100%);
  border: 1px solid #537082;
}
#canvasHost {
  position: absolute;
  inset: 0;
}
canvas {
  display: block;
  width: 100%;
  height: 100%;
}
/* 0.6.2: no title over the 3D view (the scene name stays in the toolbar and the browser tab). */
.view-heading {
  display: none;
  position: absolute;
  top: 22px;
  left: 24px;
  pointer-events: none;
  text-shadow: 0 1px 6px #102d4150;
}
.eyebrow {
  font-size: 0.68rem;
  letter-spacing: 1.8px;
  color: #a7d5d7;
  font-weight: 650;
}
.view-heading h2 {
  font-size: 1.65rem;
  letter-spacing: -0.6px;
  font-weight: 500;
  margin: 5px 0;
}
.view-heading p {
  font-size: 0.8rem;
  color: #c1d7e1;
  margin: 0;
}
.view-tools {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 2px;
  padding: 4px;
  border: 1px solid #65839870;
  border-radius: 8px;
  background: #102d41d9;
  backdrop-filter: blur(10px);
}
.view-tools button {
  background: none;
  border: 0;
  color: #d3e7eb;
  padding: 7px 9px;
  font-size: 0.79rem;
}
.view-tools button:hover {
  background: #416274;
}
.view-tools [aria-pressed='true'] {
  background: #bcebdd;
  color: #103b41;
}
.time-control {
  position: absolute;
  left: 22px;
  bottom: 96px;
  width: 230px;
  padding: 9px 12px;
  background: #102d41db;
  border: 1px solid #62829370;
  border-radius: 6px;
  color: #d4e5e9;
}
.time-control label {
  display: flex;
  justify-content: space-between;
  color: inherit;
  font-size: 0.76rem;
}
.time-control output {
  font-variant-numeric: tabular-nums;
  color: #9cdfcf;
}
.time-control input {
  width: 100%;
  margin: 8px 0 0;
  accent-color: #48cfad;
}
.view-options {
  position: absolute;
  left: 22px;
  bottom: 46px;
  display: flex;
  gap: 8px;
}
.view-options label {
  background: #102d41db;
  color: #d4e5e9;
  border: 1px solid #62829370;
  border-radius: 5px;
  font-size: 0.76rem;
  padding: 8px 10px;
  display: flex;
  align-items: center;
}
.view-options input {
  width: 14px;
  height: 14px;
  accent-color: #48cfad;
}
.navigation-hint {
  position: absolute;
  bottom: 13px;
  left: 24px;
  color: #b8ccd6;
  font-size: 0.72rem;
  margin: 0;
  pointer-events: none;
}
.export-tools {
  position: absolute;
  right: 20px;
  bottom: 46px;
  display: flex;
  gap: 5px;
  align-items: center;
}
.export-tools > button,
.export-tools summary {
  font-size: 0.75rem;
  background: #102d41de;
  color: #d5e9eb;
  border: 1px solid #62829380;
  border-radius: 5px;
  padding: 8px 10px;
  cursor: pointer;
}
.export-tools summary {
  list-style: none;
}
#model-info[open] summary {
  background: #bcebdd;
  color: #103b41;
}
.stats {
  position: absolute;
  right: 0;
  bottom: 44px;
  background: #f7fafbf5;
  color: var(--ink);
  backdrop-filter: blur(12px);
  width: 290px;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 10px 40px #091d3840;
  border: 1px solid #bbd1d8;
}
.stats > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.stats span {
  font-size: 0.8rem;
  color: var(--muted);
}
.stats strong {
  font-weight: 600;
  font-size: 1.05rem;
}
.stats small {
  font-size: 0.78rem;
  font-weight: 400;
}
.stats p {
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--muted);
  margin: 12px 0 0;
}
/* Road profile (0.6.2): chainage / elevation table and CSV export. */
.stats {
  width: 330px;
  max-height: max(220px, calc(100vh - 340px));
  overflow-y: auto;
}
.profile-summary {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.profile-summary h3 {
  font-size: 0.8rem;
  font-weight: 650;
  margin: 0 0 8px;
}
.profile-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.profile-fields label {
  display: grid;
  gap: 3px;
  font-size: 0.7rem;
  color: var(--muted);
}
.profile-fields input {
  font: inherit;
  font-size: 0.82rem;
  color: var(--ink);
  border: 1px solid #bbd1d8;
  border-radius: 4px;
  padding: 4px 6px;
  min-width: 0;
}
.profile-fields input[aria-invalid='true'] {
  border-color: #c0392b;
}
.profile-scroll {
  max-height: 180px;
  overflow-y: auto;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
}
#profileTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}
#profileTable th {
  position: sticky;
  top: 0;
  background: #e8f0f3;
  text-align: left;
  font-weight: 600;
  padding: 4px 6px;
}
#profileTable td {
  padding: 3px 6px;
  border-top: 1px solid var(--line);
}
#profileTable td:nth-child(-n + 2) {
  text-align: right;
  white-space: nowrap;
}
#profileTable tr.axis td {
  font-weight: 600;
  color: #00655f;
}
#exportProfile {
  margin-top: 10px;
  width: 100%;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: #fff;
  background: #007f78;
  border: 0;
  border-radius: 5px;
  padding: 8px 10px;
  cursor: pointer;
}
#exportProfile:hover {
  background: #006a64;
}
#feedback {
  position: absolute;
  left: 20px;
  bottom: 94px;
  max-width: min(480px, calc(100% - 40px));
  background: #f0faf6f5;
  color: #1e504d;
  padding: 12px 16px;
  border: 1px solid #7bb4a5;
  border-radius: 7px;
  font-size: 0.86rem;
  line-height: 1.5;
  box-shadow: 0 6px 30px #102d4130;
  z-index: 4;
}
#feedback.error {
  background: #fff1e8;
  color: #813e2a;
  border-color: #bc8976;
}
#fatal {
  position: absolute;
  inset: 25%;
  height: fit-content;
  padding: 24px;
  background: #fff1e8;
  color: #813e2a;
  border-radius: 8px;
}
dialog {
  max-width: 460px;
  border: 0;
  border-radius: 12px;
  padding: 0;
  color: var(--ink);
  box-shadow: 0 20px 100px #04101d80;
}
dialog::backdrop {
  background: #051726aa;
  backdrop-filter: blur(4px);
}
dialog form {
  padding: 26px;
}
dialog p {
  line-height: 1.6;
  color: var(--muted);
  font-size: 0.9rem;
}
dialog h2 {
  margin: 12px 0 5px;
}
.close-dialog {
  float: right;
  font-size: 1.4rem;
  border: 0;
}
body.focus-mode .sidebar {
  display: none;
}
body.focus-mode .workspace {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}
@media (max-width: 1250px) {
  .workspace {
    grid-template-columns: 330px minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
  }
  .view-tools {
    top: 110px;
    left: 20px;
    right: auto;
  }
  .export-tools {
    bottom: 88px;
  }
  .view-heading h2 {
    font-size: 1.45rem;
  }
  .release-info {
    font-size: 0.76rem;
  }
}
@media (max-height: 750px) {
  .topbar {
    height: 48px;
  }
  .workspace {
    height: calc(100dvh - 48px);
  }
  .brand h1 {
    font-size: 1.4rem;
  }
  .panel-heading {
    padding-top: 10px;
  }
  .field-grid {
    gap: 0 9px;
  }
}
@media (max-width: 850px) {
  .workspace {
    grid-template-columns: 300px minmax(360px, 1fr);
  }
  body {
    min-width: 690px;
  }
  .topbar {
    padding: 0 14px;
  }
  .brand small {
    font-size: 0.65rem;
  }
  .header-right {
    gap: 8px;
  }
  .release-info small {
    font-size: 0.64rem;
  }
  .view-options {
    gap: 4px;
    left: 15px;
  }
  .view-options label {
    font-size: 0.7rem;
    padding: 7px;
  }
  .input-tabs button {
    font-size: 0.75rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}
body.focus-mode .workspace {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}
.drive-status {
  position: absolute;
  top: 160px;
  left: 24px;
  background: #102d41e8;
  color: #c6f8e6;
  border: 1px solid #5d9e91;
  padding: 9px 12px;
  border-radius: 5px;
  font-size: 0.75rem;
  pointer-events: none;
}
.view-tools {
  flex-wrap: wrap;
  max-width: calc(100% - 40px);
}
.steel-custom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}
.steel-custom input {
  width: 100%;
  height: 35px;
  margin-top: 6px;
  border: 1px solid #bfced8;
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  padding: 5px 8px;
  font: inherit;
}
.steel-custom input[type='color'] {
  padding: 2px;
  cursor: pointer;
}
#viewport:not(.section-view) {
  background: radial-gradient(
    ellipse at 45% 12%,
    color-mix(in srgb, #5e7b8b, #172b46 var(--night-factor, 0%)) 0%,
    color-mix(in srgb, #35566c, #0a1930 var(--night-factor, 0%)) 58%,
    color-mix(in srgb, #203d51, #050d1d var(--night-factor, 0%)) 100%
  );
}

.section-view #canvasHost {
  visibility: hidden;
}
#sectionHost {
  position: absolute;
  inset: 0;
  background: #f4f6f4;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 115px 22px 100px;
  color: #17374b;
}
#sectionSvg {
  width: 100%;
  flex: 1;
  min-height: 0;
}
#sectionSvg text {
  font-family: 'Segoe UI', Arial, sans-serif;
}
.section-zoom-hint {
  font-size: 12px;
  opacity: 0.7;
}
#sectionSvg {
  cursor: grab;
  touch-action: none;
}
.section-toolbar {
  align-self: flex-end;
  z-index: 1;
  background: #fff;
  border: 1px solid #cad7d7;
  border-radius: 7px;
  padding: 9px 13px;
  width: 240px;
  box-shadow: 0 2px 12px #17374b22;
}
.section-toolbar label {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
}
.section-toolbar input {
  width: 100%;
  accent-color: #007f78;
}
.section-view .view-heading,
.section-view .view-heading p,
.section-view .navigation-hint {
  color: #17374b;
  text-shadow: none;
}
.section-view .eyebrow {
  color: #007f78;
}
.view-options {
  flex-wrap: wrap;
  max-width: calc(100% - 32px);
}
.view-options label {
  white-space: nowrap;
  flex-shrink: 0;
}
@media (max-width: 1250px) {
  .export-tools {
    bottom: 218px;
  }
  .time-control {
    bottom: 133px;
  }
  #sectionHost {
    padding-top: 150px;
  }
}
.section-view .export-tools {
  display: none;
}
.section-toolbar button {
  width: 100%;
  margin-top: 7px;
  background: #007f78;
  color: #fff;
  border-color: #007f78;
  font-size: 0.75rem;
  padding: 5px;
}
.section-view .time-control,
.section-view .view-options,
.section-view .navigation-hint {
  display: none;
}
#viewport:not(.section-view) .view-heading {
  text-shadow:
    0 1px 2px #0b1f2ecc,
    0 0 14px #0b1f2eb3;
}

.fascia-swatch {
  align-self: end;
  margin: 0 0 6px;
}

/* Launch sequence (intro.mjs) */
.intro {
  position: fixed; inset: 0; z-index: 100; overflow: hidden; color: #e6f4f8;
  background: radial-gradient(ellipse at 50% 38%, #1d4660, #102d41 55%, #081a27);
  transition: opacity .25s;
}
.intro.leaving { opacity: 0; pointer-events: none; }
.intro-grid { position: absolute; inset: 0; background-image: linear-gradient(#73e4c211 1px, transparent 1px), linear-gradient(90deg,#73e4c211 1px,transparent 1px); background-size: 40px 40px; }
.intro-reveal { position: absolute; top: 18%; left: 50%; width: min(1100px,92vw); margin-left: calc(min(1100px,92vw) / -2); aspect-ratio: 1200 / 420; overflow: hidden; animation: intro-wipe 2s ease-in-out infinite; will-change: transform; }
.intro-reveal-inner { height: 100%; animation: intro-counter-wipe 2s ease-in-out infinite; will-change: transform; }
.intro-drawing { display: block; width: 100%; height: 100%; }
@keyframes intro-wipe { 0% { transform: translateX(-100%); } 65%,85% { transform: translateX(0); } 100% { transform: translateX(100%); } }
@keyframes intro-counter-wipe { 0% { transform: translateX(100%); } 65%,85% { transform: translateX(0); } 100% { transform: translateX(-100%); } }
.intro-brand { position: absolute; top: calc(18% + min(420px,35vw)); left: 0; right: 0; text-align: center; }
.intro-brand h1 { margin: 0; font-size: clamp(30px,4.4vw,54px); font-weight: 300; letter-spacing: .02em; }
.intro-brand h1 span { font-weight: 700; color: #73e4c2; }
.intro-brand h1 em { font-style: normal; font-size: .5em; vertical-align: .55em; padding: 2px 8px; border: 1px solid #73e4c2; border-radius: 6px; color: #73e4c2; }
.intro-brand p { margin: 8px 0 18px; color: #a9c4d1; letter-spacing: .08em; }
.intro-brand p.intro-author { margin: -10px 0 16px; color: #73e4c2; font-size: 13px; letter-spacing: .16em; }
.intro-progress { width: 220px; height: 2px; margin: 0 auto 8px; background: #ffffff1c; overflow: hidden; }
.intro-progress i { display: block; height: 100%; background: #73e4c2; transform-origin: left; transform: scaleX(.04); transition: transform .5s ease; }
.intro-status { color: #9bb9c8; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.intro-skip { position: absolute; right: 22px; bottom: 20px; background: transparent; color: #a9c4d1; border-color: #ffffff33; }
.intro.reduced .intro-reveal, .intro.reduced .intro-reveal-inner { animation: none; }
.scene-loading { position: absolute; inset: 0; z-index: 12; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: #102d4166; color: #d6fff0; pointer-events: none; font-size: 13px; }
.scene-loading img { animation: loading-bridge 1.4s ease-in-out infinite; will-change: transform; }
@keyframes loading-bridge { 50% { transform: translateY(-6px) rotate(-6deg); } }
@media (prefers-reduced-motion: reduce) { .scene-loading img { animation: none; } }

/* Stats overlay: frame rate, CPU / GPU time, draw calls, triangles and quality tier (bottom centre, 0.5.6). */
.perf-hud {
  position: absolute;
  bottom: 9px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  z-index: 4;
  margin: 0;
  padding: 5px 10px;
  border-radius: 6px;
  background: #0b1f2ecc;
  color: #cdeee4;
  font: 600 11.5px/1.4 ui-monospace, 'Cascadia Mono', Consolas, monospace;
  letter-spacing: 0.02em;
  pointer-events: none;
}
.section-view .perf-hud {
  display: none;
}
#viewport:has(#perf-hud:not([hidden])) .navigation-hint {
  display: none;
}
.time-control label {
  align-items: center;
}
.time-play {
  min-width: 30px;
  padding: 2px 8px;
  border: 1px solid #62829370;
  border-radius: 5px;
  background: #0b1f2e;
  color: #9cdfcf;
  font-size: 0.72rem;
  line-height: 1.4;
  cursor: pointer;
}
.time-play[aria-pressed='false'] {
  color: #d4e5e9;
}

/* 0.6.0 · camera icon on the snapshot button */
#image .icon {
  width: 16px;
  height: 16px;
  margin-right: 6px;
  vertical-align: -3px;
}

/* 0.6.0 · Phones and small tablets: the 3D view on top (full width, fixed aspect), parameters below in the page
   flow; overlays become compact rows that scroll sideways instead of overlapping the model. */
@media (max-width: 760px), (max-height: 500px) and (orientation: landscape) {
  body {
    min-width: 0;
  }
  .topbar {
    height: 44px;
    padding: 0 12px;
  }
  .brand img {
    width: 32px;
    height: 32px;
  }
  .brand h1 {
    font-size: 1.2rem;
  }
  .brand small,
  .release-info {
    display: none;
  }
  .workspace {
    height: auto;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 8px;
    padding: 8px;
  }
  #viewport {
    grid-row: 1;
    height: min(66svh, 128vw);
    min-height: 300px;
  }
  .sidebar {
    grid-row: 2;
    max-height: none;
    overflow: visible;
  }
  .view-heading {
    top: 10px;
    left: 12px;
    right: 150px;
  }
  .view-heading h2 {
    font-size: 1.05rem;
    margin: 2px 0;
  }
  .view-heading p,
  .eyebrow,
  .navigation-hint {
    display: none;
  }
  .view-tools,
  .view-options,
  .export-tools {
    left: 8px;
    right: 8px;
    top: auto;
    overflow-x: auto;
    scrollbar-width: none;
    flex-wrap: nowrap;
  }
  .view-tools::-webkit-scrollbar,
  .view-options::-webkit-scrollbar,
  .export-tools::-webkit-scrollbar {
    display: none;
  }
  .view-tools {
    bottom: 8px;
    justify-content: space-between;
  }
  .view-tools button {
    padding: 8px 9px;
    flex: 0 0 auto;
  }
  .view-options {
    bottom: 58px;
    gap: 4px;
  }
  .view-options label {
    flex: 0 0 auto;
    padding: 7px 8px;
    font-size: 0.72rem;
  }
  .export-tools {
    bottom: 100px;
    justify-content: flex-end;
  }
  .export-tools > button,
  .export-tools summary {
    flex: 0 0 auto;
  }
  #model-info {
    display: none;
  }
  .time-control {
    top: 8px;
    right: 8px;
    left: auto;
    bottom: auto;
    width: 140px;
    padding: 6px 8px;
  }
  .time-control label {
    font-size: 0.7rem;
  }
  .section-view .view-options,
  .section-view .export-tools {
    display: none;
  }
  .perf-hud {
    bottom: 142px;
  }
  #feedback {
    left: 8px;
    right: 8px;
    max-width: none;
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  #viewport {
    height: calc(100svh - 60px);
  }
}

/* 0.6.0 · Soft cinematic vignette over the 3D view: pure CSS, no GPU pass. */
#canvasHost::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 48%, transparent 58%, rgba(8, 20, 32, 0.26) 100%);
}
.section-view #canvasHost::after {
  display: none;
}

/* Focus keeps one exit button and gives the scene the whole window. */
.brand img { width: 34px; height: 34px; }
.brand h1 { font-size: 1.4rem; }
.brand small { display: none; }
body.focus-mode .topbar, body.focus-mode .sidebar, body.focus-mode .view-heading,
body.focus-mode .view-options, body.focus-mode .export-tools, body.focus-mode .navigation-hint,
body.focus-mode .time-control, body.focus-mode .perf-hud, body.focus-mode .section-controls,
body.focus-mode .view-tools > :not(#focus) { display: none; }
body.focus-mode .workspace { height: 100dvh; min-height: 0; padding: 0; gap: 0; grid-template-columns: 1fr; grid-template-rows: 1fr; }
body.focus-mode #viewport { height: 100dvh; min-height: 0; border: 0; border-radius: 0; }
body.focus-mode .view-tools { top: 12px; right: 12px; left: auto; bottom: auto; }

/* 0.6.1 · hover states on dark overlays and teal buttons (the generic light hover would hide their text). */
.export-tools > button:hover:not(:disabled),
.export-tools summary:hover,
.view-options label:hover {
  background: #1f4a62;
  color: #fff;
}
.time-play:hover:not(:disabled) {
  background: #1f4a62;
}
.section-toolbar button:hover:not(:disabled) {
  background: #006861;
  border-color: #006861;
}
.intro-skip:hover:not(:disabled) {
  background: #ffffff1a;
}

/* 0.6.1 · touch targets, reduced motion */
@media (pointer: coarse) {
  .sidebar input[type='text'],
  .sidebar select,
  .input-tabs button,
  .menu-button,
  .icon-button,
  .menu-pop button {
    min-height: 40px;
  }
  .input-group > summary {
    min-height: 42px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .input-group > summary::before,
  .menu-button .caret {
    transition: none;
  }
  .qb-menu.open > .menu-pop,
  .sidebar input.num-flash {
    animation: none;
  }
}

dialog code {
  font-size: 0.85em;
  background: #eef5f7;
  padding: 1px 4px;
  border-radius: 3px;
}
