:root {
  color-scheme: light;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;
  font-size: 13px;
  color: #1f2933;
  background: #e9edf1;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: #e9edf1;
}

button, input, select { font: inherit; }

button {
  min-height: 34px;
  border: 1px solid #aeb8c2;
  border-radius: 4px;
  padding: 6px 12px;
  color: #26323d;
  background: #ffffff;
  cursor: pointer;
}

button:hover:not(:disabled) { background: #f2f5f7; border-color: #7d8b97; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid #2574a9; outline-offset: 1px; }
button:disabled { color: #8b96a0; background: #eef1f3; cursor: not-allowed; }

.app-header {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 18px;
  color: #f7fafc;
  background: #2d3943;
  border-bottom: 1px solid #202a31;
}

.app-header h1 { margin: 0; font-size: 17px; font-weight: 500; }
.app-header p { margin: 3px 0 0; font-size: 12px; color: #cbd3da; }
.header-status { display: flex; align-items: center; gap: 8px; font-size: 13px; white-space: nowrap; }
.header-status span:first-child { width: 8px; height: 8px; border-radius: 50%; background: #e0a12b; }
.header-status.is-ready span:first-child { background: #3f9b64; }
.header-status.is-error span:first-child { background: #c74c48; }

.app-shell {
  display: grid;
  grid-template-columns: 292px minmax(480px, 1fr) 316px;
  height: calc(100vh - 66px);
  min-height: 0;
  overflow: hidden;
}

.control-panel,
.output-panel {
  background: #f8f9fa;
  overflow-y: auto;
}

.control-panel { border-right: 1px solid #c7ced4; }
.output-panel { border-left: 1px solid #c7ced4; }

.control-panel section,
.output-panel section {
  padding: 14px 16px;
  border-bottom: 1px solid #d7dde2;
}

h2 {
  margin: 0 0 11px;
  color: #2f3a44;
  font-size: 13px;
  font-weight: 500;
}

label {
  display: grid;
  gap: 5px;
  margin-bottom: 9px;
  color: #4b5965;
  font-size: 12px;
}

input[type="number"], select {
  width: 100%;
  min-height: 32px;
  border: 1px solid #b9c2ca;
  border-radius: 3px;
  padding: 5px 7px;
  color: #26323d;
  background: #ffffff;
}

input:disabled { background: #edf0f2; color: #8b96a0; }

.field-grid { display: grid; gap: 0 9px; }
.field-grid.two { grid-template-columns: 1fr 1fr; }
.field-grid.three { grid-template-columns: repeat(3, 1fr); }

.file-picker {
  position: relative;
  display: block;
  margin-bottom: 8px;
  border: 1px dashed #8997a3;
  border-radius: 4px;
  padding: 12px;
  color: #245f89;
  text-align: center;
  background: #f2f6f9;
  cursor: pointer;
}

.file-picker:hover { border-color: #2574a9; background: #eaf2f7; }
.file-picker input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.primary-btn {
  width: calc(100% - 32px);
  margin: 14px 16px 8px;
  min-height: 42px;
  border-color: #1c5f8e;
  color: #ffffff;
  background: #2574a9;
  font-weight: 500;
}

.primary-btn:hover:not(:disabled) { border-color: #174e75; background: #1f6797; }
.secondary-btn { width: 100%; margin-bottom: 8px; }

.model-info, .result-list { margin: 8px 0 0; }
.model-info div, .result-list div { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: 12px; }
.model-info dt, .result-list dt { color: #687580; }
.model-info dd, .result-list dd { margin: 0; text-align: right; color: #27333d; font-variant-numeric: tabular-nums; }

.field-note { margin: 4px 0 0; color: #75818b; font-size: 11px; line-height: 1.5; }
.warning-note { color: #8a5b13; }
.checkbox-row { display: flex; align-items: center; gap: 7px; }
.checkbox-row input { margin: 0; }
output {
  display: flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid #cbd2d8;
  border-radius: 3px;
  padding: 5px 7px;
  color: #1c5f8e;
  background: #eef4f8;
  font-variant-numeric: tabular-nums;
  font-family: Consolas, "Courier New", monospace;
}

.error-message { min-height: 18px; margin: 0 16px 12px; color: #ae322e; font-size: 12px; line-height: 1.4; }

.workspace {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(420px, 1fr) auto;
  background: #dfe4e8;
}

.workspace-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 7px 10px;
  border-bottom: 1px solid #c1c9d0;
  background: #f4f6f7;
}

.playback-controls, .view-controls { display: flex; align-items: center; gap: 7px; }
.view-controls span { color: #75818b; font-size: 11px; }

.canvas-wrap { position: relative; min-height: 420px; overflow: hidden; }
#sceneCanvas { display: block; width: 100%; height: 100%; cursor: grab; background: #f6f7f8; }
#sceneCanvas:active { cursor: grabbing; }

.canvas-legend {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: flex;
  gap: 13px;
  padding: 6px 8px;
  border: 1px solid #c7ced4;
  border-radius: 3px;
  color: #4f5c66;
  background: rgba(255,255,255,.9);
  font-size: 11px;
}

.canvas-legend span { display: flex; align-items: center; gap: 5px; }
.canvas-legend i { display: inline-block; width: 17px; height: 3px; }
.legend-wall { background: #236fa1; }
.legend-infill { background: #29865c; }
.legend-travel { border-top: 2px dashed #c1781d; }

.layer-control {
  display: grid;
  grid-template-columns: auto minmax(140px, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 8px 12px;
  border-top: 1px solid #c1c9d0;
  color: #4e5b65;
  background: #f4f6f7;
  font-size: 12px;
}

.layer-control label { display: block; margin: 0; }
.layer-control input { width: 100%; }
#layerLabel { color: #26323d; }
#animationLabel { min-width: 100px; color: #687580; text-align: right; }

.validation-message {
  margin-top: 10px;
  border-left: 3px solid #8896a1;
  padding: 7px 9px;
  color: #56636d;
  background: #eef1f3;
  font-size: 12px;
  line-height: 1.45;
}
.validation-message.ok { border-color: #318058; color: #276847; background: #edf7f1; }
.validation-message.bad { border-color: #bd4742; color: #973732; background: #fbeeee; }

.section-heading { display: flex; justify-content: space-between; align-items: center; }
.section-heading span { color: #6f7b85; font-size: 11px; }
.point-section { min-height: 250px; }
.table-wrap { max-height: 290px; overflow: auto; border: 1px solid #d1d7dc; background: #ffffff; }
table { width: 100%; border-collapse: collapse; font-size: 11px; font-variant-numeric: tabular-nums; }
table th:not(:first-child), table td:not(:first-child) { font-family: Consolas, "Courier New", monospace; }
th, td { padding: 6px 7px; border-bottom: 1px solid #e2e6e9; text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead { position: sticky; top: 0; background: #edf0f2; }
tbody tr:last-child td { border-bottom: 0; }

details { margin-top: 8px; }
summary { color: #4f5d67; font-size: 12px; cursor: pointer; }
pre { max-height: 220px; overflow: auto; margin: 8px 0 0; padding: 9px; color: #d7e0e7; background: #27323a; font: 11px/1.45 Consolas, monospace; white-space: pre-wrap; }

@media (max-width: 1120px) {
  .app-shell { height: auto; min-height: calc(100vh - 66px); overflow: visible; }
  .app-shell { grid-template-columns: 270px minmax(430px, 1fr); }
  .output-panel { grid-column: 1 / -1; border-left: 0; border-top: 1px solid #c7ced4; display: grid; grid-template-columns: repeat(3, 1fr); overflow: visible; }
  .output-panel section { border-right: 1px solid #d7dde2; }
  .point-section { min-height: 0; }
  .table-wrap { max-height: 250px; }
}

@media (max-width: 760px) {
  .app-header { align-items: flex-start; }
  .header-status { display: none; }
  .app-shell { display: block; height: auto; overflow: visible; }
  .control-panel, .output-panel { overflow: visible; border: 0; }
  .workspace { min-height: 580px; }
  .output-panel { display: block; }
  .workspace-toolbar { align-items: flex-start; flex-direction: column; }
  .layer-control { grid-template-columns: auto 1fr auto; }
  #animationLabel { grid-column: 1 / -1; text-align: left; }
}
