:root {
  --paper: #f4efe3;
  --panel: rgba(248, 244, 235, 0.76);
  --panel-strong: rgba(255, 252, 245, 0.9);
  --ink: #1f2430;
  --muted: #5f6470;
  --grid: rgba(31, 36, 48, 0.1);
  --signal: #1c5d99;
  --surface: #b7552d;
  --ligand: #d7a330;
  --silent: #d9c8aa;
  --active: #2574a9;
  --internal: #c96a42;
  --accent: #0e3d56;
  --warm: #e67e4b;
  --cool: #6ba7d6;
  --pharm-orange: #d37522;
  --shadow: 0 28px 90px rgba(23, 32, 42, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(106, 167, 214, 0.28), transparent 28%),
    radial-gradient(circle at 88% 12%, rgba(230, 126, 75, 0.24), transparent 22%),
    linear-gradient(180deg, #f8f4eb 0%, #efe7d6 100%);
  font-family: "Space Grotesk", "Avenir Next", "Segoe UI", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(31, 36, 48, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 36, 48, 0.03) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 95%);
}

.page-shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 24px 56px;
}

.hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.5rem;
  align-items: start;
  padding: clamp(1.35rem, 2.8vw, 2.3rem);
  border: 1px solid rgba(15, 51, 69, 0.1);
  border-radius: 30px;
  box-shadow: var(--shadow);
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.92)),
    linear-gradient(135deg, rgba(107, 167, 214, 0.08), rgba(211, 117, 34, 0.08));
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -4rem -5rem auto;
  width: 14rem;
  height: 14rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(211, 117, 34, 0.2), rgba(211, 117, 34, 0));
  pointer-events: none;
}

.eyebrow {
  position: relative;
  z-index: 1;
  margin: 0 0 0.6rem;
  color: var(--pharm-orange);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero h1,
.block-heading h2,
.outcome-banner h2,
.card-heading h3,
.snapshot-header h4 {
  font-family: "Fraunces", Georgia, serif;
}

.hero h1 {
  position: relative;
  z-index: 1;
  margin: 0;
  max-width: 12ch;
  font-size: clamp(2rem, 3.9vw, 3.2rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
}

.hero-text {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.hero-subtitle {
  position: relative;
  z-index: 1;
  margin: 1rem 0 0;
  max-width: 66ch;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

.hero-mark {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  justify-self: end;
  gap: 0.25rem;
  min-width: 13rem;
  padding: 0.8rem 1rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(15, 51, 69, 0.08);
  box-shadow: 0 10px 24px rgba(21, 37, 61, 0.08);
  text-align: center;
}

.hero-mark-name {
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(2rem, 3.4vw, 3rem);
  line-height: 0.9;
  color: var(--ink);
}

.hero-mark-expansion {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--pharm-orange);
}

.secondary-button,
.preset-button,
.segmented-control button {
  appearance: none;
  border: 0;
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease,
    color 160ms ease;
}

.secondary-button {
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(15, 51, 69, 0.08);
  color: var(--accent);
  font: inherit;
  font-weight: 700;
}

.secondary-button:hover,
.preset-button:hover,
.segmented-control button:hover {
  transform: translateY(-1px);
}

.preset-reset {
  margin-top: 14px;
}

.workspace {
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  align-items: start;
}

.panel {
  border: 1px solid rgba(31, 36, 48, 0.08);
  border-radius: var(--radius-xl);
  background: var(--panel);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.controls-panel {
  position: sticky;
  top: 18px;
  padding: 22px;
}

.block + .block,
.block + .model-note {
  margin-top: 26px;
}

.block-heading h2,
.outcome-banner h2,
.card-heading h3,
.snapshot-header h4 {
  margin: 0;
}

.block-heading p,
.insight-text,
.card-caption,
.model-note p,
.model-note li,
.snapshot-text,
.phase-legend,
.snapshot-legend {
  color: var(--muted);
}

.block-heading p,
.card-caption,
.insight-text,
.snapshot-text,
.phase-legend,
.snapshot-legend {
  line-height: 1.6;
}

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

.preset-button {
  padding: 14px 15px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  text-align: left;
  font: inherit;
  color: var(--ink);
}

.preset-button strong {
  display: block;
  margin-bottom: 3px;
  font-size: 0.96rem;
}

.preset-button span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.preset-button.active {
  background: linear-gradient(135deg, rgba(28, 93, 153, 0.14), rgba(230, 126, 75, 0.14));
  box-shadow: inset 0 0 0 1px rgba(28, 93, 153, 0.18);
}

.control-list {
  display: grid;
  gap: 18px;
  margin-top: 14px;
}

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

.control-label {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font-size: 0.94rem;
  font-weight: 500;
}

.control-label strong {
  color: var(--accent);
}

input[type="range"] {
  width: 100%;
  margin: 0;
  accent-color: var(--accent);
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.segmented-control button {
  padding: 14px 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.68);
  font: inherit;
  font-weight: 700;
  color: var(--muted);
}

.segmented-control button.active {
  color: var(--ink);
  background: linear-gradient(180deg, rgba(230, 126, 75, 0.22), rgba(107, 167, 214, 0.22));
  box-shadow: inset 0 0 0 1px rgba(31, 36, 48, 0.1);
}

.model-note {
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  background: rgba(255, 252, 245, 0.78);
}

.model-note summary {
  cursor: pointer;
  font-weight: 700;
}

.model-note ol,
.model-note ul {
  padding-left: 18px;
}

.model-note ul {
  margin: 10px 0 0;
}

.model-note code {
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(15, 61, 86, 0.08);
  font-size: 0.92em;
}

.results-panel {
  padding: 22px;
}

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

.fate-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.fate-badge.growth {
  color: #74361f;
  background: rgba(230, 126, 75, 0.18);
}

.fate-badge.differentiation {
  color: #184a72;
  background: rgba(107, 167, 214, 0.2);
}

.fate-badge.mixed {
  color: #5e4a10;
  background: rgba(215, 163, 48, 0.18);
}

.insight-text {
  margin: 16px 0 0;
  max-width: 82ch;
}

.metric-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 22px;
}

.metric-card,
.chart-card {
  border-radius: var(--radius-lg);
  background: var(--panel-strong);
  border: 1px solid rgba(31, 36, 48, 0.07);
}

.metric-card {
  padding: 18px;
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
}

.metric-value {
  display: block;
  margin-top: 8px;
  font-size: clamp(1.3rem, 2vw, 1.9rem);
  letter-spacing: -0.04em;
}

.chart-card {
  padding: 20px;
}

.chart-card + .chart-card,
.detail-grid {
  margin-top: 18px;
}

.card-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
}

.phase-heading-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.phase-status-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.chart-legend,
.snapshot-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 0.88rem;
}

.legend-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 6px;
  border-radius: 999px;
  vertical-align: -1px;
}

