:root {
  --bg: #eef4f6;
  --panel: #ffffff;
  --panel-soft: #f7fafb;
  --ink: #203247;
  --muted: #6c7d8e;
  --line: #dbe6e9;
  --accent: #0f9f91;
  --accent-dark: #0b7d75;
  --accent-soft: #dff5ef;
  --purple: #7667d8;
  --code: #14253a;
  --code-line: #2a3c52;
  --danger: #c94c5c;
  --warning: #9a6700;
  --shadow: 0 8px 28px rgba(41, 65, 77, 0.08);
  font-family: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-width: 320px; }
body {
  min-height: 100vh;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(circle at 8% 0%, rgba(125, 211, 252, 0.18), transparent 28%),
    radial-gradient(circle at 94% 100%, rgba(196, 181, 253, 0.16), transparent 30%),
    var(--bg);
  font-size: 14px;
}
button, select, input, textarea { font: inherit; }
button, a, select, input { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(15, 159, 145, 0.28);
  outline-offset: 2px;
}

#toolbar {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(203, 220, 224, 0.85);
  box-shadow: 0 2px 14px rgba(41, 65, 77, 0.04);
  backdrop-filter: blur(16px);
  z-index: 2;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-right: 5px;
  color: var(--ink);
  text-decoration: none;
  min-width: 156px;
}
.brand-mark {
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--accent-soft);
  border: 1px solid #c6eae1;
}
.brand-mark svg { width: 31px; height: 31px; }
.brand strong { display: block; font-size: 18px; line-height: 1.05; letter-spacing: -0.4px; }
.brand small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; letter-spacing: 1px; }

#toolbar a.nav, #toolbar button, #toolbar select, #toolbar input[type="number"] {
  min-height: 37px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel-soft);
  color: var(--ink);
  padding: 7px 11px;
}
#toolbar a.nav {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  font-weight: 600;
}
#toolbar button { cursor: pointer; font-weight: 600; }
#toolbar button:hover, #toolbar a.nav:hover { background: #edf6f5; border-color: #b8d9d4; }
#toolbar button:active { transform: translateY(1px); }
#toolbar button.primary {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(15, 159, 145, 0.22);
}
#toolbar button.primary:hover { background: var(--accent-dark); }
#toolbar select { cursor: pointer; max-width: 205px; }
#map-select { min-width: 175px; }
#toolbar label { display: flex; align-items: center; gap: 10px; color: var(--muted); }
#toolbar input[type="number"] { width: 58px; padding: 6px 7px; }
.toolbar-overlay {
  position: absolute;
  top: 50%;
  right: 16px;
  z-index: 3;
  width: 0;
  height: 37px;
  transform: translateY(-50%);
}
#settings-menu { position: absolute; right: 0; }
#settings-summary {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 37px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel-soft);
  color: var(--ink);
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  user-select: none;
  white-space: nowrap;
}
#settings-summary::-webkit-details-marker { display: none; }
#settings-summary::after { content: "▾"; color: var(--muted); font-size: 11px; }
#settings-menu[open] #settings-summary::after { transform: rotate(180deg); }
#settings-summary:hover { background: #edf6f5; border-color: #b8d9d4; }
#settings-summary:focus-visible { outline: 3px solid rgba(15, 159, 145, 0.28); outline-offset: 2px; }
.settings-panel {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  z-index: 10;
  width: 230px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(32, 50, 71, 0.16);
}
.settings-panel label { padding: 10px; border-radius: 9px; cursor: pointer; }
.settings-panel label:hover { background: var(--panel-soft); }
.settings-panel input { flex: none; width: 16px; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.settings-panel strong, .settings-panel small { display: block; }
.settings-panel strong { color: var(--ink); font-size: 12px; }
.settings-panel small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.opacity-control { padding: 9px 10px 11px; }
.opacity-control > div { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.opacity-control label { padding: 0; color: var(--ink); font-size: 12px; font-weight: 700; }
.opacity-control output { color: var(--accent-dark); font: 700 11px/1 "Cascadia Code", Consolas, monospace; }
.settings-panel input[type="range"] { width: 100%; height: 16px; }
.sep { width: 1px; height: 25px; background: var(--line); margin: 0 2px; }
#status {
  position: absolute;
  top: 0;
  right: 70px;
  z-index: 4;
  display: flex;
  align-items: center;
  min-height: 37px;
  width: max-content;
  max-width: min(520px, 45vw);
  padding: 7px 12px;
  border: 1px solid rgba(203, 220, 224, 0.9);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 4px 16px rgba(41, 65, 77, 0.12);
  backdrop-filter: blur(10px);
  color: #526b78;
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  opacity: 0.9;
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
}
#status.dragging { cursor: grabbing; }
#status[hidden] { display: none; }
.btn-symbol { margin-right: 4px; font-size: 13px; }

#layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr) 264px;
  gap: 14px;
  padding: 14px;
}
#left, #right, #palette, #canvas-wrap {
  min-width: 0;
  min-height: 0;
  border: 1px solid rgba(214, 228, 231, 0.9);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
