/* =========================================================================
   NEXISLE · Studio 设计语言
   高端深色工坊：曜石黑底 · 暖金主色 · 细腻发丝边线 · 克制的微动效
   （替代旧的「米色 + 像素字 + AI 渐变紫」风格）
   ========================================================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
  /* 背景层级：曜石深灰（带一丝冷调，不是纯黑） */
  --bg-0: #0a0c10;
  --bg-1: #0f1218;
  --bg-2: #141821;
  --bg-3: #1a1f2b;
  --bg-4: #212837;

  /* 面板与控件 */
  --panel: rgba(18, 22, 30, .88);
  --panel-solid: #12161e;
  --panel-2: #161b25;
  --panel-3: #1c2230;
  --inset: #0c0f15;
  --inset-2: #131824;

  /* 发丝边线 */
  --line: #242b3a;
  --line-2: #2e3648;
  --line-strong: #39425a;

  /* 文字 */
  --tx-1: #eef1f7;
  --tx-2: #a4adbe;
  --tx-3: #6c7688;

  /* 品牌主色：暖金（锻造/工坊气质，远离 AI 紫蓝渐变） */
  --acc: #e8b54d;
  --acc-hi: #f4cd6f;
  --acc-lo: #c99a35;
  --acc-ink: #241a05;
  --acc-soft: rgba(232, 181, 77, .13);
  --acc-line: rgba(232, 181, 77, .4);

  /* 辅助色 */
  --ok: #3ecf8e;
  --ok-soft: rgba(62, 207, 142, .12);
  --warn: #f0a13c;
  --err: #e5484d;
  --err-soft: rgba(229, 72, 77, .12);
  --info: #58a6ff;
  --info-soft: rgba(88, 166, 255, .12);

  /* 尺寸 */
  --r-xs: 5px;
  --r-sm: 7px;
  --r-md: 10px;
  --r-lg: 14px;

  /* 阴影（低透明、分层、克制的环境感） */
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-2: 0 8px 28px rgba(0, 0, 0, .42);
  --shadow-3: 0 22px 70px rgba(0, 0, 0, .58);
  --ring: 0 0 0 1px var(--acc-line), 0 0 0 4px rgba(232, 181, 77, .08);

  /* 字体 */
  --font-ui: "Inter", "PingFang SC", "Microsoft YaHei", "Segoe UI", "Noto Sans SC", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Consolas, monospace;

  --topbar-h: 54px;
  --bar-h: 42px;
  --ease: cubic-bezier(.22, .8, .3, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: var(--font-ui);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
  color: var(--tx-1);
  background: var(--bg-0);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
button { font-family: inherit; }
::-moz-selection { background: rgba(232, 181, 77, .28); }
::selection { background: rgba(232, 181, 77, .28); }

#app { position: fixed; inset: 0; z-index: 1; width: 100vw; height: 100vh; display: block; touch-action: none; }

/* ---------- 加载页 ---------- */
#loading {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(120% 120% at 50% 20%, #131722 0%, var(--bg-0) 60%);
  transition: opacity .5s var(--ease), visibility .5s;
}
#loading.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-box { text-align: center; }
.pixel-logo { font-size: 30px; letter-spacing: 2px; color: var(--acc); text-shadow: 0 0 24px rgba(232, 181, 77, .35); }
.loader-title { font-size: 15px; font-weight: 700; margin-top: 18px; letter-spacing: .5px; color: var(--tx-1); }
.loader-sub { font-size: 10px; color: var(--tx-3); margin-top: 10px; letter-spacing: 4px; text-transform: uppercase; }
.progress { width: 240px; max-width: 70vw; height: 3px; margin: 26px auto 12px; background: var(--bg-3); border-radius: 99px; overflow: hidden; }
.progress-bar { height: 100%; width: 40%; background: linear-gradient(90deg, var(--acc-lo), var(--acc-hi)); animation: load 1.3s var(--ease) infinite; border-radius: 99px; }
@keyframes load { 0% { margin-left: -40% } 100% { margin-left: 100% } }
.loader-text { color: var(--tx-3); font-size: 11px; margin-top: 8px; }

/* ---------- 顶栏 ---------- */
#topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h); z-index: 60;
  display: flex; align-items: center; gap: 10px; padding: 0 14px;
  padding-top: env(safe-area-inset-top, 0);
  background: rgba(13, 16, 22, .86);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line);
  overflow-x: auto; overflow-y: hidden;
  scrollbar-width: thin;
}
body.embed #topbar, body.embed #leftPanel, body.embed #rightPanel, body.embed #fabBlocks,
body.embed #fabPanel, body.embed #fabDock, body.embed #mobileBar, body.embed #leftReopen,
body.embed #rightReopen, body.embed #statusbar, body.embed #multiPanel, body.embed #dao3Modal,
body.embed #codeModal, body.embed #sheetBackdrop { display: none !important; }
#topbar::-webkit-scrollbar { height: 3px; }
#topbar::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 2px; }

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex-shrink: 0; }
.brand .logo {
  width: 26px; height: 26px; flex: none; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--acc-hi), var(--acc-lo));
  border-radius: 8px; color: var(--acc-ink); font-size: 15px; font-weight: 800;
  box-shadow: 0 2px 10px rgba(232, 181, 77, .35), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.brand .title { font-weight: 700; font-size: 14px; letter-spacing: .5px; color: var(--tx-1); white-space: nowrap; }
.brand .title b { color: var(--acc); font-weight: 800; }
.brand .ver {
  font-family: var(--font-mono); font-size: 9px; color: var(--tx-3);
  border: 1px solid var(--line-2); padding: 1px 6px; border-radius: 99px; white-space: nowrap;
}
.status-group { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.status-pill {
  display: inline-flex; align-items: center; font-size: 10px; color: var(--tx-2);
  border: 1px solid var(--line-2); background: var(--inset); padding: 4px 10px; border-radius: 99px; white-space: nowrap;
}
.status-pill .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); margin-right: 5px; box-shadow: 0 0 8px var(--ok); }
.status-pill.mode-dot { color: var(--acc); border-color: var(--acc-line); background: var(--acc-soft); }

