/* ============================================================
 * 白膜工作台 · 样式（暗色电影感）
 * 配色与用户白膜场景一致：#0a0a0a 底 / #ffd250 琥珀 / #2ec4b6 青
 * ============================================================ */

:root {
  --bg0: #05070d;
  --bg1: #0b0e16;
  --bg2: #10141e;
  --bg3: #161c29;
  --line: #1e2635;
  --line2: #2a3448;
  --text: #e9edf5;
  --text2: #8b94a8;
  --text3: #565f73;
  --amber: #ffd250;
  --amber-dim: rgba(255, 210, 80, 0.14);
  --teal: #2ec4b6;
  --teal-dim: rgba(46, 196, 182, 0.14);
  --red: #ff6b6b;
  --blue: #5b8cff;
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --mono: "SF Mono", "Cascadia Code", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  background: var(--bg0);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #232b3d; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #2f3a52; }
::-webkit-scrollbar-track { background: transparent; }

#app { display: flex; flex-direction: column; height: 100vh; }

/* ------------------------------------------------------------ */
/* 顶栏                                                          */
/* ------------------------------------------------------------ */
#topbar {
  flex: 0 0 52px;
  display: flex; align-items: center; gap: 18px;
  padding: 0 16px;
  background: linear-gradient(180deg, #0c1018, #090c13);
  border-bottom: 1px solid var(--line);
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; user-select: none; }
.brand-logo { flex: 0 0 auto; filter: drop-shadow(0 0 8px rgba(255, 210, 80, 0.35)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text .cn { font-size: 15px; font-weight: 700; letter-spacing: 1px; }
.brand-text .en { font-size: 8.5px; letter-spacing: 2.6px; color: var(--text3); }

.search {
  flex: 1 1 auto; max-width: 460px;
  display: flex; align-items: center; gap: 8px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  height: 32px;
  color: var(--text3);
  transition: border-color 0.15s;
}
.search:focus-within { border-color: var(--line2); color: var(--text2); }
.search input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-size: 12px; font-family: inherit;
}
.search input::placeholder { color: var(--text3); }

.actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text2);
  font-size: 12px; cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg3); color: var(--text); border-color: var(--line2); }
.btn.primary {
  background: var(--amber-dim);
  border-color: rgba(255, 210, 80, 0.45);
  color: var(--amber);
}
.btn.primary:hover { background: rgba(255, 210, 80, 0.22); color: #ffe68f; }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; justify-content: center; margin-top: 10px; }

/* ------------------------------------------------------------ */
/* 主区                                                            */
/* ------------------------------------------------------------ */
#main {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 262px 1fr;
  min-height: 0;
}
#main:has(#detail:not([hidden])) { grid-template-columns: 262px 1fr auto; }

/* ---- 左侧场景库 ---- */
#library {
  display: flex; flex-direction: column;
  background: var(--bg1);
  border-right: 1px solid var(--line);
  min-height: 0;
}
.lib-head {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px 10px;
  font-size: 12px; font-weight: 600; letter-spacing: 1px;
  color: var(--text2);
  border-bottom: 1px solid var(--line);
}
.lib-count {
  font-size: 10px; font-weight: 400; color: var(--text3);
  background: var(--bg2); border: 1px solid var(--line);
  padding: 1px 7px; border-radius: 8px;
  font-variant-numeric: tabular-nums;
}
.lib-ops { margin-left: auto; display: flex; gap: 4px; }
.lib-ops button {
  background: none; border: none; color: var(--text3);
  font-size: 11px; cursor: pointer; padding: 2px 5px; border-radius: 4px;
}
.lib-ops button:hover { color: var(--amber); background: var(--bg2); }

