:root {
  --ink: #10253d;
  --muted: #627287;
  --line: #d9e2ea;
  --paper: #ffffff;
  --bg: #edf2f5;
  --navy: #0c2741;
  --navy-2: #123c5b;
  --teal: #0d8c87;
  --teal-soft: #dff3f1;
  --orange: #e27b38;
  --blue: #3b70c5;
  --shadow: 0 12px 34px rgba(22, 45, 67, .08);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }
button, input, select { font: inherit; }
button { cursor: pointer; }

.topbar { min-height: 76px; padding: 0 32px; display: flex; align-items: center; gap: 28px; color: white; background: linear-gradient(110deg, #081f35, #103957); box-shadow: 0 5px 18px rgba(2,18,32,.18); }
.brand { color: white; text-decoration: none; display: flex; align-items: center; gap: 12px; min-width: 310px; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px; color: var(--navy); background: #d5f0ec; font-weight: 900; letter-spacing: -.04em; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; letter-spacing: .01em; }
.brand small { margin-top: 3px; color: #a8c0d2; font-size: 12px; }
nav { display: flex; align-self: stretch; }
.nav-link { padding: 0 16px; color: #b8cada; border: 0; border-bottom: 3px solid transparent; background: transparent; font-weight: 700; font-size: 13px; }
.nav-link:hover, .nav-link.active { color: white; border-bottom-color: #5bd2c7; }
.preview-pill { margin-left: auto; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; color: #cfdee9; font-size: 11px; white-space: nowrap; }
.preview-pill i { width: 7px; height: 7px; border-radius: 50%; background: #67dcc4; box-shadow: 0 0 0 4px rgba(103,220,196,.13); }

.model-strip { min-height: 60px; padding: 10px 32px; display: flex; align-items: center; gap: 18px; background: white; border-bottom: 1px solid var(--line); }
.model-strip > span { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; }
.model-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.model-tab { padding: 9px 14px; border: 1px solid var(--line); border-radius: 7px; color: #43556a; background: #f7f9fa; font-weight: 750; font-size: 12px; }
.model-tab.active { color: white; border-color: var(--teal); background: var(--teal); box-shadow: 0 4px 12px rgba(13,140,135,.22); }
#model-version { margin-left: auto; color: #778799; font-size: 11px; }

main { max-width: 1500px; margin: auto; padding: 30px 32px 52px; }
.page { display: none; }
.page.active { display: block; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 22px; }
.eyebrow { margin: 0 0 6px; color: var(--teal); font-size: 10px; line-height: 1.2; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 7px; font-size: clamp(27px, 3vw, 40px); line-height: 1.03; letter-spacing: -.035em; }
h2 { margin-bottom: 8px; font-size: 20px; letter-spacing: -.02em; }
h3 { margin-bottom: 0; font-size: 16px; }
.intro { max-width: 790px; margin-bottom: 0; color: var(--muted); line-height: 1.55; font-size: 14px; }
.safe-card { min-width: 250px; padding: 13px 16px; border-left: 3px solid var(--teal); background: white; box-shadow: var(--shadow); }
.safe-card span, .safe-card strong, .safe-card small { display: block; }
.safe-card span { color: var(--teal); font-size: 9px; font-weight: 900; letter-spacing: .14em; }
.safe-card strong { margin: 3px 0; font-size: 13px; }
.safe-card small { color: var(--muted); }

.panel { border: 1px solid var(--line); background: var(--paper); box-shadow: var(--shadow); }
.predictor-layout { display: grid; grid-template-columns: minmax(570px, 1.18fr) minmax(410px, .82fr); gap: 20px; align-items: start; }
.inputs { padding: 23px; }
.input-section + .input-section { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); }
.section-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.section-title span { width: 28px; height: 28px; display: grid; place-items: center; color: var(--teal); background: var(--teal-soft); border-radius: 7px; font-size: 12px; font-weight: 900; }
.section-title h2 { margin: 0; font-size: 14px; }
.fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.field { position: relative; display: block; }
.field > span { display: flex; justify-content: space-between; margin-bottom: 6px; color: #415269; font-size: 11px; font-weight: 800; }
.field > span small { color: #8592a0; font-weight: 600; }
.field input, .field select, .relation-toolbar select { width: 100%; height: 42px; padding: 0 11px; border: 1px solid #cdd7df; border-radius: 6px; outline: 0; color: var(--ink); background: #fbfcfd; }
.field input:focus, .field select:focus, .relation-toolbar select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(13,140,135,.1); }
.field input.outside { border-color: #e18a4a; background: #fff9f4; }
.check-field { grid-column: span 2; display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 12px; background: #f6faf9; border: 1px solid #d6e9e6; border-radius: 6px; font-size: 12px; font-weight: 750; }
.check-field input { width: 17px; height: 17px; accent-color: var(--teal); }
.actions { display: flex; gap: 9px; margin-top: 24px; }
.button { min-height: 44px; padding: 0 18px; border-radius: 6px; border: 1px solid transparent; font-weight: 850; font-size: 12px; }
.button.primary { color: white; background: var(--teal); }
.button.primary:hover { background: #0a7773; }
.button.ghost { color: #526478; border-color: var(--line); background: white; }
.messages { margin-top: 12px; display: grid; gap: 7px; }
.message { padding: 9px 11px; border-left: 3px solid #d88741; background: #fff7ef; color: #6f4b2e; font-size: 11px; line-height: 1.45; }

.results { position: sticky; top: 16px; overflow: hidden; }
.empty-state { min-height: 510px; padding: 60px 42px; display: grid; place-content: center; justify-items: center; text-align: center; }
.empty-state p { max-width: 360px; color: var(--muted); line-height: 1.55; }
.target { width: 92px; height: 92px; margin-bottom: 23px; display: grid; place-items: center; border: 1px solid #badfdc; border-radius: 50%; box-shadow: inset 0 0 0 16px white, inset 0 0 0 18px #dceeed; background: #f5fbfa; }
.target span { width: 20px; height: 20px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 10px rgba(13,140,135,.12); }
#results-content { padding: 23px; }
.result-heading, .subheading, .chart-head { display: flex; justify-content: space-between; align-items: start; gap: 14px; }
.class-chip { padding: 6px 9px; color: #0d6e69; background: var(--teal-soft); border-radius: 4px; font-size: 10px; font-weight: 850; }
.result-cards { margin-top: 15px; display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.result-card { position: relative; overflow: hidden; padding: 18px; border: 1px solid var(--line); background: #f8fafb; }
.result-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; }
.result-card.yp::before { background: var(--blue); }
.result-card.ts::before { background: var(--orange); }
.result-card span, .result-card small { display: block; color: var(--muted); font-size: 11px; }
.result-card strong { display: inline-block; margin: 6px 5px 0 0; font-size: 38px; line-height: 1; letter-spacing: -.05em; }
.result-card small { display: inline; }
.ratio { margin: 11px 0 18px; padding: 10px 12px; display: flex; justify-content: space-between; background: #eef3f6; color: #4e6074; font-size: 12px; }
.subheading { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.segmented { display: flex; padding: 3px; background: #eef2f4; border-radius: 6px; }
.segment { padding: 6px 12px; border: 0; border-radius: 4px; color: #607084; background: transparent; font-size: 10px; font-weight: 850; }
.segment.active { color: white; background: var(--navy-2); }
.contribution-chart { margin-top: 15px; display: grid; gap: 8px; max-height: 255px; overflow: auto; padding-right: 4px; }
.contribution { display: grid; grid-template-columns: 112px 1fr 60px; gap: 8px; align-items: center; font-size: 10px; }
.contribution > span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.bar-track { position: relative; height: 9px; border-radius: 999px; background: #edf1f4; overflow: hidden; }
.bar { position: absolute; top: 0; bottom: 0; left: 50%; border-radius: 999px; }
.bar.positive { background: var(--teal); }
.bar.negative { background: #dc8060; transform: translateX(-100%); }
.contribution b { text-align: right; font-variant-numeric: tabular-nums; }
.local-lock { margin-top: 22px; padding: 14px; display: flex; gap: 12px; border: 1px solid #d7e5e4; background: #f3f9f8; }
.lock-icon { width: 34px; height: 34px; flex: none; display: grid; place-items: center; color: white; background: var(--teal); border-radius: 50%; }
.local-lock strong { font-size: 12px; }
.local-lock p { margin: 3px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }

.relation-toolbar { padding: 16px 18px; display: flex; flex-wrap: wrap; gap: 12px; align-items: end; justify-content: flex-start; margin-bottom: 15px; }
.relation-toolbar label { display: grid; gap: 6px; color: #46586d; font-size: 11px; font-weight: 850; }
.relation-toolbar select { min-width: 155px; }
.relation-toolbar label:first-child select { min-width: 250px; }
.relation-toolbar .legend { margin-left: auto; padding-bottom: 11px; }
.legend { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.legend i { width: 9px; height: 9px; border-radius: 50%; }
.yp-dot { background: var(--blue); }.ts-dot { margin-left: 10px; background: var(--orange); }
.chart-card { padding: 22px; }
.chart-head > span { max-width: 430px; color: var(--muted); font-size: 11px; line-height: 1.45; text-align: right; }
.relation-chart { margin-top: 18px; overflow-x: auto; }
.relation-chart svg { display: block; width: 100%; min-width: 720px; height: 390px; }
.relation-table { overflow-x: auto; margin-top: 16px; }
.relation-table table { width: 100%; border-collapse: collapse; font-size: 11px; }
.relation-table th, .relation-table td { padding: 8px 10px; text-align: right; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.relation-table th:first-child, .relation-table td:first-child { text-align: left; }
.relation-table th { color: #5e6f82; background: #f4f7f9; }
.relation-table-card { border-top: 3px solid var(--teal); }
.relation-table td:nth-child(2) { color: var(--blue); font-weight: 800; }
.relation-table td:nth-child(3) { color: var(--orange); font-weight: 800; }

.effect-method-grid { display: grid; grid-template-columns: repeat(3,1fr); margin-bottom: 15px; }
.effect-method-grid > div { display: grid; gap: 5px; padding: 17px 19px; border-right: 1px solid var(--line); }
.effect-method-grid > div:last-child { border-right: 0; }
.effect-method-grid span { color: var(--teal); font-size: 9px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.effect-method-grid strong { font-size: 13px; }
.effect-method-grid small { color: var(--muted); font-size: 10px; line-height: 1.5; }
.effect-toolbar { margin-bottom: 15px; }
.effect-version { margin-left: auto; padding-bottom: 11px; color: var(--muted); font-size: 10px; }
.effect-table-card { margin-top: 15px; padding: 21px; }
.effect-table-scroll { margin-top: 15px; overflow-x: auto; }
.effect-table-scroll table { width: 100%; min-width: 1320px; border-collapse: collapse; font-size: 10px; }
.effect-table-scroll th { padding: 9px 8px; color: white; background: var(--navy-2); text-align: left; white-space: nowrap; }
.effect-table-scroll td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; font-variant-numeric: tabular-nums; }
.effect-table-scroll tbody tr:hover td { background: #f7fafb; }
.effect-input { width: 76px; height: 32px; padding: 4px 7px; color: var(--ink); background: white; border: 1px solid #c4d0d9; border-radius: 5px; }
.effect-total { color: var(--teal); background: #f0faf8; font-weight: 900; }
.effect-why { min-width: 250px; max-width: 370px; color: var(--muted); line-height: 1.45; }
.muted-zero { color: #99a5af; }
.effect-save { padding: 6px 9px; color: #0b6f69; background: white; border: 1px solid #9cd6d1; border-radius: 5px; font-weight: 850; font-size: 10px; }

.equation-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.equation-card { padding: 22px; border: 1px solid var(--line); background: white; box-shadow: var(--shadow); }
.equation-card.active { border-top: 4px solid var(--teal); }
.equation-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; }
.formula { margin-top: 15px; padding: 14px; color: #294056; background: #f5f7f8; border-left: 3px solid; font-family: "Cascadia Mono", Consolas, monospace; font-size: 11px; line-height: 1.65; overflow-wrap: anywhere; }
.formula.yp { border-color: var(--blue); }.formula.ts { border-color: var(--orange); }
.formula b { display: block; margin-bottom: 5px; font-family: inherit; font-size: 10px; letter-spacing: .12em; }

.local-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; }
.feature-card { padding: 23px; border-top: 3px solid var(--teal); background: white; box-shadow: var(--shadow); }
.feature-card > span { color: #a1b0bd; font-size: 10px; font-weight: 900; letter-spacing: .12em; }
.feature-card h2 { margin: 20px 0 8px; font-size: 17px; }
.feature-card p { margin: 0; color: var(--muted); line-height: 1.55; font-size: 12px; }
.notice-large { margin-top: 18px; padding: 22px 25px; color: white; background: linear-gradient(110deg, var(--navy), var(--navy-2)); }
.notice-large strong { font-size: 17px; }.notice-large p { margin: 5px 0 0; color: #c3d2df; font-size: 12px; }
.diagnosis-demo { padding: 24px; }
.diagnosis-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.review-chip { padding: 6px 10px; color: #7a4a17; background: #fff0d9; border-radius: 999px; font-size: 10px; font-weight: 850; text-transform: uppercase; }
.demo-targets { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0; }
.demo-targets article { padding: 16px; border: 1px solid var(--line); background: #f8fafb; }
.demo-targets span, .demo-targets small { display: block; color: var(--muted); font-size: 10px; }
.demo-targets strong { display: block; margin: 6px 0; color: #b65335; font-size: 24px; }
.demo-explanation { margin-top: 12px; padding: 14px 16px; border-left: 3px solid var(--teal); background: #f3f9f8; }
.demo-explanation > span { color: var(--teal); font-size: 9px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.demo-explanation p { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.diagnosis-demo footer { margin-top: 15px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
footer { min-height: 65px; padding: 0 32px; display: flex; align-items: center; justify-content: space-between; color: #8fa1b3; background: #0b2136; font-size: 10px; }

@media (max-width: 1080px) {
  .topbar { flex-wrap: wrap; padding-top: 14px; padding-bottom: 0; }
  nav { order: 3; width: 100%; height: 48px; }
  .preview-pill { margin-left: auto; }
  .predictor-layout { grid-template-columns: 1fr; }
  .results { position: static; }
  .local-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .topbar, .model-strip, main, footer { padding-left: 16px; padding-right: 16px; }
  .brand { min-width: 0; }
  .brand small, .preview-pill { display: none; }
  nav { overflow-x: auto; }
  .nav-link { padding: 0 11px; white-space: nowrap; }
  .model-strip { align-items: start; flex-direction: column; }
  #model-version { margin: 0; }
  .page-heading { align-items: start; flex-direction: column; }
  .safe-card { width: 100%; }
  .fields { grid-template-columns: repeat(2, 1fr); }
  .predictor-layout, .equation-list, .local-grid { grid-template-columns: 1fr; }
  .result-card strong { font-size: 31px; }
  .demo-targets { grid-template-columns: 1fr; }
  .effect-method-grid { grid-template-columns: 1fr; }
  .effect-method-grid > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .effect-method-grid > div:last-child { border-bottom: 0; }
  .effect-version { margin-left: 0; padding-bottom: 0; }
  .relation-toolbar { align-items: stretch; flex-direction: column; gap: 14px; }
  .chart-head { flex-direction: column; }.chart-head > span { text-align: left; }
  footer { padding-top: 15px; padding-bottom: 15px; align-items: start; flex-direction: column; gap: 5px; }
}
@media (max-width: 470px) {
  .fields { grid-template-columns: 1fr; }
  .check-field { grid-column: auto; }
  .result-cards { grid-template-columns: 1fr; }
  .contribution { grid-template-columns: 90px 1fr 54px; }
}
