:root {
  color-scheme: light;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  background: #f4f7fb;
  color: #111827;
  --text: #111827;
  --muted: #64748b;
  --line: #dce3ee;
  --soft-line: #e6ebf2;
  --surface: #ffffff;
  --soft: #f8fafc;
  --blue: #1d4ed8;
  --blue-text: #1e3a8a;
  --blue-soft: #eff6ff;
  --green: #1d4ed8;
  --green-soft: #eff6ff;
  --amber: #9a5b00;
  --amber-soft: #fff4df;
  --ink: #0f172a;
  --red: #b42318;
  --red-soft: #fff1f1;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.22);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
  padding: 18px 24px 28px;
}

.workbench {
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 32px 28px;
  background:
    linear-gradient(180deg, rgba(239, 246, 255, 0.92), rgba(255, 255, 255, 0) 230px),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.site-footer {
  max-width: 1320px;
  margin: 18px auto 0;
  padding: 18px 0 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}

.site-footer p {
  margin: 0;
}

.footer-compliance {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
}

.footer-compliance a {
  color: inherit;
  text-decoration: none;
}

.beian-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  line-height: 1.6;
}

.beian-icon {
  width: 13px;
  height: 14px;
  flex: none;
  object-fit: contain;
}

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

h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.1;
}

h2 {
  margin-bottom: 10px;
  font-size: 28px;
  line-height: 1.18;
}

h3 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.3;
}

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

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.brand-subtitle {
  margin: 8px 0 0;
  color: var(--blue-text);
  font-size: 14px;
  font-weight: 700;
}

.topbar-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.topbar-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  max-width: 420px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 800;
  line-height: 1.3;
  text-align: center;
}

.topbar-meta p {
  margin: 0;
}

.review-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #f8fbff;
  color: #334155;
  font-size: 13px;
}

.review-strip strong {
  color: var(--blue-text);
}

.review-strip span {
  padding: 5px 9px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #dbeafe;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 252px;
  gap: 28px;
  align-items: center;
  padding: 18px 0 14px;
}

.hero-copy p {
  max-width: 860px;
  margin-bottom: 0;
  color: #4b5563;
  font-size: 15px;
  line-height: 1.75;
}

.flow-steps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 8px 0;
}

.flow-step {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #fff;
  color: var(--blue);
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
}

.flow-step.active {
  background: var(--blue);
  color: #fff;
}

.flow-arrow {
  color: var(--blue);
  font-size: 20px;
  font-weight: 800;
}

.asset-stat {
  min-height: 90px;
  padding: 15px 18px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #fff;
  box-shadow: inset 4px 0 0 var(--blue);
}

.asset-stat span,
.asset-stat p,
.section-head p,
.panel-head span,
.scene-picker-head span {
  color: var(--muted);
  font-size: 13px;
}

.asset-stat strong {
  display: block;
  margin-top: 8px;
  font-size: 25px;
  line-height: 1;
}

.asset-stat p {
  margin: 8px 0 0;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
}

.module-search {
  display: grid;
  gap: 7px;
  margin-bottom: 10px;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

.module-search input,
.prompt-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.module-search input {
  min-height: 38px;
  padding: 0 13px;
}

.part-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.part-filter-button,
.scene-option,
.module-card,
#copyButton,
#generateButton {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.part-filter-button {
  min-height: 34px;
  padding: 0 12px;
  color: #334155;
  font-weight: 800;
}

.module-section {
  padding: 12px 14px 10px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #fff;
}

.part-filter-button.active {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
}

.module-grid {
  display: flex;
  gap: 8px;
  padding: 3px 3px 8px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
}

.module-card {
  flex: 0 0 174px;
  min-height: 74px;
  padding: 9px 11px;
  scroll-snap-align: start;
  text-align: left;
}

.module-card .module-phase {
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
}

.module-card .module-name,
.module-card .module-meta {
  display: block;
}

.module-card .module-name {
  min-height: 26px;
  margin-top: 5px;
  font-size: 13px;
  line-height: 1.35;
}

.module-card .module-meta {
  margin-top: 6px;
  color: var(--green);
  font-size: 11px;
  font-weight: 900;
}

.module-card.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.module-card:hover,
.scene-option:hover,
.part-filter-button:hover {
  border-color: #93c5fd;
}

.page-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.page-nav button {
  min-height: 36px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--blue);
  font-size: 14px;
  font-weight: 700;
  transition: all 180ms ease;
}

.page-nav button:hover {
  background: var(--blue-soft);
  border-color: var(--blue);
}

.nav-step-hint {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.scene-page {
  margin-top: 14px;
}

.scene-page-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 14px;
}

