:root {
  --bg: #0f1115;
  --panel: #171a21;
  --bubble-user: #2b5cff;
  --bubble-ai: #20242e;
  --text: #e6e8ee;
  --muted: #8b92a5;
  --accent: #6c8cff;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--panel);
  border-bottom: 1px solid #232733;
}
.brand { font-weight: 700; font-size: 18px; }
.mirror-tag {
  font-size: 11px;
  background: var(--accent);
  color: #fff;
  padding: 2px 6px;
  border-radius: 6px;
  margin-left: 4px;
  vertical-align: middle;
}
.icon-btn {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  border-radius: 8px;
  padding: 6px 10px;
}
.tabs { display: flex; gap: 6px; }
.tab {
  background: transparent;
  border: 1px solid #2a2f3a;
  color: var(--muted);
  font-size: 14px;
  padding: 6px 16px;
  border-radius: 999px;
  cursor: pointer;
}
.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.tabpane { display: none; flex: 1; min-height: 0; flex-direction: column; }
.tabpane.active { display: flex; }

.chat {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.msg { display: flex; }
.msg.user { justify-content: flex-end; }
.msg.system { justify-content: center; }
.bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bubble-ai);
}
.msg.user .bubble { background: var(--bubble-user); color: #fff; }
.msg.system .bubble {
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  max-width: 90%;
}
.typing::after {
  content: "▍";
  animation: blink 1s steps(2) infinite;
}
@keyframes blink { 0% { opacity: 1; } 50% { opacity: 0; } }

.composer {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  background: var(--panel);
  border-top: 1px solid #232733;
}
#input {
  flex: 1;
  resize: none;
  background: #0c0e13;
  color: var(--text);
  border: 1px solid #2a2f3a;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
}
.send-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.panel {
  position: fixed;
  top: 0; right: 0;
  width: 340px;
  height: 100%;
  background: var(--panel);
  border-left: 1px solid #232733;
  padding: 16px;
  overflow-y: auto;
  box-shadow: -8px 0 24px rgba(0,0,0,0.4);
  z-index: 10;
}
.panel.hidden { display: none; }
.panel-head { display: flex; align-items: center; justify-content: space-between; }
.panel-head h3 { margin: 0; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; font-size: 14px; color: var(--muted); }
.field input, .field select {
  background: #0c0e13;
  color: var(--text);
  border: 1px solid #2a2f3a;
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 14px;
}
.icon-btn:hover { background: #232733; }

/* ---------- 生图布局 ---------- */
.image-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 16px;
  padding: 16px;
  overflow: hidden;
  min-height: 0;
}
.image-controls {
  overflow-y: auto;
  padding-right: 8px;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row .field { margin: 8px 0; }
.image-controls textarea {
  background: #0c0e13;
  color: var(--text);
  border: 1px solid #2a2f3a;
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
}
.image-result {
  overflow-y: auto;
  background: #0c0e13;
  border: 1px solid #2a2f3a;
  border-radius: 12px;
  padding: 16px;
}
.img-status { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.img-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.img-cell {
  background: #171a21;
  border: 1px solid #2a2f3a;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.img-cell img {
  width: 100%;
  display: block;
  background: #000;
  min-height: 160px;
  object-fit: contain;
}
.img-dl {
  text-align: center;
  padding: 9px;
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
  border-top: 1px solid #2a2f3a;
}
.img-dl:hover { background: #20242e; }

