:root {
  --paper: #f7f8f4;
  --panel: #fffefa;
  --ink: #25302c;
  --muted: #5b6963;
  --line: #d7dcd3;
  --green: #315d48;
  --terra: #9b5037;
  --plan-a: #a34e2f;
  --ok: #315d48;
  --warn: #8a4d22;
  --bad: #993627;
  color-scheme: light;
  font:
    16px/1.55 'Source Sans 3',
    'PingFang SC',
    'Microsoft YaHei',
    sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-variant-numeric: tabular-nums;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}
body.stage-expanded {
  overflow: hidden;
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
button,
summary,
label.switch {
  cursor: pointer;
}
button,
a,
input,
label.switch {
  touch-action: manipulation;
}
:focus-visible {
  outline: 3px solid #aa623b;
  outline-offset: 3px;
}
.masthead {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 56px;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #24372d;
  color: #fff;
  padding: 8px clamp(16px, 2.2vw, 32px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06),
    0 4px 12px rgba(20, 34, 26, 0.14);
}
.masthead strong {
  font-size: 18px;
  letter-spacing: 0.03em;
  white-space: nowrap;
  flex: none;
}
.room-nav {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 3px 2px;
}
.room-nav::-webkit-scrollbar {
  display: none;
}
.room-nav a {
  flex: none;
  display: inline-flex;
  align-items: center;
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.05);
  color: #dde5dc;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background 0.14s,
    border-color 0.14s,
    color 0.14s;
}
.room-nav a:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(223, 205, 176, 0.55);
  color: #fff;
}
.room-nav a[aria-current='page'] {
  background: #366b51;
  border-color: #dfcdb0;
  color: #fff;
  font-weight: 600;
}
.room-nav a:focus-visible,
.masthead .back-home:focus-visible {
  outline: 2px solid #e7b66b;
  outline-offset: 2px;
}
.back-home {
  flex: none;
  display: inline-block;
  border: 1px solid #819486;
  color: inherit;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  text-decoration: none;
  padding: 5px 12px;
  white-space: nowrap;
  font-size: 13px;
}
.back-home:hover {
  background: #49624f;
}
main,
footer {
  max-width: 1580px;
  margin: 0 auto;
  padding-inline: clamp(16px, 4.5vw, 75px);
}
.context {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  margin: 25px 0 7px;
}
.context i {
  color: #8a968d;
  font-style: normal;
}
.intro {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}
h1,
h2,
h3,
p,
dl,
dd {
  margin: 0;
}
h1 {
  font-size: clamp(28px, 3vw, 44px);
  font-weight: 660;
  line-height: 1.24;
  letter-spacing: -0.03em;
}
.intro p {
  color: var(--muted);
  font-size: 14px;
  margin-top: 8px;
  max-width: 70em;
}
.edition {
  color: var(--green);
  border: 1px solid #bcccbf;
  border-radius: 4px;
  padding: 3px 10px;
  white-space: nowrap;
  font:
    14px/1.5 'IBM Plex Mono',
    monospace;
}
.stats {
  display: flex;
  gap: clamp(12px, 4vw, 65px);
  flex-wrap: wrap;
  margin: 20px 0;
  padding: 14px 0;
  border-block: 1px solid var(--line);
}
.stats dt {
  color: var(--muted);
  font-size: 12px;
}
.stats dd {
  font-size: clamp(16px, 1.5vw, 22px);
  font-weight: 550;
  letter-spacing: 0.01em;
}
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(262px, 23vw, 336px);
  gap: 22px;
  align-items: start;
}
.drawing,
aside {
  min-width: 0;
}
.stage {
  position: relative;
  height: clamp(420px, 54vh, 710px);
  background: #e5e9e2;
  border: 1px solid #c9d1c5;
  border-radius: 10px;
  overflow: hidden;
  isolation: isolate;
}
.stage.expanded {
  position: fixed;
  inset: 0;
  z-index: 45;
  border: 0;
  border-radius: 0;
  height: 100dvh;
  width: 100vw;
  max-height: none;
}
.stage:fullscreen {
  width: 100vw;
  height: 100vh;
  border: 0;
  border-radius: 0;
  max-height: none;
}
#canvas-wrap,
#labels-layer {
  position: absolute;
  inset: 0;
}
#canvas-wrap canvas {
  display: block;
  touch-action: none;
  width: 100%;
  height: 100%;
}
#labels-layer {
  pointer-events: none;
  overflow: hidden;
}
.stage-head,
.stage-foot {
  position: absolute;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 7px;
  pointer-events: none;
  z-index: 3;
}
.stage-head {
  top: 14px;
  justify-content: space-between;
}
.stage-foot {
  bottom: 12px;
  justify-content: flex-end;
}
.stage-head span,
.stage-foot button,
.gesture,
.screen-home {
  background: #fffefaef;
  backdrop-filter: blur(4px);
  border: 1px solid #d0d7cc;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--ink);
  box-shadow: 0 1px 6px #26392e12;
}
.stage-head #active-camera::before {
  content: '';
  vertical-align: middle;
  display: inline-block;
  margin-right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}
