:root {
  --ink: #17212b;
  --muted: #607080;
  --paper: #f7faf8;
  --panel: #ffffff;
  --line: #dbe5e3;
  --blue: #155f8e;
  --teal: #008277;
  --green: #557a3e;
  --gold: #b8822f;
  --coral: #b85643;
  --shadow: 0 18px 56px rgba(23, 33, 43, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px clamp(18px, 4vw, 56px);
  background: rgba(247, 250, 248, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: max-content;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  border-radius: 8px;
  font-weight: 850;
}

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

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

nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 18px;
  color: #314150;
  font-size: 0.94rem;
}

nav a {
  padding: 8px 0;
  border-bottom: 2px solid transparent;
}

nav a:hover {
  border-color: var(--teal);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: clamp(24px, 5vw, 64px);
  align-items: stretch;
  padding: clamp(64px, 9vw, 120px) clamp(18px, 5vw, 72px) clamp(40px, 6vw, 72px);
  color: white;
  background:
    linear-gradient(115deg, rgba(14, 29, 39, 0.9), rgba(14, 45, 55, 0.72), rgba(17, 86, 85, 0.38)),
    url("/assets/openqp-grid.svg") center / cover;
}

.simple-hero {
  grid-template-columns: 1fr;
  min-height: 520px;
}

.prompt-hero {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.54fr);
  min-height: 620px;
  align-items: center;
}

.hero-copy {
  max-width: 860px;
  align-self: end;
}

.prompt-hero .hero-copy {
  align-self: center;
}

.molecule-scene {
  position: relative;
  min-height: clamp(420px, 48vw, 660px);
  margin: -18px 0;
  overflow: hidden;
  isolation: isolate;
}

.molecule-scene canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.molecule-scene canvas.is-hidden {
  visibility: hidden;
}

.molecule-fallback {
  position: absolute;
  inset: 0;
  display: none;
}

.molecule-fallback.is-visible {
  display: block;
}

.fallback-bond,
.fallback-atom {
  position: absolute;
  pointer-events: none;
}

.fallback-bond {
  height: 7px;
  background: #d7ece8;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  transform-origin: center;
}

.fallback-atom {
  display: grid;
  place-items: center;
  width: var(--size);
  height: var(--size);
  color: #18232c;
  background: var(--color);
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.28);
  font-size: 0.78rem;
  font-weight: 850;
  transform: translate(-50%, -50%);
}

.molecule-overlay {
  position: absolute;
  left: 0;
  bottom: 0;
  display: grid;
  gap: 4px;
  max-width: 280px;
  padding: 14px 0 0;
  background: linear-gradient(90deg, rgba(18, 49, 61, 0.88), rgba(18, 49, 61, 0));
}

.molecule-overlay strong {
  font-size: 1.6rem;
}

.molecule-overlay span {
  color: #d4ebe7;
}

.viewer-mode {
  display: grid;
  gap: 6px;
  width: min(230px, 62vw);
  margin-top: 12px;
  color: #d4ebe7;
  font-size: 0.86rem;
  font-weight: 750;
}

.viewer-mode select {
  min-height: 36px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.94);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--teal);
  font-size: 0.82rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero .eyebrow {
  color: #a7f2df;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.08;
}

h1 {
  max-width: 820px;
  font-size: clamp(2.7rem, 7vw, 6.5rem);
  font-weight: 850;
}

h2 {
  font-size: clamp(1.8rem, 4vw, 3rem);
}

h3 {
  font-size: 1.16rem;
}

.lead {
  max-width: 760px;
  margin: 22px 0 0;
  font-size: clamp(1.05rem, 2vw, 1.36rem);
}

.hero-actions,
.download-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.hero-prompt-form {
  display: grid;
  gap: 14px;
  max-width: 760px;
  margin-top: 28px;
}

.hero-prompt-form label {
  color: #eaf8f5;
}

.hero-prompt-form textarea {
  min-height: 128px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(255, 255, 255, 0.7);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.18);
}

