:root {
  --bg: #0f1723;
  --bg-soft: #151f2f;
  --panel: rgba(10, 18, 30, 0.78);
  --panel-strong: rgba(18, 28, 43, 0.95);
  --panel-border: rgba(140, 170, 210, 0.14);
  --text: #ecf2fb;
  --muted: #95a6bd;
  --muted-strong: #c5d1df;
  --accent: #38bdf8;
  --accent-strong: #0ea5e9;
  --accent-soft: rgba(56, 189, 248, 0.14);
  --green: #14b8a6;
  --green-soft: rgba(20, 184, 166, 0.14);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.14);
  --danger: #fb7185;
  --danger-soft: rgba(251, 113, 133, 0.12);
  --user-bubble: linear-gradient(135deg, #1d4ed8 0%, #0f766e 100%);
  --assistant-bubble: rgba(255, 255, 255, 0.04);
  --shadow: 0 32px 80px rgba(3, 9, 18, 0.34);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Noto Sans SC", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(14, 165, 233, 0.2), transparent 26%),
    radial-gradient(circle at 85% 15%, rgba(20, 184, 166, 0.16), transparent 22%),
    radial-gradient(circle at bottom right, rgba(59, 130, 246, 0.2), transparent 24%),
    linear-gradient(160deg, #08111d 0%, #0f1723 48%, #121c2a 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.5), transparent 80%);
  opacity: 0.18;
}

button,
textarea {
  font: inherit;
}

.page-shell {
  position: relative;
  z-index: 1;
  padding: 24px;
}

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

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

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

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-family: "Manrope", sans-serif;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #041017;
  background: linear-gradient(135deg, #7dd3fc 0%, #5eead4 100%);
}

.kicker,
.metric-chip span,
.input-label,
.helper-text,
.meta-label,
.mode-card small,
.history-label {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.brand-block h1,
.hero-copy h2,
.section-head h2,
.topbar strong {
  margin: 0;
  font-family: "Manrope", sans-serif;
}

.brand-block h1 {
  font-size: 30px;
  line-height: 1.05;
}

.topbar-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.metric-chip {
  min-width: 132px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(148, 163, 184, 0.14);
}

.metric-chip strong {
  display: block;
  margin-top: 6px;
  font-size: 15px;
  color: var(--text);
}

.metric-chip.accent {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.16), rgba(20, 184, 166, 0.14));
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  gap: 24px;
}

.main-column,
.side-column {
  display: grid;
  gap: 24px;
}

.panel {
  border-radius: 26px;
  padding: 22px;
}

.hero-ribbon {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
  background:
    linear-gradient(135deg, rgba(8, 18, 34, 0.92), rgba(18, 30, 49, 0.94)),
    var(--panel);
}

.hero-copy h2 {
  margin-top: 10px;
  font-size: 30px;
  line-height: 1.12;
  max-width: 16ch;
}

.hero-copy p:last-child,
.hero-summary p,
.message,
.prompt-text,
.meta-value,
.result-note {
  line-height: 1.7;
}

.hero-copy p:last-child {
  margin: 14px 0 0;
  max-width: 58ch;
  color: var(--muted-strong);
}

.hero-summary {
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.11), rgba(15, 23, 35, 0.1));
  border: 1px solid rgba(56, 189, 248, 0.16);
}

.hero-summary span,
.prompt-source {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted-strong);
  font-size: 12px;
}

.hero-summary p {
  margin: 14px 0 0;
  color: var(--text);
}

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

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

.toolbar,
.inline-actions,
.image-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.conversation-panel {
  min-height: 760px;
  display: flex;
  flex-direction: column;
}

.messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-right: 4px;
}

.message {
  max-width: 86%;
  padding: 15px 17px;
  border-radius: 18px;
  white-space: pre-wrap;
  word-break: break-word;
}

.message.assistant {
  align-self: flex-start;
  background: var(--assistant-bubble);
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.message.user {
  align-self: flex-end;
  background: var(--user-bubble);
  color: #f8fdff;
}

.typing,
.error-banner {
  margin-top: 14px;
  padding: 13px 14px;
  border-radius: 16px;
}

.typing {
  background: var(--accent-soft);
  color: #8ce2ff;
  border: 1px solid rgba(56, 189, 248, 0.18);
}

.error-banner {
  background: var(--danger-soft);
  color: #ffc0cb;
  border: 1px solid rgba(251, 113, 133, 0.2);
}

.hidden {
  display: none;
}

.composer {
  margin-top: 18px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.input-label {
  display: block;
  margin-bottom: 10px;
}

.composer textarea,
.prompt-panel textarea {
  width: 100%;
  resize: vertical;
  min-height: 128px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 18px;
  padding: 15px 16px;
  outline: none;
  background: rgba(6, 13, 23, 0.85);
  color: var(--text);
}

.composer textarea:focus,
.prompt-panel textarea:focus {
  border-color: rgba(56, 189, 248, 0.42);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.12);
}

.composer-footer {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.helper-text {
  max-width: 48ch;
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.btn-primary {
  color: #03131c;
  background: linear-gradient(135deg, #7dd3fc 0%, #5eead4 100%);
}

.btn-secondary {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(148, 163, 184, 0.14);
}

.btn-ghost {
  color: #86efac;
  background: rgba(20, 184, 166, 0.1);
  border: 1px solid rgba(20, 184, 166, 0.18);
}

.requirements-grid,
.mode-grid,
.meta-grid,
.history-grid {
  display: grid;
  gap: 12px;
}

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

.requirement-card,
.mode-card,
.meta-card,
.history-card {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.requirement-card strong,
.mode-card strong,
.meta-card strong,
.history-card strong {
  display: block;
  margin-top: 8px;
  font-weight: 600;
  color: var(--text);
}

.requirement-card.pending strong {
  color: var(--muted);
}

.requirement-card.ready {
  background: linear-gradient(180deg, rgba(20, 184, 166, 0.08), rgba(255, 255, 255, 0.03));
  border-color: rgba(20, 184, 166, 0.2);
}

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

.mode-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mode-card.active {
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.12), rgba(255, 255, 255, 0.03));
  border-color: rgba(56, 189, 248, 0.22);
}

.mode-card.pending {
  opacity: 0.72;
}

.mode-card p,
.mode-card small {
  margin: 0;
}

.prompt-panel,
.image-panel {
  min-height: 220px;
}

.prompt-panel.empty,
.image-panel.empty {
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
}

.prompt-stack {
  display: grid;
  gap: 16px;
}

.prompt-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.prompt-text {
  margin: 0;
  color: var(--muted-strong);
}

.negative-note {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

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

.meta-value {
  margin: 8px 0 0;
  color: var(--muted-strong);
}

.image-panel img {
  width: 100%;
  display: block;
  border-radius: 18px;
  margin-bottom: 16px;
  background: rgba(255, 255, 255, 0.04);
}

.result-note {
  margin: 0 0 16px;
  color: var(--muted-strong);
}

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

.history-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  margin-bottom: 10px;
  border-radius: 14px;
}

.history-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 13px;
}

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

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

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .requirements-grid,
  .meta-grid,
  .history-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .brand-block h1 {
    font-size: 24px;
  }

  .hero-copy h2 {
    font-size: 24px;
  }

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

  .message {
    max-width: 94%;
  }

  .composer-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .btn,
  .toolbar,
  .inline-actions,
  .image-actions {
    width: 100%;
  }

  .btn {
    width: 100%;
  }
}
