/* Any2GGB · 深色工作台（靛蓝紫强调，延续 Any2 家族气质但独立身份） */
:root {
  --bg: #12141D; --panel: #1A1D2A; --panel2: #202436; --line: #2A2D3E;
  --ink: #EDEFF6; --ink-dim: #9AA0B5; --accent: #5B5BD6; --accent2: #8B5CF6;
  --cyan: #3FB6C6; --warn: #E6783C; --ok: #4CAF7D; --err: #E05B5B;
  --radius: 10px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--ink); display: flex; flex-direction: column;
}
button {
  background: var(--accent); color: #fff; border: 0; border-radius: 8px;
  padding: 7px 14px; cursor: pointer; font-size: 13px;
}
button:hover { filter: brightness(1.12); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink-dim); }
button.ghost:hover { color: var(--ink); border-color: var(--accent); }
input, select, textarea {
  background: var(--panel2); border: 1px solid var(--line); color: var(--ink);
  border-radius: 8px; padding: 7px 10px; font-size: 13px; outline: none;
}
input:focus, textarea:focus { border-color: var(--accent); }

/* 顶栏 */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.brand { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.logo { color: var(--accent2); font-size: 20px; }
.ver { font-size: 11px; color: var(--ink-dim); border: 1px solid var(--line); border-radius: 20px; padding: 1px 8px; }
.demo-chip { font-size: 11px; color: var(--warn); border: 1px solid var(--warn); border-radius: 20px; padding: 1px 8px; }
.top-actions { display: flex; gap: 8px; }

/* 主工作区 */
.workspace { flex: 1; display: flex; min-height: 0; }
.left {
  width: 360px; min-width: 300px; display: flex; flex-direction: column;
  border-right: 1px solid var(--line); background: var(--panel);
}
.proj-bar { display: flex; gap: 6px; padding: 10px; border-bottom: 1px solid var(--line); }
.proj-bar select { flex: 1; }
.chat { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 92%; padding: 8px 12px; border-radius: 10px; font-size: 13px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.msg.user { align-self: flex-end; background: var(--accent); }
.msg.assistant { align-self: flex-start; background: var(--panel2); }
.msg.system { align-self: center; color: var(--ink-dim); font-size: 12px; background: none; }
.generation-options { display: flex; flex-direction: column; gap: 6px; padding: 8px 12px 0; }
.option-row { display: flex; align-items: center; gap: 7px; min-width: 0; }
.option-label { width: 30px; flex: 0 0 30px; color: var(--ink-dim); font-size: 11px; }
.choice-group { display: flex; gap: 5px; }
.choice-group .choice {
  font-size: 12px; color: var(--ink-dim); border: 1px solid var(--line);
  border-radius: 20px; padding: 3px 10px; cursor: pointer; background: none;
}
.choice-group.compact .choice { padding-inline: 11px; }
.choice-group .choice:hover { border-color: var(--cyan); color: var(--ink); }
.choice-group .choice.active { color: #fff; border-color: var(--accent); background: var(--accent); }
.option-hint { color: var(--ink-dim); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.interaction-toggle {
  display: inline-flex; align-items: center; gap: 6px; min-height: 26px;
  padding: 3px 10px; border: 1px solid var(--line); border-radius: 20px;
  color: var(--ink-dim); font-size: 12px; cursor: pointer; transition: .18s ease;
}
.interaction-toggle:hover { color: var(--ink); border-color: var(--cyan); }
.interaction-toggle:has(input:checked) { color: #fff; border-color: var(--accent); background: var(--accent); }
.interaction-toggle input { width: 13px; height: 13px; padding: 0; accent-color: var(--accent2); }
.composer { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; }
.composer textarea { width: 100%; resize: none; }
.composer-actions { display: flex; gap: 8px; align-items: center; }
.composer-actions #sendBtn { margin-left: auto; }
.stop-generation {
  color: #FFD9D9; background: rgba(224,91,91,.12); border: 1px solid rgba(224,91,91,.58);
  transition: transform .16s ease, background .16s ease, border-color .16s ease;
}
.stop-generation:hover { background: rgba(224,91,91,.24); border-color: var(--err); transform: translateY(-1px); }
.stop-generation:disabled { transform: none; }
.attachbar { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 12px 0; }
.att-chip { position: relative; display: inline-flex; align-items: center; gap: 6px; max-width: 180px;
  padding: 4px 8px 4px 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel2); font-size: 12px; }
.att-chip img { width: 34px; height: 34px; object-fit: cover; border-radius: 5px; display: block; }
.att-chip .att-ico { font-size: 20px; padding: 0 4px; }
.att-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-dim); }
.att-x { position: absolute; top: -7px; right: -7px; width: 18px; height: 18px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-size: 13px; line-height: 1; padding: 0; cursor: pointer; }
.att-x:hover { border-color: var(--accent); }
.status { padding: 6px 12px 10px; font-size: 12px; color: var(--ink-dim); min-height: 28px; }
.status.spin::before { content: "◌ "; color: var(--accent2); }

/* 右侧 */
.right { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.tabs { display: flex; align-items: center; gap: 4px; padding: 8px 12px 0; border-bottom: 1px solid var(--line); }
.tab { background: none; color: var(--ink-dim); border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 8px 14px; }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.tab-actions { margin-left: auto; display: flex; gap: 6px; padding-bottom: 6px; align-items: center; flex-wrap: wrap; }
.png-opt { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-dim); cursor: pointer; white-space: nowrap; }
.png-opt input { accent-color: var(--accent); }
.pane { display: none; flex: 1; min-height: 0; flex-direction: column; }
.pane.active { display: flex; }

#ggbBox { flex: 1; min-height: 0; display: flex; align-items: stretch; justify-content: stretch; background: #fff; }
#ggbApplet { width: 100%; height: 100%; }
.stepbar {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  border-top: 1px solid var(--line); background: var(--panel);
}
#stepLabel { font-size: 13px; color: var(--ink-dim); flex: 1; text-align: center; }

#scriptEditor {
  flex: 1; resize: none; border-radius: 0; border: 0; border-bottom: 1px solid var(--line);
  font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 13px; line-height: 1.6; padding: 12px;
}
.script-actions { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--panel); }
.script-actions .hint { font-size: 12px; color: var(--ink-dim); }