.hero-prompt-form .hero-actions {
  margin-top: 0;
}

.home-demo {
  position: relative;
  align-self: stretch;
  min-height: clamp(360px, 44vw, 560px);
}

.home-demo-scene {
  height: 100%;
  min-height: inherit;
  margin: 0;
}

.home-demo-caption {
  position: absolute;
  left: 0;
  bottom: 0;
  display: grid;
  gap: 3px;
  padding: 14px 0 0;
  background: linear-gradient(90deg, rgba(18, 49, 61, 0.9), rgba(18, 49, 61, 0));
}

.home-demo-caption strong {
  font-size: 1.35rem;
}

.home-demo-caption span {
  color: #d4ebe7;
  font-weight: 720;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 11px 16px;
  color: white;
  background: var(--blue);
  border: 1px solid var(--blue);
  border-radius: 6px;
  font-weight: 780;
  cursor: pointer;
}

.button:hover {
  background: #104a71;
}

.button.secondary {
  color: var(--ink);
  background: white;
  border-color: var(--line);
}

.panel,
.cards article,
.lock-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.status-strip {
  padding: 0 clamp(18px, 5vw, 72px);
  background: linear-gradient(180deg, #12313d 0, #12313d 50%, var(--paper) 50%, var(--paper) 100%);
}

.status-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  max-width: 1180px;
  margin: 0 auto;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.status-row {
  display: grid;
  gap: 18px;
  padding: 16px 18px;
  border-right: 1px solid var(--line);
}

.status-row:last-child {
  border-right: 0;
}

.status-row span {
  color: var(--muted);
}

.notice {
  margin: 22px clamp(18px, 5vw, 72px) 0;
  padding: 16px 18px;
  background: #fff7e8;
  border: 1px solid #ead19f;
  border-left: 5px solid var(--gold);
  border-radius: 8px;
}

.builder {
  display: grid;
  grid-template-columns: minmax(240px, 0.75fr) minmax(280px, 0.85fr) minmax(360px, 1.4fr);
  gap: 18px;
  padding: clamp(36px, 6vw, 72px) clamp(18px, 5vw, 72px);
  align-items: start;
}

.workflow-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.42fr);
  gap: 24px;
  align-items: end;
  padding: clamp(46px, 7vw, 88px) clamp(18px, 5vw, 72px) clamp(28px, 4vw, 44px);
  color: white;
  background:
    linear-gradient(115deg, rgba(14, 29, 39, 0.92), rgba(18, 68, 72, 0.74)),
    url("/assets/openqp-grid.svg") center / cover;
}

.workflow-hero h1 {
  max-width: 960px;
  font-size: clamp(2.4rem, 5vw, 5.2rem);
}

.workflow-switcher {
  align-content: end;
  padding: 18px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  backdrop-filter: blur(12px);
}

.workflow-switcher label {
  color: #eaf8f5;
}

.workflow-layout,
.analysis-layout {
  display: grid;
  gap: 18px;
  padding: clamp(36px, 6vw, 72px) clamp(18px, 5vw, 72px);
  align-items: start;
}

.workflow-layout {
  grid-template-columns: minmax(280px, 0.78fr) minmax(360px, 1fr) minmax(380px, 1fr);
}

.analysis-layout {
  grid-template-columns: minmax(420px, 1.05fr) minmax(320px, 0.75fr);
}

.prompt-section {
  padding: clamp(28px, 5vw, 54px) clamp(18px, 5vw, 72px) 0;
}

.workflow-prompt {
  padding-top: 28px;
}

.panel {
  padding: 22px;
}

.section-title {
  margin-bottom: 18px;
}

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

.workflow-card {
  width: 100%;
  padding: 14px;
  color: var(--ink);
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
}

.workflow-card[aria-pressed="true"] {
  background: #e8f5f2;
  border-color: var(--teal);
}

.workflow-card strong {
  display: block;
}

.workflow-card span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.92rem;
}

form {
  display: grid;
  gap: 14px;
}