.scene-page-head {
  margin-bottom: 10px;
}

.generator-panel {
  display: grid;
  grid-template-columns: minmax(390px, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
  margin-top: 16px;
  align-items: start;
}

.input-panel,
.result-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.input-panel {
  padding: 18px;
}

.result-panel {
  position: sticky;
  top: 18px;
  overflow: hidden;
}

.panel-head,
.scene-picker-head,
.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-head > div:first-child {
  min-width: 0;
}

.input-progress {
  min-width: 44px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: var(--amber);
  text-align: center;
  font-weight: 900;
}

.input-progress.ready {
  background: var(--green-soft);
  color: var(--green);
}

.panel-actions {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.scene-switch-button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid rgba(37, 99, 235, 0.24);
  border-radius: 999px;
  padding: 0 12px;
  background: #f8fbff;
  color: var(--blue);
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.08);
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.scene-switch-button:hover,
.scene-switch-button:focus-visible {
  border-color: rgba(37, 99, 235, 0.42);
  background: var(--blue-soft);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.scene-switch-button span:first-child {
  font-size: 15px;
  transform: translateY(-1px);
}

.scene-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}

.scene-option {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 100px;
  padding: 16px 18px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: all 180ms ease;
}

.scene-option:hover {
  border-color: #93b5f0;
  background: #fafcff;
  box-shadow: 0 2px 12px rgba(29,78,216,0.06);
}

.scene-option span {
  color: var(--text);
  font-size: 16px;
  font-weight: 750;
  line-height: 1.4;
}

.scene-option b {
  color: #5b7ab8;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.scene-option small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.scene-option.active {
  border-color: var(--blue);
  background: var(--blue-soft);
  box-shadow: 0 0 0 3px rgba(29,78,216,0.08), 0 4px 16px rgba(29,78,216,0.1);
}

.scene-option.active span {
  color: var(--blue-text);
}

.scene-option.active b {
  color: var(--blue);
}

.scene-option.active small {
  color: #3b5a9a;
}

.prompt-form {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.prompt-form label {
  display: grid;
  gap: 7px;
  color: #334155;
  font-size: 13px;
  font-weight: 900;
}

.prompt-form textarea {
  min-height: 84px;
  resize: vertical;
  padding: 11px 12px;
  line-height: 1.6;
}

.prompt-form textarea[data-prefilled="true"] {
  color: #94a3b8;
}

.privacy-note {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--red-soft);
  color: var(--red);
  font-size: 13px;
  line-height: 1.55;
}

#generateButton,
#copyButton {
  min-height: 42px;
  padding: 0 16px;
  font-weight: 900;
}

#generateButton {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

#generateButton:disabled,
#copyButton:disabled {
  cursor: not-allowed;
  border-color: var(--line);
  background: #eef2f7;
  color: #94a3b8;
}

#copyButton:not(:disabled) {
  border-color: var(--blue);
  color: var(--blue);
}

.structure-preview {
  margin-top: 14px;
  padding: 12px;
  border-radius: 8px;
  background: #f8fbff;
  border: 1px solid #dbeafe;
}

.result-structure-preview {
  margin: 14px 18px 0;
}

.structure-preview strong {
  display: block;
  margin-bottom: 8px;
  color: var(--blue-text);
}

.structure-preview ol {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 20px;
  color: #334155;
  font-size: 13px;
  line-height: 1.45;
}

.result-head {
  padding: 18px 18px 0;
}

#promptResult {
  min-height: 620px;
  max-height: 76vh;
  margin: 14px 18px 0;
  padding: 18px;
  overflow: auto;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #0f172a;
  color: #e5edf8;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
  line-height: 1.72;
}

#promptResult.is-empty {
  background: #f8fafc;
  color: var(--muted);
}

.quality-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 18px 18px;
}

.quality-strip span {
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.empty-state {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: var(--muted);
}

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

  .workbench {
    padding: 18px;
  }

  .topbar,
  .hero,
  .generator-panel {
    grid-template-columns: 1fr;
  }

  .topbar,
  .hero {
    display: grid;
  }

  .topbar-meta {
    align-items: flex-start;
  }

  .result-panel {
    position: static;
  }

  .input-panel .panel-head {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .input-panel .panel-head > div:first-child {
    width: 100%;
  }

  #selectedSceneLabel {
    display: block;
    max-width: 100%;
    line-height: 1.5;
    overflow-wrap: anywhere;
  }

  .panel-actions {
    width: 100%;
    justify-content: space-between;
  }

  #promptResult {
    min-height: 420px;
    max-height: none;
  }
}