.legend-swatch.signal {
  background: var(--signal);
}

.legend-swatch.surface {
  background: var(--surface);
}

.legend-swatch.ligand {
  background: rgba(215, 163, 48, 0.9);
}

.legend-swatch.silent {
  background: var(--silent);
}

.legend-swatch.active {
  background: var(--active);
}

.legend-swatch.internal {
  background: var(--internal);
}

.timecourse-chart,
.phase-canvas {
  width: 100%;
  display: block;
  margin-top: 18px;
}

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

.phase-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  font-size: 0.9rem;
}

.phase-gradient {
  flex: 1;
  min-width: 120px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #e67e4b 0%, #f3d7a9 50%, #6ba7d6 100%);
}

.snapshot + .snapshot {
  margin-top: 18px;
}

.snapshot-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.snapshot-header span {
  color: var(--muted);
  font-size: 0.88rem;
}

.stacked-bar {
  display: flex;
  overflow: hidden;
  height: 22px;
  margin-top: 10px;
  border-radius: 999px;
  background: rgba(31, 36, 48, 0.06);
}

.bar-segment {
  height: 100%;
}

.bar-segment.silent {
  background: var(--silent);
}

.bar-segment.active {
  background: var(--active);
}

.bar-segment.internal {
  background: var(--internal);
}

.snapshot-text {
  margin: 10px 0 0;
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .controls-panel {
    position: static;
  }

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

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

  .hero {
    grid-template-columns: 1fr;
    padding: clamp(1.1rem, 4vw, 1.5rem);
  }

  .hero h1 {
    font-size: clamp(1.8rem, 9vw, 2.5rem);
  }

  .hero-mark {
    justify-self: start;
    min-width: 0;
  }

  .controls-panel,
  .results-panel {
    padding: 16px;
  }

  .outcome-banner,
  .card-heading,
  .snapshot-header {
    flex-direction: column;
    align-items: start;
  }

  .phase-heading-meta {
    align-items: flex-start;
  }

  .metric-grid,
  .detail-grid,
  .segmented-control {
    grid-template-columns: 1fr;
  }

  .chart-legend,
  .phase-legend,
  .snapshot-legend {
    gap: 10px;
  }
}
