/* Revenue Leakage Calculator redesign. Loaded after tools.css. Visual only; all script hooks are untouched. */
:root {
  --rl-w: 1120px;
  --rl-gut: 24px;
  --rl-r: 12px;
  --rl-R: 20px;
  --rl-focus: 0 0 0 3px rgba(56, 100, 0, 0.55);
}
html, body { overflow-x: clip; }
body { font-size: 16px; line-height: 1.55; background: #fff !important; }
main.page-main { max-width: none !important; padding: 0 !important; margin: 0 !important; width: 100%; }
.foot3 { margin-top: 0; }

/* Focus */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--ps-green); outline-offset: 3px;
}

/* State shells: keep script-driven visibility, restyle the rest */
#state-1.visible-state, #state-2.visible-state { display: block; height: auto; overflow: visible; }
#state-3.visible-state, #state-3 {
  width: auto !important; max-width: none !important; margin: 0 !important; padding: 0 !important;
  background: #fff !important; box-sizing: border-box;
}
.fade-transition { transition: opacity 0.25s ease, transform 0.25s ease; }
#state-3.report-reveal { animation: none; }

.rl-band { padding: 96px 0; background: #fff; }
.rl-band--paper { background: var(--ps-tint); }
.page-section.rl-band { padding-top: 96px; padding-bottom: 96px; }
.rl-wrap { width: 100%; max-width: calc(var(--rl-w) + var(--rl-gut) * 2); margin: 0 auto; padding: 0 var(--rl-gut); box-sizing: border-box; }
.rl-mt { margin-top: 20px; }
.rl-mt-lg { margin-top: 24px; }

/* Type */
.rl-h1 { font-size: clamp(40px, 5.4vw, 68px); line-height: 1.04; font-weight: 800; letter-spacing: -0.035em; color: var(--ps-forest); margin: 0; text-wrap: balance; }
.rl-accent { color: var(--ps-green); font-style: normal; }
.rl-h2 { font-size: clamp(30px, 3.6vw, 44px); line-height: 1.1; font-weight: 800; letter-spacing: -0.03em; color: var(--ps-forest); margin: 0; text-wrap: balance; }
.rl-h3 { font-size: 20px; line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; color: var(--ps-forest); margin: 0; }
.rl-lead { font-size: 19px; line-height: 1.55; color: var(--ps-ink); margin: 20px 0 0; max-width: 540px; }
.rl-body, .rl-body-stack p { font-size: 17px; line-height: 1.6; color: var(--ps-ink); margin: 0; }
.rl-body-stack { display: grid; gap: 14px; margin-top: 20px; }
.rl-label { font-size: 15px; font-weight: 500; color: var(--ps-muted); letter-spacing: 0; text-transform: none; }
.rl-kicker { font-size: 15px; font-weight: 600; color: var(--ps-green); margin: 0 0 10px; }
.rl-meta { font-size: 15px; color: var(--ps-muted); margin: 10px 0 0; }

/* Buttons and links: pills only */
.rl-btn, #start-btn, #generate-btn, .cta-main-btn, .gate-unlock-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 28px; border-radius: 999px !important; font-size: 17px; font-weight: 700;
  letter-spacing: 0; text-transform: none; text-decoration: none; cursor: pointer; width: auto;
  transition: background-color 0.2s ease, transform 0.2s ease; box-shadow: none !important; border: 0;
}
#start-btn .material-symbols-outlined { transition: transform 0.2s ease; font-size: 22px; }
#start-btn:hover .material-symbols-outlined { transform: translateX(3px); }
.rl-btn--lime, #generate-btn { background: var(--ps-lime) !important; color: var(--ps-forest) !important; width: 100%; }
.rl-btn--lime:hover, #generate-btn:hover { background: #d3f6b8 !important; transform: translateY(-1px); }
.rl-link { display: inline-flex; align-items: center; min-height: 44px; font-size: 16px; font-weight: 600; color: var(--ps-green); text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.rl-link:hover { color: var(--ps-green-d); }

/* Quiet fact line */
.rl-facts { list-style: none; margin: 28px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 28px; font-size: 15px; color: var(--ps-muted); }
.rl-facts li { margin: 0; }

/* Hero */
.rl-hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: 64px; align-items: center; }
.rl-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin-top: 32px; }
.rl-hero-card { display: flex; justify-content: flex-end; }
.bcw-card {
  width: 100%; max-width: 460px; padding: 28px !important; background: #fff;
  border: 1px solid var(--ps-line) !important; border-radius: var(--rl-R) !important; box-shadow: 0 1px 2px rgba(14,31,5,0.04) !important;
}
.bcw-title { font-size: 15px !important; font-weight: 600 !important; letter-spacing: 0 !important; text-transform: none !important; color: var(--ps-forest) !important; margin: 0 0 8px; }
.bcw-bar { background: var(--ps-green) !important; border-radius: 6px 6px 0 0; width: 36px; }
.bcw-bar--accent { background: var(--ps-risk) !important; }
.bcw-val { background: var(--ps-tint) !important; color: var(--ps-forest) !important; border: 1px solid var(--ps-line); font-size: 12px !important; }
.bcw-val--accent { background: var(--ps-risk-bg) !important; color: var(--ps-risk) !important; border-color: #f4c7c2; }
.bcw-label { font-size: 12px !important; letter-spacing: 0 !important; text-transform: none !important; color: var(--ps-muted) !important; }
.bcw-label--accent { color: var(--ps-forest) !important; }

/* Diagnostic */
.rl-head { margin-bottom: 48px; }
.rl-head .rl-lead { margin-top: 14px; }
.rl-diag { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 64px; align-items: start; }
.rl-inputs { display: grid; }
.rl-input { padding: 28px 0; border-top: 1px solid var(--ps-line); }
.rl-input:last-child { border-bottom: 1px solid var(--ps-line); }
.rl-input-top { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.rl-value { font-size: 36px; line-height: 1; font-weight: 700; letter-spacing: -0.02em; color: var(--ps-forest); font-variant-numeric: tabular-nums; }
#state-2 input[type=range] {
  display: block; width: 100%; height: 4px !important; margin: 10px 0; border-radius: 999px; cursor: pointer;
  background: linear-gradient(to right, var(--ps-green) var(--fill, 0%), var(--ps-line) var(--fill, 0%)) !important;
  outline-offset: 12px;
}
#state-2 input[type=range]::-webkit-slider-thumb {
  height: 24px; width: 24px; border-radius: 50%; background: #fff; border: 3px solid var(--ps-green);
  box-shadow: none; transition: transform 0.15s ease; cursor: grab;
}
#state-2 input[type=range]::-moz-range-thumb { height: 18px; width: 18px; border-radius: 50%; background: #fff; border: 3px solid var(--ps-green); box-shadow: none; transition: transform 0.15s ease; }
#state-2 input[type=range]::-moz-range-track { background: transparent; height: 4px; }
#state-2 input[type=range]:hover::-webkit-slider-thumb, #state-2 input[type=range]:active::-webkit-slider-thumb { transform: scale(1.15); }
#state-2 input[type=range]:hover::-moz-range-thumb { transform: scale(1.15); }
#state-2 input[type=range]:focus-visible { outline: none; }
#state-2 input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: var(--rl-focus); }
#state-2 input[type=range]:focus-visible::-moz-range-thumb { box-shadow: var(--rl-focus); }

