:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --bg-alt: #edf1f8;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: rgba(255, 255, 255, 0.96);
  --stroke: rgba(15, 23, 42, 0.08);
  --stroke-strong: rgba(15, 23, 42, 0.14);
  --text: #101828;
  --muted: #5b6475;
  --muted-strong: #344054;
  --accent: #2457f5;
  --accent-soft: rgba(36, 87, 245, 0.08);
  --shadow: 0 20px 60px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 8px 30px rgba(15, 23, 42, 0.05);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Manrope", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(36, 87, 245, 0.08), transparent 35%),
    radial-gradient(circle at bottom right, rgba(36, 87, 245, 0.05), transparent 32%),
    linear-gradient(180deg, #fbfcfe 0%, var(--bg) 100%);
}

button,
textarea,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

textarea {
  resize: none;
}

[hidden] {
  display: none !important;
}

.page {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.brand,
.intro,
.upload-card,
.chat-shell,
.projects,
.results-panel {
  position: relative;
}

.brand {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.eyebrow,
.section-kicker,
.subhead {
  margin: 0;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font: 700 0.72rem/1 "IBM Plex Mono", monospace;
}

h1,
h2,
.project-row strong {
  margin: 0;
  letter-spacing: -0.04em;
}

h1 {
  font-size: clamp(2.4rem, 5vw, 4.4rem);
  line-height: 0.98;
}

h2 {
  font-size: clamp(1.4rem, 2.2vw, 2rem);
  line-height: 1.1;
}

.brand-copy,
.intro-copy,
.dropzone-note,
.result-copy,
.message-text,
.project-row small {
  color: var(--muted);
  line-height: 1.65;
}

.brand-copy {
  max-width: 56ch;
  margin: 0;
  font-size: 1.02rem;
}

.intro {
  margin: 8px 0 22px;
}

.intro-copy {
  margin: 0;
  font-size: 0.94rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.upload-card {
  margin-bottom: 18px;
}

.dropzone {
  display: grid;
  gap: 24px;
  padding: clamp(26px, 4vw, 44px);
  border-radius: var(--radius-xl);
  border: 1px solid var(--stroke-strong);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(245, 248, 253, 0.9)),
    radial-gradient(circle at top right, rgba(36, 87, 245, 0.05), transparent 36%);
  box-shadow: var(--shadow);
  min-height: clamp(260px, 35vw, 380px);
  text-align: left;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.dropzone:hover,
.dropzone.dragover {
  transform: translateY(-1px);
  border-color: rgba(36, 87, 245, 0.24);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.1);
}

.dropzone-copy {
  align-self: center;
  max-width: 58ch;
}

.dropzone-copy h2 {
  margin-top: 10px;
  font-size: clamp(2rem, 3.4vw, 3.4rem);
  line-height: 1;
}

.dropzone-note {
  margin: 16px 0 0;
  font-size: 1rem;
  max-width: 50ch;
}

.dropzone-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 0.94rem;
  padding-top: 8px;
}

.browse-pill,
.state-pill,
.download-link,
.send-btn,
.ghost-chip,
.project-row {
  border-radius: 999px;
}

.browse-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.chat-shell,
.projects,
.results-panel {
  margin-top: 24px;
}

.chat-head,
.projects-head,
.results-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.conversation {
  min-height: 190px;
  padding: 4px 0 8px;
  display: grid;
  gap: 12px;
}

.message {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 78ch;
}

.message.user {
  margin-left: auto;
  flex-direction: row-reverse;
}

.avatar {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--surface-strong);
  border: 1px solid var(--stroke);
  color: var(--muted-strong);
  font-size: 0.78rem;
  font-weight: 800;
  box-shadow: var(--shadow-soft);
}

.user-avatar {
  background: #111827;
  color: #fff;
}

.bubble {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  border-radius: 20px;
  background: var(--surface-strong);
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: var(--shadow-soft);
}

.message.user .bubble {
  background: #101828;
  color: #fff;
  border-color: rgba(16, 24, 40, 0.12);
}

.bubble-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.86rem;
  font-weight: 700;
  color: inherit;
  margin-bottom: 8px;
}

.bubble-meta {
  color: var(--muted);
  font-weight: 600;
}