#sceneList { flex: 1 1 auto; overflow-y: auto; padding: 8px; }
.lib-empty {
  padding: 28px 12px; text-align: center;
  color: var(--text3); font-size: 11.5px; line-height: 1.8;
}
.lib-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.12s;
  position: relative;
}
.lib-item:hover { background: var(--bg2); }
.lib-item.active { background: var(--bg3); border-color: rgba(255, 210, 80, 0.35); }
.lib-thumb {
  flex: 0 0 84px; height: 48px;
  background: #000; border-radius: 4px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
}
.lib-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lib-thumb-ph { color: var(--text3); font-size: 18px; }
.lib-info { flex: 1; min-width: 0; }
.lib-title {
  font-size: 12px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 3px;
}
.lib-item.active .lib-title { color: var(--amber); }
.lib-sub {
  display: flex; align-items: center; gap: 6px;
  font-size: 10px; color: var(--text3);
  font-variant-numeric: tabular-nums;
}
.lib-loc { max-width: 76px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tier {
  font-size: 9px; padding: 1px 5px; border-radius: 3px;
  letter-spacing: 0.5px; flex: 0 0 auto;
}
.tier-A { color: var(--amber); background: var(--amber-dim); border: 1px solid rgba(255,210,80,.25); }
.tier-B { color: var(--teal); background: var(--teal-dim); border: 1px solid rgba(46,196,182,.25); }
.lib-del {
  position: absolute; top: 4px; right: 4px;
  width: 18px; height: 18px;
  background: var(--bg3); border: 1px solid var(--line2); border-radius: 4px;
  color: var(--text3); font-size: 12px; line-height: 1;
  cursor: pointer; opacity: 0; transition: opacity 0.12s;
}
.lib-item:hover .lib-del { opacity: 1; }
.lib-del:hover { color: var(--red); border-color: var(--red); }

.lib-foot {
  flex: 0 0 auto;
  border-top: 1px solid var(--line);
  padding: 10px 12px 12px;
}
#stats {
  display: flex; flex-direction: column; gap: 3px;
  font-size: 10.5px; color: var(--text3);
}
#stats b { color: var(--text2); font-weight: 600; }

/* ---- 中央视口 ---- */
#viewport { position: relative; min-width: 0; overflow: hidden; background: var(--bg0); }
#emptyHint {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; pointer-events: none;
  transition: opacity 0.3s;
}
#emptyHint.hide { opacity: 0; }
.empty-icon {
  font-size: 44px; color: rgba(255, 210, 80, 0.5);
  text-shadow: 0 0 30px rgba(255, 210, 80, 0.35);
  margin-bottom: 8px;
  animation: pulse 3.2s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: .55; transform: scale(1); } 50% { opacity: 1; transform: scale(1.06); } }
.empty-title { font-size: 15px; font-weight: 600; letter-spacing: 1px; color: var(--text2); }
.empty-sub { font-size: 11.5px; color: var(--text3); text-align: center; line-height: 1.9; }

/* 拖拽遮罩 */
#dropMask {
  position: absolute; inset: 0; z-index: 40;
  background: rgba(5, 7, 13, 0.82);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(3px);
}
.drop-box {
  border: 2px dashed rgba(255, 210, 80, 0.55);
  border-radius: 14px;
  padding: 46px 70px;
  text-align: center;
  color: var(--amber);
  font-size: 14px; letter-spacing: 1px;
  background: rgba(255, 210, 80, 0.05);
}
.drop-icon { font-size: 30px; margin-bottom: 10px; }

/* ---- 卡片视图 ---- */
#gridView { position: absolute; inset: 0; overflow-y: auto; padding: 18px; }
#gridCards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 14px;
}
.grid-empty { grid-column: 1/-1; text-align: center; color: var(--text3); padding: 60px 0; font-size: 12px; }
.card {
  background: var(--bg1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.16s, border-color 0.16s, box-shadow 0.16s;
}
.card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 210, 80, 0.4);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
}
.card.active { border-color: var(--amber); }
.card-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  display: flex; align-items: center; justify-content: center;
  color: var(--text3); font-size: 26px;
  border-bottom: 1px solid var(--line);
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-thumb .tier { position: absolute; top: 7px; left: 7px; backdrop-filter: blur(4px); }
.card-dur {
  position: absolute; right: 7px; bottom: 7px;
  font-size: 10px; color: var(--text);
  background: rgba(0, 0, 0, 0.65);
  padding: 2px 6px; border-radius: 3px;
  font-variant-numeric: tabular-nums;
}
.card-body { padding: 10px 12px 12px; }
.card-title {
  font-size: 12.5px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 4px;
}
.card.active .card-title { color: var(--amber); }
.card-sub { font-size: 10.5px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ------------------------------------------------------------ */
/* 右侧详情面板                                                   */
/* ------------------------------------------------------------ */
#detail {
  width: 470px;
  background: var(--bg1);
  border-left: 1px solid var(--line);
  display: flex; flex-direction: column;
  min-height: 0;
  animation: slideIn 0.22s ease;
}
@keyframes slideIn { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }

.d-head {
  flex: 0 0 auto;
  display: flex; align-items: flex-start; gap: 10px;
  padding: 13px 14px 11px;
  border-bottom: 1px solid var(--line);
}
.d-title-box { flex: 1; min-width: 0; }
.d-title {
  font-size: 14px; font-weight: 700; letter-spacing: 0.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 5px;
}
.d-sub { display: flex; align-items: center; gap: 8px; font-size: 10.5px; color: var(--text3); }
.d-close {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 5px;
  color: var(--text2); font-size: 15px; line-height: 1; cursor: pointer;
}
.d-close:hover { color: var(--text); background: var(--bg3); }

.d-stage {
  position: relative;
  margin: 14px 14px 0;
  aspect-ratio: 16 / 9;
  background: #000;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.55);
}
.d-stage:fullscreen { margin: 0; border: none; border-radius: 0; aspect-ratio: auto; }
.scene-frame { width: 100%; height: 100%; border: 0; display: block; background: #000; }
.d-loading {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--text3); font-size: 12px; letter-spacing: 1px;
  background: var(--bg1);
}
.d-loading.fail { color: var(--red); }

.d-controls {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 9px;
  padding: 11px 14px;
}
.ctl-play {
  flex: 0 0 auto;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: var(--amber-dim);
  border: 1px solid rgba(255, 210, 80, 0.45);
  border-radius: 50%;
  color: var(--amber); cursor: pointer;
  transition: all 0.15s;
}
.ctl-play:hover { background: rgba(255, 210, 80, 0.25); }
.ctl-time {
  font-size: 11px; color: var(--text2);
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
  min-width: 52px;
}
.ctl-track { position: relative; flex: 1; height: 20px; display: flex; align-items: center; }
.ctl-track input[type="range"] {
  width: 100%; height: 3px;
  -webkit-appearance: none; appearance: none;
  background: var(--line2); border-radius: 2px;
  outline: none; cursor: pointer;
}
.ctl-track input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 8px rgba(255, 210, 80, 0.6);
  cursor: pointer;
}
.ctl-track input[type="range"]:disabled::-webkit-slider-thumb { background: var(--text3); box-shadow: none; cursor: not-allowed; }
.ctl-ticks { position: absolute; left: 0; right: 0; top: 50%; height: 9px; pointer-events: none; transform: translateY(-50%); }
.ctl-ticks i {
  position: absolute; top: 0;
  width: 2px; height: 9px;
  background: rgba(46, 196, 182, 0.85);
  transform: translateX(-1px);
  border-radius: 1px;
}
.ctl-speed {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 5px;
  color: var(--text2); font-size: 11px; font-family: inherit;
  height: 26px; padding: 0 4px; cursor: pointer; outline: none;
}
.ctl-icon {
  flex: 0 0 auto;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 5px;
  color: var(--text2); cursor: pointer;
  transition: all 0.15s;
}
.ctl-icon:hover { color: var(--amber); border-color: rgba(255, 210, 80, 0.4); }

.d-meta {
  flex: 1 1 auto; overflow-y: auto;
  padding: 4px 14px 16px;
  border-top: 1px solid var(--line);
  margin-top: 4px;
}
.d-meta-row {
  display: flex; gap: 10px;
  padding: 6px 0;
  font-size: 11.5px;
  border-bottom: 1px dashed rgba(30, 38, 53, 0.7);
}
.d-meta-row .k { flex: 0 0 34px; color: var(--text3); }
.d-meta-row .v { color: var(--text2); line-height: 1.7; word-break: break-all; }
.d-shots { margin-top: 2px; }
.d-shots .d-meta-row { border-bottom: none; padding-bottom: 2px; }
.shot-list { display: flex; flex-wrap: wrap; gap: 5px; padding: 2px 0 8px; }
.shot {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 4px;
  color: var(--text2); font-size: 10.5px;
  padding: 4px 8px; cursor: pointer;
  transition: all 0.13s;
}
.shot b { color: var(--teal); font-weight: 600; margin-right: 4px; font-variant-numeric: tabular-nums; }
.shot:hover { border-color: rgba(46, 196, 182, 0.5); color: var(--text); }
.d-ops { display: flex; gap: 8px; padding-top: 12px; }
.op {
  flex: 1;
  height: 30px;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 6px;
  color: var(--text2); font-size: 11.5px; cursor: pointer;
  transition: all 0.15s;
}
.op:hover { color: var(--text); border-color: var(--line2); }
.op.danger:hover { color: var(--red); border-color: rgba(255, 107, 107, 0.5); }
.op.primary { background: var(--amber-dim); border-color: rgba(255,210,80,.4); color: var(--amber); }
.op.primary:hover { background: rgba(255,210,80,.22); }