.mode-switch { display: flex; background: var(--inset); border: 1px solid var(--line); border-radius: 9px; padding: 3px; flex: none; }
.mode-btn {
  border: none; background: transparent; color: var(--tx-2); font-size: 12px; font-weight: 600;
  padding: 5px 16px; border-radius: 7px; cursor: pointer; transition: all .18s var(--ease); white-space: nowrap;
}
.mode-btn:hover { color: var(--tx-1); }
.mode-btn.active { background: linear-gradient(145deg, var(--acc-hi), var(--acc-lo)); color: var(--acc-ink); box-shadow: 0 2px 8px rgba(232, 181, 77, .3); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; flex: none;
  background: transparent; border: 1px solid transparent; border-radius: 8px; color: var(--tx-2);
  font-size: 15px; cursor: pointer; transition: all .16s var(--ease);
}
.icon-btn:hover { background: var(--panel-3); color: var(--tx-1); border-color: var(--line-2); }
.icon-btn:active { transform: translateY(1px); }

.top-actions { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.tbtn {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; white-space: nowrap;
  padding: 7px 12px; border-radius: 8px; cursor: pointer; transition: all .16s var(--ease);
  background: transparent; border: 1px solid var(--line-2); color: var(--tx-2);
}
.tbtn:hover { background: var(--panel-3); color: var(--tx-1); border-color: var(--line-strong); }
.tbtn:active { transform: translateY(1px); }
.tbtn.danger { color: #f28b8e; border-color: rgba(229, 72, 77, .4); }
.tbtn.danger:hover { background: var(--err-soft); color: #ffb3b5; border-color: var(--err); }
.tbtn.primary {
  background: linear-gradient(145deg, var(--acc-hi), var(--acc-lo)); border-color: var(--acc-lo);
  color: var(--acc-ink); box-shadow: 0 2px 12px rgba(232, 181, 77, .3);
}
.tbtn.primary:hover { filter: brightness(1.06); box-shadow: 0 4px 16px rgba(232, 181, 77, .4); }
.tbtn.disabled { opacity: .4; cursor: not-allowed; }
.divider { width: 1px; height: 20px; background: var(--line-2); margin: 0 4px; flex: none; }

/* ---------- 两侧面板 ---------- */
.panel {
  position: fixed; z-index: 50; display: flex; flex-direction: column;
  background: var(--panel); backdrop-filter: blur(16px) saturate(1.15); -webkit-backdrop-filter: blur(16px) saturate(1.15);
  border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-2);
  overflow: hidden;
  transition: transform .28s var(--ease), box-shadow .2s var(--ease), opacity .2s var(--ease);
}
/* 折叠：点击面板内收起按钮后整体滑出视口（JS 加 .collapsed）。
   此前缺这条规则，导致按钮点了没反应、左右栏「无法收起」。 */
#leftPanel.collapsed { transform: translateX(calc(-100% - 30px)); pointer-events: none; }
#rightPanel.collapsed { transform: translateX(calc(100% + 30px)); pointer-events: none; }
#leftPanel.collapsed, #rightPanel.collapsed { opacity: 0; }
.panel-close {
  position: absolute; top: 8px; right: 8px; z-index: 2; width: 26px; height: 26px; flex: none;
  display: grid; place-items: center; background: transparent; border: 1px solid transparent;
  border-radius: 7px; color: var(--tx-3); font-size: 15px; cursor: pointer; transition: all .16s var(--ease);
}
.panel-close:hover { background: var(--panel-3); color: var(--tx-1); }
#leftPanel .panel-close { font-size: 19px; }
#rightPanel .tabs { padding-right: 32px; }

.panel-reopen {
  position: fixed; top: 50%; transform: translateY(-50%); z-index: 49;
  width: 22px; padding: 14px 0; display: none; align-items: center; justify-content: center;
  background: var(--panel); border: 1px solid var(--line); color: var(--tx-3); cursor: pointer;
  transition: all .18s var(--ease);
}
.panel-reopen span { writing-mode: vertical-rl; font-size: 11px; letter-spacing: 3px; }
.panel-reopen:hover { color: var(--acc); border-color: var(--acc-line); background: var(--acc-soft); }
#leftReopen { left: 0; border-radius: 0 9px 9px 0; border-left: none; }
#rightReopen { right: 0; border-radius: 9px 0 0 9px; border-right: none; }
.panel-reopen:not([hidden]) { display: flex; }

@media (min-width: 821px) {
  #leftPanel { top: calc(var(--topbar-h) + env(safe-area-inset-top, 0) + 14px); left: 14px; width: 108px; bottom: auto; max-height: calc(100vh - var(--topbar-h) - 40px); }
  #rightPanel { top: calc(var(--topbar-h) + env(safe-area-inset-top, 0) + 14px); right: 14px; width: 322px; max-height: calc(100vh - var(--topbar-h) - 40px); }
}
@media (max-width: 820px) {
  #leftPanel { left: 8px; width: 118px; padding: 9px; gap: 6px; align-items: stretch; }
  #rightPanel { right: 8px; width: min(322px, 92vw); }
}
#leftPanel { left: 10px; width: 108px; padding: 10px; gap: 6px; align-items: stretch; }
#rightPanel { right: 10px; width: 322px; }
@media (max-width: 1280px) { #rightPanel { width: 296px; } }
@media (max-width: 1100px) { #rightPanel { width: 272px; } }

.panel-section { padding: 10px; }
.panel-section.section-tools { flex: none; }
.panel-section h3 {
  font-size: 10px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
  color: var(--tx-3); margin-bottom: 10px;
}
.sheet-handle { display: none; }

/* ---------- 工具条 ---------- */
.tool-grid { display: flex; flex-direction: column; gap: 5px; align-items: stretch; width: 100%; }
.tool-btn {
  display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 10px 4px;
  background: transparent; border: 1px solid transparent; border-radius: var(--r-md);
  color: var(--tx-2); cursor: pointer; transition: all .16s var(--ease);
}
.tool-btn svg, .tool-btn .ic { font-size: 18px; line-height: 1; }
.tool-btn span { font-size: 10px; font-weight: 600; letter-spacing: .5px; }
.tool-btn:hover { background: var(--panel-3); color: var(--tx-1); }
.tool-btn:active { transform: translateY(1px); }
.tool-btn.active { background: var(--acc-soft); border-color: var(--acc-line); color: var(--acc); }
.tool-btn.active span { color: var(--acc); }

.brush-size { margin-top: 6px; padding: 0 2px; width: 100%; }
.brush-size label { font-size: 10px; color: var(--tx-3); display: block; margin-bottom: 4px; text-align: center; font-weight: 600; }
.brush-size input[type=range] { width: 100%; accent-color: var(--acc); }
.fill-hint { margin-top: 8px; font-size: 10px; color: var(--warn); background: var(--warn-soft, rgba(240, 161, 60, .1)); padding: 7px; border-radius: var(--r-xs); border: 1px solid rgba(240, 161, 60, .3); text-align: center; line-height: 1.5; }

.mirror-box { margin-top: 8px; padding: 0 2px; width: 100%; }
.mirror-box > label { font-size: 10px; color: var(--tx-3); display: block; margin-bottom: 5px; text-align: center; font-weight: 600; }
.mirror-toggles { display: flex; gap: 5px; }
.mirror-btn {
  flex: 1; padding: 5px 0; font-size: 11px; font-weight: 700; text-align: center;
  background: transparent; border: 1px solid var(--line-2); border-radius: var(--r-xs);
  color: var(--tx-3); cursor: pointer; transition: all .16s var(--ease);
}
.mirror-btn:hover { background: var(--panel-3); color: var(--tx-1); }
.mirror-btn.active { background: var(--acc-soft); border-color: var(--acc-line); color: var(--acc); }
.mirror-box-mobile { display: flex; align-items: center; gap: 8px; }
.mirror-box-mobile .mirror-label { font-size: 11px; color: var(--tx-3); font-weight: 700; }
.mirror-box-mobile .mirror-btn { flex: 0 0 auto; padding: 5px 12px; }

/* makerlogin75：放置方式（连续/单个）切换 */
.paint-mode { margin-top: 8px; padding: 0 2px; width: 100%; display: flex; align-items: center; gap: 8px; }
.paint-mode .pm-label { font-size: 10px; color: var(--tx-3); font-weight: 600; white-space: nowrap; }
.pm-seg { flex: 1; display: flex; gap: 4px; background: var(--inset); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 3px; }
.pm-btn {
  flex: 1; padding: 5px 0; font-size: 11px; font-weight: 700; text-align: center;
  background: transparent; border: none; border-radius: var(--r-xs); color: var(--tx-3); cursor: pointer;
  transition: all .16s var(--ease);
}
.pm-btn:hover { color: var(--tx-1); }
.pm-btn.active { background: var(--acc-soft); color: var(--acc); box-shadow: inset 0 0 0 1px var(--acc-line); }

/* ---------- 方块库 ---------- */
.palette-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; flex: none; }
.count-badge { font-family: var(--font-mono); font-size: 9px; color: var(--acc); border: 1px solid var(--acc-line); padding: 1px 7px; border-radius: 99px; background: var(--acc-soft); }
.palette-search { position: relative; margin-bottom: 9px; flex: none; }
.palette-search::before {
  content: "🔍"; position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  font-size: 12px; line-height: 1; pointer-events: none; color: var(--tx-3); z-index: 1;
}
.palette-search input {
  width: 100%; padding: 8px 11px 8px 30px; border-radius: var(--r-sm); border: 1px solid var(--line-2);
  background: var(--inset); color: var(--tx-1); font-size: 12px; outline: none; transition: all .16s var(--ease);
}
.palette-search input::placeholder { color: var(--tx-3); }
.palette-search input:focus { border-color: var(--acc-line); box-shadow: var(--ring); }

.cat-tabs { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; flex: none; }
.cat-tab {
  padding: 4px 11px; font-size: 11px; font-weight: 600; border-radius: 99px; cursor: pointer;
  background: transparent; border: 1px solid var(--line-2); color: var(--tx-3); transition: all .16s var(--ease);
}
.cat-tab:hover { background: var(--panel-3); color: var(--tx-1); }
.cat-tab.active { background: var(--acc-soft); color: var(--acc); border-color: var(--acc-line); }

.palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; }
.swatch {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 5px 3px;
  background: transparent; border: 1px solid transparent; border-radius: var(--r-sm); cursor: pointer; transition: all .15s var(--ease);
}
.swatch .thumb { width: 38px; height: 38px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, .08); image-rendering: pixelated; box-shadow: var(--shadow-1); }
.swatch .nm { font-size: 8px; color: var(--tx-3); text-align: center; line-height: 1.1; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.swatch:hover { background: var(--panel-3); }
.swatch:hover .nm { color: var(--tx-1); }
.swatch.active { border-color: var(--acc-line); background: var(--acc-soft); }
.swatch.active .nm { color: var(--acc); font-weight: 700; }

/* ---------- 右侧面板 Tab ---------- */
.tabs { display: flex; border-bottom: 1px solid var(--line); flex: none; background: var(--panel-2); }
.tab {
  flex: 1; padding: 11px 4px; text-align: center; font-size: 12px; font-weight: 600; color: var(--tx-3);
  background: transparent; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
  cursor: pointer; transition: all .16s var(--ease); white-space: nowrap;
}
.tab:hover { color: var(--tx-1); }
.tab.active { color: var(--acc); border-bottom-color: var(--acc); }
.tab-body { flex: 1; overflow-y: auto; padding: 13px; display: flex; flex-direction: column; min-height: 0; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }
.tab-pane[hidden] { display: none; }
#pane-blocks.active { display: flex; flex-direction: column; height: 100%; }

/* ---------- 表单控件 ---------- */
.field { display: block; font-size: 11px; color: var(--tx-3); margin-bottom: 13px; }
.field span { color: var(--tx-1); float: right; font-family: var(--font-mono); font-size: 11px; }
.field input[type=range] { width: 100%; margin-top: 6px; accent-color: var(--acc); }
.field input[type=color] { width: 100%; height: 34px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--inset); padding: 3px; cursor: pointer; }
.field-col { font-size: 11px; color: var(--tx-3); margin-bottom: 13px; }
.field-inline { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 13px; font-size: 12px; color: var(--tx-1); }
.field-inline input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--acc); cursor: pointer; }
.field-col > span { display: block; margin-bottom: 6px; font-weight: 700; color: var(--tx-2); }
.vec3, .stat { background: var(--inset); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; font-family: var(--font-mono); font-size: 11px; color: var(--tx-2); }