#left, #right {
  display: flex;
  flex-direction: column;
  padding: 16px;
  overflow: hidden;
}
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.panel-heading h2, .palette-intro h2, .stage-heading h2 {
  margin: 2px 0 0;
  font-size: 17px;
  line-height: 1.3;
  letter-spacing: -0.2px;
}
.eyebrow {
  color: var(--accent-dark);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
}
.panel-subtitle, .palette-intro p, .stage-heading p {
  margin: 6px 0 13px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}
.shortcut, .stage-badge {
  flex: none;
  padding: 4px 8px;
  border-radius: 8px;
  color: var(--purple);
  background: #efedff;
  font-size: 10px;
  font-weight: 700;
}

#code-editor {
  position: relative;
  flex: 1;
  min-height: 160px;
  display: flex;
  overflow: hidden;
  border: 1px solid #253b52;
  border-radius: 13px;
  background: var(--code);
  box-shadow: inset 0 1px 5px rgba(0, 0, 0, 0.15);
}
#code-editor:focus-within { border-color: #45b8aa; box-shadow: 0 0 0 3px rgba(15, 159, 145, 0.13); }
#execution-highlight {
  position: absolute;
  z-index: 0;
  top: 15px;
  left: 0;
  right: 0;
  height: 22px;
  border-left: 3px solid #45b8aa;
  background: rgba(15, 159, 145, 0.24);
  pointer-events: none;
}
#execution-highlight[hidden] { display: none; }
#execution-highlight[data-kind="error"] {
  border-left-color: var(--danger);
  background: rgba(201, 76, 92, 0.2);
}
#line-numbers {
  position: relative;
  z-index: 1;
  flex: none;
  width: 45px;
  overflow: hidden;
  padding: 15px 10px 15px 0;
  border-right: 1px solid var(--code-line);
  background: #102034;
  color: #68829b;
  text-align: right;
  white-space: pre;
  user-select: none;
  font: 14px/22px "Cascadia Code", Consolas, monospace;
}
#script {
  position: relative;
  z-index: 2;
  flex: 1;
  min-width: 0;
  height: 100%;
  resize: none;
  border: 0;
  border-radius: 0 12px 12px 0;
  outline: 0;
  padding: 15px 14px;
  background: transparent;
  color: transparent; /* 文字由背景层着色渲染（P26 符号高亮） */
  caret-color: #7dd3fc;
  white-space: pre;
  tab-size: 2;
  font: 14px/22px "Cascadia Code", Consolas, "Microsoft YaHei", monospace;
}
/* 符号高亮背景层：与 #script 同字体/行高/内边距，字符逐位对齐（P26） */
#code-highlight {
  position: absolute;
  z-index: 1;
  top: 0;
  bottom: 0;
  left: 45px;
  right: 0;
  margin: 0;
  overflow: hidden;
  padding: 15px 14px;
  color: #e7f0f8;
  white-space: pre;
  tab-size: 2;
  font: 14px/22px "Cascadia Code", Consolas, "Microsoft YaHei", monospace;
  pointer-events: none;
}
#code-highlight .tk-ctl { color: #c4b5fd; font-weight: 600; }
#code-highlight .tk-kw { color: #5eead4; }
#code-highlight .tk-sen { color: #7dd3fc; }
#code-highlight .tk-num { color: #fbbf24; }
#code-highlight .tk-op { color: #f0a8c0; }
#code-highlight .tk-com { color: #7d93a8; }
/* 自动补全（P27）：光标量尺（隐藏，与 #script 同字体度量）+ 候选弹层 */
#code-mirror {
  position: absolute;
  z-index: 1;
  top: 0;
  bottom: 0;
  left: 45px;
  right: 0;
  margin: 0;
  overflow: hidden;
  padding: 15px 14px;
  white-space: pre;
  tab-size: 2;
  font: 14px/22px "Cascadia Code", Consolas, "Microsoft YaHei", monospace;
  visibility: hidden;
  pointer-events: none;
}
#code-mirror-marker { display: inline; }
#autocomplete {
  position: absolute;
  z-index: 6;
  min-width: 170px;
  max-width: 280px;
  max-height: 230px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid #2a3c52;
  border-radius: 10px;
  background: #102034;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.4);
}
#autocomplete[hidden] { display: none; }
.ac-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  min-height: 0;
  padding: 6px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #e7f0f8;
  cursor: pointer;
  text-align: left;
  font: 12px/1.4 "Cascadia Code", Consolas, "Microsoft YaHei", monospace;
}
.ac-item:hover { background: #1a2f47; }
.ac-item.active { background: #1c3a5c; }
.ac-item .ac-kind { flex: none; color: #68829b; font-size: 10px; }
#script::selection { background: #31536c; }
#script-msg { min-height: 19px; padding-top: 7px; color: var(--danger); font-size: 12px; white-space: pre-wrap; }
.editor-help { display: flex; flex-wrap: wrap; gap: 7px 12px; color: var(--muted); font-size: 10px; }
kbd {
  padding: 1px 5px;
  border: 1px solid #d6e0e3;
  border-bottom-width: 2px;
  border-radius: 5px;
  background: #f6f9fa;
  color: #516474;
  font: 10px inherit;
}

#canvas-wrap {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 16px;
  background: linear-gradient(160deg, #ffffff, #f7fbfa);
}
.stage-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.stage-heading p { margin-bottom: 12px; }
.canvas-shell {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  border: 1px solid #d8e8e7;
  border-radius: 15px;
  background-color: #eaf4f3;
  background-image: radial-gradient(#c9dedd 0.8px, transparent 0.8px);
  background-size: 16px 16px;
}
#canvas-shell {
  overflow: hidden;
  padding: 0;
  cursor: grab;
  touch-action: none;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
}
#canvas-shell.dragging { cursor: grabbing; }
#sim-canvas, #map-canvas {
  display: block;
  flex: none;
  max-width: none;
  border: 1px solid rgba(100, 116, 139, 0.2);
  border-radius: 12px;
  background: #eaf4f3;
  box-shadow: 0 12px 30px rgba(65, 89, 94, 0.16), 0 2px 5px rgba(65, 89, 94, 0.1);
}
#map-canvas { cursor: crosshair; }

/* 轨迹回放条（P17）：终态/暂停后出现，拖动查看任意步 */
.replay-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 11px;
}
.replay-bar[hidden] { display: flex; visibility: hidden; pointer-events: none; }
.replay-bar button {
  min-height: 32px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-soft);
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}
.replay-bar button:hover { background: #edf6f5; border-color: #b8d9d4; }
#replay-slider { flex: 1; min-width: 0; height: 16px; accent-color: var(--accent); cursor: pointer; }
#replay-label { flex: none; min-width: 88px; color: var(--muted); font-size: 11px; text-align: right; }
.stage-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 15px;
  padding-top: 11px;
  color: var(--muted);
  font-size: 11px;
}
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.legend-star { color: #eaa20b; font-size: 15px; line-height: 1; }

#messages {
  flex: 1;
  min-height: 120px;
  overflow-y: auto;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
  color: #42566a;
  font: 12px/1.7 "Cascadia Code", Consolas, "Microsoft YaHei", monospace;
  white-space: pre-wrap;
  word-break: break-word;
}
#messages:empty::before { content: "准备好后，点击「运行」看看小格会做什么吧。"; color: #8a9aa7; }
#messages .m-show { color: #1478a6; }
#messages .m-info { color: var(--warning); }
#messages .m-error { color: var(--danger); }
#messages .m-done { color: #187c5a; }
.output-tip {
  margin-top: 12px;
  padding: 11px;
  border-radius: 12px;
  background: #f0efff;
  color: #665d8f;
  font-size: 11px;
  line-height: 1.55;
}
#btn-manual {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: none;
  min-height: 40px;
  margin-top: 10px;
  padding: 9px 12px;
  border: 1px solid #c9e3de;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}