.rl-panel { position: sticky; top: 96px; background: var(--ps-forest); color: #fff; border: 1px solid rgba(255,255,255,0.08); border-radius: var(--rl-R); padding: 32px; }
.rl-panel-label { font-size: 15px; font-weight: 500; color: rgba(255,255,255,0.72); margin: 0; }
.rl-panel-figure { font-size: clamp(56px, 7vw, 84px); line-height: 1; font-weight: 800; letter-spacing: -0.04em; color: var(--ps-lime); font-variant-numeric: tabular-nums; margin: 14px 0 0; overflow-wrap: anywhere; }
.rl-panel-note { font-size: 15px; color: rgba(255,255,255,0.72); margin: 14px 0 0; }
.rl-break { list-style: none; margin: 28px 0; padding: 0; border-top: 1px solid rgba(255,255,255,0.08); }
.rl-break li { padding: 16px 0; border-bottom: 1px solid rgba(255,255,255,0.08); }
.rl-break-row { display: flex; justify-content: space-between; gap: 12px; font-size: 16px; color: rgba(255,255,255,0.86); font-variant-numeric: tabular-nums; }
.rl-break-row span:last-child { color: #fff; font-weight: 600; }
.rl-bar { height: 4px; border-radius: 999px; background: rgba(255,255,255,0.1); margin-top: 10px; overflow: hidden; }
.rl-bar i { display: block; height: 100%; width: 100%; background: #e9776b; transform-origin: left center; transform: scaleX(0); transition: transform 0.25s ease; }
.rl-break-total { padding: 16px 0 !important; }
.rl-break-total .rl-break-row span:last-child { color: var(--ps-lime); }

/* Gate dialog */
#state-gate.visible-state { background: rgba(14, 31, 5, 0.55); backdrop-filter: none; -webkit-backdrop-filter: none; overflow-y: auto; }
#state-gate .gate-card {
  border-radius: var(--rl-R); border: 1px solid var(--ps-line); box-shadow: none; padding: 40px; max-width: 480px;
  max-height: calc(100vh - 32px); overflow-y: auto;
}
#state-gate .gate-heading { text-align: left; font-size: 30px; font-weight: 800; color: var(--ps-forest); }
#state-gate .gate-subtext { text-align: left; font-size: 16px; color: var(--ps-ink); margin: 10px 0 24px; }
#state-gate .gate-field-label { font-size: 15px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--ps-forest); display: block; margin-bottom: 6px; }
#state-gate .gate-input, #state-gate .gate-country-select {
  min-height: 48px; font-size: 16px; border: 1px solid #bfc8b9; border-radius: var(--rl-r); padding: 0 14px; color: var(--ps-forest); background: #fff; box-sizing: border-box; width: 100%;
  transition: border-color 0.15s ease;
}
#state-gate .gate-country-select { width: 132px; flex-shrink: 0; padding: 0 8px; }
#state-gate .gate-input::placeholder { color: #7a8475; }
#state-gate .gate-input:focus, #state-gate .gate-country-select:focus { border-color: var(--ps-green); outline: 3px solid rgba(56,100,0,0.35); outline-offset: 0; }
#state-gate .gate-unlock-btn { width: 100%; margin-top: 8px; }
#state-gate .gate-privacy { text-align: left; font-size: 15px; color: var(--ps-muted); margin: 18px 0 0; }
#state-gate .gate-error { color: var(--ps-risk); background: var(--ps-risk-bg); border-radius: var(--rl-r); padding: 10px 14px; font-size: 15px; }
.gate-error.hidden-state { display: none; }

/* Loader */
#state-loader.visible-state { background: #fff; min-height: 70vh; padding: 80px var(--rl-gut); }
.loader-inner { max-width: 440px; margin: 0 auto; align-items: flex-start; }
.loader-status { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; color: var(--ps-forest); text-align: left; }
.loader-substatus { font-size: 16px; color: var(--ps-muted); text-align: left; }
.loader-progress-track { height: 4px; background: var(--ps-line); border-radius: 999px; width: 100%; }
.loader-progress-fill { background: var(--ps-green); border-radius: 999px; }
.loader-step-item { font-size: 16px; }

/* Report */
.rl-rhead { display: flex; justify-content: space-between; align-items: flex-end; gap: 32px; flex-wrap: wrap; margin-bottom: 40px; }
.rl-inputs-sum { display: flex; gap: 40px; margin: 0; }
.rl-inputs-sum div { display: grid; gap: 2px; }
.rl-inputs-sum dt { font-size: 15px; color: var(--ps-muted); }
.rl-inputs-sum dd { margin: 0; font-size: 24px; font-weight: 700; color: var(--ps-forest); font-variant-numeric: tabular-nums; }
.rl-grid { display: grid; gap: 24px; }
.rl-grid--hero { grid-template-columns: minmax(0, 1fr) 340px; }
.rl-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rl-hero-stat { background: var(--ps-forest); border: 1px solid rgba(255,255,255,0.08); border-radius: var(--rl-R); padding: 40px 32px; color: #fff; }
.rl-hero-figure, #count-up-recovery { font-size: clamp(56px, 9vw, 112px) !important; line-height: 1 !important; font-weight: 800 !important; letter-spacing: -0.04em; color: var(--ps-lime) !important; margin: 16px 0 0 !important; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.rl-card { background: #fff; border: 1px solid var(--ps-line); border-radius: var(--rl-R); padding: 32px; box-shadow: none; min-width: 0; }
.rl-card--metric { display: flex; flex-direction: column; justify-content: center; }
.rl-card--metric .rl-mt { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--ps-line); }
.rl-metric { font-size: 36px; line-height: 1.1; font-weight: 700; letter-spacing: -0.02em; color: var(--ps-forest); margin: 4px 0 0; font-variant-numeric: tabular-nums; }
.rl-card-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.rl-legend { display: flex; gap: 20px; list-style: none; margin: 0; padding: 0; font-size: 15px; color: var(--ps-ink); }
.rl-legend li { display: flex; align-items: center; gap: 8px; }
.rl-sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.rl-sw--green { background: var(--ps-green); }
.rl-sw--risk { background: var(--ps-risk); }
#state-3 #svg-chart-container { padding: 0; margin: 0; }
#svg-chart-container svg text { font-family: 'DM Sans', sans-serif; fill: var(--ps-muted); font-size: 12px; }
#svg-chart-container svg line[stroke="#e8eaef"] { stroke: var(--ps-line); }
#svg-chart-container svg path[fill="#0a5c3e"] { fill: var(--ps-green); }
#svg-chart-container svg path[stroke="#0a5c3e"] { stroke: var(--ps-green); }
#svg-chart-container svg path[stroke="#d4847a"] { stroke: var(--ps-risk); }
#svg-chart-container svg circle[fill="#0a5c3e"] { fill: var(--ps-green); }
#svg-chart-container svg circle[fill="#d4847a"] { fill: var(--ps-risk); }
.chart-tooltip { box-shadow: none; border-radius: 8px; font-size: 13px; transition: opacity 0.15s ease; }

/* Leakage bars (markup is generated by the page script) */
.rl-leak { margin-top: 24px; display: grid; gap: 22px; }
.rl-leak > div { display: grid; gap: 10px; }
.rl-leak > div > div:first-child { font-size: 16px !important; font-weight: 500; text-transform: none !important; letter-spacing: 0; }
.rl-leak > div > div:first-child span { font-size: 16px; text-transform: none; font-variant-numeric: tabular-nums; }
.rl-leak > div > div:first-child span:first-child { color: var(--ps-ink); }
.rl-leak > div > div:first-child span:last-child { color: var(--ps-forest); font-weight: 700; }
.rl-leak > div > div:last-child { height: 6px !important; background: var(--ps-tint) !important; border: 0; border-radius: 999px; }
.rl-leak [data-width] { background: var(--ps-risk) !important; background-image: none !important; border-radius: 999px; transition: width 0.6s ease-out !important; }
.rl-leak > div:nth-child(n+2) [data-width] { background: var(--ps-green) !important; }
#typewriter-text { min-height: 7em; }

/* Roadmap */
.rl-road { list-style: none; margin: 24px 0 0; padding: 0; display: grid; gap: 0; }
.rl-road li { display: grid; grid-template-columns: 36px 1fr; gap: 16px; padding: 20px 0; border-top: 1px solid var(--ps-line); }
.rl-road li:first-child { border-top: 0; padding-top: 0; }
.rl-road h4 { margin: 0; font-size: 17px; font-weight: 700; color: var(--ps-forest); }
.rl-road p { margin: 4px 0 0; font-size: 16px; color: var(--ps-ink); }
.rl-step { width: 32px; height: 32px; border-radius: 50%; background: var(--ps-leaf); color: var(--ps-green-d); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; }
.roadmap-item { opacity: 0; transform: translateY(8px); transition: opacity 0.25s ease, transform 0.25s ease !important; }
.roadmap-item.reveal { opacity: 1; transform: none; }
.rl-radar { display: flex; justify-content: center; padding: 16px 0 0; }
.rl-radar polygon[fill^="rgba(100"] { fill: rgba(56,100,0,0.12); stroke: var(--ps-green); }
.rl-radar polygon[fill="none"] { stroke: var(--ps-line); }

/* Founder */
.rl-founder { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 64px; align-items: center; }
.rl-founder-img { position: relative; width: 100%; max-width: 360px; }
.rl-founder-img img { display: block; width: 100%; height: auto; aspect-ratio: 360 / 420; object-fit: cover; object-position: top center; border-radius: var(--rl-R); border: 1px solid var(--ps-line); }
.rl-li { position: absolute; top: 12px; right: 12px; display: inline-flex; width: 44px; height: 44px; align-items: center; justify-content: center; background: #fff; border-radius: 12px; }
.rl-founder-copy .rl-h2 { margin-bottom: 0; }

/* CTA */
.rl-cta { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 48px; align-items: center; }
.rl-cta .rl-lead strong { color: var(--ps-risk); font-weight: 700; }
.rl-cta-act { display: grid; justify-items: start; }
.rl-cta-act .rl-meta { margin-top: 12px; }
.cta-main-btn { background: var(--ps-green) !important; color: #fff !important; }
.cta-main-btn:hover { background: var(--ps-green-d) !important; }

/* Hidden placeholder gauges */
.rl-gauges[hidden] { display: none !important; }

/* Responsive */
@media (max-width: 960px) {
  .rl-hero, .rl-diag, .rl-grid--hero, .rl-founder, .rl-cta { grid-template-columns: minmax(0, 1fr); }
  .rl-hero { gap: 48px; }
  .rl-hero-card { justify-content: flex-start; }
  .rl-diag { gap: 40px; }
  .rl-panel { position: static; }
  .rl-founder { gap: 32px; }
  .rl-band, .page-section.rl-band { padding: 72px 0; }
}
@media (max-width: 767px) {
  .rl-grid--2 { grid-template-columns: minmax(0, 1fr); }
  .rl-card, .rl-hero-stat { padding: 24px; }
  .rl-inputs-sum { gap: 24px; flex-wrap: wrap; }
  #state-gate .gate-card { padding: 28px 24px; }
  #state-gate .gate-heading { font-size: 26px !important; }
  #state-gate .gate-country-select { width: 112px !important; font-size: 16px !important; padding: 0 8px !important; }
  .bcw-bar { width: 28px; }
}
@media (max-width: 480px) {
  :root { --rl-gut: 20px; }
  .rl-band, .page-section.rl-band { padding: 56px 0; }
  .rl-btn, #start-btn, .cta-main-btn { width: 100%; }
  .rl-value { font-size: 30px; }
  .rl-panel { padding: 24px; }
}

/* Motion fallbacks */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .chart-line-draw { stroke-dashoffset: 0 !important; }
  .roadmap-item { opacity: 1; transform: none; }
  .rl-bar i { transition: none; }
}
.rl-accent, #state-1 h1 .rl-accent { font-style: normal !important; font-weight: 800 !important; }
#state-gate.visible-state { position: fixed; inset: 0; z-index: 100; display: block; }
#state-gate.visible-state { background: var(--ps-tint); }
@media (max-width: 480px) {
  .bcw-card { padding: 20px 14px !important; }
  .bcw-label { font-size: 11px !important; overflow-wrap: normal !important; word-break: normal !important; }
  .bcw-labels { gap: 2px; }
  .bcw-bar { width: 24px; }
}
@media (max-width: 767px) { #state-gate .gate-country-select { width: 128px !important; font-size: 15px !important; } }

/* ===== Pass 3: alignment, mobile, touch, UX ===== */
:root { --rl-w: 1200px; --rl-gut: 24px; }
@media (max-width: 767px) { :root { --rl-gut: 16px; } }
.rl-lead { max-width: 560px; text-wrap: pretty; }
.rl-h1, .rl-h2, .rl-h3, .gate-heading, .loader-status { text-wrap: balance; }
.rl-h1 { font-size: clamp(34px, 8.6vw, 68px); }
.rl-h2 { font-size: clamp(28px, 6.4vw, 44px); }
.rl-head .rl-kicker, .gate-step { margin-bottom: 12px; }
.gate-step { text-align: left; }
.rl-label, .rl-meta, .rl-legend, .rl-facts, .rl-kicker, .rl-panel-label, .rl-panel-note, #state-gate .gate-privacy, #state-gate .gate-field-label { font-size: 15px; }
.rl-value, .rl-panel-figure, .rl-metric, #monthly-loss, .rl-break-row span { font-variant-numeric: tabular-nums; }
.rl-value { min-width: 4.5ch; text-align: right; }
.bcw-val, .bcw-label { font-size: 14px !important; }
.chart-tooltip, #svg-chart-container svg text, #radar-chart-container svg text { font-size: 14px; }

.rl-diag { gap: 64px; }
.rl-head { margin-bottom: 40px; }
.rl-input { padding: 24px 0; }
.rl-rhead > div:first-child { min-width: 0; }

#state-2 input[type=range] {
  height: 44px !important; margin: 0 !important; border-radius: 0; touch-action: pan-y;
  background: linear-gradient(to right, var(--ps-green) var(--fill, 0%), var(--ps-line) var(--fill, 0%)) center / 100% 4px no-repeat !important;
}
#state-2 input[type=range]::-webkit-slider-thumb { height: 28px; width: 28px; }
#state-2 input[type=range]::-moz-range-thumb { height: 22px; width: 22px; }
.rl-input-top { margin-bottom: 4px; align-items: center; }
.rl-input-top .rl-label { font-size: 16px; color: var(--ps-forest); font-weight: 500; }
.rl-link { min-height: 48px; }

#state-gate.visible-state {
  display: grid !important; align-items: center; justify-items: center;
  padding: 16px; box-sizing: border-box; height: 100vh; height: 100dvh; overflow-y: auto; overscroll-behavior: contain;
}
#state-gate .gate-card { width: 100%; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); margin: auto; }
#state-gate .gate-phone-row { display: flex; gap: 8px; min-width: 0; }
#state-gate .gate-phone-row .gate-input { min-width: 0; flex: 1 1 0; }
#state-gate .gate-field { margin-bottom: 16px; }

@media (max-width: 960px) {
  .rl-band, .page-section.rl-band { padding: 64px 0; }
  .rl-diag { gap: 32px; }
  .rl-head { margin-bottom: 32px; }
  .rl-panel { padding: 28px; }
  .rl-actions { margin-top: 28px; }
}
@media (max-width: 767px) {
  .rl-band, .page-section.rl-band { padding: 40px 0 48px; }
  #state-1.rl-band { padding-top: 32px; }
  .rl-lead { font-size: 17px; margin-top: 16px; }
  .rl-hero { gap: 32px; }
  .rl-actions { flex-direction: column; align-items: stretch; gap: 4px; margin-top: 24px; }
  .rl-actions .rl-link { justify-content: center; }
  .rl-btn, #start-btn, .cta-main-btn, #generate-btn, .gate-unlock-btn { width: 100%; min-height: 52px; }
  .rl-facts { margin-top: 16px; gap: 6px 20px; }
  .rl-hero-card, .bcw-card { max-width: none; }
  .rl-inputs-sum { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .rl-inputs-sum dd { font-size: 20px; }
  .rl-inputs-sum dt { font-size: 14px; }
  .rl-rhead { gap: 20px; margin-bottom: 28px; }
  .rl-grid { gap: 16px; }
  .rl-mt-lg { margin-top: 16px; }
  .rl-card, .rl-hero-stat { padding: 20px; }
  .rl-card-head { margin-bottom: 12px; }
  .rl-card--metric { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 12px; align-items: start; }
  .rl-card--metric .rl-mt { margin-top: 0; padding-top: 0; border-top: 0; }
  .rl-card--metric > p { margin: 0; }
  .rl-card--metric .rl-metric { font-size: 22px; }
  .rl-card--metric .rl-label { font-size: 14px; }
  .rl-card--metric > :nth-child(1) { grid-area: 1 / 1; }
  .rl-card--metric > :nth-child(2) { grid-area: 2 / 1; }
  .rl-card--metric > :nth-child(3) { grid-area: 1 / 2; }
  .rl-card--metric > :nth-child(4) { grid-area: 2 / 2; }
  .rl-card--metric > :nth-child(5) { grid-area: 1 / 3; }
  .rl-card--metric > :nth-child(6) { grid-area: 2 / 3; }
  #typewriter-text { min-height: 0; }
  #svg-chart-container { height: 240px !important; }
  .rl-road li { grid-template-columns: 32px 1fr; gap: 12px; }
  .rl-founder-img { max-width: none; }
  .rl-founder-img img { aspect-ratio: 4 / 3; }
  .rl-cta { gap: 28px; }
  .rl-cta-act { justify-items: stretch; }
  .rl-cta-act .rl-meta { text-align: center; }
  .rl-panel { padding: 24px 20px; }
  .rl-panel-figure { font-size: clamp(52px, 17vw, 72px); }
  .rl-input { padding: 18px 0 8px; }
  .rl-value { font-size: 30px; }
  #state-gate .gate-card { padding: 24px 20px; border-radius: 16px; }
  #state-gate .gate-heading { font-size: 26px !important; }
  #state-gate .gate-country-select { width: 124px !important; font-size: 16px !important; }
  #state-loader.visible-state { padding: 56px var(--rl-gut); }
}
@media (max-width: 560px) {
  .bcw-card { padding: 20px 16px !important; }
  .bcw-bars-area { height: auto !important; }
  .bcw-gridlines, .bcw-axis-line, .bcw-labels { display: none !important; }
  .bcw-bars { position: static !important; display: grid !important; grid-template-columns: minmax(0, 1fr); justify-content: stretch !important; gap: 14px; margin-top: 12px; }
  .bcw-bar-wrap { display: grid !important; grid-template-columns: 104px minmax(0, 1fr) 52px; align-items: center; gap: 10px; height: auto !important; flex: none; }
  .bcw-bar-wrap::before { content: attr(data-l); grid-column: 1; grid-row: 1; font-size: 14px; font-weight: 500; color: var(--ps-muted); }
  .bcw-bar-wrap:first-child::before { color: var(--ps-forest); font-weight: 700; }
  .bcw-bar { grid-column: 2; grid-row: 1; height: 16px !important; border-radius: 0 6px 6px 0 !important; width: 85%; }
  .bcw-bar-wrap:nth-child(2) .bcw-bar { width: 70%; }
  .bcw-bar-wrap:nth-child(3) .bcw-bar { width: 55%; }
  .bcw-bar-wrap:nth-child(4) .bcw-bar { width: 40%; }
  .bcw-bar-wrap:nth-child(5) .bcw-bar { width: 25%; }
  .bcw-val { grid-column: 3; grid-row: 1; justify-self: end; position: static !important; transform: none !important; margin: 0 !important; }
}
@media (max-width: 380px) {
  .bcw-bar-wrap { grid-template-columns: 96px minmax(0, 1fr) 50px; gap: 8px; }
}
@media (prefers-reduced-motion: reduce) { #start-btn:hover .material-symbols-outlined, .rl-btn--lime:hover, #generate-btn:hover { transform: none; } }
@media (min-width: 961px) { .rl-diag { grid-template-columns: minmax(0, 1fr) 400px; } }
#state-gate .gate-card { position: static !important; transform: none !important; left: auto; top: auto; }
@media (min-width: 768px) and (max-width: 960px) {
  .rl-card--metric { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 24px; align-items: start; }
  .rl-card--metric .rl-mt { margin-top: 0; padding-top: 0; border-top: 0; }
  .rl-card--metric > p { margin: 0; }
  .rl-card--metric > :nth-child(1) { grid-area: 1 / 1; } .rl-card--metric > :nth-child(2) { grid-area: 2 / 1; }
  .rl-card--metric > :nth-child(3) { grid-area: 1 / 2; } .rl-card--metric > :nth-child(4) { grid-area: 2 / 2; }
  .rl-card--metric > :nth-child(5) { grid-area: 1 / 3; } .rl-card--metric > :nth-child(6) { grid-area: 2 / 3; }
}

/* Spacing fix: tighter top and bottom around the mobile hero. */
@media (max-width: 640px) {
  html body #state-1.rl-band { padding-top: 24px; padding-bottom: 36px; }
}

/* Start at the top of the page: no dead space under the header, and the whole diagnostic fits one desktop screen. */
@media (min-width: 961px) {
  html body .page-section.rl-band { padding-top: 32px; padding-bottom: 40px; }
  html body #state-1.rl-band { padding-top: 40px; padding-bottom: 48px; }
  .rl-head { margin-bottom: 20px; }
  .rl-head h2 { font-size: clamp(28px, 2.6vw, 36px); margin: 0; }
  .rl-head .rl-lead { margin-top: 8px; }
  .rl-head .rl-kicker, .gate-step { margin-bottom: 6px; }
  .rl-diag { gap: 48px; }
  .rl-input { padding: 12px 0; }
  .rl-input-top { margin-bottom: 4px; }
  .rl-value { font-size: 30px; }
  #state-2 input[type=range] { margin: 6px 0; }
  .rl-panel { top: 88px; padding: 24px 28px; }
  .rl-panel-figure { font-size: clamp(48px, 5vw, 64px); margin-top: 8px; }
  .rl-panel-note { margin-top: 8px; }
}
@media (min-width: 961px) {
  .rl-head .rl-lead { max-width: none; }
  .rl-panel { padding: 20px 28px 24px; }
  .rl-panel .rl-break-row, .rl-panel li { padding-top: 0; padding-bottom: 0; }
  .rl-panel ul li { padding-block: 8px; }
  .rl-panel .rl-btn, .rl-panel #generate-btn { min-height: 48px; margin-top: 16px; }
}

/* Desktop: the recovery panel starts level with the heading (top of the page), inputs sit under it on the left. */
@media (min-width: 961px) {
  html body #state-2 > .rl-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 400px; column-gap: 48px; align-items: start; }
  html body #state-2 .rl-head { grid-column: 1; grid-row: 1; }
  html body #state-2 .rl-diag { display: contents; }
  html body #state-2 .rl-inputs { grid-column: 1; grid-row: 2; }
  html body #state-2 .rl-panel { grid-column: 2; grid-row: 1 / span 2; align-self: start; position: sticky; top: 88px; }
}
