/* 地图编辑器样式 —— 深色冷调、8px 间距网格、仅在 hover/focus 上做 120–180ms 过渡
   布局：顶部菜单栏 / 三栏工作区（左右栏可拖动改宽、可缩回）/ 底部状态栏 */

:root {
  --bg: #0d1116;
  --panel: #131920;
  --panel-2: #171e26;
  --panel-3: #1b232c;
  --line: #222b34;
  --line-2: #2c3742;
  --text: #dbe3ec;
  --text-2: #b3bfcc;
  --muted: #8593a2;
  --muted-2: #6d7b8a;
  --accent: #7aa2c8;
  --accent-2: #9dbcd9;
  --accent-soft: rgba(122, 162, 200, 0.14);
  --accent-line: rgba(122, 162, 200, 0.45);
  --ok: #82ab90;
  --warn: #c9a86a;
  --err: #c98a8a;
  --err-soft: rgba(201, 138, 138, 0.12);
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 10px;
  --gap: 8px;
  --h: 26px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: rgba(122, 162, 200, 0.28); }

/* 细滚动条 */
* { scrollbar-width: thin; scrollbar-color: #2b343e transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #28313b; border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #35404c; background-clip: content-box; }

/* ============================== 主布局 ============================== */
.app {
  display: grid;
  grid-template-rows: 36px minmax(0, 1fr) 24px;
  height: 100vh;
  width: 100vw;
  --w-left: 272px;
  --w-right: 340px;
}
.workspace {
  display: grid;
  grid-template-columns: var(--w-left) 7px minmax(0, 1fr) 7px var(--w-right);
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}
.col-left, .col-right, .col-center { min-width: 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.col-left { background: var(--panel); }
.col-right { background: var(--panel); }
.col-center { background: var(--bg); }
.app.left-collapsed .col-left { visibility: hidden; }
.app.right-collapsed .col-right { visibility: hidden; }

.col-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 0 0 8px; }
.col-head {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
  min-height: 30px;
}
.col-head .ch-title { font-size: 11.5px; font-weight: 600; letter-spacing: .4px; color: var(--text-2); }
.col-head .ch-sub { font-size: 10.5px; color: var(--muted-2); margin-left: auto; }

/* ============================== 顶部菜单栏 ============================== */
.menubar {
  display: flex; align-items: center; gap: 8px;
  padding: 0 8px;
  background: linear-gradient(180deg, #161d25, #131920);
  border-bottom: 1px solid var(--line);
  min-width: 0;
  position: relative;
  z-index: 20;
}
.mb-brand { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.mb-brand b { font-size: 12.5px; font-weight: 600; letter-spacing: .2px; }
.mb-brand i { font-style: normal; font-size: 11px; color: var(--muted-2); max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 6px;
  display: grid; place-items: center;
  font: 700 10px/1 var(--font); letter-spacing: .4px;
  color: #0d1116; background: linear-gradient(160deg, #9dbcd9, #7aa2c8);
}
.mb-menus { display: flex; gap: 1px; margin-left: 4px; min-width: 0; }
.menu { position: relative; }
.mb-btn {
  height: 24px; padding: 0 9px;
  border: 1px solid transparent; border-radius: 5px;
  background: transparent; color: var(--text-2);
  font-size: 12px; cursor: pointer;
  transition: background 130ms ease, color 130ms ease, border-color 130ms ease;
}
.mb-btn:hover { background: #1e2731; color: var(--text); }
.menu.open .mb-btn { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-2); }
.menu-pop {
  position: absolute; top: 100%; left: 0; margin-top: 5px;
  min-width: 236px; padding: 4px;
  background: #161d25;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5);
  display: flex; flex-direction: column; gap: 1px;
  z-index: 40;
}
.menu-pop[hidden] { display: none; }
.menu-item {
  display: flex; align-items: center; gap: 10px;
  height: 26px; padding: 0 8px;
  border: 0; border-radius: 5px;
  background: transparent; color: var(--text-2);
  font-size: 12px; text-align: left; cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.menu-item:hover { background: #222c36; color: var(--text); }
.menu-item > span { flex: 1 1 auto; white-space: nowrap; }
.menu-item .mi-note { font-style: normal; font-size: 10.5px; color: var(--muted-2); }
.menu-item .mi-state { font-style: normal; font-size: 10.5px; color: var(--accent-2); }
.menu-item[disabled] { opacity: .4; cursor: not-allowed; }
.menu-item[disabled]:hover { background: transparent; color: var(--text-2); }
.menu-sep { height: 1px; background: var(--line); margin: 4px 2px; }
.mb-right { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.mb-state { font-size: 11px; color: var(--muted-2); white-space: nowrap; }
.mb-state.err { color: var(--err); }
.mb-state.ok { color: var(--ok); }
.hidden-file { display: none; }

/* ============================== 分隔条 ============================== */
.splitter {
  position: relative;
  background: var(--line);
  cursor: col-resize;
  display: grid; place-items: center;
  transition: background 140ms ease;
  touch-action: none;
}
.splitter:hover { background: var(--line-2); }
.splitter .grip {
  font-size: 9px; color: var(--muted-2);
  opacity: 0; transition: opacity 140ms ease, color 140ms ease;
  pointer-events: none; user-select: none;
}
.splitter:hover .grip { opacity: 1; }
.splitter:focus-visible { outline: 2px solid var(--accent-line); outline-offset: -2px; }
.app.left-collapsed #split-left .grip,
.app.right-collapsed #split-right .grip { opacity: 1; color: var(--accent); }
.app.left-collapsed #split-left,
.app.right-collapsed #split-right { background: #2a3a49; }
.app.left-collapsed #split-left:hover,
.app.right-collapsed #split-right:hover { background: #35506a; }

/* ============================== 分区 ============================== */
.sec {
  margin: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  overflow: hidden;
}
.sec-head, .sec > summary {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 10px;
  font-size: 12px; font-weight: 600; letter-spacing: .3px;
  color: var(--text-2);
  background: var(--panel-3);
  border-bottom: 1px solid var(--line);
  user-select: none;
}
.sec > summary {
  list-style: none; cursor: pointer; border-bottom-color: transparent;
  transition: background 140ms ease, color 140ms ease;
}
.sec > summary::-webkit-details-marker { display: none; }
.sec > summary::before {
  content: "";
  width: 0; height: 0; flex: 0 0 auto;
  border-left: 4px solid currentColor;
  border-top: 3.5px solid transparent;
  border-bottom: 3.5px solid transparent;
  opacity: .65;
  transition: transform 150ms ease;
}
.sec[open] > summary::before { transform: rotate(90deg); }
.sec > summary:hover { background: #1e2731; color: var(--text); }
.sec[open] > summary { border-bottom-color: var(--line); }
.sec-body { padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.sec-note { padding: 0 10px 8px; font-size: 10.5px; line-height: 1.5; color: var(--muted-2); }
.sec-note code { font-family: var(--mono); font-size: 10px; color: var(--text-2); }
.sec-head .count, .sec-head .badge, .sec > summary .count { margin-left: auto; font-weight: 500; font-size: 11px; font-style: normal; color: var(--muted); }
.badge { padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 600; border: 1px solid transparent; }
.badge.ok { color: var(--ok); background: rgba(130, 171, 144, 0.1); border-color: rgba(130, 171, 144, 0.3); }
.badge.err { color: var(--err); background: var(--err-soft); border-color: rgba(201, 138, 138, 0.35); }
.badge.warn { color: var(--warn); background: rgba(201, 168, 106, 0.1); border-color: rgba(201, 168, 106, 0.3); }

/* ============================== 按钮 ============================== */
.mini {
  height: var(--h); padding: 0 9px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: #1c242d; color: var(--text-2);
  font-size: 12px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}
.mini:hover { background: #232d38; border-color: #3a4753; color: var(--text); }
.mini.ghost { background: transparent; }
.mini.ghost:hover { background: #1e2630; }
.mini.ico { width: 26px; padding: 0; font-size: 11px; }
.mini.danger { color: #d8a3a3; border-color: #3a2b2b; }
.mini.danger:hover { background: #2a1f1f; border-color: #6a4646; color: #eec3c3; }
.mini.strong { background: rgba(122, 162, 200, 0.16); border-color: var(--accent-line); color: var(--accent-2); }
.mini.strong:hover { background: rgba(122, 162, 200, 0.26); border-color: var(--accent); color: #dcebf8; }
.mini[disabled], .mini[disabled]:hover { opacity: .42; cursor: not-allowed; background: #161c23; border-color: #232b33; color: var(--muted-2); }

.icon-btn {
  width: 24px; height: 24px; flex: 0 0 auto;
  display: grid; place-items: center;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--panel-3); color: var(--text-2);
  cursor: pointer; font-size: 12px; line-height: 1;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}
.icon-btn:hover { background: #222c36; border-color: #3b4854; color: var(--text); }

.btn-row { display: flex; gap: 6px; padding: 0 8px 6px; flex-wrap: wrap; }
.btn-row > .mini { flex: 1 1 auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

button:focus-visible, .mini:focus-visible, .icon-btn:focus-visible, .tool-card:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid rgba(122, 162, 200, 0.7);
  outline-offset: 1px;
}

/* ============================== 可拖拽工具卡片 ============================== */
.tool-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 8px 8px 4px; }
.tool-card {
  position: relative;
  display: flex; align-items: center; gap: 6px;
  height: 38px; padding: 0 7px;
  border: 1px solid var(--line-2); border-radius: 7px;
  background: #1a222b; color: var(--text-2);
  font-size: 11.5px; text-align: left;
  cursor: grab;
  user-select: none; touch-action: none;
  transition: background 130ms ease, border-color 130ms ease, color 130ms ease, box-shadow 130ms ease;
}
.tool-card:hover { background: #222c36; border-color: #3d4a57; color: var(--text); }
.tool-card.on {
  background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-2);
  box-shadow: inset 0 0 0 1px rgba(122, 162, 200, 0.08);
}
.tool-card.on .tc-key { color: var(--accent); border-color: var(--accent-line); }
.tool-card .tc-glyph { flex: 0 0 auto; display: grid; place-items: center; width: 16px; height: 16px; }
.tool-card .tc-glyph svg { width: 16px; height: 16px; display: block; }
.tool-card .tc-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-card .tc-key {
  flex: 0 0 auto;
  font: 8.5px/1 var(--mono); color: var(--muted-2);
  border: 1px solid var(--line); border-radius: 4px; padding: 2px 3px;
}
.tool-card.dragging { opacity: .5; cursor: grabbing; }
.tool-card.wide { grid-column: span 2; }
.tool-card.danger { color: #d8a3a3; }
.tool-card.danger:hover { background: #2a1f1f; border-color: #6a4646; }

.drag-ghost {
  position: fixed; z-index: 80; pointer-events: none;
  transform: translate(-50%, -140%);
  padding: 4px 10px;
  border: 1px solid var(--accent-line); border-radius: 7px;
  background: rgba(23, 32, 42, 0.96);
  color: var(--accent-2); font-size: 11.5px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
}
.drag-ghost[hidden] { display: none; }

/* ============================== 表单 ============================== */
.field { display: grid; grid-template-columns: 68px minmax(0, 1fr); align-items: center; gap: 4px 8px; }
.field.wide { grid-template-columns: 84px minmax(0, 1fr); }
.field > .flabel { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.field > .fctl { display: flex; align-items: center; gap: 4px; min-width: 0; }
.field > .fhint { grid-column: 2; font-size: 10.5px; color: var(--muted-2); }
.field > .fhint.bad { color: var(--err); }
.field > .fhint.ok { color: var(--ok); }
.rows { display: flex; flex-direction: column; gap: 6px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }

.inp {
  height: var(--h); min-width: 0; width: 100%;
  padding: 0 6px;
  border: 1px solid #29323c; border-radius: var(--radius-sm);
  background: #0f151a; color: var(--text);
  font-size: 12px;
  transition: border-color 140ms ease, background 140ms ease;
}
.inp:hover { border-color: #36424e; }
.inp:focus { border-color: var(--accent-line); background: #101820; outline: none; }
.inp[type="number"] { -moz-appearance: textfield; }
.inp[type="number"]::-webkit-outer-spin-button, .inp[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
select.inp { cursor: pointer; padding-right: 2px; }
select.inp option { background: #131920; }
.inp.bad { border-color: #6a4646; background: #1b1517; }
.inp.sm { height: 22px; font-size: 11.5px; }
textarea.inp { height: auto; min-height: 50px; padding: 5px 6px; resize: vertical; line-height: 1.45; font-family: var(--font); }
textarea.code { font-family: var(--mono); font-size: 11.5px; }

/* 开关 */
.switch { position: relative; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 30px; height: 17px; border-radius: 9px;
  background: #232c36; border: 1px solid #313c47;
  position: relative; flex: 0 0 auto;
  transition: background 150ms ease, border-color 150ms ease;
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 11px; height: 11px; border-radius: 50%;
  background: #7b8998;
  transition: transform 150ms ease, background 150ms ease;
}
.switch input:checked + .track { background: rgba(122, 162, 200, 0.28); border-color: var(--accent-line); }
.switch input:checked + .track::after { transform: translateX(13px); background: var(--accent-2); }
.switch input:focus-visible + .track { outline: 2px solid rgba(122, 162, 200, 0.7); outline-offset: 2px; }
.switch .sw-label { font-size: 11.5px; color: var(--muted); }

.lbl { font-size: 10.5px; letter-spacing: .4px; color: var(--muted-2); padding: 2px 2px 0; }

/* ============================== 场景列表 ============================== */
.scene-list { overflow-y: auto; padding: 2px 6px 4px; display: flex; flex-direction: column; gap: 2px; max-height: 30vh; min-height: 72px; }
.scene-row {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 6px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  cursor: pointer; min-width: 0;
  transition: background 130ms ease, border-color 130ms ease;
}
.scene-row:hover { background: #1d2630; }
.scene-row.on { background: var(--accent-soft); border-color: var(--accent-line); }
.scene-row .dot { width: 7px; height: 7px; border-radius: 2px; flex: 0 0 auto; background: #4c5c6b; }
.scene-row .dot.outdoor, .scene-row .dot.campus { background: #6f8f6f; }
.scene-row .dot.dorm, .scene-row .dot.dormMale, .scene-row .dot.dormFemale { background: #8a7fa8; }
.scene-row .dot.hall, .scene-row .dot.stairs { background: #7c8fa8; }
.scene-row .dot.kitchen, .scene-row .dot.canteen { background: #a89078; }
.scene-row .dot.office, .scene-row .dot.library, .scene-row .dot.lab, .scene-row .dot.teaching { background: #78909c; }
.scene-row .nm { flex: 1 1 auto; min-width: 0; font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scene-row.on .nm { color: var(--text); }
.scene-row .sz { font: 10.5px/1 var(--mono); color: var(--muted-2); flex: 0 0 auto; }
.scene-row .err-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--err); flex: 0 0 auto; }

/* ============================== 文件 ============================== */
.file-btn {
  display: flex; align-items: center; justify-content: center;
  height: var(--h); padding: 0 8px;
  border: 1px dashed #33404c; border-radius: var(--radius-sm);
  background: #12181e; color: var(--text-2);
  font-size: 11.5px; cursor: pointer; position: relative;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}
.file-btn:hover { background: #1a222b; border-color: var(--accent-line); color: var(--text); }
.file-btn.hot { border-color: var(--accent-line); color: var(--accent-2); border-style: solid; background: rgba(122, 162, 200, 0.08); }
.cmd {
  display: block; padding: 6px 8px;
  background: #0e1419; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  font: 11px/1.5 var(--mono); color: var(--accent-2);
  word-break: break-all; user-select: all;
}
.preview {
  width: 100%; min-height: 68px; max-height: 150px; resize: vertical;
  padding: 6px 7px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: #0e1419; color: var(--text-2);
  font: 11px/1.45 var(--mono);
  white-space: pre; overflow: auto;
}
.preview:focus { border-color: var(--accent-line); }

/* ============================== 工具栏 ============================== */
.toolbar {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 6px;
  padding: 5px 8px; min-height: 36px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.tgroup { display: flex; align-items: center; gap: 3px; padding: 2px; border: 1px solid var(--line); border-radius: 7px; background: #11171d; }
.tbtn {
  height: 24px; padding: 0 7px;
  border: 1px solid transparent; border-radius: 5px;
  background: transparent; color: var(--muted);
  font-size: 11.5px; cursor: pointer; white-space: nowrap;
  transition: background 130ms ease, color 130ms ease, border-color 130ms ease;
}
.tbtn:hover { background: #1e2731; color: var(--text); }
.tbtn.ico { width: 24px; padding: 0; font-size: 13px; line-height: 1; }
.tbtn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-2); border-color: var(--accent-line); }
.tbtn[disabled] { opacity: .35; cursor: not-allowed; }
.tb-spacer { flex: 1 1 auto; }
.tb-hint { font-size: 11px; color: var(--muted-2); max-width: 48%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.door-target { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); }
.door-target .inp { width: 132px; height: 22px; }

/* ============================== 画布 ============================== */
.canvas-wrap { position: relative; flex: 1 1 auto; min-width: 0; min-height: 0; overflow: hidden; }
#canvas { display: block; width: 100%; height: 100%; cursor: crosshair; }
#canvas.panning { cursor: grabbing; }
#canvas.pan-ready { cursor: grab; }
.canvas-badge, .canvas-hint {
  position: absolute; pointer-events: none; user-select: none;
  font-size: 11px; color: var(--muted-2);
  background: rgba(13, 17, 22, 0.82);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 3px 7px;
}
.canvas-badge { top: 8px; left: 8px; }
.canvas-hint { bottom: 8px; left: 8px; }
.canvas-hint b { color: var(--text-2); font-weight: 600; }

/* ============================== 状态栏 ============================== */
.statusbar {
  display: flex; align-items: center; gap: 8px;
  padding: 0 10px;
  background: #10151a;
  border-top: 1px solid var(--line);
  font-size: 11px; color: var(--muted);
  min-width: 0; overflow: hidden;
}
.statusbar .st-tool { color: var(--accent-2); font-weight: 600; }
.statusbar .st-item { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.statusbar .mono { font-family: var(--mono); font-size: 10.5px; }
.st-sep { width: 1px; height: 12px; background: var(--line-2); flex: 0 0 auto; }
.st-valid { margin-left: auto; padding: 1px 7px; border-radius: 999px; border: 1px solid transparent; font-weight: 600; }
.st-valid.ok { color: var(--ok); background: rgba(130, 171, 144, 0.1); border-color: rgba(130, 171, 144, 0.3); }
.st-valid.err { color: var(--err); background: var(--err-soft); border-color: rgba(201, 138, 138, 0.35); }
.st-valid.warn { color: var(--warn); background: rgba(201, 168, 106, 0.1); border-color: rgba(201, 168, 106, 0.3); }

/* ============================== 规则 / 属性组 ============================== */
.grp { border: 1px solid var(--line); border-radius: var(--radius-sm); background: #141a21; overflow: hidden; }
.grp > summary {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 8px; cursor: pointer; list-style: none;
  font-size: 11.5px; font-weight: 600; color: var(--text-2);
  transition: background 130ms ease, color 130ms ease;
}
.grp > summary::-webkit-details-marker { display: none; }
.grp > summary::before {
  content: ""; width: 0; height: 0;
  border-left: 3.5px solid currentColor;
  border-top: 3px solid transparent; border-bottom: 3px solid transparent;
  opacity: .6; transition: transform 150ms ease;
}
.grp[open] > summary::before { transform: rotate(90deg); }
.grp > summary:hover { background: #1b232c; color: var(--text); }
.grp > summary .gcount { margin-left: auto; font: 10px/1 var(--mono); color: var(--muted-2); }
.grp > summary .gflag { font: 10px/1 var(--font); color: var(--warn); }
.grp-body { padding: 7px 8px 9px; display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--line); }

.item-card { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px; background: #12181e; display: flex; flex-direction: column; gap: 5px; }
.item-card.bad { border-color: #5c3f3f; background: #1a1416; }
.item-card .card-head { display: flex; align-items: center; gap: 6px; }
.item-card .card-head .ttl { font-size: 11px; color: var(--muted); flex: 1 1 auto; }
.item-card .card-head .mini { height: 20px; padding: 0 6px; font-size: 10.5px; }
.card-note { font-size: 10.5px; color: var(--err); }

.empty { padding: 10px; font-size: 11.5px; color: var(--muted-2); text-align: center; }
.stat-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-size: 10.5px; color: var(--muted); background: #12181e; border: 1px solid var(--line); border-radius: 999px; padding: 2px 7px; }
.chip b { color: var(--text-2); font-weight: 600; }

/* ============================== 校验列表 ============================== */
.issue-list { display: flex; flex-direction: column; gap: 2px; max-height: 208px; overflow-y: auto; }
.issue {
  display: flex; gap: 6px; align-items: baseline;
  padding: 4px 6px; border-radius: 5px;
  font-size: 11px; line-height: 1.4;
  border: 1px solid transparent; cursor: pointer;
  transition: background 130ms ease, border-color 130ms ease;
}
.issue:hover { background: #1c242e; border-color: var(--line-2); }
.issue .ico { flex: 0 0 auto; font-size: 10px; width: 10px; text-align: center; }
.issue.err .ico { color: var(--err); }
.issue.warn .ico { color: var(--warn); }
.issue .msg { color: var(--text-2); min-width: 0; }
.issue .path { display: block; font: 10px/1.3 var(--mono); color: var(--muted-2); word-break: break-all; }
.issue-more { font-size: 10.5px; color: var(--muted-2); padding: 2px 6px; }

/* ============================== Toast ============================== */
.toasts { position: fixed; right: 16px; bottom: 34px; display: flex; flex-direction: column; gap: 6px; z-index: 60; pointer-events: none; }
.toast {
  min-width: 140px; max-width: 340px;
  padding: 7px 11px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: #1a222b; color: var(--text);
  font-size: 12px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  opacity: 0; transform: translateY(4px);
  transition: opacity 160ms ease, transform 160ms ease;
}
.toast.in { opacity: 1; transform: translateY(0); }
.toast.ok { border-color: rgba(130, 171, 144, 0.45); }
.toast.err { border-color: rgba(201, 138, 138, 0.5); }
.toast.warn { border-color: rgba(201, 168, 106, 0.45); }

/* ============================== 模态框 ============================== */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  background: rgba(6, 9, 12, 0.62);
}
.modal-backdrop[hidden] { display: none; }
.modal {
  width: min(540px, calc(100vw - 48px));
  max-height: calc(100vh - 80px);
  display: flex; flex-direction: column;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.modal-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--panel-3); }
.modal-head b { font-size: 13px; flex: 1 1 auto; }
.modal-body { padding: 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--panel); }
.modal-note { font-size: 11.5px; color: var(--muted); line-height: 1.6; }
.modal-note code { font-family: var(--mono); font-size: 11px; color: var(--accent-2); }

.kbd-table { display: flex; flex-direction: column; gap: 3px; }
.kbd-row { display: grid; grid-template-columns: 132px 1fr; gap: 8px; align-items: baseline; font-size: 11.5px; }
.kbd-row .k { display: flex; gap: 3px; flex-wrap: wrap; }
.kbd-row .d { color: var(--muted); }
.kbd-group-title { font-size: 11px; font-weight: 600; color: var(--text-2); margin-top: 6px; letter-spacing: .3px; }
kbd {
  font: 10.5px/1.5 var(--mono);
  padding: 1px 5px;
  border: 1px solid var(--line-2); border-bottom-width: 2px;
  border-radius: 4px; background: #1a222b; color: var(--text-2);
}

/* ============================== 窄屏适配 ============================== */
@media (max-width: 1200px) {
  .app { --w-left: 240px; --w-right: 312px; }
  .tool-cards { grid-template-columns: 1fr; }
}

/* ============================== ����Ԥ���� ============================== */
.playtest {
  position: fixed; inset: 0; z-index: 900;
  display: flex; flex-direction: column;
  background: #0b0e13;
  animation: pt-in 140ms ease-out;
}
@keyframes pt-in { from { opacity: 0; transform: scale(.994); } to { opacity: 1; transform: none; } }
.playtest .pt-bar {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 10px;
  height: 36px; padding: 0 10px;
  background: var(--panel); border-bottom: 1px solid var(--line);
  color: var(--text); font-size: 12.5px;
}
.playtest .pt-bar b { font-size: 12.5px; letter-spacing: .2px; }
.playtest .pt-scene { color: var(--accent-2); font-weight: 600; }
.playtest .pt-hint { color: var(--text-2); font-size: 11.5px; margin-left: auto; }
.playtest #pt-canvas {
  flex: 1 1 auto; display: block; width: 100%; height: 100%;
  cursor: crosshair; touch-action: none;
}
.playtest .pt-foot {
  flex: 0 0 auto; height: 26px; line-height: 26px; padding: 0 10px;
  background: var(--panel-2); border-top: 1px solid var(--line);
  color: var(--text-3); font-size: 11px;
}
@media (prefers-reduced-motion: reduce) { .playtest { animation: none; } }

/* ����㣺iframe �����м����� */
.playtest #pt-frame { flex: 1 1 auto; width: 100%; height: 100%; border: 0; background: #0b0e13; }
.playtest .pt-pos { color: var(--text-3); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.playtest .pt-state { color: var(--accent-2); font-size: 11.5px; }

/* ============================== ¼ò½àģʽ ============================== */
body.mode-simple .adv-only { display: none !important; }
body.mode-simple #sec-rules .sec-note.adv-note { display: none; }