/* ------------------------------------------------------------ */
/* Toast                                                          */
/* ------------------------------------------------------------ */
#toasts {
  position: fixed; bottom: 26px; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  z-index: 100; pointer-events: none;
}
.toast {
  background: rgba(16, 20, 30, 0.92);
  border: 1px solid var(--line2);
  border-left: 3px solid var(--teal);
  color: var(--text);
  font-size: 12px;
  padding: 9px 16px; border-radius: 6px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  opacity: 0; transform: translateY(8px);
  transition: all 0.25s;
  max-width: 70vw;
}
.toast.show { opacity: 1; transform: none; }
.toast.ok { border-left-color: var(--teal); }
.toast.warn { border-left-color: var(--amber); }
.toast.err { border-left-color: var(--red); }

/* ------------------------------------------------------------ */
/* 模态框                                                          */
/* ------------------------------------------------------------ */
#modal {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(4, 6, 10, 0.72);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
  opacity: 0; transition: opacity 0.2s;
}
#modal.show { opacity: 1; }
.modal-box {
  width: min(760px, 92vw); max-height: 86vh;
  background: var(--bg1);
  border: 1px solid var(--line2);
  border-radius: 12px;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7);
  transform: translateY(10px); transition: transform 0.2s;
}
#modal.show .modal-box { transform: none; }
.modal-head {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 14px; font-weight: 700; letter-spacing: 0.5px;
}
.modal-head button {
  width: 26px; height: 26px;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 5px;
  color: var(--text2); font-size: 15px; cursor: pointer;
}
.modal-head button:hover { color: var(--text); }
#modalBody { flex: 1 1 auto; overflow-y: auto; padding: 16px 18px 20px; }
.modal-loading { color: var(--text3); text-align: center; padding: 40px 0; font-size: 12px; }
.modal-tip {
  margin-top: 14px; padding: 10px 12px;
  background: var(--amber-dim); border: 1px solid rgba(255, 210, 80, 0.25);
  border-radius: 6px; color: var(--amber);
  font-size: 11.5px; line-height: 1.8;
}

/* 导入报告 */
.rep {
  border: 1px solid var(--line);
  border-left: 3px solid var(--line2);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 9px;
  background: var(--bg2);
}
.rep.ok { border-left-color: var(--teal); }
.rep.err { border-left-color: var(--red); }
.rep-head { font-size: 12px; font-weight: 600; margin-bottom: 3px; }
.rep-msg { font-size: 11px; color: var(--text2); line-height: 1.7; word-break: break-all; }
.rep-warns { font-size: 10.5px; color: var(--text3); line-height: 1.8; margin-top: 5px; }

/* 规范弹窗 */
.spec-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.spec-actions .op { flex: 0 0 auto; padding: 0 14px; text-decoration: none; display: inline-flex; align-items: center; }
.spec-pre {
  white-space: pre-wrap; word-break: break-word;
  font-size: 11.5px; line-height: 1.85;
  color: var(--text2);
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  font-family: var(--font);
}

/* ------------------------------------------------------------ */
/* 响应式（窄屏隐藏库面板由详情接管时简单降级）                     */
/* ------------------------------------------------------------ */
@media (max-width: 1100px) {
  #library { width: 220px; }
  #detail { width: 400px; }
}

/* ============================================================
 * v2 · 入口视图（Cinemap 风 · 深色星空）
 * ============================================================ */
#view-entry { position: fixed; inset: 0; z-index: 40; background: var(--bg0); overflow: hidden; }
#starfield { position: absolute; inset: 0; width: 100%; height: 100%; }

.en-top {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
}
.en-top-actions { display: flex; gap: 8px; }

