/* ===========================================================================
   Magician 设计系统
   一套暗色为主的克制配色 + 8px 栅格，所有组件共用同一批 token，
   避免"每个页面各写一套样式"导致的视觉割裂。
   =========================================================================== */

:root {
  --bg:         #0a0c11;
  --bg-soft:    #0f1219;
  --panel:      #13171f;
  --panel-2:    #191e28;
  --panel-3:    #1f2531;
  --line:       rgba(255, 255, 255, .08);
  --line-2:     rgba(255, 255, 255, .14);

  --text:       #e8ebf2;
  --text-2:     #a8b0c2;
  --muted:      #6f7789;

  --accent:     #7c6cff;
  --accent-2:   #4dd8e8;
  --accent-dim: rgba(124, 108, 255, .14);
  --ok:         #3ddc97;
  --warn:       #f5b445;
  --danger:     #ff6b6b;

  --r-sm: 8px;
  --r:    12px;
  --r-lg: 18px;

  --shadow: 0 8px 30px rgba(0, 0, 0, .45);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --header-h: 56px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

#app { height: 100vh; display: flex; flex-direction: column; }

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
::selection { background: var(--accent); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.2); background-clip: content-box; }

/* --------------------------------- 启动态 -------------------------------- */

.boot { height: 100vh; display: grid; place-content: center; justify-items: center; gap: 14px; }
.boot-logo { font-size: 44px; animation: float 2.4s ease-in-out infinite; }
.boot-text { color: var(--muted); font-size: 13px; }
@keyframes float { 0%,100% { transform: translateY(0) rotate(-6deg);} 50% { transform: translateY(-8px) rotate(6deg);} }

/* --------------------------------- 通用件 -------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: var(--r-sm);
  background: var(--panel-2); border: 1px solid var(--line);
  cursor: pointer; white-space: nowrap; transition: .15s;
  font-size: 13px; font-weight: 500;
}
.btn:hover { background: var(--panel-3); border-color: var(--line-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn-primary:hover { background: #8b7dff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--panel-2); color: var(--text); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: rgba(255,107,107,.1); border-color: rgba(255,107,107,.3); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-lg { height: 44px; padding: 0 22px; font-size: 15px; border-radius: var(--r); }
.btn-icon { width: 32px; padding: 0; }

.input, .textarea {
  width: 100%; background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 10px 12px; outline: none; transition: .15s;
  resize: none; font-size: 14px;
}
.input:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.input::placeholder, .textarea::placeholder { color: var(--muted); }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 9px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--line);
  font-size: 11px; color: var(--text-2); white-space: nowrap;
}
.chip-ok    { color: var(--ok);     border-color: rgba(61,220,151,.3);  background: rgba(61,220,151,.08); }
.chip-warn  { color: var(--warn);   border-color: rgba(245,180,69,.3);  background: rgba(245,180,69,.08); }
.chip-danger{ color: var(--danger); border-color: rgba(255,107,107,.3); background: rgba(255,107,107,.08); }
.chip-accent{ color: var(--accent-2); border-color: rgba(77,216,232,.3); background: rgba(77,216,232,.08); }

.spinner {
  width: 13px; height: 13px; border-radius: 50%; flex: none;
  border: 2px solid rgba(255,255,255,.18); border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty { padding: 48px 20px; text-align: center; color: var(--muted); font-size: 13px; }

/* --------------------------------- 顶栏 --------------------------------- */

