/* ===== AI写小说助手 深色科技风 ===== */
:root {
  --bg: #0d0f14;
  --bg-2: #14171f;
  --bg-3: #1c212c;
  --border: #262c3a;
  --text: #e8eaed;
  --text-dim: #9aa3b2;
  --accent: #f5a623;
  --accent-2: #ff8a3d;
  --accent-grad: linear-gradient(135deg, #f5a623, #ff6b3d);
  --green: #28c840;
  --red: #ff5f57;
  --yellow: #febc2e;
  --radius: 10px;
  --sidebar-w: 240px;
  --right-w: 320px;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

/* ===== 顶部地址栏 ===== */
.addr-bar {
  height: 44px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.traffic-lights { display: flex; gap: 7px; }
.dot { width: 12px; height: 12px; border-radius: 50%; }
.dot.red { background: var(--red); }
.dot.yellow { background: var(--yellow); }
.dot.green { background: var(--green); }
.addr-input {
  flex: 0 1 480px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 28px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 12px;
  color: var(--text-dim);
}
.lock { font-size: 11px; }
.addr-spacer { width: 54px; flex-shrink: 0; }

/* ===== 主体三栏 ===== */
.app-body {
  display: flex;
  height: calc(100% - 44px);
  min-height: 0;
}

/* ===== 左侧栏 ===== */
.left-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 14px 10px;
  gap: 10px;
  overflow: hidden;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
}
.brand-icon { font-size: 18px; }
.brand-name {
  font-size: 16px;
  font-weight: 700;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.menu-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 13px;
  transition: all .15s;
  border: 1px solid transparent;
  user-select: none;
}
.menu-item:hover { background: var(--bg-3); color: var(--text); }
.menu-item.active {
  background: var(--bg-3);
  color: var(--accent);
  border-color: rgba(245,166,35,.35);
  font-weight: 600;
}
.menu-icon { width: 18px; text-align: center; font-size: 14px; }

.divider { height: 1px; background: var(--border); margin: 2px 4px; }

.story-section { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px 6px;
}
.section-title { font-size: 12px; color: var(--text-dim); font-weight: 600; }
.icon-btn {
  width: 22px; height: 22px;
  border: 1px solid var(--border);
  background: var(--bg-3);
  color: var(--text-dim);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }

.story-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.story-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 13px;
  transition: all .15s;
}
.story-item:hover { background: var(--bg-3); color: var(--text); }
.story-item.active { background: var(--bg-3); color: var(--text); border-left: 3px solid var(--accent); }
.story-item .story-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.story-item .story-del {
  visibility: hidden;
  border: none; background: none; color: var(--text-dim);
  cursor: pointer; font-size: 12px; padding: 2px;
}
.story-item:hover .story-del { visibility: visible; }
.story-item .story-del:hover { color: var(--red); }
.story-empty { color: var(--text-dim); font-size: 12px; padding: 8px; text-align: center; }

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}
.footer-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  border-radius: 8px;
  text-align: left;
}
.footer-btn:hover { background: var(--bg-3); color: var(--text); }
.footer-icon { font-size: 15px; }

/* ===== 中间栏 ===== */
.center-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.output-area {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 14px 18px 6px;
}
.output-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  flex-shrink: 0;
}
.output-type {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
}
.output-tools { display: flex; align-items: center; gap: 6px; }
.tool-btn {
  padding: 4px 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
}
.tool-btn:hover { color: var(--accent); border-color: var(--accent); }
.font-size { font-size: 12px; color: var(--text-dim); width: 26px; text-align: center; }

