:root {
  color-scheme: light;
  --navy-950: #061633;
  --navy-900: #082353;
  --navy-800: #0b3474;
  --navy-700: #14539d;
  --blue-100: #eaf2fb;
  --orange: #f36b21;
  --orange-dark: #cf4e0d;
  --ink: #0a1d3d;
  --muted: #5b6d86;
  --line: rgba(15, 47, 96, 0.14);
  --glass: rgba(250, 252, 255, 0.91);
  --glass-strong: rgba(255, 255, 255, 0.97);
  --shadow: 0 20px 55px rgba(4, 24, 58, 0.2);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  color: var(--ink);
  background: #dce7ee;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
output {
  font: inherit;
}

button {
  color: inherit;
}

#viewport {
  position: fixed;
  inset: 0;
  touch-action: none;
}

#viewport::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(4, 21, 48, 0.08), transparent 28%, transparent 72%, rgba(4, 21, 48, 0.06)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 22%);
  content: "";
}

.glass-panel {
  border: 1px solid rgba(255, 255, 255, 0.78);
  background: var(--glass);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.08);
  -webkit-backdrop-filter: blur(18px) saturate(1.08);
}

.project-card {
  position: fixed;
  z-index: 5;
  top: 18px;
  left: 18px;
  width: min(440px, calc(100vw - 36px));
  padding: 18px 20px 17px;
  overflow: hidden;
  border-radius: var(--radius);
  pointer-events: none;
}

.project-card::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 5px;
  background: var(--orange);
  content: "";
}

.project-kicker {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--navy-700);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.105em;
}

.signal-dot {
  width: 8px;
  height: 8px;
  border: 2px solid white;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 4px rgba(243, 107, 33, 0.15);
}

h1,
h2,
p,
dl,
dd {
  margin: 0;
}

h1 {
  margin-top: 8px;
  font-size: clamp(25px, 3vw, 39px);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.project-english {
  margin-top: 4px;
  color: var(--navy-700);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.03em;
}

.project-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 9px;
  margin-top: 13px;
  color: var(--muted);
  font-size: 11px;
}

.project-summary strong {
  color: var(--navy-900);
  font-size: 18px;
  line-height: 1;
}

.summary-divider {
  width: 1px;
  height: 15px;
  margin: 0 2px;
  background: var(--line);
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 11px;
}

.project-tags span {
  padding: 5px 8px;
  border: 1px solid rgba(12, 52, 116, 0.12);
  border-radius: 999px;
  color: var(--navy-800);
  background: var(--blue-100);
  font-size: 9px;
  font-weight: 800;
}

