:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #171a1f;
  --muted: #626a76;
  --line: #dde2ea;
  --accent: #0f8f68;
  --accent-strong: #09684e;
  --soft: #e7f7f0;
  --warn: #b7791f;
  --shadow: 0 10px 30px rgba(22, 29, 38, 0.08);
}

body[data-theme="dark"] {
  --bg: #101114;
  --panel: #181a20;
  --text: #f5f1e8;
  --muted: #b9b0a2;
  --line: #333844;
  --accent: #d6a84f;
  --accent-strong: #f1c96d;
  --soft: #2a2419;
  --warn: #f1c96d;
}

body[data-theme="fresh"] {
  --bg: #f4f8ff;
  --panel: #ffffff;
  --text: #142033;
  --muted: #59677d;
  --line: #d7e2f3;
  --accent: #2766d8;
  --accent-strong: #174ba7;
  --soft: #e3edff;
  --warn: #0e7490;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, "Microsoft YaHei", sans-serif;
  line-height: 1.5;
}

button,
select {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 32px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.topbar h1,
.hero-panel h2,
.panel h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: 24px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
}

.status-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-strip span {
  border: 1px solid var(--accent);
  color: var(--accent-strong);
  background: var(--soft);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
}

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 22px;
  padding: 22px 32px 36px;
}

.sidebar,
.workspace {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.workspace {
  min-width: 0;
}

.panel,
.hero-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 16px;
}

.panel.compact {
  box-shadow: none;
}

.hero-panel {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding: 20px;
}

.hero-panel h2 {
  font-size: 26px;
}

.hero-panel p:last-child,
.panel-note {
  margin: 8px 0 0;
  color: var(--muted);
}

.panel-note {
  font-size: 13px;
}

.hero-actions,
.panel-head {
  display: flex;
  gap: 8px;
  align-items: center;
}

.hero-actions {
  flex-shrink: 0;
}

.panel-head {
  justify-content: space-between;
  margin-bottom: 10px;
}

.panel h2 {
  font-size: 17px;
}

label {
  display: block;
  margin-top: 12px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  padding: 8px 10px;
  color: var(--text);
}

button {
  min-height: 36px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  padding: 7px 12px;
  cursor: pointer;
  font-weight: 700;
}

button:hover {
  background: var(--accent-strong);
}

.copy-btn {
  min-height: 30px;
  padding: 4px 9px;
  background: var(--panel);
  color: var(--accent-strong);
}

.copy-btn:hover {
  color: #fff;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.module-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.module-tab {
  min-height: 34px;
  background: var(--panel);
  color: var(--accent-strong);
}

.module-tab.active,
.module-tab:hover {
  background: var(--accent);
  color: #fff;
}

.module-section {
  display: none;
}

.module-section.active {
  display: grid;
}

.panel.module-section.active {
  display: block;
}

pre {
  margin: 0;
  min-height: 260px;
  max-height: 520px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  background: color-mix(in srgb, var(--panel) 88%, var(--bg));
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
  font-family: Consolas, "Microsoft YaHei", monospace;
  font-size: 13px;
}

.asset-panel {
  overflow: hidden;
}

.card-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.asset-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.asset-card img {
  width: 100%;
  aspect-ratio: 3 / 4;
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  object-fit: cover;
}

.asset-card button {
  width: 100%;
  min-height: 34px;
  background: var(--panel);
  color: var(--accent-strong);
}

.asset-card button:hover {
  background: var(--accent);
  color: #fff;
}

.output-path {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--warn) 48%, var(--line));
  border-radius: 6px;
  background: color-mix(in srgb, var(--soft) 60%, var(--panel));
}

.output-path span {
  display: block;
  color: var(--warn);
  font-size: 12px;
  font-weight: 700;
}

.output-path strong {
  display: block;
  margin-top: 4px;
  word-break: break-all;
  font-size: 13px;
}

.check {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 10px 0 0;
  color: var(--text);
  font-weight: 400;
}

#toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  min-width: 180px;
  max-width: 320px;
  background: #111827;
  color: #fff;
  border-radius: 6px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

#toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .topbar,
  .hero-panel {
    flex-direction: column;
  }

  .grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .topbar {
    padding: 18px 16px 14px;
  }

  .topbar h1,
  .hero-panel h2 {
    font-size: 21px;
  }

  .hero-actions {
    width: 100%;
    flex-direction: column;
  }

  .hero-actions button {
    width: 100%;
  }

  .module-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