.mini-btn {
  margin-top: 7px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--tx-1);
  font-size: 11px; font-weight: 600; padding: 7px 12px; border-radius: var(--r-sm); cursor: pointer; transition: all .16s var(--ease);
}
.mini-btn:hover { background: var(--panel-3); border-color: var(--line-strong); }
.mini-btn:active { transform: translateY(1px); }
.mini-btn.primary { background: linear-gradient(145deg, var(--acc-hi), var(--acc-lo)); border-color: var(--acc-lo); color: var(--acc-ink); }
.mini-btn.primary:hover { filter: brightness(1.06); }

.empty-hint { color: var(--tx-3); font-size: 11px; line-height: 1.7; }
#inspectorContent .insp-row { display: flex; justify-content: space-between; font-size: 11px; padding: 4px 0; border-bottom: 1px solid var(--line); }
#inspectorContent .insp-row b { color: var(--tx-3); font-weight: 500; }
#inspectorContent .insp-row span { color: var(--tx-1); font-family: var(--font-mono); }

/* ---------- 脚本面板 ---------- */
.script-tip { font-size: 10px; color: var(--tx-3); line-height: 1.7; margin-bottom: 9px; }
.script-tip code { background: var(--acc-soft); color: var(--acc); padding: 1px 5px; border-radius: 4px; }
.script-actions { display: flex; gap: 7px; margin-bottom: 8px; flex-wrap: wrap; }
.script-subtabs, .cm-subtabs { display: flex; gap: 6px; margin-bottom: 8px; }
.cm-subtabs { padding: 6px 8px 0; }
.ssub-tab {
  flex: 1; padding: 6px 4px; font-size: 11px; font-weight: 700; text-align: center; border-radius: var(--r-sm);
  background: transparent; border: 1px solid var(--line-2); color: var(--tx-3); cursor: pointer; transition: all .16s var(--ease);
}
.ssub-tab:hover { color: var(--tx-1); }
.ssub-tab.active { background: var(--acc-soft); border-color: var(--acc-line); color: var(--acc); }
#scriptCode, #scriptCodeS {
  width: 100%; min-height: 150px; resize: vertical; background: var(--inset); color: #d6e2f0;
  border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 9px 11px;
  font-family: var(--font-mono); font-size: 12px; line-height: 1.6; outline: none;
}
#scriptCode:focus, #scriptCodeS:focus { border-color: var(--acc-line); box-shadow: var(--ring); }
.console { margin-top: 9px; background: #0b0e14; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; min-height: 70px; max-height: 160px; overflow-y: auto; font-family: var(--font-mono); font-size: 11px; line-height: 1.7; color: #9fd4a8; }
.console .err { color: #f38ba8; }
.console .line { white-space: pre-wrap; word-break: break-all; }

/* ---------- 弹窗 ---------- */
.modal { position: fixed; inset: 0; z-index: 90; background: rgba(5, 7, 10, .6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; }
.modal[hidden] { display: none !important; }
.modal-card {
  width: 460px; max-width: 92vw; max-height: 88vh; overflow-y: auto;
  background: var(--panel-solid); border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: var(--shadow-3);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 15px 17px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-weight: 700; font-size: 15px; color: var(--tx-1); }
.modal-close {
  width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--line-2);
  background: transparent; color: var(--tx-3); border-radius: 7px; font-size: 14px; cursor: pointer; transition: all .16s var(--ease);
}
.modal-close:hover { background: var(--err-soft); color: #ffb3b5; border-color: var(--err); }
.modal-body { padding: 17px; font-size: 12px; color: var(--tx-2); line-height: 1.7; }
.modal-actions { display: flex; gap: 7px; margin: 10px 0; flex-wrap: wrap; }

/* makerlogin75：脚本新手引导 */
.onboard-card { max-width: 560px; }
.onboard-lead { margin: 0 0 12px; color: var(--tx-1); font-weight: 600; }
.onboard-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 9px; }
.onboard-list li { color: var(--tx-2); }
.onboard-list code { font-family: var(--font-mono); font-size: 11px; background: var(--inset); border: 1px solid var(--line-2); border-radius: 4px; padding: 1px 5px; color: var(--acc); }
.onboard-list .tag-c, .onboard-list .tag-s { font-family: var(--font-mono); font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 99px; }
.onboard-list .tag-c { background: var(--acc-soft); color: var(--acc); border: 1px solid var(--acc-line); }
.onboard-list .tag-s { background: var(--warn-soft, rgba(240, 161, 60, .12)); color: #f0a13c; border: 1px solid rgba(240, 161, 60, .3); }
.onboard-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.muted { color: var(--tx-3); font-size: 11px; }
.help-h { font-weight: 700; font-size: 13px; color: var(--acc); margin: 13px 0 7px; }
.help-h:first-child { margin-top: 0; }
.help-list { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.help-list li { font-size: 12px; line-height: 1.6; padding-left: 14px; position: relative; color: var(--tx-2); }
.help-list li::before { content: "›"; position: absolute; left: 0; color: var(--acc); font-weight: 700; }
.help-list code { background: var(--acc-soft); color: var(--acc); padding: 1px 5px; border-radius: 4px; font-family: var(--font-mono); font-size: 11px; }

.import-table { width: 100%; border-collapse: collapse; margin-bottom: 5px; }
.import-table td { padding: 8px 9px; border-bottom: 1px solid var(--line); font-size: 12px; }
.import-table td:first-child { color: var(--tx-3); width: 40%; }
.import-table td:last-child { color: var(--tx-1); font-family: var(--font-mono); }
.import-warn { margin-top: 9px; background: rgba(240, 161, 60, .1); border: 1px solid rgba(240, 161, 60, .3); border-radius: var(--r-sm); padding: 9px 11px; font-size: 11px; color: var(--warn); line-height: 1.6; }
.import-note { margin-top: 7px; font-size: 11px; color: var(--ok); }
.import-err { font-size: 12px; color: #f28b8e; line-height: 1.7; }

#importProgress { position: fixed; top: calc(var(--topbar-h) + env(safe-area-inset-top, 0) + 14px); left: 50%; transform: translateX(-50%); z-index: 70; }
#importProgress[hidden] { display: none !important; }
.ip-card { min-width: 240px; max-width: 80vw; background: var(--panel-solid); border: 1px solid var(--line-2); border-radius: var(--r-md); box-shadow: var(--shadow-2); padding: 12px 14px; display: flex; flex-direction: column; gap: 9px; }
.ip-text { font-size: 12px; font-weight: 600; color: var(--tx-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ip-bar { flex: 1; height: 5px; border-radius: 99px; background: var(--bg-3); overflow: hidden; }
.ip-bar > i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--acc-lo), var(--acc-hi)); transition: width .2s var(--ease); }

/* ---------- 全屏脚本编辑器 ---------- */
.code-modal { background: rgba(5, 7, 10, .7); padding: 16px; align-items: stretch; }
.code-card {
  width: min(1060px, 96vw); height: min(700px, 92vh); display: flex; flex-direction: column;
  background: var(--panel-solid); border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: var(--shadow-3); overflow: hidden;
}
.code-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.code-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; color: var(--tx-1); }
.code-logo { color: var(--acc); font-size: 17px; }
.code-sub { font-size: 11px; color: var(--warn); font-weight: 600; }
.code-tools { display: flex; align-items: center; gap: 6px; }
.code-fontlabel { font-size: 10px; color: var(--tx-3); }
.code-close {
  width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--line-2);
  background: transparent; color: var(--tx-3); border-radius: 7px; font-size: 14px; cursor: pointer; transition: all .16s var(--ease);
}
.code-close:hover { background: var(--err-soft); color: #ffb3b5; border-color: var(--err); }
.code-body { flex: 1 1 auto; min-height: 400px; overflow: hidden; position: relative; display: flex; }
.code-body .CodeMirror { height: 100% !important; width: 100%; font-size: 14px; background: var(--inset); color: #d6e2f0; }
.code-body .CodeMirror-gutters { background: var(--panel-2); border-right: 1px solid var(--line); }
.code-foot { padding: 9px 14px; border-top: 1px solid var(--line); font-size: 11px; color: var(--tx-3); display: flex; justify-content: space-between; }
#cmStatus { font-family: var(--font-mono); }

.code-tree-col { width: 200px; flex: none; border-right: 1px solid var(--line); background: var(--panel-2); padding: 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.code-tree-group { display: flex; flex-direction: column; gap: 2px; }
.code-tree-head { display: flex; align-items: center; justify-content: space-between; font-size: 10px; font-weight: 700; letter-spacing: 1px; color: var(--tx-3); text-transform: uppercase; margin-bottom: 4px; }
.tree-add { width: 20px; height: 20px; border-radius: 6px; border: 1px solid var(--line-2); background: transparent; color: var(--tx-3); cursor: pointer; font-size: 13px; line-height: 1; transition: all .16s var(--ease); }
.tree-add:hover { background: var(--acc-soft); color: var(--acc); border-color: var(--acc-line); }
.code-tree-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.tree-file { display: flex; align-items: center; gap: 4px; padding: 5px 7px; border-radius: var(--r-sm); font-size: 11px; color: var(--tx-2); cursor: pointer; transition: all .14s var(--ease); }
.tree-file:hover { background: var(--panel-3); }
.tree-file.active { background: var(--acc-soft); color: var(--acc); }
.tree-file .tree-name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-mono); }
.tree-file .tree-del { border: none; background: transparent; color: inherit; opacity: .4; cursor: pointer; font-size: 12px; padding: 0 2px; }
.tree-file .tree-del:hover { opacity: 1; color: var(--err); }
.cm-editor-col { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; }
.cm-editor-col .cm-subtabs { flex: none; }

.script-split { display: flex; gap: 8px; }
.script-tree { width: 130px; flex: none; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--inset); padding: 8px; overflow-y: auto; }
.tree-head-mini { font-size: 10px; font-weight: 700; color: var(--tx-3); margin-bottom: 5px; letter-spacing: 1px; }
.tree-file-mini { display: block; width: 100%; text-align: left; font-size: 11px; padding: 5px 7px; border-radius: var(--r-sm); border: none; background: transparent; color: var(--tx-2); cursor: pointer; transition: all .14s var(--ease); font-family: var(--font-mono); }
.tree-file-mini:hover { background: var(--panel-3); }
.tree-file-mini.active { background: var(--acc-soft); color: var(--acc); }
.script-mini { flex: 1 1 auto; }

/* ---------- 运行模式 HUD ---------- */
#playHud { position: fixed; inset: 0; z-index: 45; pointer-events: none; }
.crosshair { position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; transform: translate(-50%, -50%); opacity: .8; }
.crosshair::before, .crosshair::after { content: ""; position: absolute; background: rgba(255, 255, 255, .85); box-shadow: 0 0 4px rgba(0, 0, 0, .6); }
.crosshair::before { left: 50%; top: 0; width: 2px; height: 100%; transform: translateX(-50%); }
.crosshair::after { top: 50%; left: 0; height: 2px; width: 100%; transform: translateY(-50%); }
.play-hint {
  position: absolute; left: 50%; bottom: 60px; transform: translateX(-50%);
  background: rgba(13, 16, 22, .85); backdrop-filter: blur(10px); border: 1px solid var(--line-2);
  color: var(--tx-1); font-size: 12px; padding: 9px 15px; border-radius: 99px; white-space: nowrap; transition: opacity .5s;
}
.play-hint.fade { opacity: 0; pointer-events: none; }
.hint-close { margin-left: 6px; cursor: pointer; opacity: .55; font-size: 14px; line-height: 1; padding: 0 3px; border-radius: 4px; }
.hint-close:hover { opacity: 1; background: rgba(255, 255, 255, .1); }
.play-stats { position: absolute; left: 14px; top: calc(var(--topbar-h) + env(safe-area-inset-top, 0) + 14px); font-family: var(--font-mono); font-size: 11px; color: var(--tx-2); text-shadow: 0 1px 3px rgba(0, 0, 0, .8); line-height: 1.8; }

#btnExitPlay {
  position: fixed; right: 14px; top: calc(var(--topbar-h) + env(safe-area-inset-top, 0) + 48px); z-index: 48;
  padding: 8px 16px; font-size: 12px; font-weight: 600; border-radius: 9px; cursor: pointer;
  background: rgba(13, 16, 22, .85); backdrop-filter: blur(10px); border: 1px solid var(--line-2); color: var(--tx-1); transition: all .16s var(--ease);
}
#btnExitPlay:hover { background: var(--err-soft); color: #ffb3b5; border-color: var(--err); }
#btnExitPlay:active { transform: translateY(1px); }

#btnView, #btnFly {
  position: fixed; right: 14px; z-index: 48; padding: 8px 15px; font-size: 12px; font-weight: 600;
  border-radius: 9px; cursor: pointer; background: rgba(13, 16, 22, .85); backdrop-filter: blur(10px);
  border: 1px solid var(--line-2); color: var(--tx-1); transition: all .16s var(--ease); white-space: nowrap;
}
#btnView { top: calc(var(--topbar-h) + env(safe-area-inset-top, 0) + 96px); }
#btnFly { top: calc(var(--topbar-h) + env(safe-area-inset-top, 0) + 144px); }
#btnView:hover, #btnFly:hover { background: var(--panel-3); border-color: var(--line-strong); }
#btnView:active, #btnFly:active { transform: translateY(1px); }
#btnFly.active { background: var(--info-soft); color: var(--info); border-color: rgba(88, 166, 255, .45); }
#leftPanel { top: calc(var(--topbar-h) + env(safe-area-inset-top, 0) + 96px); }

