:root {
  color-scheme: light;
  --ink: #132238;
  --muted: #66758a;
  --line: #dce5ee;
  --panel: rgba(255, 255, 255, 0.96);
  --navy: #163b65;
  --teal: #0e7d79;
  --teal-light: #e3f4f2;
  --blue: #2f6fbd;
  --blue-light: #e5effb;
  --red: #c94b50;
  --red-light: #fbe9e9;
  --amber: #b66b11;
  --amber-light: #fff1d9;
  --green: #24734f;
  --green-light: #e4f4eb;
  --shadow: 0 18px 55px rgba(25, 55, 84, 0.1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 8% 0%, rgba(39, 125, 133, 0.11), transparent 32rem),
    radial-gradient(circle at 100% 15%, rgba(47, 111, 189, 0.09), transparent 30rem),
    #f4f7fa;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button, input, select { font: inherit; }

.site-shell { width: min(1380px, calc(100% - 40px)); margin: 0 auto; }

.hero {
  min-height: 330px;
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(310px, 0.7fr);
  gap: 70px;
  align-items: center;
  padding: 58px 52px 70px;
  margin: 24px 0 0;
  border-radius: 28px 28px 0 0;
  color: white;
  overflow: hidden;
  position: relative;
  background: linear-gradient(120deg, #102f52 0%, #174f71 56%, #11766f 100%);
}

.hero::before, .hero::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 50%;
}
.hero::before { width: 420px; height: 420px; right: -110px; top: -210px; }
.hero::after { width: 300px; height: 300px; right: 120px; bottom: -235px; }

.hero-copy, .hero-card { position: relative; z-index: 1; }
.eyebrow { display: flex; align-items: center; gap: 9px; text-transform: uppercase; letter-spacing: .13em; font-size: .75rem; font-weight: 700; opacity: .86; }
.eyebrow-dot { width: 8px; height: 8px; border-radius: 50%; background: #5de0d2; box-shadow: 0 0 0 5px rgba(93,224,210,.15); }
.hero h1 { margin: 18px 0 18px; font-size: clamp(2.55rem, 5vw, 4.35rem); line-height: 1.03; letter-spacing: -.045em; }
.hero h1 span { color: #7fe0d4; }
.hero-copy p { max-width: 760px; margin: 0; color: rgba(255,255,255,.79); font-size: 1.06rem; }

.hero-card {
  justify-self: end;
  width: min(100%, 360px);
  padding: 24px;
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 14px;
  align-items: center;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.09);
  backdrop-filter: blur(12px);
  border-radius: 20px;
}
.hero-card-icon { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 15px; background: rgba(127,224,212,.17); color: #8ce9dd; font-weight: 800; font-size: .92rem; }
.hero-card strong { display: block; font-size: 1.02rem; }
.hero-card span { color: rgba(255,255,255,.69); font-size: .9rem; }
.privacy-note { grid-column: 1 / -1; display: flex; align-items: center; gap: 9px; padding-top: 15px; margin-top: 4px; border-top: 1px solid rgba(255,255,255,.14); color: rgba(255,255,255,.72); font-size: .81rem; }
.privacy-note svg { width: 20px; height: 20px; fill: #78dcd0; }

.main-grid { display: grid; grid-template-columns: minmax(400px, .9fr) minmax(500px, 1.1fr); gap: 22px; margin-top: -1px; }
.panel { background: var(--panel); border: 1px solid var(--line); padding: 34px; box-shadow: var(--shadow); }
.input-panel { border-radius: 0 0 0 22px; }
.result-panel { border-radius: 0 0 22px 0; min-height: 730px; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.step-label { color: var(--teal); text-transform: uppercase; letter-spacing: .11em; font-weight: 800; font-size: .68rem; }
.panel h2 { margin: 3px 0 0; font-size: 1.55rem; letter-spacing: -.025em; }
.panel-intro, .explanation-intro { color: var(--muted); margin: 7px 0 26px; font-size: .92rem; }
.text-button { border: 0; background: transparent; color: var(--teal); font-size: .82rem; font-weight: 700; cursor: pointer; padding: 5px 0; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px 14px; }
.field { min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { display: block; margin: 0 0 7px; color: #34465c; font-size: .79rem; font-weight: 700; }
.input-wrap { position: relative; }
.input-wrap input, .input-wrap select {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  border: 1px solid #cfd9e4;
  border-radius: 10px;
  background: #fbfcfd;
  color: var(--ink);
  outline: none;
  transition: .18s ease;
}
.input-wrap.has-unit input { padding-right: 72px; }
.input-wrap input:focus, .input-wrap select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(14,125,121,.11); background: white; }
.unit { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: #8995a4; font-size: .75rem; pointer-events: none; }
.range-help { display: block; margin-top: 4px; color: #96a1af; font-size: .66rem; }
.primary-button { width: 100%; height: 52px; margin-top: 25px; display: flex; align-items: center; justify-content: center; gap: 10px; border: 0; border-radius: 11px; background: linear-gradient(110deg, var(--navy), var(--teal)); color: white; font-weight: 750; cursor: pointer; box-shadow: 0 10px 24px rgba(17,92,102,.19); transition: transform .18s, box-shadow .18s; }
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 13px 30px rgba(17,92,102,.25); }
.primary-button:disabled { opacity: .6; cursor: wait; transform: none; }
.primary-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; }

.status-pill { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; padding: 6px 10px; border-radius: 99px; background: #eef2f6; color: #647387; font-size: .71rem; font-weight: 700; }
.status-pill span { width: 7px; height: 7px; border-radius: 50%; background: #9aa8b7; }
.status-pill.ready { background: var(--green-light); color: var(--green); }
.status-pill.ready span { background: #42a877; }
.status-pill.error { background: var(--red-light); color: var(--red); }
.status-pill.error span { background: var(--red); }

.empty-state, .loading-state { min-height: 565px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.empty-state h3, .loading-state strong { margin: 22px 0 5px; font-size: 1.08rem; }
.empty-state p, .loading-state span { max-width: 320px; margin: 0; color: var(--muted); font-size: .88rem; }
.empty-visual { width: 126px; height: 126px; position: relative; display: grid; place-items: center; }
.empty-ring { position: absolute; border-radius: 50%; border: 1px solid #d6e4ec; }
.ring-one { inset: 0; }
.ring-two { inset: 18px; background: #edf5f6; border-color: #d1e7e6; }
.empty-visual svg { position: relative; width: 38px; height: 38px; stroke: var(--teal); fill: none; stroke-width: 1.6; }
.spinner { width: 44px; height: 44px; border: 4px solid #d9e9e8; border-top-color: var(--teal); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

.prediction-output { padding-top: 30px; }
.risk-summary { display: grid; grid-template-columns: 260px 1fr; gap: 24px; align-items: center; }
.gauge-wrap { height: 174px; position: relative; }
.gauge { width: 100%; height: 150px; overflow: visible; }
.gauge-track, .gauge-value { fill: none; stroke-width: 18; stroke-linecap: round; }
.gauge-track { stroke: #e7edf2; }
.gauge-value { stroke: var(--teal); stroke-dasharray: 267; stroke-dashoffset: 267; transition: stroke-dashoffset .7s ease, stroke .3s; }
.gauge-number { position: absolute; inset: 73px 0 auto; text-align: center; }
.gauge-number strong { display: block; font-size: 2.1rem; letter-spacing: -.05em; }
.gauge-number span { color: var(--muted); font-size: .71rem; }
.risk-badge { display: inline-flex; padding: 6px 11px; border-radius: 99px; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.risk-badge.low { background: var(--green-light); color: var(--green); }
.risk-badge.intermediate { background: var(--amber-light); color: var(--amber); }
.risk-badge.high { background: var(--red-light); color: var(--red); }
.risk-copy h3 { margin: 12px 0 6px; font-size: 1.25rem; }
.risk-copy p { margin: 0; color: var(--muted); font-size: .86rem; }
.divider { height: 1px; background: var(--line); margin: 29px 0 25px; }
.explanation-heading { display: flex; justify-content: space-between; gap: 20px; align-items: center; }
.explanation-heading h3 { margin: 2px 0 0; font-size: 1.08rem; }
.icon-button { width: 28px; height: 28px; border-radius: 50%; border: 1px solid #cfd9e4; background: white; color: var(--teal); cursor: pointer; font-weight: 800; }
.explanation-intro { margin-bottom: 14px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 18px; color: var(--muted); font-size: .68rem; margin-bottom: 16px; }
.chart-legend span { display: flex; align-items: center; gap: 6px; }
.chart-legend i { width: 9px; height: 9px; border-radius: 2px; }
.legend-down { background: var(--blue); }
.legend-up { background: var(--red); }
.shap-chart { display: grid; gap: 10px; }
.shap-row { display: grid; grid-template-columns: minmax(145px, .9fr) minmax(220px, 1.4fr) 58px; gap: 10px; align-items: center; }
.shap-label { color: #34465c; font-size: .72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shap-axis { position: relative; height: 18px; background: linear-gradient(90deg, rgba(47,111,189,.04), transparent 48%, transparent 52%, rgba(201,75,80,.04)); border-radius: 4px; }
.shap-axis::after { content: ""; position: absolute; top: -2px; bottom: -2px; left: 50%; width: 1px; background: #c9d3de; }
.shap-bar { position: absolute; top: 3px; height: 12px; min-width: 2px; border-radius: 3px; }
.shap-bar.positive { left: 50%; background: var(--red); }
.shap-bar.negative { right: 50%; background: var(--blue); }
.shap-value { text-align: right; font-variant-numeric: tabular-nums; font-size: .69rem; font-weight: 700; color: #536276; }
.baseline-row { display: flex; justify-content: space-between; margin-top: 17px; padding: 11px 13px; border-radius: 8px; background: #f3f6f8; color: var(--muted); font-size: .72rem; }
.baseline-row strong { color: var(--ink); }

.information-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 22px 0; border: 1px solid var(--line); background: white; border-radius: 18px; box-shadow: 0 12px 35px rgba(25,55,84,.07); }
.information-strip div { padding: 23px 26px; }
.information-strip div + div { border-left: 1px solid var(--line); }
.information-strip strong { display: block; font-size: .83rem; margin-bottom: 4px; }
.information-strip p { margin: 0; color: var(--muted); font-size: .76rem; }
footer { display: flex; justify-content: space-between; gap: 20px; padding: 8px 4px 34px; color: #798697; font-size: .7rem; }

dialog { width: min(540px, calc(100% - 32px)); border: 0; border-radius: 18px; padding: 30px; color: var(--ink); box-shadow: 0 25px 80px rgba(13,35,58,.3); }
dialog::backdrop { background: rgba(8,25,42,.48); backdrop-filter: blur(3px); }
dialog h2 { margin: 4px 0 13px; }
dialog p { color: var(--muted); font-size: .9rem; }
.dialog-close { position: absolute; right: 15px; top: 12px; border: 0; background: transparent; font-size: 1.7rem; color: #778494; cursor: pointer; }

@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; gap: 30px; padding: 46px 34px 55px; }
  .hero-card { justify-self: start; }
  .main-grid { grid-template-columns: 1fr; }
  .input-panel, .result-panel { border-radius: 0; }
  .result-panel { border-radius: 0 0 22px 22px; }
  .information-strip { grid-template-columns: 1fr; }
  .information-strip div + div { border-left: 0; border-top: 1px solid var(--line); }
}

@media (max-width: 620px) {
  .site-shell { width: min(100% - 20px, 1380px); }
  .hero { margin-top: 10px; padding: 38px 22px 45px; border-radius: 20px 20px 0 0; }
  .hero h1 { font-size: 2.45rem; }
  .panel { padding: 25px 20px; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .risk-summary { grid-template-columns: 1fr; }
  .risk-copy { text-align: center; margin-top: -18px; }
  .shap-row { grid-template-columns: 115px minmax(135px, 1fr) 49px; gap: 7px; }
  footer { flex-direction: column; }
}