.stage-head .render-mode {
  display: none;
  color: var(--muted);
}
body[data-renderer='software'] .stage-head .render-mode {
  display: inline-block;
}
.stage-foot button,
.screen-home {
  pointer-events: auto;
}
.stage-foot button:hover {
  border-color: var(--green);
}
.stage-foot button[aria-pressed='true'] {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.gesture {
  margin-right: auto;
  color: #46574b;
}
.screen-home {
  display: none;
}
.stage:fullscreen .screen-home,
.stage.expanded .screen-home {
  display: block;
}
.stage .screen-home:hover {
  background: #e4ebe2;
}
.dim-tag {
  position: absolute;
  transform: translate(-50%, -50%);
  font:
    550 11px/1.35 'IBM Plex Mono',
    'Microsoft YaHei',
    sans-serif;
  white-space: nowrap;
  color: #fff;
  padding: 3px 6px;
  background: #345546eb;
  border: 1px solid #ffffff80;
  border-radius: 3px;
  pointer-events: none;
  box-shadow: 0 1px 4px #1f332828;
}
.dim-tag.warn {
  background: #9b5037eb;
}
.dim-tag.blue,
.dim-tag.ok {
  background: #345546eb;
}
.view-selection,
.notes,
aside > section,
aside > details {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.view-selection {
  margin-top: 12px;
  padding: 16px;
}
h2,
h3 {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0.015em;
}
.view-selection h2,
.controls h2 {
  margin-bottom: 12px;
}
.cam-bar,
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.row + .row,
.row-spaced {
  margin-top: 8px;
}
.sec-title.compact {
  margin-bottom: 4px;
}
.btn {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  padding: 6px 10px;
  font-size: 13px;
  line-height: 1.4;
}
.btn:hover {
  border-color: var(--green);
}
.btn.active,
.btn.active-blue,
.btn[aria-pressed='true'] {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.btn[data-plan='planA'].active,
.btn[data-plan='planA'][aria-pressed='true'] {
  background: var(--plan-a);
  border-color: var(--plan-a);
  color: #fff;
}
.hidden {
  display: none !important;
}
aside {
  display: grid;
  gap: 12px;
}
.controls {
  padding: 15px 17px;
}
.ctrl-group {
  padding: 10px 0;
  border-top: 1px solid #e9ece5;
}
.ctrl-group:first-of-type {
  border-top: 0;
  padding-top: 0;
}
.ctrl-group:last-child {
  padding-bottom: 0;
}
.sec-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 620;
  color: var(--ink);
  margin-bottom: 8px;
}
.sec-title > span + span {
  font:
    12px/1.4 'IBM Plex Mono',
    'Microsoft YaHei',
    monospace;
  color: var(--muted);
  font-weight: 400;
}
.status-pill {
  border-radius: 4px;
  padding: 1px 6px;
  background: #e9f1e9;
  color: var(--green);
  font-size: 11px;
}
.status-pill.warn {
  background: #f9eeda;
  color: var(--warn);
}
.slider-row {
  display: grid;
  grid-template-columns: auto minmax(64px, 1fr) auto;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 6px 0;
}
.slider-row input[type='range'] {
  width: 100%;
  min-width: 0;
  accent-color: var(--green);
}
.slider-val {
  min-width: 46px;
  text-align: right;
  font:
    12px/1.4 'IBM Plex Mono',
    monospace;
  color: var(--muted);
}
.hint {
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
  margin-top: 7px;
}
/* 全屋统一 30×17px 圆角胶囊拨片开关（同时支持 button.switch 与 label.switch + checkbox） */
.switch {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 7px 0;
  border: 0;
  border-top: 1px solid #e9ece5;
  border-radius: 0;
  background: none;
  text-align: left;
  font-size: 13px;
  color: var(--ink);
}
.controls > .switch:first-of-type,
.ctrl-group > .switch:first-child {
  border-top: 0;
}
.switch:hover {
  border-top-color: #e9ece5;
}
.switch:hover > span {
  color: var(--green);
}
.switch > input[type='checkbox'] {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 24px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}
.switch > i {
  width: 30px;
  height: 17px;
  border-radius: 14px;
  background: #d2d7d1;
  position: relative;
  flex: none;
  transition: background 0.16s;
}
.switch > i::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 11px;
  height: 11px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.16s;
}
.switch.active > i,
.switch[aria-pressed='true'] > i,
.switch > input[type='checkbox']:checked + i {
  background: var(--green);
}
.switch.active > i::after,
.switch[aria-pressed='true'] > i::after,
.switch > input[type='checkbox']:checked + i::after {
  transform: translateX(13px);
}
.switch > input[type='checkbox']:focus-visible + i {
  outline: 3px solid #aa623b;
  outline-offset: 3px;
}
.notes {
  margin-top: 12px;
}
.notes ul {
  margin: 0;
  padding: 0 24px 16px 32px;
}
.notes li {
  font-size: 13px;
  color: var(--muted);
  margin: 6px 0;
}
details summary {
  padding: 13px 16px;
  font-weight: 620;
  font-size: 14px;
}
#audit summary {
  color: var(--green);
  display: flex;
  align-items: baseline;
  gap: 6px 10px;
  flex-wrap: wrap;
  list-style: none;
}
#audit summary::-webkit-details-marker {
  display: none;
}
#audit summary::before {
  content: '▸';
  font-size: 12px;
  flex: none;
}
#audit[open] summary::before {
  content: '▾';
}
#audit-summary {
  margin-left: auto;
  font:
    12px/1.6 'IBM Plex Mono',
    monospace;
}
.audit-list {
  margin: 0 0 10px;
  padding: 0 16px;
  max-height: 48vh;
  overflow: auto;
}
.audit-item {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.5;
}
.pill {
  font: 600 11px/1.4 monospace;
  padding: 2px 5px;
  border-radius: 3px;
  flex-shrink: 0;
  margin-top: 1px;
}
.pill.pass {
  background: #e9f1e9;
  color: #2d6146;
}
.pill.warn {
  background: #f9eeda;
  color: var(--warn);
}
.pill.fail {
  background: #f8e6e0;
  color: var(--bad);
}
footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 35px;
  margin-bottom: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