/* ---------- 状态栏 ---------- */
#statusbar {
  position: fixed; left: 0; right: 0; bottom: 0; height: 26px; z-index: 55;
  display: flex; align-items: center; gap: 14px; padding: 0 14px;
  background: rgba(13, 16, 22, .88); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
  font-size: 10px; color: var(--tx-3); font-family: var(--font-mono);
}
#statMode { color: var(--acc); font-weight: 700; }
#statFps { color: var(--acc); font-weight: 600; }
#statTip { margin-left: auto; color: var(--tx-3); font-style: normal; font-family: var(--font-ui); }

body.playing #leftPanel, body.playing #rightPanel, body.playing #topbar .top-actions,
body.playing #topbar .brand .ver, body.playing #statusbar { display: none; }
body.playing #topbar { background: rgba(13, 16, 22, .55); }

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--line-strong); background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }

/* ---------- 触屏控件 ---------- */
#touchControls { position: fixed; inset: 0; z-index: 46; pointer-events: none; display: none; }
#touchControls.show { display: block; }
#joystick {
  position: absolute; left: 26px; bottom: 60px; width: 118px; height: 118px; border-radius: 50%;
  background: rgba(13, 16, 22, .4); border: 1px solid rgba(255, 255, 255, .15); pointer-events: auto; display: none;
}
#joyKnob {
  position: absolute; left: 50%; top: 50%; width: 50px; height: 50px; border-radius: 50%; transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, .25); border: 1px solid rgba(255, 255, 255, .3); backdrop-filter: blur(4px);
}
#btnJump {
  position: fixed; right: 30px; bottom: 74px; z-index: 47; width: 74px; height: 74px; border-radius: 50%;
  background: rgba(13, 16, 22, .5); border: 1px solid rgba(255, 255, 255, .2); color: var(--tx-1);
  font-size: 13px; font-weight: 700; cursor: pointer; display: none; transition: all .15s var(--ease);
}
#btnJump:active { background: var(--acc-soft); border-color: var(--acc-line); transform: scale(.95); }
body.touch #joystick { display: block; pointer-events: auto; }
body.touch #btnExitPlay { display: block; }