.en-scroll {
  position: relative; z-index: 2;
  height: calc(100% - 62px);
  overflow-y: auto; padding: 0 28px 40px;
  scrollbar-width: thin;
}
.en-hero { text-align: center; padding: 5vh 0 4vh; }
.en-mascot { margin-bottom: 18px; filter: drop-shadow(0 6px 24px rgba(255, 210, 80, 0.25)); }
.en-hero h1 {
  font-size: 30px; font-weight: 700; letter-spacing: 0.5px;
  background: linear-gradient(180deg, #fff, #b9c2d8);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.en-sub { margin: 12px auto 30px; max-width: 560px; color: var(--text2); font-size: 13px; line-height: 1.8; }

.en-cards { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.en-card {
  display: flex; align-items: center; gap: 16px; text-align: left;
  width: 300px; padding: 18px 20px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line2); border-radius: 14px;
  color: var(--text); cursor: pointer;
  transition: transform 0.18s, border-color 0.18s, background 0.18s;
}
.en-card:hover { transform: translateY(-3px); border-color: rgba(255, 210, 80, 0.55); background: rgba(255, 210, 80, 0.05); }
.en-card.primary { border-color: rgba(255, 210, 80, 0.4); background: rgba(255, 210, 80, 0.06); }
.en-card-icon {
  flex: 0 0 auto; width: 52px; height: 52px; border-radius: 12px;
  display: grid; place-items: center; color: var(--amber);
  background: var(--amber-dim); border: 1px solid rgba(255, 210, 80, 0.25);
}
.en-card-text { display: flex; flex-direction: column; gap: 4px; }
.en-card-text b { font-size: 15px; }
.en-card-text i { font-style: normal; font-size: 11.5px; color: var(--text3); line-height: 1.5; }

.en-sec { max-width: 1080px; margin: 34px auto 0; }
.en-sec-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.en-sec-head h2 { font-size: 15px; font-weight: 700; letter-spacing: 1px; }
.en-sec-head h2::before { content: ''; display: inline-block; width: 3px; height: 13px; background: var(--amber); margin-right: 8px; border-radius: 2px; vertical-align: -1px; }
.en-sec-tip { font-size: 11px; color: var(--text3); }

.env-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.env-card {
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  background: var(--bg1); cursor: pointer; text-align: left;
  transition: transform 0.18s, border-color 0.18s; color: var(--text);
}
.env-card:hover { transform: translateY(-3px); border-color: rgba(255, 210, 80, 0.5); }
.env-card .env-prev { display: block; width: 100%; height: 92px; background: linear-gradient(160deg, #232a3a, #12151f); }
.env-card .env-info { padding: 10px 12px 12px; }
.env-card .env-name { font-size: 13px; font-weight: 600; }
.env-card .env-desc { font-size: 10.5px; color: var(--text3); margin-top: 3px; }

.mine-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.mine-empty {
  grid-column: 1 / -1; padding: 34px; text-align: center;
  border: 1px dashed var(--line2); border-radius: 12px; color: var(--text3); font-size: 12px;
}
.mine-card {
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  background: var(--bg1); cursor: pointer; text-align: left; color: var(--text);
  transition: transform 0.18s, border-color 0.18s;
}
.mine-card:hover { transform: translateY(-3px); border-color: rgba(255, 210, 80, 0.5); }
.mine-thumb { position: relative; height: 104px; background: #0d1017; }
.mine-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mine-thumb .ph { width: 100%; height: 100%; display: grid; place-items: center; color: var(--text3); font-size: 22px; }
.mine-badge {
  position: absolute; left: 8px; top: 8px; font-size: 10px; padding: 2px 7px; border-radius: 20px;
  background: rgba(5, 7, 13, 0.72); border: 1px solid var(--line2); color: var(--text2);
}
.mine-badge.native { color: var(--amber); border-color: rgba(255, 210, 80, 0.4); }
.mine-body { padding: 10px 12px 12px; }
.mine-title { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mine-sub { font-size: 10.5px; color: var(--text3); margin-top: 3px; }
.en-foot { text-align: center; color: var(--text3); font-size: 11px; margin-top: 48px; }
.en-foot a { color: var(--text2); }

.lib-back { flex: 0 0 auto; }

/* ============================================================
 * v2 · 编辑器视图（Cinemap 导演台 · 浅色）
 * ============================================================ */
#view-editor {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column;
  --ed-panel: #ffffff; --ed-bg: #f4f3ef; --ed-line: #e4e1d7; --ed-line2: #d4d0c3;
  --ed-text: #23262d; --ed-text2: #7d828e; --ed-text3: #a8adb8;
  --ed-accent: #c8891a; --ed-accent-soft: rgba(200, 137, 26, 0.12);
  --ed-danger: #c2533f;
  background: var(--ed-bg); color: var(--ed-text);
}
.ed-top {
  flex: 0 0 48px; display: flex; align-items: center; gap: 10px;
  padding: 0 12px; background: var(--ed-panel); border-bottom: 1px solid var(--ed-line);
}
.ed-back {
  width: 30px; height: 30px; border: none; border-radius: 8px; cursor: pointer;
  background: none; color: var(--ed-text2); display: grid; place-items: center;
}
.ed-back:hover { background: #f0eee8; color: var(--ed-text); }
.ed-env-badge {
  font-size: 11px; padding: 3px 9px; border-radius: 20px;
  background: var(--ed-accent-soft); color: var(--ed-accent); border: 1px solid rgba(200, 137, 26, 0.25);
}
.ed-name {
  flex: 0 1 240px; height: 28px; padding: 0 8px; font-size: 13px; font-weight: 600;
  border: 1px solid transparent; border-radius: 7px; background: none; color: var(--ed-text);
  outline: none; font-family: inherit;
}
.ed-name:hover, .ed-name:focus { border-color: var(--ed-line2); background: #faf9f6; }
.ed-top-actions { margin-left: auto; display: flex; gap: 8px; }
.ed-btn {
  height: 30px; padding: 0 13px; border-radius: 8px; font-size: 12px; cursor: pointer;
  border: 1px solid var(--ed-line2); background: var(--ed-panel); color: var(--ed-text);
  transition: background 0.15s, border-color 0.15s;
}
.ed-btn:hover { background: #f0eee8; }
.ed-btn.primary { background: var(--ed-accent); border-color: var(--ed-accent); color: #fff; font-weight: 600; }
.ed-btn.primary:hover { background: #b57a14; }
.ed-btn.danger { color: var(--ed-danger); border-color: rgba(194, 83, 63, 0.35); }
.ed-btn.danger:hover { background: rgba(194, 83, 63, 0.08); }
.ed-btn.on { background: var(--ed-accent-soft); border-color: rgba(200, 137, 26, 0.4); color: var(--ed-accent); }

.ed-body { flex: 1; display: flex; min-height: 0; position: relative; }

.ed-rail {
  flex: 0 0 46px; background: var(--ed-panel); border-right: 1px solid var(--ed-line);
  display: flex; flex-direction: column; align-items: center; padding: 8px 0; gap: 4px;
}
.ed-rail button {
  width: 34px; height: 34px; border: none; border-radius: 9px; cursor: pointer;
  background: none; color: var(--ed-text2); display: grid; place-items: center;
}
.ed-rail button:hover { background: #f0eee8; color: var(--ed-text); }
.ed-rail button.active { background: var(--ed-accent-soft); color: var(--ed-accent); }

.ed-drawer {
  position: absolute; left: 52px; top: 10px; bottom: 10px; width: 232px; z-index: 5;
  background: var(--ed-panel); border: 1px solid var(--ed-line); border-radius: 12px;
  box-shadow: 0 12px 40px rgba(30, 28, 20, 0.14);
  display: flex; flex-direction: column; overflow: hidden;
}
.ed-drawer-head { display: flex; gap: 6px; padding: 10px; border-bottom: 1px solid var(--ed-line); }
.ed-drawer-head input {
  flex: 1; height: 28px; padding: 0 9px; font-size: 12px; font-family: inherit;
  border: 1px solid var(--ed-line2); border-radius: 7px; outline: none; color: var(--ed-text);
}
.ed-drawer-head input:focus { border-color: var(--ed-accent); }
.ed-drawer-head button { width: 28px; border: none; background: none; font-size: 15px; color: var(--ed-text2); cursor: pointer; border-radius: 6px; }
.ed-drawer-head button:hover { background: #f0eee8; }
.ed-asset-grid {
  flex: 1; overflow-y: auto; padding: 10px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-content: start;
}
.ed-asset {
  border: 1px solid var(--ed-line); border-radius: 9px; cursor: pointer;
  background: #fbfaf7; padding: 7px 6px 8px; text-align: center;
  transition: border-color 0.15s, transform 0.12s;
}
.ed-asset:hover { border-color: var(--ed-accent); transform: translateY(-1px); }
.ed-asset img, .ed-asset canvas { width: 100%; height: 52px; object-fit: contain; display: block; }
.ed-asset .ed-asset-name { font-size: 10.5px; color: var(--ed-text2); margin-top: 4px; }
.ed-drawer-foot { padding: 8px; text-align: center; font-size: 10px; color: var(--ed-text3); border-top: 1px solid var(--ed-line); }

.ed-viewport { flex: 1; position: relative; min-width: 0; background: #e8e6df; }
.ed-viewport canvas { display: block; }
.ed-vp-tip {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  font-size: 10.5px; color: #9a9689; background: rgba(255, 255, 255, 0.75);
  padding: 4px 12px; border-radius: 20px; pointer-events: none; white-space: nowrap;
}

.ed-inspect {
  flex: 0 0 236px; background: var(--ed-panel); border-left: 1px solid var(--ed-line);
  overflow-y: auto; padding: 14px;
}
.ed-ins-title { font-size: 12px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 7px; }
.ed-ins-title .swatch { width: 12px; height: 12px; border-radius: 3px; background: var(--ed-accent); }
.ed-ins-empty { font-size: 11.5px; color: var(--ed-text3); line-height: 1.9; }
.ed-field { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.ed-field label { flex: 0 0 34px; font-size: 11px; color: var(--ed-text2); }
.ed-field input[type=number] {
  flex: 1; width: 0; height: 27px; padding: 0 7px; font-size: 11.5px; font-family: var(--mono);
  border: 1px solid var(--ed-line2); border-radius: 6px; outline: none; color: var(--ed-text); background: #fbfaf7;
}
.ed-field input[type=number]:focus { border-color: var(--ed-accent); }
.ed-field input[type=range] { flex: 1; accent-color: var(--ed-accent); }
.ed-field .val { flex: 0 0 34px; font-size: 10.5px; color: var(--ed-text2); font-family: var(--mono); text-align: right; }
.ed-colors { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 12px; }
.ed-colors button {
  width: 21px; height: 21px; border-radius: 50%; cursor: pointer;
  border: 2px solid #fff; box-shadow: 0 0 0 1px var(--ed-line2);
}
.ed-colors button:hover { transform: scale(1.12); }
.ed-ins-ops { display: flex; gap: 8px; margin-top: 14px; }
.ed-ins-ops .ed-btn { flex: 1; }
.ed-cam-list { display: flex; flex-direction: column; gap: 6px; }
.ed-cam-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 9px; font-size: 11.5px;
  border: 1px solid var(--ed-line); border-radius: 8px; cursor: pointer; background: #fbfaf7;
}
.ed-cam-item:hover { border-color: var(--ed-accent); }
.ed-cam-item .n { flex: 1; }
.ed-cam-item .del { border: none; background: none; color: var(--ed-text3); cursor: pointer; font-size: 12px; }
.ed-cam-item .del:hover { color: var(--ed-danger); }

.ed-bottom {
  flex: 0 0 46px; display: flex; align-items: center; gap: 14px;
  padding: 0 12px; background: var(--ed-panel); border-top: 1px solid var(--ed-line);
}
.ed-cams { display: flex; gap: 6px; align-items: center; overflow-x: auto; }
.ed-chip {
  height: 26px; padding: 0 11px; border-radius: 20px; font-size: 11px; cursor: pointer;
  border: 1px solid var(--ed-line2); background: #fbfaf7; color: var(--ed-text2); white-space: nowrap;
}
.ed-chip:hover { border-color: var(--ed-accent); color: var(--ed-accent); }
.ed-chip.add { border-style: dashed; }
.ed-shots { display: flex; gap: 4px; background: #f0eee8; padding: 3px; border-radius: 9px; }
.ed-shots button {
  height: 24px; padding: 0 12px; border: none; border-radius: 7px; font-size: 11px;
  background: none; color: var(--ed-text2); cursor: pointer;
}
.ed-shots button:hover { color: var(--ed-text); }
.ed-shots button.active { background: #fff; color: var(--ed-accent); font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.ed-bottom-ops { margin-left: auto; }

/* 编辑器里的 toast 需要浅色底 */
#view-editor ~ #toasts .toast { border-color: var(--ed-line2); }

/* 弹窗里新增：环境预览 SVG 通用 */
.env-prev svg { display: block; width: 100%; height: 100%; }

@media (max-width: 900px) {
  .en-cards { flex-direction: column; align-items: center; }
  .ed-inspect { position: absolute; right: 0; top: 0; bottom: 0; z-index: 6; box-shadow: -8px 0 24px rgba(0,0,0,0.08); }
}
