:root {
  --bg: #071018;
  --bg-overlay-1: rgba(57, 213, 255, 0.12);
  --bg-overlay-2: rgba(108, 240, 194, 0.12);
  --panel: rgba(13, 22, 34, 0.88);
  --panel-strong: rgba(18, 29, 43, 0.98);
  --panel-soft: rgba(255, 255, 255, 0.04);
  --line: rgba(120, 220, 255, 0.14);
  --ink: #eef7ff;
  --muted: #98a6bc;
  --accent: #39d5ff;
  --accent-2: #6cf0c2;
  --danger: #ff8d8d;
  --warning: #ffc56b;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: "Manrope", "Noto Sans SC", sans-serif;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, var(--bg-overlay-1), transparent 24%),
    radial-gradient(circle at left 20%, var(--bg-overlay-2), transparent 18%),
    linear-gradient(180deg, var(--bg) 0%, #0c1420 100%);
}

body.theme-steel {
  --bg: #071018;
  --bg-overlay-1: rgba(76, 220, 255, 0.14);
  --bg-overlay-2: rgba(117, 225, 180, 0.12);
  --panel: rgba(11, 22, 30, 0.9);
  --panel-soft: rgba(255, 255, 255, 0.04);
  --line: rgba(114, 219, 255, 0.14);
  --accent: #42d8ff;
  --accent-2: #79f0bf;
}

body.theme-car {
  --bg: #050812;
  --bg-overlay-1: rgba(0, 153, 255, 0.16);
  --bg-overlay-2: rgba(140, 184, 255, 0.12);
  --panel: rgba(16, 20, 34, 0.9);
  --panel-soft: rgba(255, 255, 255, 0.05);
  --line: rgba(112, 145, 255, 0.18);
  --accent: #7aa2ff;
  --accent-2: #90c8ff;
  --muted: #a7b4d4;
}

body.theme-car .demo-hero {
  grid-template-columns: minmax(360px, 0.9fr) minmax(0, 1.1fr);
}

body.theme-car .demo-hero-side {
  order: 1;
}

body.theme-car .demo-hero-main {
  order: 2;
}

body.theme-car .chat-window {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02)),
    radial-gradient(circle at top, rgba(122, 162, 255, 0.12), transparent 45%);
}

body.theme-car .msg.user {
  background: rgba(122, 162, 255, 0.24);
}

body.theme-opinion {
  --bg: #ece6dd;
  --bg-overlay-1: rgba(238, 128, 88, 0.18);
  --bg-overlay-2: rgba(240, 207, 141, 0.18);
  --panel: rgba(255, 251, 247, 0.92);
  --panel-soft: rgba(88, 56, 39, 0.05);
  --line: rgba(115, 78, 54, 0.14);
  --ink: #2e231d;
  --muted: #7d6f66;
  --accent: #d76a3c;
  --accent-2: #c09a48;
  --danger: #bd3f2e;
  --warning: #bb7b1d;
  --shadow: 0 20px 48px rgba(114, 79, 53, 0.12);
}

body.theme-opinion .demo-topbar,
body.theme-opinion .demo-hero-main,
body.theme-opinion .demo-hero-side,
body.theme-opinion .demo-panel,
body.theme-opinion .engine-drawer {
  backdrop-filter: blur(4px);
}

body.theme-opinion .primary-button {
  color: #fffaf4;
}

.demo-shell {
  width: min(1660px, calc(100% - 20px));
  margin: 10px auto 40px;
}

.demo-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background: rgba(10, 18, 27, 0.82);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.demo-topbar a,
.demo-topbar button {
  color: var(--ink);
  text-decoration: none;
  font: inherit;
}

.demo-brand {
  font-weight: 800;
  letter-spacing: 0.12em;
  font-size: 0.95rem;
}

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

.ghost-link,
.ghost-button,
.primary-button {
  min-height: 46px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.primary-button {
  background: var(--accent);
  color: #041018;
  border-color: transparent;
  font-weight: 800;
}

.demo-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(360px, 0.98fr);
  gap: 16px;
  margin-bottom: 16px;
}