/* ---------- 移动端 ---------- */
#mobileBar, #fabDock, .menu-only { display: none }
@media (max-width: 1440px) { .tbtn { padding: 6px 10px; } }
@media (max-width: 1100px) { .brand .title { font-size: 12px; } }
@media (max-width: 820px) {
  #topbar { gap: 6px; padding: 0 8px; padding-top: env(safe-area-inset-top, 0); }
  .top-actions .tbtn .lbl { display: none; }
  #leftPanel { display: none; }
  #rightPanel { display: none; }
  #mobileBar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 58;
    background: rgba(13, 16, 22, .92); backdrop-filter: blur(14px); border-top: 1px solid var(--line);
    padding: 7px 10px calc(7px + env(safe-area-inset-bottom, 0)); gap: 7px; overflow-x: auto;
  }
  .mb-tool {
    flex: none; display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 54px;
    padding: 7px 8px; border-radius: var(--r-md); background: transparent; border: 1px solid transparent;
    color: var(--tx-2); font-size: 10px; font-weight: 600; cursor: pointer; transition: all .16s var(--ease);
  }
  .mb-tool .ic { font-size: 17px; }
  .mb-tool.active { background: var(--acc-soft); border-color: var(--acc-line); color: var(--acc); }
  .paint-mode-mobile { flex: 0 0 auto; display: flex; align-items: center; padding: 0; margin: 0; }
  .paint-mode-mobile .pm-seg { flex: 0 0 auto; width: auto; gap: 3px; padding: 2px; }
  .paint-mode-mobile .pm-btn { padding: 6px 12px; min-width: 46px; }
  #fabDock { display: flex; position: fixed; right: 12px; bottom: 90px; z-index: 57; flex-direction: column; gap: 10px; }
  .fab {
    width: 54px; height: 54px; border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    background: var(--panel-solid); border: 1px solid var(--line-2); color: var(--tx-1); font-size: 18px; box-shadow: var(--shadow-2); cursor: pointer; transition: all .16s var(--ease);
  }
  .fab span { font-size: 9px; color: var(--tx-3); }
  .fab:active { transform: scale(.94); }
  .sheet-handle { display: block; width: 38px; height: 4px; border-radius: 99px; background: var(--line-strong); margin: 7px auto 3px; }
}
@media (max-width: 820px) and (max-height: 480px) { #joystick { bottom: 20px; } #btnJump { bottom: 30px; } }

#sheetBackdrop { position: fixed; inset: 0; z-index: 75; background: rgba(5, 7, 10, .55); opacity: 0; pointer-events: none; transition: opacity .25s; }
#sheetBackdrop.show { opacity: 1; pointer-events: auto; }

/* ---------- 数据统计面板 ---------- */
.stat-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 13px; }
.stat-summary > div { background: var(--inset); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 9px 6px; text-align: center; }
.stat-big { font-size: 17px; font-weight: 800; color: var(--acc); line-height: 1.2; font-family: var(--font-mono); }
.stat-label { font-size: 9px; color: var(--tx-3); margin-top: 2px; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.stat-cell { display: flex; flex-direction: column; gap: 3px; background: var(--inset); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; }
.stat-cell b { font-size: 10px; color: var(--tx-3); font-weight: 600; }
.stat-cell span { font-family: var(--font-mono); color: var(--tx-1); font-size: 12px; }
.stat-row-bar { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.stat-row-bar:last-child { border-bottom: none; }
.stat-name { width: 100px; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--tx-2); }
.stat-bar-track { flex: 1; height: 12px; background: var(--inset); border-radius: 99px; overflow: hidden; }
.stat-bar-fill { height: 100%; background: linear-gradient(90deg, var(--acc-lo), var(--acc-hi)); border-radius: 99px; }
.stat-count { font-size: 10px; color: var(--tx-3); width: 70px; text-align: right; white-space: nowrap; font-family: var(--font-mono); }

.sec-title { font-size: 10px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--tx-3); margin: 14px 0 8px; }
.range-row { display: flex; align-items: center; gap: 4px; margin-bottom: 5px; font-size: 11px; }
.range-row span:first-child { width: 20px; color: var(--tx-3); }
.range-row input[type=number] { width: 56px; padding: 3px 6px; border: 1px solid var(--line-2); border-radius: var(--r-xs); background: var(--inset); color: var(--tx-1); font-family: var(--font-mono); font-size: 11px; outline: none; }
.range-row input[type=number]:focus { border-color: var(--acc-line); }