.message.user .bubble-meta {
  color: rgba(255, 255, 255, 0.7);
}

.message-text {
  margin: 0;
}

.message.user .message-text {
  color: rgba(255, 255, 255, 0.92);
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-top: 14px;
  padding: 10px;
  border-radius: 24px;
  background: var(--surface);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow-soft);
}

.composer textarea {
  flex: 1;
  min-height: 62px;
  padding: 16px 16px 14px;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  line-height: 1.5;
}

.composer textarea::placeholder {
  color: #7b8497;
}

.send-btn,
.ghost-chip,
.project-row,
.download-link {
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background 160ms ease;
}

.send-btn {
  flex: 0 0 auto;
  padding: 14px 18px;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 14px 28px rgba(36, 87, 245, 0.22);
}

.send-btn:hover,
.ghost-chip:hover,
.project-row:hover,
.download-link:hover {
  transform: translateY(-1px);
}

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

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.ghost-chip {
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--muted-strong);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow-soft);
}

.projects {
  margin-bottom: 16px;
}

.project-list {
  display: grid;
  gap: 10px;
}

.project-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  text-align: left;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: var(--shadow-soft);
}

.project-row span:first-child {
  display: grid;
  gap: 4px;
}

.project-row strong {
  font-size: 1rem;
}

.project-row small {
  font-size: 0.92rem;
}

.project-arrow {
  color: var(--accent);
  font-size: 1.2rem;
}

.results-panel {
  padding-top: 10px;
}

.state-pill {
  padding: 10px 14px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(36, 87, 245, 0.16);
  font: 700 0.84rem/1 "IBM Plex Mono", monospace;
}

.results-stack {
  display: grid;
  gap: 12px;
}

.result-section {
  padding: 18px 20px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: var(--shadow-soft);
}

details.result-section {
  padding-bottom: 16px;
}

details.result-section > summary {
  cursor: pointer;
  list-style: none;
  font-weight: 700;
  color: var(--muted-strong);
}

details.result-section > summary::-webkit-details-marker {
  display: none;
}

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

.result-headline {
  font-weight: 700;
  color: var(--muted-strong);
  margin-bottom: 10px;
}

.result-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  color: var(--muted);
  margin-bottom: 10px;
}

.result-metric {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(36, 87, 245, 0.06);
  color: var(--muted-strong);
}

.result-metric strong {
  color: var(--text);
}

.result-copy {
  margin: 0 0 10px;
}

.result-copy.compact {
  margin-bottom: 8px;
}

.progress-list,
.result-list {
  display: grid;
  gap: 8px;
}

.progress-list div,
.result-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted-strong);
}

.progress-list div {
  padding: 10px 0;
  border-top: 1px solid rgba(15, 23, 42, 0.05);
}

.progress-list div:first-child {
  border-top: 0;
  padding-top: 0;
}

.progress-list div span:last-child {
  color: var(--muted);
  font-size: 0.9rem;
}

.progress-list div.active span:last-child {
  color: var(--accent);
}

.progress-list div.done span:last-child {
  color: #0f7a3c;
}

.result-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.result-list li {
  padding: 10px 0;
  border-top: 1px solid rgba(15, 23, 42, 0.05);
}

.result-list li:first-child {
  border-top: 0;
  padding-top: 0;
}

.generated-grid {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.code-block,
.preview-canvas {
  width: 100%;
  border-radius: 18px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-soft);
}

.code-block {
  margin: 8px 0 0;
  padding: 14px;
  min-height: 170px;
  overflow: auto;
  color: #24324a;
  font: 0.86rem/1.6 "IBM Plex Mono", monospace;
}

.preview-canvas {
  display: block;
  height: auto;
  min-height: 260px;
}

.download-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  color: var(--accent);
  background: rgba(36, 87, 245, 0.07);
  border: 1px solid rgba(36, 87, 245, 0.14);
  text-decoration: none;
  font-weight: 700;
}

@media (max-width: 820px) {
  .page {
    width: min(100vw - 22px, 1120px);
    padding: 18px 0 32px;
  }

  .brand {
    gap: 8px;
  }

  .dropzone {
    min-height: 0;
  }

  .chat-head,
  .projects-head,
  .results-head,
  .dropzone-foot {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .send-btn {
    width: 100%;
  }
}