.control-card {
  position: fixed;
  z-index: 6;
  top: 18px;
  right: 18px;
  width: min(465px, calc(100vw - 36px));
  max-height: calc(100vh - 86px);
  padding: 15px;
  overflow: auto;
  border-radius: var(--radius);
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.panel-title-row > div {
  display: flex;
  align-items: center;
  gap: 9px;
}

.section-index {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border-radius: 8px;
  color: white;
  background: var(--navy-900);
  font-size: 10px;
  font-weight: 900;
}

h2 {
  color: var(--navy-950);
  font-size: 16px;
  letter-spacing: -0.02em;
}

.unit-badge,
.verified-mark {
  color: var(--navy-700);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.control-group {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.control-label,
.control-label-row {
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.control-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#airflow-value {
  color: var(--orange-dark);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
}

.button-grid {
  display: grid;
  gap: 6px;
  margin-top: 7px;
}

.view-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.control-button,
.layer-button,
.feature-button,
.switch-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.control-button:hover,
.layer-button:hover,
.feature-button:hover,
.switch-button:hover {
  border-color: rgba(20, 83, 157, 0.42);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(6, 35, 83, 0.1);
}

.control-button:focus-visible,
.layer-button:focus-visible,
.feature-button:focus-visible,
.switch-button:focus-visible,
input[type="range"]:focus-visible {
  outline: 3px solid rgba(243, 107, 33, 0.26);
  outline-offset: 2px;
}

.control-button {
  min-height: 34px;
  padding: 7px 5px;
  border-radius: 9px;
  color: var(--navy-800);
  font-size: 10px;
  font-weight: 850;
  white-space: nowrap;
}

.control-button.is-active,
.control-button.active {
  border-color: var(--navy-900);
  color: white;
  background: var(--navy-900);
}

.airflow-row {
  display: grid;
  grid-template-columns: minmax(165px, 0.95fr) minmax(120px, 1.2fr);
  align-items: center;
  gap: 13px;
  margin-top: 7px;
}

.switch-button,
.feature-button {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 43px;
  padding: 7px 9px;
  border-radius: 11px;
  text-align: left;
}

.switch-track {
  position: relative;
  flex: 0 0 auto;
  width: 34px;
  height: 19px;
  border-radius: 999px;
  background: #aeb9c6;
  transition: background 140ms ease;
}

.switch-track span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 2px 5px rgba(6, 22, 51, 0.3);
  transition: transform 140ms ease;
}

.switch-button.is-active .switch-track,
.switch-button.active .switch-track {
  background: var(--orange);
}

.switch-button.is-active .switch-track span,
.switch-button.active .switch-track span {
  transform: translateX(15px);
}

.switch-copy,
.feature-button > span:last-child {
  display: grid;
  min-width: 0;
}

.switch-copy strong,
.feature-button strong {
  color: var(--navy-900);
  font-size: 10px;
}

.switch-copy small,
.feature-button small {
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

input[type="range"] {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  accent-color: var(--orange);
  cursor: pointer;
}

.compact-row {
  display: grid;
  grid-template-columns: 74px 1fr;
  align-items: center;
  gap: 9px;
}

.compact-row .feature-button {
  min-height: 39px;
}

.feature-icon {
  display: grid;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 7px;
  color: white;
  background: var(--navy-800);
  font-size: 17px;
}

.feature-button:not(.is-active):not(.active),
.switch-button:not(.is-active):not(.active) {
  opacity: 0.62;
}

.layer-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.layer-button {
  display: flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 5px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 850;
}

.layer-button.is-active,
.layer-button.active {
  border-color: rgba(20, 83, 157, 0.25);
  color: var(--navy-900);
  background: var(--blue-100);
}

.swatch {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.swatch.steel { background: #7f919e; }
.swatch.cover { background: #a7d9ef; }
.swatch.equipment { background: #153d76; }
.swatch.airflow { background: #1aa5de; }
.swatch.dimensions { background: var(--orange); }

.spec-card {
  position: fixed;
  z-index: 5;
  bottom: 18px;
  left: 18px;
  width: min(495px, calc(100vw - 36px));
  padding: 15px;
  border-radius: var(--radius);
}

.verified-mark {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #18724b;
}

.verified-mark span {
  display: grid;
  width: 17px;
  height: 17px;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: #1f9965;
  font-size: 10px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-top: 11px;
}

.metric {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
}

.metric dt {
  overflow: hidden;
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric dt small {
  margin-left: 3px;
  color: #8a98a9;
  font-size: 6px;
}

.metric dd {
  margin-top: 5px;
  overflow: hidden;
  color: var(--navy-900);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.primary-metric {
  border-color: rgba(243, 107, 33, 0.26);
  background: rgba(255, 246, 240, 0.86);
}

.primary-metric dd {
  color: var(--orange-dark);
}

.system-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  color: white;
  background: linear-gradient(120deg, var(--navy-900), var(--navy-700));
}

.system-note-icon {
  display: grid;
  flex: 0 0 auto;
  width: 27px;
  height: 27px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  color: #8bdeff;
  font-size: 15px;
  font-weight: 900;
}

.system-note p {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.system-note strong {
  font-size: 9px;
}

.system-note p span {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.72);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-bar {
  position: fixed;
  z-index: 5;
  right: 18px;
  bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(520px, calc(100vw - 36px));
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--navy-900);
  font-size: 9px;
  font-weight: 800;
}

.status-pulse {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #1f9965;
  box-shadow: 0 0 0 5px rgba(31, 153, 101, 0.12);
}

#status-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.interaction-hint {
  margin-left: auto;
  padding-left: 9px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.error-card {
  position: fixed;
  z-index: 20;
  top: 50%;
  left: 50%;
  display: flex;
  width: min(520px, calc(100vw - 36px));
  gap: 13px;
  padding: 18px;
  border: 1px solid rgba(191, 53, 32, 0.25);
  border-radius: var(--radius);
  transform: translate(-50%, -50%);
}

.error-card[hidden] {
  display: none;
}

.error-symbol {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  color: white;
  background: #c43e2c;
  font-size: 20px;
  font-weight: 900;
}

.error-card strong {
  color: #932c1e;
  font-size: 14px;
}

.error-card p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.error-card code {
  display: block;
  max-height: 90px;
  margin-top: 8px;
  overflow: auto;
  color: #8f2a1d;
  font-size: 10px;
  white-space: pre-wrap;
}

noscript {
  position: fixed;
  z-index: 30;
  top: 50%;
  left: 50%;
  padding: 14px 18px;
  border-radius: 10px;
  color: white;
  background: var(--navy-950);
  transform: translate(-50%, -50%);
}

@media (max-width: 1100px) {
  .project-card {
    width: min(370px, calc(48vw - 24px));
  }

  .control-card {
    width: min(430px, calc(52vw - 24px));
  }

  .spec-card {
    width: min(440px, calc(54vw - 24px));
  }

  .status-bar {
    max-width: calc(46vw - 24px);
  }

  .interaction-hint {
    display: none;
  }
}

@media (max-width: 760px) {
  .project-card {
    top: 10px;
    left: 10px;
    width: calc(100vw - 20px);
    padding: 13px 15px 12px;
  }

  h1 {
    margin-top: 5px;
    font-size: 24px;
  }

  .project-english {
    font-size: 10px;
  }

  .project-summary {
    margin-top: 8px;
  }

  .project-tags {
    display: none;
  }

  .control-card {
    top: auto;
    right: 10px;
    bottom: 10px;
    left: 10px;
    width: auto;
    max-height: 44vh;
    padding: 12px;
    border-radius: 15px;
  }

  .control-card .panel-title-row,
  .control-group.compact-row,
  .control-group:last-child {
    display: none;
  }

  .control-group {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }

  .control-group + .control-group {
    margin-top: 9px;
    padding-top: 9px;
    border-top: 1px solid var(--line);
  }

  .view-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .control-button {
    min-height: 32px;
    padding-inline: 3px;
    font-size: 9px;
  }

  .airflow-row {
    grid-template-columns: 1.1fr 1fr;
  }

  .spec-card {
    display: none;
  }

  .status-bar {
    top: 136px;
    right: 10px;
    bottom: auto;
    left: 10px;
    max-width: none;
    min-height: 32px;
    justify-content: center;
    padding: 6px 10px;
  }
}

@media (max-width: 420px) {
  .project-kicker {
    font-size: 8px;
  }

  .project-summary strong {
    font-size: 16px;
  }

  .project-summary {
    gap: 4px 7px;
    font-size: 9px;
  }

  .view-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .airflow-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .switch-button {
    min-height: 38px;
  }

  .control-card {
    max-height: 48vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