/* =====================  追加：功能组件（auth / 发布 / 下拉 / 模板 / 生成器）  ===================== */

/* ---- 登录 / 用户菜单 / 发布按钮（auth-widget.js 动态注入） ---- */
.auth-wrap { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; z-index: 70; }
.auth-chip { position: relative; display: inline-flex; align-items: center; flex-shrink: 0; z-index: 70; }
.auth-loading { color: var(--tx-3); font-size: 12px; }

.auth-publish-btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--acc-lo); background: linear-gradient(145deg, var(--acc-hi), var(--acc-lo));
  color: var(--acc-ink); padding: 7px 14px; border-radius: 8px; cursor: pointer;
  font-size: 12px; font-weight: 700; white-space: nowrap;
  box-shadow: 0 2px 12px rgba(232, 181, 77, .3); transition: all .16s var(--ease);
}
.auth-publish-btn:hover { filter: brightness(1.06); box-shadow: 0 4px 16px rgba(232, 181, 77, .4); }
.auth-publish-btn:active { transform: translateY(1px); }

.auth-login {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--tx-1);
  padding: 7px 14px; border-radius: 8px; cursor: pointer; font-size: 12px; font-weight: 600;
  text-decoration: none; white-space: nowrap; transition: all .16s var(--ease);
}
.auth-login:hover { background: var(--panel-3); border-color: var(--acc-line); color: var(--acc); }
.auth-login:active { transform: translateY(1px); }