.topbar {
  height: var(--header-h); flex: none; display: flex; align-items: center; gap: 12px;
  padding: 0 16px; border-bottom: 1px solid var(--line);
  background: rgba(12, 14, 20, .8); backdrop-filter: blur(12px);
  position: relative; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; letter-spacing: .3px; cursor: pointer; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 8px; display: grid; place-content: center; font-size: 15px;
  background: linear-gradient(135deg, var(--accent), #4b3ed8); box-shadow: 0 2px 10px rgba(124,108,255,.4);
}
.brand small { color: var(--muted); font-weight: 400; font-size: 11px; margin-left: 2px; }
.topbar-spacer { flex: 1; }
.topbar-nav { display: flex; gap: 2px; }
.topbar-nav .btn-ghost.active { background: var(--panel-2); color: var(--text); }

.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-content: center;
  background: linear-gradient(135deg, #4b3ed8, var(--accent-2)); font-size: 12px; font-weight: 600; color: #fff;
  cursor: pointer; flex: none;
}

/* ================================ 登录页 ================================ */

.auth-wrap { flex: 1; display: grid; place-items: center; padding: 24px; overflow: auto; }
.auth-card {
  width: min(400px, 100%); background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 34px 30px; box-shadow: var(--shadow);
}
.auth-logo { font-size: 40px; text-align: center; margin-bottom: 10px; }
.auth-card h1 { font-size: 21px; text-align: center; margin-bottom: 6px; letter-spacing: .5px; }
.auth-card p.sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.auth-note { margin-top: 16px; font-size: 11.5px; color: var(--muted); text-align: center; line-height: 1.7; }

/* ================================= 首页 ================================= */

.home { flex: 1; overflow-y: auto; }
.home-inner { max-width: 940px; margin: 0 auto; padding: 44px 22px 80px; }

.hero { text-align: center; margin-bottom: 30px; }
.hero h1 {
  font-size: clamp(26px, 4.4vw, 38px); line-height: 1.3; letter-spacing: .5px; margin-bottom: 12px;
  background: linear-gradient(120deg, #fff 20%, #b3a9ff 60%, var(--accent-2));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero p { color: var(--text-2); font-size: 14.5px; max-width: 560px; margin: 0 auto; }

.roles-strip { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 22px 0 30px; }
.role-pill {
  display: flex; align-items: center; gap: 7px; padding: 6px 12px 6px 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px; font-size: 12px;
}
.role-av {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-content: center;
  font-size: 11px; font-weight: 600; color: #fff; flex: none;
}
.role-pill b { font-weight: 600; }
.role-pill span { color: var(--muted); }

.composer {
  background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-lg);
  padding: 16px; box-shadow: var(--shadow); transition: .2s;
}
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-dim), var(--shadow); }
.composer textarea {
  width: 100%; min-height: 92px; background: transparent; border: none; outline: none;
  font-size: 15px; line-height: 1.7; resize: none;
}
.composer textarea::placeholder { color: var(--muted); }
.composer-bar { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.composer-bar .grow { flex: 1; }

.switch { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; user-select: none; font-size: 12.5px; color: var(--text-2); }
.switch input { display: none; }
.switch .track {
  width: 34px; height: 19px; border-radius: 999px; background: var(--panel-3);
  border: 1px solid var(--line); position: relative; transition: .2s; flex: none;
}
.switch .track::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px;
  border-radius: 50%; background: var(--muted); transition: .2s;
}
.switch input:checked + .track { background: var(--accent); border-color: transparent; }
.switch input:checked + .track::after { transform: translateX(15px); background: #fff; }

.section-title {
  display: flex; align-items: center; gap: 10px; margin: 38px 0 14px;
  font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: .6px;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.idea-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 10px; }
.idea-card {
  text-align: left; padding: 13px 14px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); cursor: pointer; transition: .16s; line-height: 1.55;
}
.idea-card:hover { background: var(--panel-2); border-color: var(--accent); transform: translateY(-2px); }
.idea-card b { display: block; font-size: 13.5px; margin-bottom: 3px; font-weight: 600; }
.idea-card span { color: var(--muted); font-size: 12px; }