.prompt-chat {
  max-width: 1180px;
  margin: 0 auto;
}

.compact-chat {
  box-shadow: none;
}

.landing-prompt {
  max-width: 820px;
}

.chat-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.7fr);
  gap: 18px;
  align-items: stretch;
}

.chat-log {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 220px;
  max-height: 360px;
  overflow: auto;
  padding: 12px;
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.chat-message {
  display: grid;
  gap: 4px;
  max-width: 86%;
  padding: 11px 13px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.chat-message p {
  margin: 0;
  color: var(--muted);
}

.chat-message.user {
  justify-self: end;
  color: white;
  background: var(--blue);
  border-color: var(--blue);
}

.chat-message.user p {
  color: white;
}

.chat-compose {
  align-content: start;
}

.prompt-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.hero-examples {
  max-width: 760px;
}

.prompt-examples button {
  min-height: 36px;
  padding: 7px 11px;
  color: #28524a;
  background: #eaf5f1;
  border: 1px solid #cfe1da;
  border-radius: 999px;
  font-weight: 780;
  cursor: pointer;
}

label {
  display: grid;
  gap: 6px;
  color: #344452;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 11px;
  color: var(--ink);
  background: white;
  border: 1px solid #cfdad8;
  border-radius: 6px;
}

textarea {
  resize: vertical;
}

.database-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.database-search span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.9rem;
}

.database-search span[data-state="error"] {
  color: #9f2f22;
}

.database-search span[data-state="ok"] {
  color: #28524a;
}

#xyzInput {
  min-height: 178px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.88rem;
  line-height: 1.45;
}

.xyz-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-weight: 780;
  cursor: pointer;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.button.compact {
  min-height: 38px;
  padding: 8px 12px;
}

#xyzStatus[data-state="error"] {
  color: #9f2f22;
}

#xyzStatus[data-state="ok"] {
  color: #28524a;
}

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