.auth-user {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--tx-1);
  padding: 3px 12px 3px 3px; border-radius: 99px; cursor: pointer; font-size: 12px; font-weight: 600;
  text-decoration: none; white-space: nowrap; max-width: 170px; transition: all .16s var(--ease);
}
.auth-user:hover { background: var(--panel-3); border-color: var(--line-strong); }
.auth-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; background: var(--panel-3); flex: none; display: block; }
.auth-avatar--fallback { display: grid; place-items: center; font-size: 13px; font-weight: 800; color: var(--acc-ink); background: linear-gradient(145deg, var(--acc-hi), var(--acc-lo)); }
.auth-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.auth-menu {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 160px; padding: 5px;
  background: var(--panel-solid); border: 1px solid var(--line-2); border-radius: var(--r-md);
  box-shadow: var(--shadow-2); display: flex; flex-direction: column; gap: 2px; z-index: 80;
}
.auth-menu[hidden] { display: none; }
.auth-menu-item {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: var(--r-sm);
  border: none; background: transparent; color: var(--tx-1); font-size: 12px; cursor: pointer;
  text-decoration: none; transition: background .14s var(--ease);
}
.auth-menu-item:hover { background: var(--panel-3); }
.auth-menu-item.auth-logout { color: #f28b8e; }
.auth-menu-item.auth-logout:hover { background: var(--err-soft); }

/* ---- 发布弹窗（nx-modal） ---- */
.nx-modal-overlay {
  position: fixed; inset: 0; background: rgba(5, 7, 10, .62); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; z-index: 200; padding: 16px;
}
.nx-modal {
  width: 100%; max-width: 400px; background: var(--panel-solid); color: var(--tx-1);
  border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: var(--shadow-3); overflow: hidden;
}
.nx-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.nx-modal-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.nx-modal-close {
  width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--line-2);
  background: transparent; color: var(--tx-3); border-radius: 7px; font-size: 15px; cursor: pointer; transition: all .16s var(--ease);
}
.nx-modal-close:hover { background: var(--err-soft); color: #ffb3b5; border-color: var(--err); }
.nx-modal-body { padding: 16px; display: flex; flex-direction: column; gap: 13px; }
.nx-field { display: flex; flex-direction: column; gap: 6px; }
.nx-field label { font-size: 12px; font-weight: 600; color: var(--tx-2); }
.nx-field input, .nx-field textarea, .nx-field select {
  font: inherit; font-size: 13px; padding: 9px 11px; border-radius: var(--r-sm);
  border: 1px solid var(--line-2); background: var(--inset); color: var(--tx-1); resize: vertical; outline: none; transition: all .16s var(--ease);
}
.nx-field input:focus, .nx-field textarea:focus, .nx-field select:focus { border-color: var(--acc-line); box-shadow: var(--ring); }
.nx-field option { background: var(--panel-solid); }
.nx-cover-preview { min-height: 90px; border: 1px dashed var(--line-2); border-radius: var(--r-sm); overflow: hidden; display: grid; place-items: center; background: var(--inset); }
.nx-cover-preview img { width: 100%; display: block; }
.nx-cover-preview:empty::after { content: '封面将自动截取当前画面'; font-size: 11px; color: var(--tx-3); padding: 30px 0; }
.nx-msg { font-size: 12px; min-height: 16px; color: #f28b8e; }
.nx-modal-foot { padding: 13px 16px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; }
.nx-btn {
  border: 1px solid var(--acc-lo); cursor: pointer; font: inherit; font-weight: 700; font-size: 13px; color: var(--acc-ink);
  background: linear-gradient(145deg, var(--acc-hi), var(--acc-lo)); padding: 9px 18px; border-radius: var(--r-sm);
  box-shadow: 0 2px 12px rgba(232, 181, 77, .3); transition: all .16s var(--ease);
}
.nx-btn:hover:not(:disabled) { filter: brightness(1.06); }
.nx-btn:disabled { opacity: .55; cursor: default; }

/* ---- 顶部导出下拉 ---- */
.tbtn-wrap { position: relative; display: inline-flex; }
.dropdown-menu {
  position: fixed; top: calc(var(--topbar-h) + 6px); left: 0; z-index: 80;
  min-width: 190px; padding: 5px; display: flex; flex-direction: column; gap: 2px;
  background: var(--panel-solid); border: 1px solid var(--line-2); border-radius: var(--r-md); box-shadow: var(--shadow-2);
}
.dropdown-menu[hidden] { display: none; }
.dm-item {
  display: block; width: 100%; text-align: left; cursor: pointer;
  font: inherit; font-weight: 600; font-size: 12px; color: var(--tx-1);
  background: transparent; border: none; border-radius: var(--r-sm); padding: 8px 10px; transition: background .14s var(--ease);
}
.dm-item:hover { background: var(--panel-3); }
.dm-item.danger { color: #f28b8e; }
.dm-sep { height: 1px; background: var(--line-2); margin: 4px 2px; }
/* 「更多」下拉靠右对齐，避免溢出视口；fixed 定位逃脱 #topbar overflow 裁剪 */
.more-menu { right: 14px; left: auto; }

/* ---- 世界生成器（设置弹窗） ---- */
.gen-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 8px 0; }
.gen-btn { font-size: 10px; padding: 7px 4px; }

/* ---- 属性面板操作条 ---- */
.insp-actions { display: flex; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line-2); }
.insp-actions .mini-btn { flex: 1; }

/* ---- 帮助弹窗（大） ---- */
.modal-lg { max-width: 560px; }
.help-table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 11px; }
.help-table td { padding: 6px 9px; border: 1px solid var(--line); vertical-align: top; color: var(--tx-2); }
.help-table td:first-child { white-space: nowrap; background: var(--panel-2); font-weight: 600; width: 140px; color: var(--tx-1); }