.output-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  position: relative;
}
.output-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  gap: 10px;
}
.empty-icon { font-size: 40px; opacity: .5; }
.output-content {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.75;
  color: var(--text);
}
.output-media { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.output-media img {
  max-width: 100%;
  max-height: 420px;
  border-radius: 8px;
  border: 1px solid var(--border);
  object-fit: contain;
}
.output-media video {
  max-width: 100%;
  max-height: 420px;
  border-radius: 8px;
  background: #000;
}
.stream-cursor {
  display: none;
  width: 10px; height: 18px;
  background: var(--accent);
  animation: blink 1s infinite;
  margin-top: 2px;
}
.stream-cursor.on { display: inline-block; }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

/* ===== 输入区 ===== */
.input-area {
  flex-shrink: 0;
  padding: 8px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.config-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.cfg-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
}
.cfg-item select {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  outline: none;
}
.cfg-item select:focus { border-color: var(--accent); }

.input-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}
.input-row textarea {
  flex: 1;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px 14px;
  font-size: 13px;
  resize: none;
  outline: none;
  line-height: 1.6;
  font-family: inherit;
}
.input-row textarea:focus { border-color: var(--accent); }
.send-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 0 22px;
  background: var(--accent-grad);
  border: none;
  border-radius: var(--radius);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: filter .15s;
}
.send-btn:hover { filter: brightness(1.1); }
.send-btn:disabled { opacity: .5; cursor: not-allowed; }
.send-icon { font-size: 12px; }

/* ===== 右侧面板 ===== */
.right-panel {
  width: var(--right-w);
  flex-shrink: 0;
  background: var(--bg-2);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.panel-title { font-size: 14px; font-weight: 700; }
.panel-status { font-size: 11px; color: var(--accent); background: rgba(245,166,35,.12); padding: 2px 8px; border-radius: 10px; }
.panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px;
}
.panel-empty { color: var(--text-dim); font-size: 12px; text-align: center; margin-top: 40px; }
.panel-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.panel-item .p-title { font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.panel-item .p-meta { font-size: 11px; color: var(--text-dim); margin-bottom: 6px; }
.panel-item .p-content {
  font-size: 12px; color: var(--text-dim);
  max-height: 90px; overflow: hidden;
  white-space: pre-wrap; word-break: break-word;
  line-height: 1.6;
}
.panel-item .p-content.expanded { max-height: none; }
.panel-item .p-actions { display: flex; gap: 6px; margin-top: 8px; }
.panel-item .p-download {
  font-size: 11px; color: var(--accent); cursor: pointer;
  background: rgba(245, 166, 35, 0.08); border: 1px solid rgba(245, 166, 35, 0.35);
  border-radius: 4px; padding: 3px 8px;
}
.panel-item .p-download:hover { background: rgba(245, 166, 35, 0.18); }
.panel-item img, .panel-item video {
  max-width: 100%; border-radius: 6px; margin-top: 6px;
}
.panel-item .p-expand {
  font-size: 11px; color: var(--accent); cursor: pointer; background: none; border: none; margin-top: 4px;
}

.panel-footer {
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  justify-content: flex-end;
}
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent-grad);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  cursor: pointer;
}

/* ===== 弹窗 ===== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-mask.hidden { display: none; }
.modal {
  width: 360px;
  max-width: calc(100vw - 40px);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
}
.modal.wide { width: 420px; }
.modal h3 { font-size: 16px; margin-bottom: 4px; }
.modal-sub { font-size: 12px; color: var(--text-dim); margin-bottom: 14px; }
.modal-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 12px;
  font-size: 13px;
  margin-bottom: 10px;
  outline: none;
}
.modal-input:focus { border-color: var(--accent); }
.modal-error { color: var(--red); font-size: 12px; min-height: 16px; margin-bottom: 6px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.modal-btn {
  padding: 8px 18px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-3);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
}
.modal-btn.primary { background: var(--accent-grad); border: none; color: #fff; font-weight: 600; }
.modal-btn.secondary:hover { border-color: var(--text-dim); }
.set-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; margin-bottom: 6px;
}
.set-row > span { width: 80px; color: var(--text-dim); flex-shrink: 0; }
.set-row .modal-input { margin-bottom: 0; flex: 1; }

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #333b4d; border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }
