:root {
  --panel: rgba(255, 255, 255, 0.9);
  --panel-strong: rgba(255, 255, 255, 0.96);
  --ink: #0f1b2e;
  --muted: #5c6b82;
  --line: rgba(21, 39, 64, 0.12);
  --brand: #1d4ed8;
  --brand-strong: #0f3aa9;
  --accent: #f97316;
  --success: #0f9f6e;
  --danger: #c0392b;
  --shadow: 0 24px 80px rgba(5, 13, 25, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(249, 115, 22, 0.22), transparent 24%),
    radial-gradient(circle at top right, rgba(29, 78, 216, 0.22), transparent 20%),
    linear-gradient(135deg, #09111f 0%, #101d32 46%, #d9e4f7 100%);
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}

.shell {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 20px;
  min-height: 100vh;
  padding: 20px;
}

.panel {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 28px;
  background: var(--panel);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

.settings-panel {
  padding: 28px;
}

.workspace {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 20px;
}

.control-panel,
.output-panel {
  padding: 24px;
}

.eyebrow {
  margin-bottom: 12px;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.lede,
.microcopy {
  color: var(--muted);
  line-height: 1.8;
}

.settings-group {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

label {
  display: block;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 600;
  color: #122033;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  margin-top: 8px;
  padding: 14px 16px;
  border: 1px solid rgba(21, 39, 64, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: rgba(29, 78, 216, 0.45);
  box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.12);
}

button {
  border: 0;
  border-radius: 14px;
  padding: 12px 18px;
  background: #dbe5fb;
  color: #11306e;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, opacity 160ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

button.primary {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-strong) 100%);
  color: white;
}

.checkbox {
  display: flex;
  gap: 10px;
  align-items: center;
}

.checkbox input {
  width: auto;
  margin: 0;
}

.tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.tab {
  background: rgba(17, 48, 110, 0.08);
  color: #315da8;
}

.tab.active {
  background: #132033;
  color: white;
}

.mode-panel {
  display: none;
}

.mode-panel.active {
  display: block;
}

.toolbar,
.output-toolbar {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  justify-content: space-between;
}

.toolbar .grow {
  flex: 1;
  margin-bottom: 0;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.status {
  margin: 20px 0;
  padding: 14px 16px;
  border-radius: 16px;
  background: #eef4ff;
  color: #294d92;
}

.status[data-type="loading"] {
  background: #fff5e8;
  color: #9a4c08;
}

.status[data-type="error"] {
  background: #fdeeee;
  color: var(--danger);
}

.status[data-type="success"] {
  background: #eaf8f2;
  color: var(--success);
}

.topic-list.empty,
.image-gallery.empty,
.article-meta.empty {
  padding: 18px;
  border: 1px dashed rgba(21, 39, 64, 0.18);
  border-radius: 18px;
  color: var(--muted);
}

.topic-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  padding: 18px;
  margin-top: 14px;
  border: 1px solid rgba(21, 39, 64, 0.1);
  border-radius: 22px;
  background: var(--panel-strong);
}

.topic-card h3 {
  margin-bottom: 10px;
}

.topic-card p {
  color: var(--muted);
  line-height: 1.75;
}

.mini-grid {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  font-size: 14px;
  color: #314156;
}

.chip-row,
.prompt-list,
.source-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip-row span,
.prompt-list code,
.source-strip a {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(29, 78, 216, 0.08);
  color: #315da8;
  font-size: 13px;
  text-decoration: none;
}

.asset-section {
  margin-top: 28px;
}

.image-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.image-card {
  margin: 0;
  overflow: hidden;
  border-radius: 20px;
  background: white;
  border: 1px solid rgba(21, 39, 64, 0.1);
}

.image-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #d8e0ef;
}

.image-card figcaption {
  padding: 12px 14px 16px;
  color: var(--muted);
  line-height: 1.6;
  font-size: 13px;
}

.article-meta {
  display: grid;
  gap: 14px;
}

.meta-block {
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(21, 39, 64, 0.08);
  background: rgba(255, 255, 255, 0.85);
}

.meta-block strong {
  display: block;
  margin-bottom: 10px;
}

.article-preview {
  margin-top: 20px;
  padding: 20px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(21, 39, 64, 0.1);
  overflow-x: auto;
}

@media (max-width: 1180px) {
  .shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 12px;
  }

  .settings-panel,
  .control-panel,
  .output-panel {
    padding: 18px;
  }

  .toolbar,
  .output-toolbar,
  .topic-card {
    grid-template-columns: 1fr;
    display: grid;
  }

  .actions {
    width: 100%;
  }

  .actions button,
  .topic-card button {
    width: 100%;
  }
}