.demo-hero-main,
.demo-hero-side,
.demo-panel,
.engine-drawer {
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.demo-hero-main {
  padding: 28px;
}

.demo-kicker {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.88rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 800;
}

.demo-hero-main h1 {
  margin: 0;
  font-size: clamp(2.4rem, 4.5vw, 4.2rem);
  line-height: 1.05;
}

.demo-subtitle {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.14rem;
  line-height: 1.75;
}

.demo-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.demo-badges span {
  min-height: 34px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
  font-size: 0.92rem;
  font-weight: 700;
}

.demo-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.demo-meta-card {
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.demo-meta-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.demo-meta-card strong {
  display: block;
  font-size: 1rem;
}

.demo-hero-side {
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
}

.hero-image {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
  border-bottom: 1px solid var(--line);
}

.hero-side-body {
  padding: 20px;
}

.hero-side-body h2 {
  margin: 0 0 12px;
  font-size: 1.45rem;
}

.hero-side-body p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.hero-side-body ul {
  margin: 16px 0 0;
  padding-left: 20px;
  display: grid;
  gap: 10px;
  color: var(--muted);
  line-height: 1.7;
}

.engine-drawer {
  margin-bottom: 16px;
  padding: 18px 20px;
  display: none;
}

.engine-drawer.is-open {
  display: block;
}

.engine-grid {
  display: grid;
  grid-template-columns: 1.1fr auto auto auto;
  gap: 12px;
}

.engine-grid label {
  display: grid;
  gap: 8px;
}

.engine-grid span {
  color: var(--muted);
  font-size: 0.92rem;
}

.engine-grid input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font: inherit;
}

.engine-status {
  align-self: end;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  color: var(--muted);
}

.demo-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.92fr) minmax(0, 1.08fr);
  gap: 16px;
}

.project-insight-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 16px;
  margin-bottom: 16px;
}

.demo-panel {
  padding: 20px;
}

.panel-title {
  margin: 0 0 6px;
  font-size: 1.32rem;
}

.outcome-grid {
  display: grid;
  gap: 12px;
}

.outcome-card {
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.outcome-card span,
.architecture-flow span {
  display: inline-flex;
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.outcome-card p,
.architecture-flow p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

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

.architecture-flow > div {
  position: relative;
  min-height: 142px;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.architecture-flow > div:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -11px;
  width: 12px;
  height: 1px;
  background: var(--accent);
  opacity: 0.55;
}

.panel-desc {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.7;
}

.stack {
  display: grid;
  gap: 14px;
}

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

.field label,
.mini-title {
  color: var(--muted);
  font-size: 0.92rem;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font: inherit;
}

.field textarea {
  min-height: 130px;
  resize: vertical;
}

.action-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

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

.chip {
  min-height: 34px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.92rem;
  cursor: pointer;
}

.output-card,
.timeline-card,
.data-card,
.result-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.output-card pre,
.result-card pre {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  color: color-mix(in srgb, var(--ink) 92%, transparent);
  line-height: 1.8;
  font-family: inherit;
}

.timeline {
  display: grid;
  gap: 12px;
}

.timeline-step {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.timeline-step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.timeline-step.active .timeline-step-dot {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--accent);
}

.timeline-step strong {
  display: block;
  margin-bottom: 6px;
}

.timeline-step p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.upload-box {
  min-height: 180px;
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px dashed color-mix(in srgb, var(--accent-2) 38%, transparent);
  background: color-mix(in srgb, var(--accent-2) 8%, transparent);
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
}

.upload-box img {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  border-radius: 16px;
}

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

.gallery-card,
.cards-item {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.gallery-card h4,
.cards-item h4 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.gallery-card p,
.cards-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.chat-shell {
  display: grid;
  gap: 14px;
}

.chat-window {
  min-height: 420px;
  max-height: 560px;
  overflow: auto;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  display: grid;
  gap: 12px;
}

.msg {
  max-width: 88%;
  padding: 14px 16px;
  border-radius: 18px;
  line-height: 1.75;
}

.msg.user {
  justify-self: end;
  background: color-mix(in srgb, var(--accent) 26%, transparent);
}

.msg.assistant {
  background: rgba(255, 255, 255, 0.06);
}

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

.source-item {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.source-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.92rem;
}

.risk-high {
  color: var(--danger);
}

.risk-mid {
  color: var(--warning);
}

.risk-low {
  color: var(--accent-2);
}

.footer-note {
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.7;
}

@media (max-width: 1180px) {
  .demo-hero,
  .demo-grid,
  .project-insight-grid,
  .engine-grid {
    grid-template-columns: 1fr;
  }

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

  .architecture-flow > div::after {
    display: none;
  }

  .demo-meta-grid,
  .gallery-grid,
  .cards-grid {
    grid-template-columns: 1fr;
  }

  body.theme-car .demo-hero-side,
  body.theme-car .demo-hero-main {
    order: initial;
  }
}

@media (max-width: 760px) {
  .demo-shell {
    width: min(100% - 14px, 1660px);
  }

  .demo-topbar,
  .demo-hero-main,
  .demo-panel,
  .engine-drawer {
    padding: 16px;
  }

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

  .demo-topbar-actions {
    width: 100%;
  }

  .ghost-link,
  .ghost-button,
  .primary-button {
    width: 100%;
  }

  .architecture-flow {
    grid-template-columns: 1fr;
  }
}
