/* TGS 脚本工坊 样式 */
:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --border: #e2e5ea;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #2f6fed;
  --primary-dark: #1f56c4;
  --accent: #e8a13d;
  --code-bg: #1e2430;
  --code-text: #d7e1f0;
  --ok: #16a34a;
  --warn: #d97706;
  --err: #dc2626;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; overflow: hidden;
}
#app { display: flex; flex-direction: column; height: 100vh; }
button { font-family: inherit; cursor: pointer; }

/* 顶栏 */
#topbar {
  display: flex; align-items: center; gap: 14px; height: 52px; padding: 0 16px;
  background: #1b1f27; color: #fff; flex: none;
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo {
  width: 34px; height: 34px; border-radius: 8px; background: linear-gradient(135deg, #2f6fed, #7c3aed);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; letter-spacing: .5px;
}
.brand-title { font-weight: 700; font-size: 15px; }
.brand-sub { font-size: 11px; color: #9aa3b2; }
.proj-info { display: flex; gap: 8px; margin-left: 8px; flex: 1; max-width: 480px; }
.proj-info input, .proj-info select {
  background: #2a303c; border: 1px solid #3b4352; color: #e6eaf2; border-radius: 6px;
  padding: 6px 10px; font-size: 13px; outline: none;
}
.proj-info input { flex: 1; min-width: 120px; }
.proj-info input:focus, .proj-info select:focus { border-color: var(--primary); }
.actions { display: flex; gap: 8px; margin-left: auto; }
.btn {
  border: 1px solid #3b4352; background: #2a303c; color: #e6eaf2; border-radius: 6px;
  padding: 6px 14px; font-size: 13px; transition: all .15s;
}
.btn:hover { background: #333b49; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-sm { padding: 3px 9px; font-size: 12px; }
.btn-block { width: 100%; margin-top: 8px; padding: 9px; font-size: 14px; }
.btn-danger { background: var(--err); border-color: var(--err); }

/* 主体 */
#main { display: flex; flex: 1; min-height: 0; }
#toolboxWrap { flex: 1; min-width: 0; position: relative; background: var(--panel); }
#blocklyDiv { position: absolute; inset: 0; }

/* 侧栏 */
#sidePanel {
  width: 380px; flex: none; background: var(--panel); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; min-height: 0;
}
.tabs { display: flex; border-bottom: 1px solid var(--border); flex: none; }
.tab {
  flex: 1; padding: 9px 4px; border: none; background: transparent; color: var(--muted);
  font-size: 13px; border-bottom: 2px solid transparent;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab-page { flex: 1; min-height: 0; display: none; flex-direction: column; padding: 10px; }
.tab-page.active { display: flex; }

/* 代码页 */
.code-toolbar { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; flex: none; }
.badge { background: var(--warn); color: #fff; border-radius: 10px; padding: 1px 8px; font-size: 11px; }
.badge.err { background: var(--err); }
.code-view {
  flex: 1; min-height: 0; overflow: auto; background: var(--code-bg); color: var(--code-text);
  font-family: Consolas, "Courier New", monospace; font-size: 12.5px; line-height: 1.55;
  padding: 12px; border-radius: 8px; white-space: pre; tab-size: 4;
}
textarea.code-view { resize: none; outline: none; border: 1px solid var(--border); }
.code-hint { color: var(--muted); font-size: 12px; margin-top: 8px; flex: none; }
.spacer { flex: 1; }

/* AI 页 */
.ai-mode select { width: 100%; padding: 7px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
#aiInputWrap { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; flex: none; }
#aiInput {
  width: 100%; height: 84px; resize: none; padding: 9px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 13px; outline: none; font-family: inherit;
}
#aiInput:focus { border-color: var(--primary); }
.ai-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--border); background: #f7f8fa; border-radius: 14px; padding: 3px 10px;
  font-size: 12px; color: var(--muted);
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.ai-result { flex: 1; min-height: 0; overflow: auto; margin-top: 12px; }
.ai-welcome { color: var(--muted); font-size: 13px; line-height: 1.8; }
.ai-warn { color: var(--warn); margin-top: 8px; background: #fff7ed; border: 1px solid #fed7aa; border-radius: 6px; padding: 8px; }
.ai-msg { background: #f7f8fa; border: 1px solid var(--border); border-radius: 8px; padding: 10px; margin-bottom: 10px; font-size: 13px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.ai-msg.ai-user { background: #e8f0fe; border-color: #bcd3fa; }
.ai-msg .ai-label { font-weight: 700; font-size: 12px; color: var(--primary); display: block; margin-bottom: 4px; }
.ai-msg pre { background: var(--code-bg); color: var(--code-text); padding: 10px; border-radius: 6px; overflow: auto; font-size: 12px; margin-top: 6px; white-space: pre-wrap; }
.ai-msg .ai-action { margin-top: 8px; }
.ai-msg .ai-loading { color: var(--muted); font-style: italic; }

/* 函数速查 */
.func-search { display: flex; gap: 6px; margin-bottom: 8px; flex: none; }
.func-search input { flex: 1; padding: 7px 9px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; outline: none; }
.func-search select { padding: 6px; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; }
.func-list { flex: 1; min-height: 0; overflow: auto; }
.func-item {
  padding: 7px 9px; border: 1px solid var(--border); border-radius: 6px; margin-bottom: 6px;
  cursor: pointer; font-size: 12.5px; display: flex; flex-direction: column; gap: 2px;
}
.func-item:hover { border-color: var(--primary); background: #f0f5ff; }
.func-item .fn-name { font-weight: 600; color: var(--primary); font-family: Consolas, monospace; }
.func-item .fn-desc { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.func-item .fn-ns { font-size: 11px; color: #9aa3b2; }
.func-detail { flex: none; border-top: 1px solid var(--border); padding-top: 8px; max-height: 40%; overflow: auto; }
.func-detail h4 { font-size: 14px; margin-bottom: 6px; }
.func-detail .fd-sig { font-family: Consolas, monospace; background: #f3f4f6; padding: 6px 8px; border-radius: 6px; font-size: 12px; margin-bottom: 6px; overflow-wrap: break-word; }
.func-detail .fd-desc { font-size: 13px; line-height: 1.7; color: var(--text); margin-bottom: 6px; }
.func-detail .fd-example { font-size: 12px; color: var(--muted); font-family: Consolas, monospace; background: #fafafa; padding: 6px 8px; border-radius: 6px; white-space: pre-wrap; }

/* 帮助 */
.help-body { flex: 1; min-height: 0; overflow: auto; font-size: 13px; line-height: 1.85; color: #374151; }
.help-body h3 { font-size: 14px; margin: 14px 0 6px; color: var(--text); }
.help-body p { margin-bottom: 6px; }
.help-body ol { padding-left: 20px; margin-bottom: 8px; }
.help-body li { margin-bottom: 4px; }
.help-body code { background: #f3f4f6; border: 1px solid #e5e7eb; border-radius: 4px; padding: 1px 5px; font-size: 12px; color: #b91c1c; font-family: Consolas, monospace; }

/* 状态栏 */
#statusbar {
  display: flex; align-items: center; gap: 12px; height: 30px; padding: 0 14px; flex: none;
  background: #232833; color: #aab3c2; font-size: 12px;
}
#statusMsg.err { color: #f87171; }
#statusMsg.ok { color: #6ee7a0; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 18, 25, .55); z-index: 300;
  display: flex; align-items: center; justify-content: center;
}
.modal { background: #fff; border-radius: 12px; width: 560px; max-width: 92vw; max-height: 82vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); font-weight: 700; }
.modal-close { border: none; background: transparent; font-size: 20px; color: var(--muted); padding: 0 4px; }
.modal-body { padding: 14px 18px; overflow: auto; flex: 1; min-height: 0; }
.modal-foot { text-align: right; margin-top: 12px; }
.tpl-item { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; }
.tpl-item:hover { border-color: var(--primary); background: #f0f5ff; }
.tpl-item .tpl-name { font-weight: 600; }
.tpl-item .tpl-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }
.proj-item { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; margin-bottom: 8px; }
.proj-item .pj-name { flex: 1; font-weight: 600; }
.proj-item .pj-time { font-size: 11px; color: var(--muted); }
.proj-item .pj-open { border: none; background: var(--primary); color: #fff; border-radius: 6px; padding: 4px 10px; font-size: 12px; }
.proj-item .pj-del { border: none; background: transparent; color: var(--err); font-size: 12px; }
#settingsModal { width: 620px; }
#settingsModal h4 { margin: 14px 0 6px; font-size: 13px; color: var(--text); }
#settingsModal label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
#settingsModal input { width: 100%; padding: 7px 9px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; outline: none; margin-top: 3px; }
#settingsModal input:focus { border-color: var(--primary); }
.ai-tips { font-size: 12px; color: var(--muted); background: #f7f8fa; border-radius: 6px; padding: 8px 10px; line-height: 1.7; margin-bottom: 8px; }
.ai-test-result { margin-left: 8px; font-size: 12px; }
.ai-test-result.ok { color: var(--ok); }
.ai-test-result.err { color: var(--err); }
#settingsModal select { width: 100%; padding: 7px 9px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; outline: none; margin-top: 3px; background: #fff; }

/* 对话写脚本向导 */
.modal-wizard { width: 680px; height: 78vh; }
.wizard-chat { flex: 1; min-height: 0; overflow: auto; padding: 16px 18px; background: #f6f8fb; display: flex; flex-direction: column; gap: 8px; }
.wz-msg { max-width: 88%; padding: 9px 13px; border-radius: 10px; font-size: 13px; line-height: 1.7; white-space: normal; word-break: break-word; }
.wz-msg b { font-weight: 700; }
.wz-bot { align-self: flex-start; background: #fff; border: 1px solid var(--border); border-radius: 4px 12px 12px 12px; color: var(--text); }
.wz-user { align-self: flex-end; background: var(--primary); color: #fff; border-radius: 12px 4px 12px 12px; }
.wz-code { background: #1f2937; color: #d1e7ff; padding: 10px; border-radius: 8px; font-size: 11.5px; overflow: auto; white-space: pre-wrap; max-height: 200px; margin-top: 6px; }
.wizard-foot { flex: none; padding: 12px 18px; border-top: 1px solid var(--border); background: #fff; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.wz-opt { flex: 1 1 30%; min-width: 150px; text-align: left; }
.wz-lab { font-size: 13px; color: var(--text); font-weight: 600; margin-right: 6px; }
.wz-input { flex: 1; min-width: 180px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; outline: none; }
.wz-input:focus { border-color: var(--primary); }
.wz-ok { flex: none; }

/* 帮助页目录知识 */
.help-know { margin-top: 4px; }
.kn-loading { color: var(--muted); }
.kn-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 6px; }
.kn-table th, .kn-table td { border: 1px solid var(--border); padding: 5px 8px; text-align: left; vertical-align: top; }
.kn-table th { background: #f3f4f6; }
.kn-table td:first-child { white-space: nowrap; }
.kn-detail { color: var(--muted); font-size: 11.5px; }
.kn-note { color: var(--muted); font-size: 11.5px; margin-top: 6px; }
.hidden { display: none !important; }

/* ===== 对话式写脚本(全屏 AI 开发界面) ===== */
.build-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: #f2f5fa; display: flex; flex-direction: column;
}
.build-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 22px; background: #fff; border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 6px rgba(0,0,0,.05);
}
.build-title { display: flex; align-items: center; gap: 12px; }
.build-logo {
  width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, #4f6ef7, #7c5cf0);
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700;
}
.build-name { font-size: 16px; font-weight: 700; }
.build-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.build-head-actions { display: flex; gap: 8px; }
/* 历史会话面板 */
.history-panel {
  position: fixed; top: 64px; right: 20px; z-index: 260; width: 340px; max-height: 70vh;
  background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.15);
  display: flex; flex-direction: column; overflow: hidden;
}
.history-panel.hidden { display: none; }
.history-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; font-weight: 700; border-bottom: 1px solid var(--border);
}
.history-list { flex: 1; overflow: auto; padding: 8px; min-height: 60px; }
.history-loading { color: var(--muted); font-size: 12px; padding: 12px; }
.history-empty { color: var(--muted); font-size: 13px; padding: 16px; text-align: center; }
.history-item {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 8px; cursor: pointer;
}
.history-item:hover { background: #f0f3fa; }
.history-item.active { background: #e7edff; }
.history-item-title { flex: 1; min-width: 0; }
.history-item-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-item-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.history-item-del {
  border: none; background: none; color: #c0392b; font-size: 14px; cursor: pointer; padding: 4px 6px; border-radius: 6px;
}
.history-item-del:hover { background: #fdecea; }
.history-foot { padding: 8px 16px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--border); }
/* 左右分栏: 左问答 + 右脚本工作区 */
.build-main {
  flex: 1; min-height: 0; display: flex;
}
.build-left {
  width: 44%; min-width: 380px; max-width: 560px;
  display: flex; flex-direction: column; min-height: 0;
  border-left: 1px solid var(--border); background: #f2f5fa;
}
.build-chat {
  flex: 1; min-height: 0; overflow: auto; padding: 18px 20px;
  display: flex; flex-direction: column; gap: 12px;
}
.bm-msg { display: flex; max-width: 92%; }
.bm-user { align-self: flex-end; justify-content: flex-end; }
.bm-ai { align-self: flex-start; }
.bm-user-bubble {
  background: linear-gradient(135deg, #4f6ef7, #5f6df2); color: #fff;
  padding: 10px 14px; border-radius: 14px 14px 4px 14px; font-size: 13.5px; line-height: 1.7;
  white-space: pre-wrap; word-break: break-word;
}
.bm-bubble {
  background: #fff; border: 1px solid var(--border); border-radius: 4px 14px 14px 14px;
  padding: 10px 14px; font-size: 13.5px; line-height: 1.75; color: var(--text);
  white-space: pre-wrap; word-break: break-word;
}
.bm-done-hint {
  margin-top: 8px; padding: 7px 10px; background: #eef6ee; border: 1px solid #bfe3bf;
  color: #2e7d32; border-radius: 8px; font-size: 12px; line-height: 1.6;
}
.bm-tips {
  margin-top: 8px; background: #fff8e6; border: 1px solid #f5d78e; color: #8a5b00;
  border-radius: 8px; padding: 7px 10px; font-size: 12px; line-height: 1.6;
}
.bm-tips.bm-warn { background: #fdecec; border-color: #f5a8a8; color: #a03030; }
.bm-actions { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.bm-export.ok { color: var(--ok); border-color: var(--ok); }
.bm-export-hint { width: 100%; font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.bm-typing { display: flex; gap: 4px; align-items: center; color: var(--muted); font-size: 12.5px; flex-wrap: wrap; }
.bm-typing span:not(.bm-typing-sec) {
  width: 6px; height: 6px; border-radius: 50%; background: #9aa5b5;
  animation: bm-blink 1.2s infinite;
}
.bm-typing span:nth-child(2) { animation-delay: .2s; }
.bm-typing span:nth-child(3) { animation-delay: .4s; }
.bm-typing-sec { margin-left: 6px; font-size: 11.5px; white-space: nowrap; }
.bm-cancel-btn { margin-left: 8px; padding: 2px 10px; font-size: 11.5px; color: #c0392b; border-color: #e5a5a5; }
.bm-cancel-btn:hover { background: #fdecec; }
.bm-quick-row { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.bm-quick-default, .bm-retry { padding: 4px 12px; font-size: 12.5px; border-color: var(--primary); color: var(--primary); background: #fff; }
.bm-quick-default:hover, .bm-retry:hover { background: #eef2ff; }
#brUndoWrap { display: inline-block; }
#brUndoWrap.hidden { display: none; }
@keyframes bm-blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
.build-suggest {
  padding: 8px 20px; background: #fff; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 12px; color: var(--muted);
}
.build-suggest .chip-sm { padding: 4px 10px; font-size: 12px; }
.build-foot {
  display: flex; gap: 10px; align-items: flex-end;
  padding: 12px 20px 16px; background: #fff; border-top: 1px solid var(--border);
}
.build-foot textarea {
  flex: 1; resize: none; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 10px; font-size: 13.5px; line-height: 1.6; outline: none; font-family: inherit;
}
.build-foot textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,110,247,.12); }
#btnBuildSend { padding: 10px 22px; font-size: 14px; border-radius: 10px; }

/* 右: 脚本工作区 */
.build-right {
  flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0;
  background: #fff;
}
.br-head {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  border-bottom: 1px solid var(--border); background: #fafbfd;
}
.br-title { font-size: 14px; font-weight: 700; color: var(--text); }
.br-status { font-size: 12px; color: var(--muted); }
.br-status.ok { color: var(--ok); }
.br-status.warn { color: #c0392b; }
.br-code {
  flex: 1; min-height: 0; width: 100%; box-sizing: border-box;
  border: none; border-bottom: 1px solid var(--border); outline: none; resize: none;
  padding: 14px 16px; font-family: Consolas, "Courier New", monospace;
  font-size: 12.5px; line-height: 1.65; color: #1e293b; background: #f8fafc;
  white-space: pre; tab-size: 2;
}
.br-code:focus { background: #fff; }
.br-card {
  margin: 10px 16px; padding: 10px 12px; border-radius: 10px;
  font-size: 12.5px; line-height: 1.7; max-height: 180px; overflow: auto;
}
.br-card-title { font-weight: 700; margin-bottom: 6px; }
.br-explain { background: #eef6ff; border: 1px solid #c5dcf7; color: #1a3f6b; }
.br-tips { background: #fff8e6; border: 1px solid #f5d78e; color: #7a5200; white-space: pre-wrap; }
.br-warn { background: #fdecec; border: 1px solid #f5a8a8; color: #8e2a2a; }
.br-warn-item { margin-bottom: 8px; }
.br-warn-item:last-child { margin-bottom: 0; }
.br-warn-hint { color: #a05a5a; font-size: 11.5px; }
.br-suggest { background: #f0f7ff; border: 1px solid #bfd9f5; color: #1a3f6b; }
.br-suggest-text { margin-bottom: 8px; }
.br-suggest-send { margin-top: 2px; }
/* 玩法灵感库 */
.build-ideas { border-top: 1px dashed #cbd5e1; padding: 8px 12px 10px; background: #faf7ef; }
.build-ideas-head { font-size: 13px; font-weight: 600; color: #7c5a12; margin-bottom: 6px; }
.build-ideas-tip { font-weight: 400; font-size: 11px; color: #a08a55; margin-left: 6px; }
.build-ideas-list { display: flex; flex-wrap: wrap; gap: 6px; max-height: 118px; overflow-y: auto; }
.build-ideas-loading { color: #a08a55; font-size: 12px; }
.idea-chip {
  display: flex; align-items: center; gap: 5px; flex: 1 1 calc(50% - 6px); min-width: 0;
  background: #fff; border: 1px solid #e2d9bf; border-radius: 8px; padding: 6px 8px; cursor: pointer;
  font-size: 12px; color: #4a3f1f; text-align: left; transition: border-color .15s, background .15s;
}
.idea-chip:hover { border-color: #c9a94e; background: #fffdf5; }
.idea-tag {
  flex: none; font-size: 10px; color: #fff; background: #c9a94e; border-radius: 4px; padding: 1px 5px;
}
.idea-desc {
  flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: #8a7a4a; font-size: 11px;
}
.check-label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #334; margin-bottom: 10px; cursor: pointer; }
/* 登录/注册界面 */
.login-overlay {
  position: fixed; inset: 0; z-index: 400; background: linear-gradient(135deg, #16213e 0%, #1b2a52 55%, #243b6e 100%);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-box { background: #fff; border-radius: 16px; width: 400px; max-width: 94vw; padding: 30px 34px 22px; box-shadow: 0 24px 70px rgba(0,0,0,.4); }
.login-logo {
  width: 56px; height: 56px; margin: 0 auto 10px; border-radius: 14px; background: linear-gradient(135deg, #2f6fed, #4f9dff);
  color: #fff; font-size: 30px; display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.login-title { text-align: center; font-size: 22px; margin: 0 0 4px; color: #1a2340; }
.login-sub { text-align: center; font-size: 12px; color: #7a86a5; margin: 0 0 18px; }
.login-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.login-tab { flex: 1; padding: 8px 0; border: 1px solid #d5dbe8; background: #f4f6fb; border-radius: 8px; cursor: pointer; font-size: 13px; color: #5a6480; }
.login-tab.active { background: #2f6fed; border-color: #2f6fed; color: #fff; font-weight: 600; }
.login-field { margin-bottom: 12px; }
.login-field label { display: block; font-size: 12px; color: #5a6480; margin-bottom: 4px; }
.login-field input {
  width: 100%; box-sizing: border-box; padding: 9px 12px; border: 1px solid #cdd6e6; border-radius: 8px; font-size: 14px; outline: none;
}
.login-field input:focus { border-color: #2f6fed; box-shadow: 0 0 0 2px rgba(47,111,237,.15); }
.btn-block { width: 100%; margin-top: 6px; }
.login-msg { min-height: 18px; font-size: 12.5px; color: #c0392b; margin-top: 8px; }
.login-tip { background: #f0f6ff; border: 1px solid #cfe0fb; color: #23457a; font-size: 12.5px; border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; line-height: 1.6; }
.login-tip-small { color: #7a5a2e; font-size: 11.5px; }
.login-foot { text-align: center; font-size: 11px; color: #9aa5c0; margin-top: 16px; }
.login-foot code { background: #eef1f8; padding: 1px 5px; border-radius: 4px; font-size: 11px; }
.build-user { font-size: 12px; color: #2f6fed; background: #eaf1ff; border: 1px solid #c6d9fb; padding: 4px 10px; border-radius: 14px; margin-right: 4px; }

/* ===== 击杀时间计算器 ===== */
.modal-calc { max-width: 560px; }
.calc-tip { color: #666; font-size: 12px; line-height: 1.6; margin: 0 0 12px; }
.calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.calc-grid label { display: block; font-size: 12px; color: #444; }
.calc-grid select, .calc-grid input { width: 100%; margin-top: 4px; }
.calc-actions { display: flex; align-items: center; gap: 10px; margin: 14px 0 6px; }
.calc-msg { font-size: 12px; color: #888; }
.calc-result { margin-top: 8px; border: 1px solid #dbe4f8; border-radius: 8px; background: #f6f9ff; padding: 10px 12px; }
.calc-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.calc-table td { padding: 5px 8px; border-bottom: 1px dashed #dbe4f8; }
.calc-table tr:last-child td { border-bottom: none; }
.calc-table td:first-child { color: #666; width: 90px; white-space: nowrap; }
.calc-time { color: #2f6fed; font-size: 16px; }
.calc-note { font-size: 11px; color: #999; margin: 8px 0 0; }

/* ===== 击杀计算器 v2 手动模式 ===== */
.calc-sec { margin: 12px 0 8px; font-size: 13px; color: #2f6fed; border-left: 3px solid #2f6fed; padding-left: 8px; }
.calc-grid { grid-template-columns: repeat(3, 1fr); }
.calc-note2 { font-size: 11px; color: #999; margin: 10px 0 0; line-height: 1.5; }

/* ===== 目录浏览选择器 ===== */
.calc-path-inputrow { display: flex; gap: 6px; }
.calc-path-inputrow input { flex: 1; min-width: 0; }
.browse-modal .modal-body { display: flex; flex-direction: column; gap: 8px; }
.browse-nav { display: flex; align-items: center; gap: 8px; }
.browse-current { font-size: 12px; color: #555; word-break: break-all; }
.browse-quick { display: flex; gap: 6px; align-items: center; font-size: 12px; color: #888; }
.btn-xs { padding: 2px 8px; font-size: 12px; }
.browse-list { border: 1px solid #ddd; border-radius: 6px; max-height: 320px; overflow-y: auto; min-height: 120px; background: #fff; }
.browse-list .b-item { display: flex; align-items: center; gap: 8px; padding: 6px 10px; cursor: pointer; border-bottom: 1px solid #f0f0f0; font-size: 13px; }
.browse-list .b-item:hover { background: #f2f6ff; }
.browse-list .b-item.dir { color: #2f6fed; }
.browse-list .b-item.file { color: #333; }
.browse-list .b-item .b-ico { width: 18px; text-align: center; }
.browse-list .b-item.sel { background: #dbe7ff; }
.browse-list .b-empty { padding: 20px; text-align: center; color: #aaa; font-size: 13px; }
.browse-foot { display: flex; align-items: center; gap: 10px; }
.browse-msg { font-size: 12px; color: #e07c1f; }

/* ===== 计算器输入框优化: 加高 + 同列对齐 ===== */
.calc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 14px; align-items: start; }
.calc-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #666; min-width: 0; }
.calc-grid label input,
.calc-grid label select {
  width: 100%;
  box-sizing: border-box;
  height: 38px;
  padding: 8px 10px;
  font-size: 14px;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  background: #fff;
}
.calc-grid label input:focus,
.calc-grid label select:focus { border-color: #2f6fed; outline: none; box-shadow: 0 0 0 2px rgba(47,111,237,.12); }
.calc-sub { font-size: 11px; color: #e07c1f; }

/* ===== 计算器紧凑版 ===== */
.calc-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px 8px; align-items: start; }
.calc-grid label { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: #666; min-width: 0; }
.calc-grid label input,
.calc-grid label select {
  width: 100%;
  box-sizing: border-box;
  height: 30px;
  padding: 4px 8px;
  font-size: 13px;
  border: 1px solid #d0d5dd;
  border-radius: 5px;
  background: #fff;
}
.calc-grid label input:focus,
.calc-grid label select:focus { border-color: #2f6fed; outline: none; box-shadow: 0 0 0 2px rgba(47,111,237,.12); }
.calc-path-inputrow { display: flex; gap: 5px; }
.calc-path-inputrow input { flex: 1; min-width: 0; height: 30px; padding: 4px 8px; font-size: 12px; }
.calc-path-inputrow .btn { height: 30px; padding: 2px 10px; line-height: 1; }
/* 路径行: 整行垂直居中对齐, 路径占3列、旁边的选择占2列 */
.calc-pathrow { align-items: center; }
.calc-pathrow > label.calc-path-label { grid-column: span 3; }
.calc-pathrow > label:last-child { grid-column: span 2; }
.calc-pathrow label input,
.calc-pathrow label select { margin: 0; }
.calc-actions { margin-top: 8px; display: flex; align-items: center; gap: 8px; }
.calc-sec { margin: 10px 0 6px; font-size: 12px; color: #2f6fed; border-left: 3px solid #2f6fed; padding-left: 7px; }
.calc-sub { font-size: 11px; color: #e07c1f; }

.login-remember { margin: 2px 0 10px; }
.login-remember label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.login-remember input { width: 14px; height: 14px; margin: 0; cursor: pointer; }
.login-switch { text-align: center; margin-top: 10px; font-size: 12.5px; }
.login-switch a { color: var(--primary); text-decoration: none; }
.login-switch a:hover { text-decoration: underline; }