:root {
  --ink: #15282d;
  --ink-soft: #3e5358;
  --muted: #718086;
  --paper: #f1f4f2;
  --surface: #ffffff;
  --surface-soft: #f7f9f8;
  --line: #d7dfdc;
  --line-strong: #becbc6;
  --teal: #236b67;
  --teal-dark: #194f4c;
  --teal-pale: #e3efeb;
  --gold: #ad7c3e;
  --gold-pale: #f7efdf;
  --high: #a54b41;
  --high-pale: #f7e9e6;
  --low: #236b67;
  --shadow: 0 24px 70px rgba(19, 51, 56, .09);
}

* { box-sizing: border-box; }

html { background: var(--paper); scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(35, 107, 103, .035) 1px, transparent 1px) 0 0 / 72px 72px,
    linear-gradient(rgba(35, 107, 103, .035) 1px, transparent 1px) 0 0 / 72px 72px,
    var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }

.page-shell {
  width: min(1100px, calc(100% - 48px));
  min-height: 100vh;
  margin: 0 auto;
}

.masthead {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  border-bottom: 1px solid var(--line-strong);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.wordmark-mark {
  font: 700 20px/1 Georgia, "Times New Roman", serif;
  letter-spacing: .12em;
}

.wordmark-rule {
  width: 1px;
  height: 24px;
  margin: 0 15px;
  background: var(--line-strong);
}

.wordmark-copy {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .12em;
  text-transform: uppercase;
}

main { padding: 64px 0 54px; }

.hero {
  margin-bottom: 36px;
}

.eyebrow, .preset-label, .summary-label, .formula-label {
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.eyebrow { margin-bottom: 18px; }

h1 {
  margin: 0;
  font: 700 clamp(42px, 4.8vw, 64px)/.98 Georgia, "Times New Roman", serif;
  letter-spacing: -.045em;
}

h1 em { color: var(--teal); font-style: normal; }

.model-overview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 22px;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}

.overview-item {
  min-width: 0;
  padding: 18px 20px 19px;
  border-right: 1px solid var(--line);
}

.overview-item:first-child { padding-left: 0; }
.overview-item:last-child { border-right: 0; }

.overview-item span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.overview-item strong {
  color: var(--ink-soft);
  font: 700 15px/1.35 Georgia, "Times New Roman", serif;
}

.workspace {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: stretch;
}

.input-panel, .result-panel {
  min-width: 0;
  padding: 24px 28px 26px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(145deg, #fff 0%, var(--surface-soft) 100%);
  box-shadow: var(--shadow);
}

.input-panel {
  display: flex;
  flex-direction: column;
}

.result-panel {
  display: grid;
  grid-template-rows: auto auto auto minmax(245px, 1fr) auto;
}

.input-panel { border-top: 3px solid var(--teal); }
.result-panel { border-top: 3px solid var(--gold); }

.section-heading {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  min-height: 72px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.section-number {
  margin-top: -4px;
  color: var(--teal);
  font: 700 40px/.9 Georgia, "Times New Roman", serif;
  letter-spacing: -.06em;
}

h2 {
  margin: 0;
  font: 700 26px/1.08 Georgia, "Times New Roman", serif;
  letter-spacing: -.025em;
}

.section-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.subtype-switcher {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 14px 0 0;
  padding: 5px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.subtype-switcher legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.subtype-switcher button {
  min-width: 0;
  padding: 9px 5px;
  color: var(--muted);
  border: 0;
  background: transparent;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.subtype-switcher button:hover { color: var(--teal-dark); }

.subtype-switcher button.active {
  color: #fff;
  background: var(--teal);
  box-shadow: 0 5px 14px rgba(35, 107, 103, .18);
}

.subtype-description {
  min-height: 25px;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.profile-presets {
  margin-top: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.preset-label {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
}

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

.preset-button {
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  color: var(--ink);
  background: var(--surface-soft);
  text-align: left;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.preset-button:hover {
  border-color: #93a6a0;
  background: #fff;
  transform: translateY(-1px);
}

.preset-button:focus-visible, input:focus, select:focus, #predict-button:focus-visible, .subtype-switcher button:focus-visible {
  outline: 3px solid rgba(35, 107, 103, .18);
  outline-offset: 2px;
}

.preset-name {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--low);
  font: 700 15px/1.15 Georgia, "Times New Roman", serif;
}

.preset-name i {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--low);
  box-shadow: 0 0 0 3px var(--teal-pale);
}

.preset-name.high { color: var(--high); }
.preset-name.high i { background: var(--high); box-shadow: 0 0 0 3px var(--high-pale); }

.preset-button small {
  display: block;
  overflow: hidden;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

form { margin-top: 10px; }

#prediction-form {
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

#prediction-form .field {
  min-height: 56px;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin: 0;
  padding: 6px 0;
  border-top: 1px solid var(--line);
}

#prediction-form .field + .field { border-top: 0; }

.field > span {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 720;
}

.field em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 500;
}

input[type="number"], select {
  width: 100%;
  height: 38px;
  padding: 0 13px;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  outline: none;
  background: var(--surface);
  font-size: 14px;
  transition: border-color .18s ease, box-shadow .18s ease;
}

input[type="number"]:hover, select:hover { border-color: #98aaa4; }

.hidden { display: none !important; }

#predict-button {
  width: 100%;
  flex: 0 0 45px;
  min-height: 45px;
  margin-top: 11px;
  padding: 0 16px 0 19px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  border: 1px solid var(--teal-dark);
  border-radius: 2px;
  background: var(--teal);
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, box-shadow .18s ease;
}

#predict-button:hover {
  background: var(--teal-dark);
  box-shadow: 0 9px 20px rgba(25, 79, 76, .19);
  transform: translateY(-1px);
}

.button-arrow { font-size: 19px; font-weight: 400; }

.prediction-summary {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 0 14px;
  border-bottom: 1px solid var(--line);
}

.summary-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
}

.risk-group {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 15px;
  color: var(--muted);
  border: 1px solid var(--line);
  background: #edf1ef;
  font: 700 19px/1 Georgia, "Times New Roman", serif;
}

.risk-group.low {
  color: var(--low);
  border-color: #b9d3ca;
  background: var(--teal-pale);
}

.risk-group.high {
  color: var(--high);
  border-color: #e1bbb4;
  background: var(--high-pale);
}

.risk-score { text-align: right; }

.risk-score strong {
  display: block;
  color: var(--ink);
  font: 700 30px/1 Georgia, "Times New Roman", serif;
  letter-spacing: -.035em;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  padding: 12px 0;
}

.metrics article {
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: #fbfcfb;
}

.metrics article.primary {
  border-color: #a9c4bd;
  background: var(--teal-pale);
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metrics strong {
  display: block;
  margin-top: 4px;
  font: 700 clamp(19px, 1.8vw, 25px)/1 Georgia, "Times New Roman", serif;
  letter-spacing: -.035em;
}

.survival-figure {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  margin: 0;
  padding-top: 4px;
}

.figure-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 6px;
}

.figure-heading figcaption {
  font: 700 16px/1.3 Georgia, "Times New Roman", serif;
}

.figure-heading span { color: var(--muted); font-size: 12px; }

#survival-chart {
  width: 100%;
  min-height: 0;
  height: 100%;
  display: block;
  overflow: visible;
}

.chart-axis { stroke: #91a19d; stroke-width: 1; }
.chart-grid { stroke: #dfe6e3; stroke-width: 1; }
.chart-line { fill: none; stroke: var(--teal); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.chart-area { fill: rgba(35, 107, 103, .085); }
.chart-marker { stroke: var(--gold); stroke-width: 1.5; stroke-dasharray: 4 5; }
.chart-dot { fill: var(--gold); stroke: #fff; stroke-width: 3; }
.chart-text { fill: var(--ink-soft); font-size: 16px; font-family: inherit; }
.chart-label { fill: #77552a; font-size: 15px; font-weight: 800; font-family: inherit; }

.result-footnote {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.evidence-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--line);
}

.evidence-strip div { padding: 17px 19px; background: var(--surface); }
.evidence-strip span, .evidence-strip b { display: block; }
.evidence-strip span { margin-bottom: 5px; color: var(--muted); font-size: 12px; }
.evidence-strip b { font: 700 14px/1.35 Georgia, "Times New Roman", serif; }

.model-specification { margin-top: 16px; }

.model-specification details {
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .86);
  box-shadow: 0 10px 30px rgba(24, 52, 57, .045);
}

.model-specification summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 17px 19px;
  cursor: pointer;
  list-style: none;
  font-size: 14px;
  font-weight: 780;
}

.model-specification summary::-webkit-details-marker { display: none; }

.model-specification summary::after {
  content: "+";
  margin-left: auto;
  color: var(--teal);
  font-size: 20px;
  font-weight: 450;
}

.model-specification details[open] summary { border-bottom: 1px solid var(--line); }
.model-specification details[open] summary::after { content: "−"; }
.model-specification summary small { color: var(--muted); font-size: 11px; font-weight: 620; }

.spec-content { padding: 20px; }

.spec-intro, .spec-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.formula-card {
  margin: 17px 0;
  padding: 16px 18px;
  border-left: 3px solid var(--teal);
  background: #f3f8f6;
}

.formula-card p {
  margin: 6px 0 0;
  font: 400 14px/1.7 "Cambria Math", Cambria, Georgia, serif;
  overflow-wrap: anywhere;
}

.formula-card .formula-label {
  margin: 0;
  color: var(--teal-dark);
  font-family: inherit;
  font-size: 10px;
}

footer {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  color: var(--muted);
  border-top: 1px solid var(--line-strong);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .09em;
  text-transform: uppercase;
}

@media (max-width: 980px) {
  .model-overview { grid-template-columns: repeat(3, 1fr); }
  .workspace { grid-template-columns: 1fr; }
  .result-panel { display: block; }
  .survival-figure { min-height: 320px; }
  #survival-chart { min-height: 280px; height: auto; }
  .evidence-strip { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 620px) {
  .page-shell { width: min(100% - 24px, 1100px); }
  .masthead { min-height: 68px; }
  .wordmark-rule, .wordmark-copy { display: none; }
  main { padding-top: 42px; }
  h1 { font-size: 39px; }
  .hero { margin-bottom: 30px; }
  .model-overview { grid-template-columns: 1fr; }
  .overview-item, .overview-item:first-child { padding: 14px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .overview-item:last-child { border-bottom: 0; }
  .input-panel, .result-panel { padding: 21px 18px; }
  .section-heading { grid-template-columns: 48px 1fr; gap: 13px; }
  .section-number { font-size: 38px; }
  h2 { font-size: 25px; }
  .subtype-switcher { grid-template-columns: 1fr; }
  .preset-grid { grid-template-columns: 1fr; }
  .prediction-summary { align-items: flex-start; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .survival-figure { min-height: 270px; }
  #survival-chart { min-height: 235px; }
  .figure-heading { display: block; }
  .figure-heading span { display: block; margin-top: 4px; }
  .evidence-strip { grid-template-columns: 1fr; }
  .model-specification summary small { display: none; }
  footer { display: block; padding: 22px 0; line-height: 1.8; }
  footer span { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}