footer span {
  font-family: 'IBM Plex Mono', monospace;
}
#loading-mask {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 10px;
  padding: 24px;
  background: #e5e9e2;
  color: var(--muted);
  font-size: 14px;
  z-index: 10;
}
[hidden] {
  display: none !important;
}
.selection-box {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  background: #f5f6f1;
  border: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.selection-box small {
  color: var(--muted);
}
.engineering-section {
  margin-top: 22px;
}
.eng-head {
  margin-bottom: 12px;
}
.eng-head h2 {
  margin: 0 0 4px;
  font-size: 18px;
}
.eng-head p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}
.eng-grid {
  display: grid;
  gap: 16px;
}
.eng-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.eng-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #fafbf7;
}
.eng-card-head h3 {
  margin: 0;
  font-size: 15px;
}
.eng-card-head p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.eng-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.eng-actions .btn {
  padding: 4px 9px;
  font-size: 12px;
}
.eng-viewport {
  height: clamp(300px, 46vh, 520px);
  background: #fdfefa;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}
.eng-viewport:active {
  cursor: grabbing;
}
.eng-viewport svg {
  width: 100%;
  height: 100%;
  display: block;
}
.eng-notes {
  margin-top: 16px;
}
.eng-table-wrap {
  overflow-x: auto;
  margin-bottom: 12px;
}
.eng-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.eng-table th,
.eng-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}
.eng-table th {
  background: #f1f3ec;
  font-weight: 600;
}
.review-toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  padding: 9px 16px;
  border-radius: 6px;
  background: #24372d;
  color: #f8f7eb;
  font-size: 13px;
  box-shadow: 0 6px 20px rgba(24, 38, 30, 0.24);
  z-index: 60;
}
@media (max-width: 1260px) {
  .masthead {
    flex-wrap: wrap;
    row-gap: 6px;
    padding: 8px clamp(14px, 2vw, 24px) 6px;
  }
  .room-nav {
    order: 3;
    flex: 1 0 100%;
    max-width: 100%;
    gap: 4px;
    padding: 6px 2px 3px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }
  .room-nav a {
    padding: 4px 7px;
    font-size: 12px;
  }
}
@media (max-width: 1050px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr) 276px;
    gap: 16px;
  }
  .stage {
    height: clamp(400px, 52vh, 560px);
  }
  .stage-foot .gesture {
    display: none;
  }
}
@media (max-width: 780px) {
  .room-nav {
    justify-content: flex-start;
  }
}
@media (max-width: 725px) {
  .masthead {
    min-height: 0;
    height: auto;
    padding: 8px 12px 6px;
    gap: 6px 8px;
  }
  .masthead strong {
    font-size: 15px;
  }
  .masthead .back-home {
    padding: 4px 10px;
    font-size: 12px;
  }
  .room-nav {
    flex-wrap: nowrap;
    gap: 5px;
    padding: 5px 2px 3px;
    -webkit-overflow-scrolling: touch;
  }
  .room-nav a {
    padding: 4px 8px;
    font-size: 12px;
  }
  .context {
    margin-top: 17px;
  }
  .intro {
    gap: 8px;
  }
  .edition {
    font-size: 12px;
  }
  .intro p {
    font-size: 13px;
  }
  .stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px 16px;
    margin: 12px 0;
    padding: 8px 0;
  }
  .stats > div:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
  .stats dt {
    font-size: 11px;
  }
  .workspace {
    display: flex;
    flex-direction: column;
  }
  .drawing,
  aside {
    width: 100%;
  }
  .stage {
    height: 44dvh;
    min-height: 285px;
  }
  .stage-head {
    left: 8px;
    right: 8px;
    top: 8px;
  }
  .stage-foot {
    left: 8px;
    right: 8px;
    bottom: 8px;
  }
  .view-selection {
    padding: 12px;
  }
  .view-selection h2 {
    margin-bottom: 8px;
  }
  .cam-bar {
    gap: 5px;
  }
  .cam-bar .btn {
    padding: 5px 8px;
    font-size: 12px;
  }
  .stage.expanded,
  .stage:fullscreen {
    height: 100dvh;
  }
  .stage.expanded .dim-tag,
  .stage:fullscreen .dim-tag {
    display: none !important;
  }
  .dim-tag {
    font-size: 10px;
  }
  footer {
    gap: 10px;
  }
}