#planView { flex: 1; overflow: auto; padding: 14px; font-size: 13px; line-height: 1.7; color: var(--ink-dim); white-space: pre-wrap; font-family: inherit; }

/* 版本时间线 */
.timeline { display: flex; gap: 6px; padding: 8px 12px; border-top: 1px solid var(--line); background: var(--panel); overflow-x: auto; min-height: 44px; }
.vchip {
  font-size: 12px; padding: 4px 10px; border-radius: 20px; cursor: pointer;
  border: 1px solid var(--line); color: var(--ink-dim); white-space: nowrap; background: none;
}
.vchip.ok { color: var(--ok); }
.vchip.failed { color: var(--err); }
.vchip.cancelled { color: var(--warn); }
.vchip.current { border-color: var(--accent); color: var(--ink); }

/* 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal[hidden] { display: none !important; }
.modal-card {
  width: 440px; max-width: 92vw; max-height: 86vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px;
  display: flex; flex-direction: column; gap: 10px;
}
.modal-card.wide { width: 640px; }
.modal-card h3 { font-size: 15px; }
.modal-card label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-dim); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.cfg-msg { font-size: 12px; color: var(--ink-dim); min-height: 18px; }
.cfg-msg.ok { color: var(--ok); } .cfg-msg.err { color: var(--err); }
.modal-card hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.update-panel { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; }
.changelog { font-size: 13px; line-height: 1.7; color: var(--ink-dim); white-space: pre-wrap; overflow-y: auto; }

@media (max-width: 860px) {
  .workspace { flex-direction: column; }
  .left { width: 100%; max-height: 45vh; }
}
