:root {
  --bg: #0d1117;
  --bg-soft: #121a25;
  --surface: rgba(15, 24, 35, 0.78);
  --surface-strong: #121c28;
  --surface-soft: rgba(255, 255, 255, 0.04);
  --text: #edf3fb;
  --muted: #95a8bc;
  --line: rgba(255, 255, 255, 0.08);
  --brand: #ff7a1a;
  --brand-deep: #ff5a17;
  --brand-soft: rgba(255, 122, 26, 0.14);
  --ok: #2fd18f;
  --warn: #ffb020;
  --danger: #ff6b6b;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.35);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans SC", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 122, 26, 0.16), transparent 30%),
    radial-gradient(circle at bottom right, rgba(47, 209, 143, 0.12), transparent 22%),
    linear-gradient(160deg, #091018 0%, #0d1117 38%, #101927 100%);
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.2;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: radial-gradient(circle at center, black 40%, transparent 100%);
}

.page-shell {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}

.topbar,
.hero,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 18px 22px;
  border-radius: 24px;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  font-family: "Outfit", sans-serif;
  font-weight: 800;
  font-size: 1.1rem;
  color: #fff8ef;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
  box-shadow: 0 18px 38px rgba(255, 90, 23, 0.24);
}

.brand-kicker,
.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 11px;
  color: #f2a66d;
  font-family: "Outfit", sans-serif;
}

.brand h1,
.hero h2,
.panel h3,
.detail-head h4 {
  margin: 0;
  font-family: "Outfit", sans-serif;
}

.brand h1 {
  font-size: 1.3rem;
}

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

.mini-chip,
.metric-card,
.summary-card,
.message-box,
.status-pill,
.guide-list article,
.preview-grid,
.gallery,
.detail-panel,
.prompt-chip,
.ghost-button,
.primary-button,
.secondary-button,
.input-wrap,
input,
textarea,
.upload-zone,
.inline-action,
.text-action {
  border-radius: var(--radius-sm);
}

.mini-chip {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 0.92rem;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) 360px;
  gap: 24px;
  padding: 32px;
  margin-top: 20px;
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.hero-copy {
  position: relative;
}

.hero-copy::after {
  content: "";
  position: absolute;
  width: 280px;
  height: 280px;
  top: -130px;
  right: -120px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 122, 26, 0.3), transparent 70%);
}

.hero h2 {
  max-width: 12ch;
  font-size: clamp(2.3rem, 5vw, 4.5rem);
  line-height: 0.94;
}

.hero-text {
  max-width: 60ch;
  margin: 18px 0 26px;
  color: var(--muted);
  line-height: 1.85;
  font-size: 1rem;
}

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

.protocol-notice {
  margin-top: 18px;
  padding: 14px 16px;
  line-height: 1.7;
  color: #ffd8b8;
  background: rgba(255, 122, 26, 0.1);
  border: 1px solid rgba(255, 122, 26, 0.24);
  border-radius: var(--radius-md);
}

.protocol-notice code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #fff0df;
}

.ghost-button,
.primary-button,
.secondary-button,
.inline-action,
.text-action {
  border: none;
  font: inherit;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease, background 160ms ease, border-color 160ms ease;
}

.ghost-button {
  padding: 14px 18px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.ghost-button.secondary {
  color: #ffc99b;
}

.ghost-button:hover,
.primary-button:hover,
.secondary-button:hover,
.prompt-chip:hover,
.inline-action:hover,
.text-action:hover {
  transform: translateY(-1px);
}

.hero-aside {
  display: grid;
  gap: 14px;
}

.metric-card {
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02)),
    linear-gradient(135deg, rgba(255, 122, 26, 0.08), transparent 60%);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.metric-card span,
.summary-card span {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 10px;
}

.metric-card strong,
.summary-card strong {
  font-size: 1.16rem;
}

.main-grid {
  display: grid;
  grid-template-columns: 420px minmax(0, 1fr);
  gap: 20px;
  margin-top: 20px;
}

.control-column,
.result-column {
  display: grid;
  gap: 20px;
  align-content: start;
}

.panel {
  padding: 24px;
  border-radius: var(--radius-xl);
}

.panel-heading {
  margin-bottom: 18px;
}

.stack-form {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 10px;
}

.field > span {
  font-weight: 700;
}

.input-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

input,
textarea {
  width: 100%;
  padding: 15px 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font: inherit;
}

.input-wrap input {
  border: none;
  background: transparent;
}

input::placeholder,
textarea::placeholder {
  color: #718396;
}

input:focus,
textarea:focus {
  outline: 2px solid rgba(255, 122, 26, 0.16);
  border-color: rgba(255, 122, 26, 0.45);
}

.inline-action {
  padding: 0 16px;
  color: #ffd0ab;
  background: rgba(255, 122, 26, 0.08);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.inline-check input {
  width: 18px;
  height: 18px;
}

textarea {
  resize: vertical;
  min-height: 148px;
  line-height: 1.75;
}

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

.model-picker {
  display: grid;
  gap: 10px;
}

.model-option {
  display: block;
  cursor: pointer;
}

.model-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.model-option-body {
  display: grid;
  gap: 6px;
  padding: 15px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02)),
    rgba(255, 255, 255, 0.02);
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.model-option-body strong {
  font-family: "Outfit", sans-serif;
  font-size: 1rem;
  color: var(--text);
}

.model-option-body em {
  font-style: normal;
  color: var(--muted);
  line-height: 1.6;
  font-size: 0.92rem;
}

.model-option:hover .model-option-body {
  transform: translateY(-1px);
  border-color: rgba(255, 122, 26, 0.24);
}

.model-option input:checked + .model-option-body {
  border-color: rgba(255, 122, 26, 0.48);
  background:
    linear-gradient(180deg, rgba(255, 122, 26, 0.13), rgba(255, 122, 26, 0.05)),
    rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 0 0 1px rgba(255, 122, 26, 0.18);
}

.prompt-chip {
  padding: 12px;
  text-align: left;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.upload-zone {
  padding: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.025);
}

.upload-zone p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.preview-grid,
.gallery {
  min-height: 150px;
  padding: 14px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
}

.preview-grid.empty,
.gallery.empty {
  display: grid;
  place-items: center;
  color: var(--muted);
}

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

.preview-card,
.gallery-card {
  position: relative;
  overflow: hidden;
  background: var(--surface-soft);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
}

.preview-remove {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 7px 10px;
  color: #ffe3ca;
  background: rgba(9, 16, 24, 0.72);
  backdrop-filter: blur(8px);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.preview-remove:hover {
  transform: translateY(-1px);
  background: rgba(255, 122, 26, 0.18);
  border-color: rgba(255, 122, 26, 0.3);
}

.preview-card img,
.gallery-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.preview-card footer,
.gallery-card footer {
  padding: 12px;
}

.preview-card span,
.gallery-card a {
  font-size: 0.92rem;
}

.gallery-card a {
  color: #ffb67e;
  text-decoration: none;
  font-weight: 700;
}

.action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}

.primary-button {
  padding: 15px 18px;
  color: #fff7ef;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
  box-shadow: 0 16px 34px rgba(255, 90, 23, 0.24);
}

.secondary-button {
  padding: 15px 18px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.guide-panel .guide-list {
  display: grid;
  gap: 12px;
}

.guide-list article {
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.guide-list strong {
  display: block;
  margin-bottom: 8px;
}

.guide-list p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.result-top {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
}

.status-pill {
  padding: 10px 14px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.04);
}

.status-pill.idle {
  color: var(--muted);
}

.status-pill.loading {
  color: var(--warn);
  background: rgba(255, 176, 32, 0.12);
}

.status-pill.success {
  color: var(--ok);
  background: rgba(47, 209, 143, 0.12);
}

.status-pill.error {
  color: var(--danger);
  background: rgba(255, 107, 107, 0.12);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.summary-card {
  padding: 16px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.message-box {
  margin-top: 16px;
  padding: 14px 16px;
  line-height: 1.7;
}

.message-box.error {
  color: #ffc1c1;
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.18);
}

.message-box.success {
  color: #bff3da;
  background: rgba(47, 209, 143, 0.1);
  border: 1px solid rgba(47, 209, 143, 0.18);
}

.hidden {
  display: none;
}

.gallery {
  margin-top: 18px;
}

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

.detail-panel {
  padding: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.text-action {
  padding: 8px 10px;
  color: #ffd2ad;
  background: rgba(255, 122, 26, 0.08);
}

.detail-panel pre {
  margin: 14px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.68;
  max-height: 380px;
  overflow: auto;
  color: #dae7f5;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

@media (max-width: 1180px) {
  .hero,
  .main-grid,
  .split-panels {
    grid-template-columns: 1fr;
  }

  .hero h2 {
    max-width: 100%;
  }
}

@media (max-width: 760px) {
  .page-shell {
    padding: 14px 14px 26px;
  }

  .topbar,
  .hero,
  .panel {
    padding: 18px;
    border-radius: 20px;
  }

  .topbar,
  .result-top,
  .action-row {
    grid-template-columns: 1fr;
    display: grid;
  }

  .topbar-side,
  .hero-actions,
  .summary-grid,
  .prompt-grid {
    grid-template-columns: 1fr;
    display: grid;
  }
}