.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.proj-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px; cursor: pointer; transition: .16s; position: relative; overflow: hidden;
}
.proj-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.proj-card .head { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.proj-card .emoji { font-size: 20px; flex: none; }
.proj-card .title { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-card .desc {
  color: var(--muted); font-size: 12px; height: 34px; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-clamp: 2;
}
.proj-card .foot { display: flex; align-items: center; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.proj-card .del {
  position: absolute; top: 8px; right: 8px; opacity: 0; transition: .15s;
  width: 26px; height: 26px; border-radius: 6px; display: grid; place-content: center;
  background: var(--panel-3); border: 1px solid var(--line); cursor: pointer; color: var(--muted);
}
.proj-card:hover .del { opacity: 1; }
.proj-card .del:hover { color: var(--danger); border-color: rgba(255,107,107,.4); }

/* =============================== 工作台 =============================== */

.ws { flex: 1; display: flex; min-height: 0; }

.ws-left {
  width: 420px; flex: none; display: flex; flex-direction: column;
  border-right: 1px solid var(--line); background: var(--bg-soft); min-height: 0;
}
.ws-right { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.ws-head {
  flex: none; padding: 12px 14px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.ws-head .emoji { font-size: 20px; }
.ws-head .meta { flex: 1; min-width: 0; }
.ws-head .meta b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-head .meta span { font-size: 11.5px; color: var(--muted); }

/* --- Agent 轨迹流 --- */
.trace { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }

.trace-empty { padding: 30px 18px; text-align: center; color: var(--muted); }
.trace-empty .te-emoji { font-size: 34px; margin-bottom: 10px; }
.trace-empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 8px; }
.trace-empty p { font-size: 12.5px; line-height: 1.75; margin-bottom: 10px; }
.trace-empty p.hint {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 10px 12px; text-align: left; margin-top: 14px;
}

.tr-item { display: flex; gap: 10px; animation: fadeUp .25s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px);} to { opacity: 1; transform: none; } }

.tr-av {
  width: 26px; height: 26px; border-radius: 50%; flex: none; display: grid; place-content: center;
  font-size: 11px; font-weight: 600; color: #fff; margin-top: 1px;
}
.tr-body { flex: 1; min-width: 0; }
.tr-title { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; flex-wrap: wrap; }
.tr-title small { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.tr-note { font-size: 12.5px; color: var(--text-2); margin-top: 3px; }

.tr-card {
  margin-top: 7px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 11px 12px;
}
.tr-card h5 { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 7px; letter-spacing: .4px; }

.thought-label {
  margin-top: 8px; font-size: 10.5px; color: var(--muted); letter-spacing: .4px;
  display: flex; align-items: center; gap: 5px; cursor: pointer; user-select: none;
}
.thought-label:hover { color: var(--text-2); }
.thought-label::before { content: '⋯'; }
.thought-label::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.thought {
  margin-top: 4px; max-height: 92px; overflow: hidden; position: relative;
  font-family: var(--mono); font-size: 11px; line-height: 1.65; color: var(--muted);
  background: rgba(0,0,0,.28); border-radius: var(--r-sm); padding: 8px 10px;
  white-space: pre-wrap; word-break: break-all;
}
.thought::before {
  content: ''; position: absolute; inset: 0 0 auto; height: 26px;
  background: linear-gradient(var(--bg-soft), transparent); pointer-events: none;
}
.thought.collapsed { max-height: 0; padding: 0; margin: 0; opacity: 0; }

.feat-row { display: flex; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 12.5px; }
.feat-row:first-of-type { border-top: none; }
.feat-row b { flex: none; min-width: 62px; font-weight: 600; }
.feat-row span { color: var(--text-2); flex: 1; }

.file-line {
  display: flex; align-items: center; gap: 8px; font-family: var(--mono);
  font-size: 11.5px; padding: 4px 0; color: var(--text-2);
}
.file-line .path { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-line .size { color: var(--muted); font-size: 10.5px; }
.file-line .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); flex: none; }
.file-line.writing .dot { background: var(--accent); animation: pulse 1s infinite; }
.file-line.done .dot { background: var(--ok); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

.qa-row { display: flex; align-items: flex-start; gap: 8px; padding: 5px 0; font-size: 12.5px; }
.qa-row .ic { flex: none; width: 15px; text-align: center; font-size: 11px; margin-top: 2px; }
.qa-row .nm { flex: none; min-width: 112px; }
.qa-row .dt { color: var(--muted); font-size: 11.5px; flex: 1; word-break: break-word; }

.tr-summary {
  margin-top: 7px; padding: 11px 12px; border-radius: var(--r-sm); font-size: 13px; line-height: 1.7;
  background: linear-gradient(135deg, rgba(124,108,255,.13), rgba(77,216,232,.07));
  border: 1px solid rgba(124,108,255,.25);
}
.tr-error {
  margin-top: 7px; padding: 10px 12px; border-radius: var(--r-sm); font-size: 12.5px;
  background: rgba(255,107,107,.1); border: 1px solid rgba(255,107,107,.3); color: #ffb3b3;
}

/* --- 规格审批闸门 --- */
.gate {
  margin-top: 8px; background: var(--panel); border: 1px solid rgba(124,108,255,.35);
  border-radius: var(--r); overflow: hidden;
}
.gate-head {
  padding: 10px 13px; background: rgba(124,108,255,.1); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600;
}
.gate-body { padding: 13px; }
.gate-title-row { display: flex; gap: 8px; margin-bottom: 12px; }
.gate-title-row .emoji-in { width: 46px; text-align: center; font-size: 17px; }
.gate-feat { display: flex; gap: 7px; margin-bottom: 7px; align-items: flex-start; }
.gate-feat .input { font-size: 12.5px; padding: 7px 9px; }
.gate-feat .nm { width: 96px; flex: none; }
.gate-feat .rm {
  width: 28px; height: 32px; flex: none; border-radius: 6px; background: transparent;
  border: 1px solid var(--line); color: var(--muted); cursor: pointer;
}
.gate-feat .rm:hover { color: var(--danger); border-color: rgba(255,107,107,.4); }
.gate-foot {
  padding: 11px 13px; border-top: 1px solid var(--line); background: var(--bg-soft);
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
}

/* --- 对话输入 --- */
.ws-composer { flex: none; padding: 12px; border-top: 1px solid var(--line); background: var(--bg-soft); }
.ws-composer .box {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px;
  transition: .15s;
}
.ws-composer .box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.ws-composer textarea {
  width: 100%; min-height: 46px; max-height: 150px; background: transparent; border: none;
  outline: none; resize: none; font-size: 13.5px; line-height: 1.65;
}
.ws-composer .row { display: flex; align-items: center; gap: 8px; margin-top: 7px; }
.ws-composer .hint { flex: 1; font-size: 11px; color: var(--muted); }

/* --- 右侧面板 --- */
.pane-head {
  flex: none; height: 46px; display: flex; align-items: center; gap: 8px; padding: 0 12px;
  border-bottom: 1px solid var(--line); background: var(--bg-soft);
}
.tabs { display: flex; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 2px; }
.tab {
  padding: 0 13px; height: 26px; border-radius: 6px; background: transparent; border: none;
  cursor: pointer; color: var(--text-2); font-size: 12.5px; transition: .15s; display: flex; align-items: center; gap: 5px;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--accent); color: #fff; }
.tab .badge {
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: rgba(255,255,255,.15);
  font-size: 10px; display: grid; place-content: center;
}

.pane-body { flex: 1; min-height: 0; position: relative; background: var(--bg); }
/* 预览层与其它层都常驻，靠 display 切换：iframe 一旦被重新挂载就会重新加载 */
.pane-layer { position: absolute; inset: 0; }

/* 预览 */
.preview-wrap { position: absolute; inset: 0; display: flex; flex-direction: column; }
.preview-stage {
  flex: 1; min-height: 0; display: grid; place-items: center; padding: 14px; overflow: auto;
  background:
    radial-gradient(circle at 20% 10%, rgba(124,108,255,.07), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(77,216,232,.05), transparent 45%);
}
.device {
  background: #fff; border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow);
  border: 1px solid var(--line-2); transition: width .25s, height .25s; position: relative;
}
.device.desktop { width: 100%; height: 100%; }
.device.tablet  { width: 820px;  max-width: 100%; height: 100%; max-height: 1100px; }
.device.mobile  { width: 390px;  max-width: 100%; height: 750px; max-height: 100%; }
.device iframe { width: 100%; height: 100%; border: none; display: block; background: #fff; }

.race-split { position: absolute; inset: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); }
.race-col { display: flex; flex-direction: column; background: var(--bg); min-width: 0; }
.race-col-head {
  flex: none; padding: 8px 11px; display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--line); background: var(--bg-soft); font-size: 12px;
}
.race-col-head .grow { flex: 1; }
.race-col iframe { flex: 1; border: none; background: #fff; }

.err-bar {
  flex: none; display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  background: rgba(255,107,107,.12); border-top: 1px solid rgba(255,107,107,.3); font-size: 12.5px;
}
.err-bar .msg { flex: 1; color: #ffb8b8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 11.5px; }

/* 代码 */
.code-wrap { position: absolute; inset: 0; display: flex; }
.file-tree {
  width: 208px; flex: none; border-right: 1px solid var(--line); overflow-y: auto;
  padding: 8px; background: var(--bg-soft);
}
.tree-item {
  display: flex; align-items: center; gap: 7px; padding: 6px 8px; border-radius: 6px;
  cursor: pointer; font-size: 12.5px; font-family: var(--mono); color: var(--text-2); transition: .12s;
}
.tree-item:hover { background: var(--panel-2); color: var(--text); }
.tree-item.active { background: var(--accent-dim); color: #fff; }
.tree-item .ic { flex: none; font-size: 10px; opacity: .8; }
.tree-item .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-item .sz { font-size: 10px; color: var(--muted); }

.code-view { flex: 1; overflow: auto; min-width: 0; background: #0b0e14; }
.code-view pre { padding: 14px 16px; font-family: var(--mono); font-size: 12px; line-height: 1.72; tab-size: 2; }
.code-view code { display: block; white-space: pre; }
.ln { display: inline-block; width: 34px; margin-right: 12px; text-align: right; color: #3d4557; user-select: none; }

.tk-com { color: #5c6478; font-style: italic; }
.tk-str { color: #9ee493; }
.tk-key { color: #c792ea; }
.tk-num { color: #f78c6c; }
.tk-tag { color: #7fb3ff; }
.tk-att { color: #ffcb6b; }
.tk-fn  { color: #82aaff; }

/* 版本 */
.ver-wrap { position: absolute; inset: 0; overflow-y: auto; padding: 14px; }
.ver-item {
  display: flex; align-items: center; gap: 11px; padding: 11px 13px; border-radius: var(--r);
  background: var(--panel); border: 1px solid var(--line); margin-bottom: 8px; transition: .15s;
}
.ver-item:hover { border-color: var(--line-2); }
.ver-item.current { border-color: var(--accent); background: rgba(124,108,255,.07); }
.ver-seq {
  width: 34px; height: 34px; flex: none; border-radius: 9px; display: grid; place-content: center;
  background: var(--panel-3); font-family: var(--mono); font-size: 12px; font-weight: 600;
}
.ver-item.current .ver-seq { background: var(--accent); color: #fff; }
.ver-body { flex: 1; min-width: 0; }
.ver-body b { display: block; font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ver-body span { font-size: 11.5px; color: var(--muted); }

/* =============================== 画廊 =============================== */

.gallery { flex: 1; overflow-y: auto; }
.gallery-inner { max-width: 1040px; margin: 0 auto; padding: 40px 22px 70px; }
.gal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.gal-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; transition: .18s;
}
.gal-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow); }
.gal-frame { height: 190px; background: #fff; position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.gal-frame iframe {
  width: 200%; height: 380px; border: none; transform: scale(.5); transform-origin: top left;
  pointer-events: none; overflow: hidden;
}
.gal-frame .mask { position: absolute; inset: 0; cursor: pointer; }
.gal-info { padding: 13px 14px; }
.gal-info .t { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.gal-info .d {
  color: var(--muted); font-size: 12px; line-height: 1.55; height: 37px; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-clamp: 2;
}
.gal-info .a { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.gal-info .a .who { flex: 1; font-size: 11.5px; color: var(--muted); }

/* =============================== 弹层 / 提示 =============================== */

.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.65); backdrop-filter: blur(3px);
  display: grid; place-items: center; z-index: 100; padding: 20px; animation: fade .15s;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: min(460px, 100%); background: var(--panel); border: 1px solid var(--line-2);
  border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden;
}
.modal-head { padding: 15px 18px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 15px; }
.modal-body { padding: 18px; font-size: 13.5px; color: var(--text-2); line-height: 1.75; }
.modal-foot { padding: 13px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 9px; background: var(--bg-soft); }

.share-url {
  display: flex; gap: 7px; align-items: center; margin-top: 12px; padding: 9px 11px;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--r-sm);
  font-family: var(--mono); font-size: 11.5px; word-break: break-all; color: var(--accent-2);
}

.toast-host {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none;
}
.toast {
  padding: 9px 16px; border-radius: 999px; font-size: 13px; box-shadow: var(--shadow);
  background: var(--panel-3); border: 1px solid var(--line-2); animation: toastIn .25s;
  display: flex; align-items: center; gap: 7px; max-width: 88vw;
}
.toast.ok { border-color: rgba(61,220,151,.4); }
.toast.err { border-color: rgba(255,107,107,.45); color: #ffb3b3; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } }

/* =============================== 响应式 =============================== */

@media (max-width: 1080px) {
  .ws-left { width: 360px; }
}

@media (max-width: 860px) {
  body { overflow: auto; }
  .ws { flex-direction: column; }
  .ws-left { width: 100%; height: 52vh; border-right: none; border-bottom: 1px solid var(--line); }
  .ws-right { height: 60vh; }
  .device.mobile, .device.tablet { width: 100%; height: 100%; }
  .race-split { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  .file-tree { width: 148px; }
  .home-inner { padding: 28px 16px 60px; }
  .topbar-nav .label { display: none; }
}

/* --------------------------- 配额（账户弹窗内） --------------------------- */

.quota-box {
  margin-top: 16px; padding: 12px 13px; border-radius: var(--r-sm);
  background: var(--bg-soft); border: 1px solid var(--line);
}
.quota-top { display: flex; align-items: baseline; justify-content: space-between; font-size: 12.5px; }
.quota-top b { font-family: var(--mono); font-size: 13px; color: var(--text); }
.quota-bar {
  height: 6px; border-radius: 3px; background: var(--panel-3); overflow: hidden; margin: 9px 0 8px;
}
.quota-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .3s; }
.quota-note { font-size: 11px; color: var(--muted); line-height: 1.7; }