/* ---- 游戏模板弹窗 ---- */
#templateModal .modal-body { padding: 16px 18px 20px; }
.tpl-sub { font-size: 13px; color: var(--tx-2); margin-bottom: 14px; }
.tpl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.tpl-card {
  display: flex; flex-direction: column; align-items: center; gap: 7px; text-align: center;
  padding: 20px 12px; border: 1px solid var(--line-2); border-radius: var(--r-md);
  background: var(--panel-2); color: var(--tx-1); cursor: pointer; transition: all .18s var(--ease);
}
.tpl-card:hover { transform: translateY(-3px); border-color: var(--acc-line); background: var(--panel-3); box-shadow: var(--shadow-2); }
.tpl-emoji { font-size: 32px; line-height: 1; }
.tpl-name { font-weight: 700; font-size: 14px; }
.tpl-desc { font-size: 11px; color: var(--tx-3); line-height: 1.5; }
@media (max-width: 640px) { .tpl-grid { grid-template-columns: 1fr; } }

/* ---- 移动端组件基础样式 ---- */
.mb-tool {
  flex: 1 0 auto; min-width: 54px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  border: 1px solid transparent; background: transparent; color: var(--tx-2);
  padding: 8px 5px; border-radius: var(--r-md); cursor: pointer; font-size: 10px; font-weight: 600; transition: all .16s var(--ease);
  pointer-events: auto; position: relative;
}
.mb-tool.active { background: var(--acc-soft); border-color: var(--acc-line); color: var(--acc); }
.fab {
  width: 54px; height: 54px; border-radius: 16px;
  border: 1px solid var(--line-2); background: var(--panel-solid); color: var(--tx-1); font-size: 18px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  box-shadow: var(--shadow-2); transition: all .16s var(--ease); pointer-events: auto; position: relative;
}
.fab span { font-size: 9px; color: var(--tx-3); }
.fab:active { transform: scale(.94); }

/* =====================  顶栏精简（去冗余、防溢出）  ===================== */
/* mode-switch 已能表达编辑/运行，隐藏重复的 MODE 胶囊 */
.status-pill.mode-dot { display: none; }
/* 联机中徽章保留金色提示 */
.status-pill.netplay { color: var(--acc); border-color: var(--acc-line); background: var(--acc-soft); }
/* 中高分辨率以下隐藏 PARTS / NET 统计胶囊，给操作按钮让位 */
@media (max-width: 1620px) {
  .status-group .status-pill:not(.netplay) { display: none; }
}
@media (max-width: 1620px) {
  #topbar { gap: 8px; }
  .tbtn { padding: 6px 10px; font-size: 11.5px; }
}
@media (max-width: 1380px) {
  /* 超窄时把「神岛迁移 / 模板」等次级按钮文本去掉，只留图标 */
  #btnDao3, #btnTemplate { font-size: 0; gap: 0; }
  #btnDao3::first-letter, #btnTemplate::first-letter { font-size: 13px; }
}