.three-col {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.preview textarea {
  min-height: 500px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.9rem;
  line-height: 1.45;
}

.result-preview {
  display: grid;
  gap: 10px;
  margin-top: 20px;
  padding: 16px;
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.result-preview ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.result-preview pre {
  min-height: 120px;
  margin: 0;
  overflow: auto;
  padding: 12px;
  color: #d7ece8;
  background: #17212b;
  border-radius: 6px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
  line-height: 1.45;
}

.result-preview span {
  color: var(--muted);
  font-size: 0.9rem;
}

.band,
.execution {
  padding: clamp(42px, 6vw, 80px) clamp(18px, 5vw, 72px);
}

.wide-title {
  max-width: 940px;
}

.wide-title p:not(.eyebrow) {
  color: var(--muted);
  font-size: 1.05rem;
}

.band.alt {
  background: #eaf3ef;
}

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

.workflow-picker {
  display: grid;
  grid-template-columns: minmax(280px, 0.64fr) minmax(320px, 1fr);
  gap: 18px;
  max-width: 1040px;
}

.workflow-picker-control {
  display: grid;
  gap: 14px;
  align-content: start;
}

.workflow-detail {
  display: grid;
  gap: 10px;
  min-height: 220px;
  padding: 18px;
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.workflow-detail p {
  margin: 0;
  color: var(--muted);
}

.workflow-detail dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 4px 0 0;
}

.workflow-detail dl div {
  display: grid;
  gap: 2px;
  padding: 10px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.workflow-detail dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 780;
  text-transform: uppercase;
}

.workflow-detail dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 760;
}

.cards article,
.tutorial-card {
  padding: 22px;
}

.tutorial-card {
  display: grid;
  gap: 12px;
  align-content: start;
  min-height: 230px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  text-align: left;
  cursor: pointer;
}

.tutorial-card:hover,
.tutorial-card:focus-visible {
  border-color: var(--teal);
  transform: translateY(-2px);
}

.tutorial-card p {
  margin: 0;
}

.card-action {
  align-self: end;
  color: var(--blue);
  font-weight: 780;
}

.cards p,
.execution p {
  color: var(--muted);
}

.tool-cards article {
  display: flex;
  min-height: 250px;
  flex-direction: column;
  align-items: flex-start;
}

.tool-cards p {
  flex: 1;
}

.embedded-scene {
  height: clamp(360px, 44vw, 540px);
  min-height: 360px;
  margin: 0;
  background:
    radial-gradient(circle at 40% 32%, rgba(255, 255, 255, 0.12), transparent 36%),
    linear-gradient(140deg, #122631, #174b50);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.large-scene {
  height: min(68vh, 640px);
  min-height: min(68vh, 640px);
}

.viewer-panel {
  display: grid;
  gap: 16px;
}

.viewer-controls,
.viewer-import {
  display: grid;
  gap: 14px;
}

.viewer-import {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  background: #edf4f2;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.style-choice,
.surface-choice {
  min-height: 38px;
  padding: 7px 10px;
  color: #314150;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 780;
  cursor: pointer;
}

.style-choice.active,
.surface-choice.active {
  color: var(--ink);
  background: white;
  border-color: var(--line);
  box-shadow: 0 4px 12px rgba(23, 33, 43, 0.08);
}

.inline-toggles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.inline-toggles label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 40px;
  padding: 8px 10px;
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.88rem;
}

.inline-toggles input {
  width: auto;
  min-height: 0;
}

.tight-row {
  margin-top: 0;
}

.wide-file {
  width: 100%;
}

.microcopy {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.microcopy[data-state="error"],
#viewerDataStatus[data-state="error"] {
  color: #9f2f22;
}

.microcopy[data-state="ok"],
#viewerDataStatus[data-state="ok"] {
  color: #28524a;
}

.subtle-link {
  color: var(--blue);
  font-weight: 780;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.slim-lock {
  align-self: stretch;
  box-shadow: none;
}

.tag {
  display: inline-flex;
  margin-bottom: 12px;
  padding: 4px 9px;
  color: #28524a;
  background: #eaf5f1;
  border: 1px solid #cfe1da;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 780;
}

.execution {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.6fr);
  gap: 24px;
  align-items: center;
  background: #eaf3ef;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.lock-panel {
  display: grid;
  gap: 8px;
  padding: 22px;
  border-top: 5px solid var(--coral);
}

.lock-panel span {
  color: var(--muted);
}

footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  padding: 28px clamp(18px, 5vw, 72px);
  color: white;
  background: #18232c;
}

footer a {
  color: #bdeee5;
}

@media (max-width: 1080px) {
  .hero,
  .chat-layout,
  .builder,
  .workflow-hero,
  .workflow-layout,
  .analysis-layout,
  .execution {
    grid-template-columns: 1fr;
  }

  .molecule-scene {
    min-height: 420px;
    margin: 0;
  }

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

  .status-row:nth-child(2) {
    border-right: 0;
  }

  .status-row:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .preview textarea {
    min-height: 380px;
  }

}

@media (max-width: 760px) {
  .app-header {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  nav {
    justify-content: flex-start;
  }

  .prompt-hero {
    min-height: auto;
    padding-top: 34px;
    padding-bottom: 34px;
  }

  .prompt-hero h1 {
    font-size: 2.08rem;
  }

  .prompt-hero .lead {
    margin-top: 14px;
    font-size: 1rem;
  }

  .hero-prompt-form {
    margin-top: 18px;
  }

  .hero-prompt-form textarea {
    min-height: 96px;
  }

  .home-demo {
    min-height: 280px;
  }

  .home-demo-scene {
    height: 280px;
    min-height: 280px;
  }

  .cards,
  .database-search,
  .two-col,
  .three-col,
  .workflow-picker,
  .workflow-detail dl,
  .inline-toggles,
  .status-panel {
    grid-template-columns: 1fr;
  }

  .status-row,
  .status-row:nth-child(2) {
    border-right: 0;
  }

  .status-row:nth-child(-n + 3) {
    border-bottom: 1px solid var(--line);
  }
}
