:root {
  color-scheme: light;
  --bg: #f7f8f6;
  --panel: #ffffff;
  --panel-2: #f0f2ee;
  --line: #e2e4df;
  --line-strong: #cfd5ce;
  --text: #171a17;
  --muted: #747b73;
  --mint: #24c6a3;
  --mint-dark: #0f967a;
  --soft: #ecfbf7;
  --shadow: 0 22px 80px rgba(42, 50, 44, .12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at center, #fff 0, var(--bg) 64%);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

button,
textarea,
select,
input {
  font: inherit;
}

.app {
  min-height: 100vh;
  padding: 14px 330px 130px 18px;
}

.topbar {
  height: 42px;
  display: flex;
  align-items: center;
}

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

.brand-logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  object-fit: cover;
}

.brand strong {
  font-size: 16px;
}

.status {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 7;
  width: 292px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid rgba(36, 198, 163, .32);
  border-radius: 999px;
  color: var(--mint-dark);
  background: rgba(236, 251, 247, .94);
  font-size: 13px;
  font-weight: 700;
}

.status.bad {
  color: #a83c3c;
  border-color: rgba(210, 76, 76, .28);
  background: #fff1f1;
}

.canvas-panel {
  position: relative;
  min-height: calc(100vh - 182px);
  display: grid;
  place-items: center;
  padding: 36px 24px;
}

.ready-card {
  width: min(620px, 76vw);
  min-height: 104px;
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 8px 18px;
  align-items: center;
  padding: 22px 26px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 18px 54px rgba(25, 28, 25, .08);
}

.ready-card strong {
  display: block;
  font-size: 19px;
}

.ready-card span {
  grid-column: 2;
  color: var(--muted);
  font-size: 14px;
}

.spark {
  width: 50px;
  height: 50px;
  grid-row: span 2;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: var(--mint-dark);
  background: var(--soft);
  font-size: 24px;
}

.gallery {
  width: min(1480px, 100%);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(410px, max-content));
  justify-content: center;
  gap: 22px;
}

.gallery[data-count="1"] {
  grid-template-columns: minmax(540px, 760px);
}

.gallery[data-count="2"] {
  grid-template-columns: repeat(2, minmax(410px, 560px));
}

.gallery[data-count="3"],
.gallery[data-count="4"] {
  grid-template-columns: repeat(2, minmax(360px, 500px));
}

.image-card {
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
}

.image-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  display: block;
  background: #f1f2ef;
}

.image-actions {
  display: flex;
  gap: 10px;
  padding: 12px;
}

.image-actions a {
  flex: 1;
  min-height: 42px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  background: #f5f6f3;
  border: 1px solid var(--line);
  font-size: 14px;
  font-weight: 800;
}

.loading {
  position: fixed;
  inset: 0 320px 0 0;
  z-index: 6;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 13px;
  text-align: center;
  background: rgba(247, 248, 246, .78);
  backdrop-filter: blur(8px);
}

.loading strong {
  font-size: 23px;
}

.loading p {
  max-width: 480px;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.loading span {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--mint-dark);
  background: var(--soft);
  border: 1px solid rgba(36, 198, 163, .28);
  font-size: 13px;
  font-weight: 700;
}

.loader {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 4px solid rgba(36, 198, 163, .18);
  border-top-color: var(--mint);
  animation: spin .9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.agent-composer {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(calc(-50% - 160px));
  width: min(920px, calc(100vw - 380px));
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: rgba(255, 255, 255, .96);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  overflow: hidden;
  z-index: 5;
}

.agent-head {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.agent-head strong {
  display: block;
  font-size: 15px;
}

.agent-head span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.mode-tabs {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  background: #eef0ec;
}

.mode-tabs button {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  padding: 0 13px;
  color: #596159;
  background: transparent;
  cursor: pointer;
  font-weight: 800;
}

.mode-tabs button.active {
  color: #fff;
  background: var(--mint);
}

.agent-strip {
  display: flex;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.industry-pill,
.agent-chip {
  min-height: 36px;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0 12px;
  background: #fff;
  cursor: pointer;
  font-weight: 800;
}

.industry-pill {
  color: var(--mint-dark);
  border-color: rgba(36, 198, 163, .32);
  background: var(--soft);
}

.agent-chip span {
  margin-left: 6px;
  color: var(--muted);
  font-size: 12px;
}

.prompt-row {
  min-height: 66px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 10px;
}

.prompt-row textarea {
  flex: 1;
  min-height: 46px;
  max-height: 130px;
  resize: none;
  border: 0;
  outline: none;
  padding: 12px 4px;
  color: var(--text);
  background: transparent;
  line-height: 1.45;
}

.upload-btn,
.preset-btn,
.primary {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 800;
}

.upload-btn,
.preset-btn {
  padding: 0 13px;
  border: 1px solid rgba(36, 198, 163, .28);
  color: var(--mint-dark);
  background: var(--soft);
}

.upload-btn input {
  display: none;
}

.preset-btn {
  border-color: var(--line-strong);
  color: #30362f;
  background: #f6f7f4;
}

.primary {
  min-width: 68px;
  border: 0;
  padding: 0 18px;
  color: #fff;
  background: var(--mint);
}

.primary:disabled {
  cursor: wait;
  opacity: .76;
}

.reference-chip {
  height: 46px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px 5px 5px;
  border-radius: 12px;
  background: #f3f5f2;
  border: 1px solid var(--line);
}

.reference-chip img {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  object-fit: cover;
}

.reference-chip button {
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 0 14px 10px;
  color: #777f77;
  font-size: 12px;
}

.meta-row span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  background: #f5f6f3;
}

.settings {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  height: 100vh;
  overflow: auto;
  padding: 60px 14px 24px;
  border-left: 1px solid var(--line);
  background: #f1f2ee;
  z-index: 4;
}

.settings-head {
  margin-bottom: 14px;
}

.settings-head strong {
  display: block;
  font-size: 18px;
}

.settings-head span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 13px;
}

.field span,
.quick-title {
  color: #30362f;
  font-size: 13px;
  font-weight: 800;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--text);
  background: #fff;
  outline: none;
}

