:root {
  color-scheme: dark;
  --bg: #080b12;
  --panel: #101722;
  --panel-2: #0d131d;
  --line: #243145;
  --text: #eef4ff;
  --muted: #93a3ba;
  --soft: #151f2f;
  --brand: #5b86ff;
  --brand-2: #22c8a7;
  --warn: #f4b860;
  --danger: #ff6b78;
  --ok: #35d69f;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Inter", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 18% 10%, rgba(91, 134, 255, 0.20), transparent 28%),
    radial-gradient(circle at 92% 24%, rgba(34, 200, 167, 0.14), transparent 25%),
    linear-gradient(180deg, #0a101b 0%, #080b12 58%, #06080d 100%);
}

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

a { color: inherit; }

.app-shell {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 56px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  font-size: 26px;
  font-weight: 900;
  box-shadow: 0 14px 42px rgba(91, 134, 255, 0.34);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 18px;
  letter-spacing: 0;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

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

.nav-actions a {
  text-decoration: none;
  color: var(--muted);
  border: 1px solid var(--line);
  background: rgba(16, 23, 34, 0.72);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 800;
}

.nav-actions a:hover,
.nav-actions .console-link {
  color: var(--text);
  border-color: rgba(91, 134, 255, 0.55);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  gap: 34px;
  align-items: center;
  padding: 64px 0 40px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  margin: 0 0 16px;
  color: #9fc0ff;
  background: rgba(91, 134, 255, 0.12);
  border: 1px solid rgba(91, 134, 255, 0.28);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 900;
}

.hero h1 {
  max-width: 700px;
  margin: 0;
  font-size: clamp(44px, 7vw, 88px);
  line-height: 0.98;
  letter-spacing: 0;
}

.lead {
  max-width: 680px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.7;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.hero-stats span {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(16, 23, 34, 0.72);
  padding: 11px 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.hero-stats b {
  color: var(--text);
  font-size: 22px;
}

.hero-preview {
  min-height: 460px;
  position: relative;
}

.preview-card {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 26px;
  box-shadow: var(--shadow);
}

.preview-a {
  inset: 28px 86px 70px 36px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.16), transparent 38%),
    radial-gradient(circle at 68% 32%, rgba(255,255,255,0.95), transparent 4%),
    linear-gradient(145deg, #16345d, #814ee6 54%, #0dd1bd);
}

.preview-b {
  width: 210px;
  height: 260px;
  right: 12px;
  bottom: 10px;
  background: linear-gradient(160deg, #ffb86c, #fd6b86, #6c5bff);
}

.preview-c {
  width: 190px;
  height: 190px;
  left: 0;
  bottom: 6px;
  background: linear-gradient(135deg, #101722, #5b86ff);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(330px, 430px) 1fr;
  gap: 18px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  background: rgba(16, 23, 34, 0.88);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.controls,
.result-panel {
  padding: 18px;
}

.panel-head,
.result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-head p,
.panel-head h2,
.result-head p,
.result-head h2 {
  margin: 0;
}

.panel-head p,
.result-head p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.panel-head h2,
.result-head h2 {
  margin-top: 4px;
  font-size: 24px;
}

.result-head span {
  color: var(--warn);
  border: 1px solid rgba(244, 184, 96, 0.34);
  background: rgba(244, 184, 96, 0.10);
  border-radius: 999px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 900;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

input, select, textarea {
  width: 100%;
  min-width: 0;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel-2);
  padding: 12px 13px;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: rgba(91, 134, 255, 0.86);
  box-shadow: 0 0 0 4px rgba(91, 134, 255, 0.14);
}

textarea {
  min-height: 168px;
  resize: vertical;
  line-height: 1.55;
}

.key-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.prompt-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -2px 0 14px;
}

.prompt-tools button,
.soft-button {
  min-height: 42px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
  padding: 0 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
}

.prompt-tools button:hover,
.soft-button:hover {
  border-color: rgba(91, 134, 255, 0.62);
}

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

.primary-button {
  flex: 1;
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  color: white;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  cursor: pointer;
  font-weight: 950;
  box-shadow: 0 14px 36px rgba(91, 134, 255, 0.26);
}

button:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.status {
  min-height: 24px;
  margin: 13px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.status.error { color: var(--danger); }
.status.ok { color: var(--ok); }

.result-panel {
  min-height: 650px;
}

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

.gallery.empty {
  min-height: 500px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(147, 163, 186, 0.32);
  border-radius: 18px;
  background: rgba(13, 19, 29, 0.55);
}

.empty-state {
  max-width: 320px;
  text-align: center;
  color: var(--muted);
}

.empty-icon {
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  color: #8eb0ff;
  border-radius: 24px;
  background: rgba(91, 134, 255, 0.12);
  border: 1px solid rgba(91, 134, 255, 0.28);
  font-size: 38px;
}

.empty-state strong {
  display: block;
  color: var(--text);
  font-size: 20px;
  margin-bottom: 8px;
}

.empty-state p {
  margin: 0;
  line-height: 1.6;
}

.image-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-2);
}

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

.image-card footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px;
}

.image-card a {
  color: #a9c3ff;
  text-decoration: none;
  font-weight: 950;
}

.image-card small {
  color: var(--muted);
}

.notes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 18px;
}

.notes article {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(16, 23, 34, 0.66);
  padding: 18px;
}

.notes h3 {
  margin: 0 0 8px;
  font-size: 17px;
}

.notes p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}

@media (max-width: 920px) {
  .hero,
  .workspace,
  .notes {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-top: 42px;
  }

  .hero-preview {
    min-height: 360px;
  }

  .result-panel {
    min-height: 520px;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 20px, 1220px);
    padding-top: 14px;
  }

  .topbar,
  .nav-actions,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .nav-actions {
    width: 100%;
  }

  .nav-actions a {
    text-align: center;
  }

  .hero h1 {
    font-size: 42px;
  }

  .lead {
    font-size: 16px;
  }

  .hero-preview {
    display: none;
  }

  .form-grid,
  .key-row {
    grid-template-columns: 1fr;
  }

  .panel-head,
  .result-head {
    display: block;
  }

  .result-head span {
    display: inline-flex;
    margin-top: 10px;
  }
}
