/* 仿真工作台：把模型详情页从“文章 + 画布”收成可运行、可专注、可导出的实验应用。 */

.native-workbench {
  margin: 16px 0 18px;
  padding: 16px;
  border: 1px solid #cfdded;
  border-radius: 18px;
  background: linear-gradient(180deg, #f9fcff 0%, #f3f8fd 100%);
  box-shadow: 0 14px 34px rgba(23, 50, 77, .08);
  min-width: 0;
}

.native-wb-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 2px 2px 15px;
  margin-bottom: 14px;
  border-bottom: 1px dashed #cfdded;
}

.native-wb-title { min-width: 0; }
.native-wb-titleline { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 10px; margin: 4px 0 6px; }
.native-wb-titleline h1 { margin: 0; font-size: 30px; line-height: 1.15; color: #0f172a; letter-spacing: -.015em; }
.native-wb-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid #cbe7ea;
  border-radius: 999px;
  background: #effafa;
  color: #0e7490;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.native-wb-tag.is-stage { border-color: #dbeafe; background: #eff6ff; color: #1d4ed8; }
.native-wb-summary { max-width: 820px; margin: 0; color: #475569; font-size: 14px; line-height: 1.75; }
.native-wb-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.native-wb-tags span { padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.72); border: 1px solid #e2e8f0; color: #64748b; font-size: 11.5px; }

.native-wb-actions { display: flex; align-items: flex-end; gap: 8px; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; }
.native-wb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  background: #fff;
  color: #334155;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.native-wb-btn:hover { border-color: #93c5fd; color: #1d4ed8; text-decoration: none; }
.native-wb-btn.is-primary { border-color: #17324d; background: #17324d; color: #fff; box-shadow: 0 6px 14px rgba(23,50,77,.16); }
.native-wb-btn.is-primary:hover { background: #0f2438; color: #fff; }

.native-model-switch { display: grid; gap: 3px; min-width: 148px; color: #64748b; font-size: 10.5px; }
.native-model-switch select {
  height: 34px;
  max-width: 220px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  padding: 0 8px;
  background: #fff;
  color: #0f172a;
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}

.native-wb-more { position: relative; }
.native-wb-more > summary { list-style: none; }
.native-wb-more > summary::-webkit-details-marker { display: none; }
.native-wb-more[open] > summary { border-color: #93c5fd; color: #1d4ed8; }
.native-wb-menu {
  position: absolute;
  z-index: 20;
  right: 0;
  top: calc(100% + 6px);
  width: 232px;
  display: grid;
  gap: 2px;
  padding: 7px;
  border: 1px solid #dbe5f1;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(15,23,42,.18);
}
.native-wb-menu a, .native-wb-menu button {
  display: block;
  width: 100%;
  padding: 8px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #334155;
  font: inherit;
  font-size: 12.5px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.native-wb-menu a:hover, .native-wb-menu button:hover { background: #eff6ff; color: #1d4ed8; }
.native-wb-menu .small { padding: 4px 9px 2px; font-size: 11px; line-height: 1.5; }

/* 画布卡：工具条固定在上，画布和读数成一块连续的实验台 */
.native-workbench .native-layout { grid-template-columns: minmax(0, 1.62fr) minmax(300px, .68fr); gap: 14px; }
.native-workbench .native-stage { padding: 0; overflow: hidden; border-radius: 14px; min-width: 0; }
.native-workbench .native-stage canvas { width: 100%; height: auto; border-radius: 10px; background: #fff; display: block; }
.native-workbench .native-controls { border-radius: 14px; }
.native-workbench .native-theory { margin-top: 0; }

.native-stage-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border-bottom: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #fbfdff, #f3f7fb);
}
.native-stage-status { display: flex; align-items: center; gap: 7px; min-width: 0; color: #475569; font-size: 11.5px; white-space: nowrap; }
.native-live-dot { width: 7px; height: 7px; border-radius: 50%; background: #94a3b8; box-shadow: 0 0 0 3px rgba(148,163,184,.12); flex: 0 0 auto; }
.native-live-dot.is-running { background: #10b981; box-shadow: 0 0 0 3px rgba(16,185,129,.14); }
.native-stage-status strong { color: #0f172a; font-size: 12px; }
.native-stage-model { display: none; color: #334155; font-size: 11.5px; }
.native-workbench.is-focus .native-stage-model { display: inline; }
.native-solve-label { color: #0e7490; font-size: 10.5px; letter-spacing: .06em; }
.native-stage-clock { padding-left: 7px; border-left: 1px solid #dbe5f1; color: #64748b; font-variant-numeric: tabular-nums; }
.native-rate-badge { padding: 2px 6px; border-radius: 999px; background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; font-size: 10.5px; }
.native-stage-tools { display: flex; align-items: center; gap: 5px; min-width: 0; }
.native-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  padding: 0 9px;
  border: 1px solid #d5e1ec;
  border-radius: 7px;
  background: #fff;
  color: #334155;
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.native-tool:hover { border-color: #93c5fd; color: #1d4ed8; }
.native-tool.is-primary { border-color: #17324d; background: #17324d; color: #fff; }
.native-tool.is-primary:hover { background: #0f2438; color: #fff; }
.native-tool.is-on { border-color: #fdba74; background: #fff7ed; color: #9a3412; }
.native-tool-wide { width: 100%; height: 32px; margin-top: 4px; }
.native-canvas-zoom { display: none; }

.native-canvas-frame { position: relative; padding: 12px 12px 0; background: #fff; overflow-x: auto; }
.native-canvas-frame canvas { border: 1px solid #e2e8f0; border-radius: 10px; }
.native-loading {
  position: absolute;
  inset: 12px 12px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 10px;
  background: rgba(255,255,255,.94);
  color: #475569;
  font-size: 12.5px;
  transition: opacity .18s ease;
}
.native-canvas-frame.is-ready .native-loading { opacity: 0; pointer-events: none; }
.native-loading[hidden] { display: none !important; }
.native-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #cbd5e1;
  border-top-color: #0e7490;
  border-radius: 50%;
  animation: native-spin .8s linear infinite;
}
@keyframes native-spin { to { transform: rotate(360deg); } }

.native-readout-shell { padding: 10px 12px 0; }
.native-readout-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 3px; }
.native-readout-note { color: #94a3b8; font-size: 10.5px; }
.native-readout-side { display: flex; align-items: center; justify-content: flex-end; gap: 7px; flex-wrap: wrap; }
.native-readout-add {
  height: 27px;
  padding: 0 9px;
  border: 1px solid #17324d;
  border-radius: 7px;
  background: #17324d;
  color: #fff;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.native-readout-add:hover { background: #0f2438; }
.native-workbench .native-readout { margin-top: 0; border-radius: 9px; background: #f8fafc; }
.native-log {
  margin: 10px 12px 0;
  padding: 10px;
  border: 1px solid #dbe5f1;
  border-radius: 10px;
  background: #fff;
}
.native-log-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.native-log-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; color: #64748b; font-size: 11px; }
.native-log-title b { color: #17324d; font-size: 13px; }
.native-log-actions { display: flex; gap: 5px; }
.native-log-btn {
  height: 26px;
  padding: 0 8px;
  border: 1px solid #d5e1ec;
  border-radius: 7px;
  background: #fff;
  color: #475569;
  font: inherit;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.native-log-btn:hover { border-color: #93c5fd; color: #1d4ed8; }
.native-log-btn.is-armed { border-color: #fca5a5; background: #fef2f2; color: #b91c1c; }
.native-log-table-wrap { max-height: 270px; margin-top: 8px; overflow: auto; border: 1px solid #e2e8f0; border-radius: 8px; }
.native-log-table { width: 100%; min-width: 620px; table-layout: fixed; border-collapse: collapse; font-size: 11px; }
.native-log-table th:nth-child(1) { width: 34px; }
.native-log-table th:nth-child(2) { width: 92px; }
.native-log-table th:nth-child(3) { width: 52px; }
.native-log-table th:nth-child(4) { width: 190px; }
.native-log-table th, .native-log-table td { padding: 6px 8px; border-bottom: 1px solid #eef2f7; text-align: left; vertical-align: top; }
.native-log-table th { position: sticky; top: 0; z-index: 1; background: #f8fafc; color: #64748b; font-size: 10px; font-weight: 600; white-space: nowrap; }
.native-log-table tbody tr:last-child td { border-bottom: 0; }
.native-log-table td.is-index { color: #94a3b8; font-variant-numeric: tabular-nums; }
.native-log-table td.is-time { white-space: nowrap; color: #64748b; font-variant-numeric: tabular-nums; }
.native-log-params { display: block; max-width: 280px; color: #334155; line-height: 1.55; word-break: break-word; }
.native-log-readout { max-width: 320px; color: #475569; line-height: 1.55; }
.native-log-readout span { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.native-log-row-actions { display: flex; gap: 5px; margin-top: 5px; }
.native-log-act {
  padding: 2px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 5px;
  background: #f8fafc;
  color: #64748b;
  font: inherit;
  font-size: 10px;
  line-height: 1.5;
  cursor: pointer;
}
.native-log-act:hover { border-color: #93c5fd; color: #1d4ed8; background: #eff6ff; }
.native-log-act.is-danger:hover { border-color: #fca5a5; color: #b91c1c; background: #fef2f2; }
.native-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  padding: 9px 12px 11px;
  color: #64748b;
  font-size: 10.5px;
}
.native-shortcuts kbd { font-size: 10px; }

/* 参数面板：常规页随页面阅读；专注模式下整页成为独立窗口，面板固定在窗口右侧 */
.native-workbench .native-controls {
  position: static;
  max-height: none;
  overflow: visible;
}
.native-panel-head { display: flex; align-items: flex-start; gap: 8px; }
.native-panel-head h2 { margin: 2px 0 4px; font-size: 20px; }
.native-panel-count { margin-left: auto; padding: 2px 7px; border-radius: 999px; background: #eff6ff; color: #1d4ed8; font-size: 10.5px; white-space: nowrap; }
.native-panel-collapse { border: 0; background: transparent; color: #64748b; font: inherit; font-size: 11px; cursor: pointer; padding: 3px 0; }
.native-panel-collapse:hover { color: #1d4ed8; }
.native-panel-hint { margin: 0 0 10px; color: #64748b; font-size: 11.5px; line-height: 1.6; }
.native-ctl-list { display: grid; gap: 1px; }
.native-ctl-select {
  width: 100%;
  height: 32px;
  margin: 5px 0 2px;
  padding: 0 28px 0 9px;
  border: 1px solid #cbd9e8;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}
.native-ctl-select:focus { outline: 2px solid #bfdbfe; outline-offset: 1px; border-color: #60a5fa; }
.native-panel-actions { margin-top: 8px; padding-top: 10px; border-top: 1px dashed #dbe5f1; }
.native-model-note { margin: 10px 0 0; font-size: 11px; line-height: 1.65; }

.native-layout.is-panel-collapsed { grid-template-columns: minmax(0, 1fr); }
.native-layout.is-panel-collapsed .native-controls { display: none; }

.native-toast {
  position: fixed;
  z-index: 1500;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  max-width: min(420px, calc(100vw - 28px));
  padding: 9px 14px;
  border-radius: 999px;
  background: #17324d;
  color: #fff;
  font-size: 12.5px;
  box-shadow: 0 10px 30px rgba(15,23,42,.25);
}
.native-toast[hidden] { display: none !important; }

/* 专注模式：把工作台提为独立应用窗口，页面其余内容退到遮罩后面 */
body.native-focusing { overflow: hidden; }
body.native-focusing::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1300;
  background: rgba(15, 23, 42, .52);
  backdrop-filter: blur(2px);
}
.native-workbench.is-focus {
  position: fixed;
  inset: 10px;
  z-index: 1400;
  margin: 0;
  max-width: none;
  overflow: auto;
  background: #f9fcff;
  box-shadow: 0 24px 80px rgba(15,23,42,.38);
}
.native-workbench.is-focus .native-wb-head { display: none; }
.native-workbench.is-focus .native-layout { margin-top: 0; }
.native-workbench.is-focus .native-controls { position: static; max-height: none; }
.native-workbench.is-focus .native-shortcuts { display: flex; }

@media (max-width: 1100px) {
  .native-wb-head { gap: 14px; }
  .native-wb-titleline h1 { font-size: 27px; }
  .native-workbench .native-layout { grid-template-columns: minmax(0, 1.42fr) minmax(280px, .7fr); }
  .native-stage-tools { overflow-x: auto; padding-bottom: 2px; }
  .native-tool { flex: 0 0 auto; }
}

@media (max-width: 760px) {
  /* 详情页手机端把工作区导航压成一条：只留入口，不占首屏 */
  .simsys.is-detail .simsys-top { flex-wrap: nowrap; gap: 6px; padding: 8px 10px; }
  .simsys.is-detail .simsys-brand { flex: 0 0 auto; }
  .simsys.is-detail .simsys-brand-copy { display: none; }
  .simsys.is-detail .simsys-mark { width: 30px; height: 30px; font-size: 16px; }
  .simsys.is-detail .simsys-nav { order: 2; display: flex; flex: 1 1 auto; min-width: 0; gap: 0; overflow-x: auto; padding: 0; }
  .simsys.is-detail .simsys-nav-link { flex: 0 0 auto; min-width: 0; padding: 7px 8px; font-size: 11px; }
  .simsys.is-detail .simsys-actions { display: none; }
  .simsys.is-detail .simsys-path { display: none; }

  .native-workbench { padding: 10px; margin: 12px 0 14px; border-radius: 14px; }
  .native-wb-head { display: grid; gap: 10px; padding-bottom: 11px; margin-bottom: 10px; }
  .native-wb-titleline h1 { font-size: 24px; }
  .native-wb-summary { display: none; }
  .native-wb-tags { display: none; }
  .native-wb-actions { display: grid; grid-template-columns: 1fr 1fr; align-items: stretch; gap: 7px; }
  .native-model-switch { grid-column: 1 / -1; min-width: 0; }
  .native-model-switch select { max-width: none; width: 100%; }
  .native-wb-btn { width: 100%; min-height: 36px; }
  .native-wb-more { grid-column: auto; }
  .native-wb-menu { position: fixed; left: 12px; right: 12px; top: auto; bottom: 18px; width: auto; }
  .native-workbench .native-layout { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .native-stage-bar { flex-direction: column; align-items: stretch; gap: 7px; }
  .native-stage-status { flex-wrap: wrap; white-space: normal; }
  .native-stage-tools { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; overflow: visible; padding: 0; }
  .native-tool { width: 100%; min-width: 0; padding: 0 4px; }
  .native-canvas-zoom { display: inline-flex; }
  .native-stage-clock { border-left: 0; padding-left: 0; }
  .native-canvas-frame { padding: 8px 8px 0; }
  .native-canvas-frame canvas { min-width: 0; width: 100%; }
  .native-stage.is-canvas-zoom .native-canvas-frame { overflow-x: auto; }
  .native-stage.is-canvas-zoom .native-canvas-frame canvas { width: 680px; min-width: 680px; }
  .native-readout-shell { padding: 8px 10px 0; }
  .native-readout-note { display: none; }
  .native-readout-add { height: 26px; padding: 0 7px; font-size: 10.5px; }
  .native-log { margin: 8px 10px 0; padding: 8px; }
  .native-log-table-wrap { max-height: 240px; }
  .native-log-table-wrap { max-height: none; overflow: visible; border: 0; }
  .native-log-table { display: block; min-width: 0; table-layout: auto; }
  .native-log-table thead { display: none; }
  .native-log-table tbody, .native-log-table tr, .native-log-table td { display: block; width: auto; }
  .native-log-table tr { margin-top: 7px; padding: 8px 9px; border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; }
  .native-log-table tr::before { content: "第 " attr(data-index) " 组"; display: block; margin-bottom: 4px; color: #94a3b8; font-size: 10px; }
  .native-log-table tr:first-child { margin-top: 8px; }
  .native-log-table td { padding: 1px 0; border: 0; }
  .native-log-table td::before { content: attr(data-label) "  "; color: #94a3b8; font-size: 10px; font-weight: 600; }
  .native-log-table td.is-index { display: none; }
  .native-log-table td.is-time { display: inline-block; margin-right: 12px; white-space: normal; }
  .native-log-table td.is-readout { margin-top: 5px; padding-top: 5px; border-top: 1px dashed #e2e8f0; }
  .native-log-table td.is-readout::before { display: block; margin-bottom: 2px; }
  .native-log-params, .native-log-readout { max-width: none; }
  .native-log-row-actions { margin-top: 7px; gap: 6px; }
  .native-log-act { padding: 5px 10px; font-size: 11px; }
  .native-shortcuts { display: none; }
  .native-workbench .native-controls { position: static; max-height: none; overflow: visible; }
  .native-panel-head h2 { font-size: 18px; }
  .native-layout.is-panel-collapsed .native-controls { display: none; }
  .native-workbench.is-focus { inset: 4px; padding: 8px; }
  .native-workbench.is-focus .native-wb-head { display: none; }
}

@media (max-width: 480px) {
  .native-wb-actions { grid-template-columns: 1fr 1fr; }
  .native-tool { height: 32px; }
}