#btn-manual:hover { border-color: var(--accent); background: #d3efe7; }

/* 预置观察任务（P22）：右侧任务卡 + 底部猜答案提示条 */
.task-panel { flex: none; margin-bottom: 12px; border: 1px solid #cfe3de; border-radius: 12px; background: #f4fbf9; }
.task-panel summary {
  padding: 9px 12px;
  border-radius: 12px;
  color: var(--accent-dark);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  list-style: none;
  user-select: none;
  white-space: nowrap;
}
.task-panel summary::-webkit-details-marker { display: none; }
.task-panel summary::after { content: "▾"; margin-left: 6px; color: var(--muted); font-size: 10px; }
.task-panel[open] summary::after { transform: rotate(180deg); }
.task-body { padding: 2px 10px 10px; }
.task-intro { margin: 0 0 8px; color: #4f6f68; font-size: 11px; line-height: 1.6; }
.task-list { display: flex; flex-wrap: wrap; gap: 7px; }
.task-btn {
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid #b9dbd3;
  border-radius: 9px;
  background: #fff;
  color: var(--accent-dark);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}
.task-btn:hover { background: var(--accent-soft); border-color: var(--accent); }
#task-hintbar {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 205;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(560px, calc(100vw - 32px));
  padding: 10px 16px;
  border: 1px solid #b9dbd3;
  border-radius: 14px;
  background: #e9f9f4;
  box-shadow: 0 10px 30px rgba(32, 50, 71, 0.16);
  color: #0b6f66;
  font-size: 13px;
  font-weight: 700;
  transform: translateX(-50%);
}
#task-hintbar[hidden] { display: none; }

/* 运行错误气泡（P20）：底部居中悬浮，指向出错行 */
#error-bubble {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 210;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(560px, calc(100vw - 32px));
  padding: 10px 12px 10px 14px;
  border: 1px solid #f1c7cd;
  border-radius: 14px;
  background: #fff5f6;
  box-shadow: 0 10px 30px rgba(32, 50, 71, 0.18);
  transform: translateX(-50%);
}
#error-bubble[hidden] { display: none; }
.eb-face { flex: none; font-size: 20px; line-height: 1; }
.eb-body { min-width: 0; }
.eb-body strong { display: block; color: #a33746; font-size: 13px; }
.eb-body small { display: block; margin-top: 2px; color: #7c5a60; font-size: 11px; line-height: 1.55; }
#eb-close {
  flex: none;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid #e4b6bd;
  border-radius: 9px;
  background: #fff;
  color: #a33746;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}
#eb-close:hover { background: #fdeef0; }

.editor-page #layout { grid-template-columns: 232px minmax(0, 1fr); }
#palette {
  overflow-y: auto;
  padding: 16px;
}
.palette-intro { margin-bottom: 13px; }
.palette-title {
  margin: 16px 0 7px;
  color: #647a88;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.6px;
}
.palette-group { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.tool-btn {
  --tool-color: #a8b6c2;
  position: relative;
  width: 100%;
  min-width: 0;
  height: 43px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid #dbe5e8;
  border-radius: 11px;
  background: #f8fafb;
  color: #4e6170;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}
.tool-btn::before {
  content: "";
  width: 16px;
  height: 16px;
  flex: none;
  border-radius: 5px;
  background: var(--tool-color);
  border: 1px solid rgba(51, 65, 85, 0.13);
}
.tool-btn:hover { background: #eef6f4; border-color: #a9d3ca; }
.tool-btn.selected {
  color: #0b6f66;
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(15, 159, 145, 0.12);
}

@media (max-width: 1350px) {
  .toolbar-overlay { top: calc(100% + 8px); transform: none; }
}

@media (max-width: 1250px) {
  #layout { grid-template-columns: 310px minmax(0, 1fr) 230px; gap: 10px; padding: 10px; }
  #left, #right, #canvas-wrap { padding: 13px; }
  .brand { min-width: 140px; }
}

@media (max-width: 1000px) {
  body { height: auto; min-height: 100vh; overflow: auto; }
  #layout { grid-template-columns: minmax(290px, 0.85fr) minmax(390px, 1.15fr); min-height: 720px; }
  #right { grid-column: 1 / -1; min-height: 170px; }
  #messages { min-height: 100px; }
  .editor-page #layout { grid-template-columns: 220px minmax(0, 1fr); }
}

@media (max-width: 720px) {
  #toolbar { padding: 9px 10px; gap: 7px; }
  .brand { width: 100%; margin-bottom: 2px; }
  .brand small { display: inline; margin-left: 8px; }
  .sep { display: none; }
  #layout, .editor-page #layout { display: flex; flex-direction: column; min-height: 0; padding: 9px; }
  #left { min-height: 520px; }
  #canvas-wrap { min-height: 570px; }
  #right { min-height: 190px; }
  #palette { max-height: none; }
  .palette-group { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .canvas-shell { padding: 12px; align-items: flex-start; justify-content: flex-start; }
  #status { font-size: 11px; }
}

@media (prefers-reduced-motion: no-preference) {
  #toolbar button, #toolbar a.nav, .tool-btn { transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease; }
  #toolbar button:hover, #toolbar a.nav:hover, .tool-btn:hover { transform: translateY(-1px); }
}

.immersive-only { display: none; }
body.sim-page.immersive {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
body.sim-page.immersive .immersive-only { display: inline-block; }
body.sim-page.immersive #layout {
  display: block;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  padding: 0;
}
body.sim-page.immersive #right,
body.sim-page.immersive .stage-heading,
body.sim-page.immersive #canvas-wrap > .panel-subtitle,
body.sim-page.immersive .stage-legend { display: none; }
body.sim-page.immersive #canvas-wrap {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  padding: 64px 20px 76px;
  border: 0;
  border-radius: 0;
}
body.sim-page.immersive .canvas-shell {
  padding: 0;
  overflow: hidden;
}
body.sim-page.immersive #toolbar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 100;
  justify-content: center;
  width: max-content;
  max-width: calc(100vw - 24px);
  margin: 0 auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  backdrop-filter: none;
  box-shadow: 0 8px 28px rgba(32, 50, 71, 0.18);
}
body.sim-page.immersive #toolbar > .brand,
body.sim-page.immersive #toolbar > .nav,
body.sim-page.immersive #map-select,
body.sim-page.immersive #btn-open-map,
body.sim-page.immersive #toolbar > .sep { display: none; }
body.sim-page.immersive .toolbar-overlay {
  position: fixed;
  top: 12px;
  right: 12px;
  transform: none;
}
body.sim-page.immersive #left {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 90;
  width: min(380px, calc(100vw - 32px));
  min-height: 0;
  border-radius: 0 18px 18px 0;
  transform: translateX(-105%);
  visibility: hidden;
  pointer-events: none;
}
body.sim-page.immersive.code-open #left {
  transform: none;
  visibility: visible;
  pointer-events: auto;
}
@media (max-width: 720px) {
  body.sim-page.immersive #canvas-wrap { padding: 64px 8px 126px; }
  body.sim-page.immersive #toolbar { gap: 6px; }
  body.sim-page.immersive #toolbar button { padding: 7px 9px; }
}
@media (prefers-reduced-motion: no-preference) {
  body.sim-page.immersive #left { transition: transform 180ms ease, visibility 180ms; }
}

/* 课堂投影（P15）：沉浸 + 原生全屏，放大控件与状态文字，教室后排可读 */
body.sim-page.presenting #toolbar button,
body.sim-page.presenting #toolbar select,
body.sim-page.presenting #settings-summary {
  min-height: 46px;
  padding: 9px 15px;
  font-size: 17px;
}
body.sim-page.presenting #toolbar .btn-symbol { font-size: 18px; }
body.sim-page.presenting #settings-summary::after { font-size: 13px; }
body.sim-page.presenting #status { font-size: 16px; }