.field input,
.field select {
  height: 42px;
  padding: 0 12px;
}

.field textarea {
  resize: vertical;
  min-height: 82px;
  padding: 12px;
  line-height: 1.5;
}

.key-note {
  margin: -4px 0 14px;
  padding: 10px 11px;
  border: 1px solid rgba(36, 198, 163, .25);
  border-radius: 10px;
  color: var(--mint-dark);
  background: var(--soft);
  font-size: 12px;
  line-height: 1.45;
}

.key-note.bad {
  color: #b44848;
  border-color: rgba(210, 76, 76, .25);
  background: #fff1f1;
}

.ratio-card {
  margin: -3px 0 13px;
  padding: 13px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  font-weight: 900;
  line-height: 1.5;
}

.ratio-card span,
.ratio-card b {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.check-row {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 4px 9px;
  margin: 2px 0 14px;
  color: #30362f;
  font-size: 13px;
}

.check-row input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
}

.text-safety-row {
  padding: 11px 12px;
  border: 1px solid rgba(210, 132, 36, .34);
  border-radius: 12px;
  background: #fff8e8;
}

.text-safety-row span {
  color: #6b4612;
  font-weight: 900;
}

.text-safety-row small {
  grid-column: 2;
  color: #9a6a22;
  line-height: 1.45;
}

.clear-btn {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--text);
  background: #fff;
  cursor: pointer;
  font-weight: 800;
}

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(0, 0, 0, .32);
  backdrop-filter: blur(8px);
}

.industry-modal {
  position: relative;
  width: min(1180px, 94vw);
  min-height: 680px;
  max-height: 88vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 28px 90px rgba(0, 0, 0, .25);
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-size: 22px;
}

.modal-head {
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
}

.modal-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.modal-head strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

.modal-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.modal-body {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 0;
}

.industry-list {
  padding: 16px;
  overflow: auto;
  border-right: 1px solid var(--line);
  background: #f5f6f3;
}

.industry-item {
  width: 100%;
  min-height: 58px;
  display: grid;
  grid-template-columns: 34px 1fr 16px;
  gap: 8px;
  align-items: center;
  margin-bottom: 9px;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: #fff;
  cursor: pointer;
  text-align: left;
}

.industry-item.active {
  border-color: rgba(36, 198, 163, .55);
  box-shadow: 0 0 0 3px rgba(36, 198, 163, .10);
}

.industry-item span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: #080a09;
  font-weight: 900;
}

.industry-item strong {
  display: block;
  font-size: 14px;
}

.industry-item small {
  grid-column: 2;
  color: var(--muted);
  font-size: 12px;
}

.industry-item b {
  grid-row: span 2;
  color: var(--muted);
}

.industry-detail {
  padding: 18px;
  overflow: auto;
}

.detail-empty {
  min-height: 280px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  border: 1px dashed rgba(36, 198, 163, .28);
  border-radius: 14px;
  background: linear-gradient(180deg, #fbfffd, #fff);
  text-align: center;
}

.detail-empty div {
  color: var(--mint);
  font-size: 30px;
}

.detail-empty p {
  max-width: 420px;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.detail-panel {
  min-height: 360px;
  padding: 28px;
  border: 1px dashed rgba(36, 198, 163, .28);
  border-radius: 14px;
  background: linear-gradient(180deg, #fbfffd, #fff);
}

.detail-icon {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: #080a09;
  font-size: 20px;
  font-weight: 900;
}

.detail-panel h3 {
  margin: 16px 0 4px;
  font-size: 24px;
}

.detail-panel p {
  margin: 0 0 18px;
  color: var(--muted);
}

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

.detail-grid label {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
}

.detail-grid span {
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
}

.modal-actions button {
  min-height: 38px;
  border-radius: 10px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  background: #fff;
  cursor: pointer;
  font-weight: 800;
}

.modal-actions button:first-child {
  color: #fff;
  border-color: var(--mint);
  background: var(--mint);
}

.toast {
  position: fixed;
  right: 342px;
  bottom: 146px;
  max-width: min(420px, calc(100vw - 360px));
  padding: 13px 15px;
  border: 1px solid rgba(210, 76, 76, .26);
  border-radius: 10px;
  color: #8f2d2d;
  background: #fff1f1;
  box-shadow: var(--shadow);
  line-height: 1.5;
  z-index: 30;
}

@media (max-width: 960px) {
  .app {
    padding: 12px 12px 150px;
  }

  .settings {
    position: static;
    width: 100%;
    height: auto;
    padding: 18px 14px 24px;
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: 16px 16px 0 0;
  }

  .status {
    position: static;
    width: auto;
    margin-left: auto;
  }

  .agent-composer {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    transform: none;
  }

  .loading {
    inset: 0;
  }

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

  .gallery,
  .gallery[data-count="1"],
  .gallery[data-count="2"],
  .gallery[data-count="3"],
  .gallery[data-count="4"] {
    grid-template-columns: minmax(0, 1fr);
  }

  .industry-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .toast {
    right: 16px;
    bottom: 150px;
    max-width: calc(100vw - 32px);
  }
}
