:root {
  color-scheme: dark;
  --ink: #07090e;
  --ink-soft: #0d1119;
  --glass: rgba(22, 27, 39, 0.72);
  --glass-strong: rgba(28, 34, 48, 0.9);
  --line: rgba(255, 255, 255, 0.1);
  --line-bright: rgba(255, 255, 255, 0.17);
  --text: #f7f9ff;
  --muted: #9ba7bb;
  --faint: #69768b;
  --blue: #79a8ff;
  --blue-strong: #a7c4ff;
  --green: #6edba1;
  --amber: #efc46f;
  --red: #ff8b96;
  --radius-xl: 30px;
  --radius-lg: 23px;
  --radius-md: 16px;
  --font: "Segoe UI Variable", "SF Pro Display", "Aptos", "Segoe UI", sans-serif;
  --mono: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }
html { background: var(--ink); scroll-behavior: smooth; }
body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at 9% -8%, rgba(68, 111, 222, 0.2), transparent 31rem),
    radial-gradient(circle at 92% 2%, rgba(114, 80, 211, 0.14), transparent 28rem),
    var(--ink);
  color: var(--text);
  font: 16px/1.5 var(--font);
  overflow-x: hidden;
}
button, input, select { font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; }

.app-bar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  align-items: center;
  min-height: 76px;
  padding: 12px clamp(22px, 4vw, 60px);
  border-bottom: 1px solid var(--line);
  background: rgba(7, 9, 14, 0.72);
  backdrop-filter: blur(24px) saturate(150%);
}

.brand { display: flex; align-items: center; gap: 12px; width: max-content; text-decoration: none; }
.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(130, 174, 255, 0.45);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(117, 165, 255, 0.2), rgba(255, 255, 255, 0.03));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 10px 25px rgba(0, 0, 0, 0.2);
  color: var(--blue-strong);
  font: 700 13px var(--mono);
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; line-height: 1.2; }
.brand small { margin-top: 3px; color: var(--faint); font-size: 12px; }

.mode-switch {
  display: flex;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
}
.mode-switch button {
  min-height: 34px;
  padding: 6px 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.mode-switch button.active {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 5px 16px rgba(0, 0, 0, 0.16);
  color: var(--text);
}

.bar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.engine-pill { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.engine-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px rgba(110, 219, 161, 0.65); }
.soft-button, .run-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 15px;
  border: 0;
  border-radius: 13px;
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}
.soft-button { border: 1px solid var(--line); background: rgba(255, 255, 255, 0.055); color: var(--text); }
.run-button {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(144, 183, 255, 0.7);
  background: linear-gradient(145deg, #8bb4ff, #5c8fe9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 12px 28px rgba(55, 102, 197, 0.24);
  color: #07101f;
}
button:focus-visible, a:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

.site-main { width: min(1280px, calc(100% - 44px)); margin: 0 auto; padding: 58px 0 72px; }
.design-header { display: flex; align-items: end; justify-content: space-between; gap: 32px; }
.kicker { margin: 0 0 10px; color: var(--blue); font: 650 12px/1.3 var(--mono); letter-spacing: 0.09em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 9px; font-size: clamp(2.3rem, 5vw, 4.4rem); font-weight: 620; letter-spacing: -0.055em; line-height: 0.98; }
.design-header > div:first-child > p:last-child { margin: 0; color: var(--muted); font-size: 17px; }
.design-status { display: grid; min-width: 220px; gap: 3px; text-align: right; }
.design-status span, .design-status small { color: var(--faint); font-size: 12px; }
.design-status strong { font-size: 14px; font-weight: 620; }

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 40px;
}
.hero-metrics article {
  position: relative;
  min-height: 154px;
  padding: 23px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.025));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 20px 50px rgba(0, 0, 0, 0.14);
}
.hero-metrics article > span { display: block; margin-bottom: 18px; color: var(--muted); font-size: 13px; }
.hero-metrics strong { display: block; font-size: clamp(1.7rem, 3vw, 2.3rem); font-weight: 630; letter-spacing: -0.04em; }
.hero-metrics strong small { color: var(--faint); font-size: 13px; font-weight: 550; letter-spacing: 0; }
.hero-metrics em { display: inline-block; margin-top: 11px; font-size: 12px; font-style: normal; }
.good { color: var(--green); } .bad { color: var(--red); } .neutral { color: var(--blue-strong); }

.section-intro { display: flex; align-items: end; justify-content: space-between; gap: 32px; margin: 74px 0 24px; }
.section-intro h2 { margin-bottom: 0; font-size: clamp(1.65rem, 3vw, 2.3rem); font-weight: 620; letter-spacing: -0.035em; }
.section-intro > p { max-width: 500px; margin-bottom: 2px; color: var(--muted); font-size: 14px; }
.section-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.section-card {
  --accent: 121, 168, 255;
  position: relative;
  isolation: isolate;
  min-height: 345px;
  padding: 29px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 89% 0%, rgba(var(--accent), 0.16), transparent 16rem),
    linear-gradient(155deg, rgba(30, 36, 50, 0.9), rgba(15, 19, 29, 0.78));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.11), 0 26px 65px rgba(0, 0, 0, 0.2);
  text-decoration: none;
  transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}
.section-card:hover { transform: translateY(-4px); border-color: rgba(var(--accent), 0.4); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 34px 78px rgba(0, 0, 0, 0.27); }
.card-gloss { position: absolute; z-index: -1; top: -6rem; right: -3rem; width: 20rem; height: 13rem; border-radius: 50%; background: rgba(var(--accent), 0.12); filter: blur(50px); }
.section-number { color: rgba(var(--accent), 0.85); font: 650 12px var(--mono); }
.owner { float: right; padding: 4px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 12px; }
.section-card h3 { margin: 42px 0 8px; font-size: clamp(1.55rem, 3vw, 2.15rem); font-weight: 620; letter-spacing: -0.035em; }
.section-card > p { max-width: 440px; margin-bottom: 26px; color: var(--muted); font-size: 14px; }
.section-card dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0; }
.section-card dl div { min-width: 0; padding-top: 12px; border-top: 1px solid var(--line); }
.section-card dt { overflow: hidden; color: var(--faint); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.section-card dd { margin: 5px 0 0; font-size: 14px; font-weight: 620; }
.section-card footer { position: absolute; right: 29px; bottom: 25px; left: 29px; display: flex; align-items: center; justify-content: space-between; }
.card-state { font-size: 12px; }
.open-arrow { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid var(--line-bright); border-radius: 50%; background: rgba(255, 255, 255, 0.055); }
.accent-violet { --accent: 166, 126, 255; } .accent-cyan { --accent: 83, 207, 225; }
.accent-indigo { --accent: 109, 129, 255; } .accent-rose { --accent: 242, 116, 154; } .accent-green { --accent: 92, 211, 150; }

[hidden] { display: none !important; }
.view-enter { animation: view-in 320ms ease both; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.engine-pill i.bad { background: var(--red); box-shadow: 0 0 12px rgba(255, 139, 150, 0.55); }
.engine-pill i.running { background: var(--blue); box-shadow: 0 0 12px rgba(121, 168, 255, 0.72); }
.run-button:disabled { cursor: wait; filter: saturate(0.5); opacity: 0.7; }

.dashboard-context {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  margin-top: 32px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045);
}
.dashboard-context > div:first-child { display: grid; min-width: 150px; }
.dashboard-context span, .dashboard-context p { color: var(--faint); font-size: 12px; }
.dashboard-context strong { font-size: 14px; }
.dashboard-context p { margin: 0; }
.report-links { display: flex; gap: 8px; }
.report-links a { padding: 6px 10px; border-radius: 10px; background: rgba(255,255,255,.055); color: var(--muted); font-size: 12px; text-decoration: none; }

.section-card.pending { cursor: default; filter: saturate(0.45); opacity: 0.62; }
.section-card.pending:hover { transform: none; border-color: var(--line); }
.section-card .owner { text-transform: capitalize; }

.review-card, .results-card {
  margin-top: 64px;
  padding: clamp(24px, 4vw, 38px);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(150deg, rgba(31, 37, 51, 0.75), rgba(14, 18, 27, 0.7));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09), 0 26px 65px rgba(0, 0, 0, 0.16);
}
.review-card > header, .results-card > header { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.review-card h2, .results-card h2 { margin: 0; font-size: clamp(1.45rem, 3vw, 2rem); font-weight: 620; letter-spacing: -0.035em; }
.review-card > header > strong { color: var(--blue-strong); font-size: 2rem; font-weight: 620; }
.review-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.review-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px 15px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
}
.status-mark { width: 9px; height: 9px; border-radius: 50%; background: var(--blue); }
.status-mark.good { background: var(--green); } .status-mark.warn { background: var(--amber); } .status-mark.bad { background: var(--red); }
.review-item strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.review-item span:last-child { color: var(--muted); font: 12px var(--mono); }
.empty-copy { margin: 0; padding: 18px 0; color: var(--muted); font-size: 14px; }

.candidate-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.candidate-item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 17px; background: rgba(255,255,255,.035); }
.candidate-rank { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; background: rgba(121,168,255,.12); color: var(--blue-strong); font: 12px var(--mono); }
.candidate-item strong, .candidate-item small { display: block; }
.candidate-item strong { font-size: 14px; }
.candidate-item small { margin-top: 3px; color: var(--muted); font-size: 12px; }
.candidate-score { color: var(--blue-strong); font: 12px var(--mono); }

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  margin-bottom: 27px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.04);
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}
.back-link:hover { border-color: var(--line-bright); color: var(--text); }

.detail-hero {
  --accent: 121, 168, 255;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
  gap: clamp(32px, 6vw, 84px);
  min-height: 390px;
  padding: clamp(30px, 5vw, 60px);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 36px;
  background:
    radial-gradient(circle at 90% 4%, rgba(var(--accent), .25), transparent 27rem),
    linear-gradient(145deg, rgba(35, 42, 58, .92), rgba(14, 18, 28, .82));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.13), 0 34px 90px rgba(0,0,0,.25);
}
.detail-hero::after { content: ""; position: absolute; top: -35%; right: -8%; width: 34rem; height: 24rem; border: 1px solid rgba(var(--accent), .17); border-radius: 50%; transform: rotate(-18deg); }
.detail-heading { position: relative; z-index: 1; align-self: center; }
.detail-heading h1 { margin-bottom: 17px; }
.detail-heading > p:last-child { max-width: 580px; margin: 0; color: var(--muted); font-size: 17px; }
.detail-hero-metrics { position: relative; z-index: 1; display: grid; align-self: center; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.hero-result { padding: 18px; border: 1px solid rgba(255,255,255,.11); border-radius: 20px; background: rgba(7,9,14,.28); backdrop-filter: blur(16px); }
.hero-result:first-child { grid-column: 1/-1; }
.hero-result span, .hero-result small { display: block; color: var(--muted); font-size: 12px; }
.hero-result strong { display: block; margin: 7px 0 2px; font-size: clamp(1.4rem, 3vw, 2.15rem); font-weight: 620; letter-spacing: -.035em; }

.deck-shell {
  margin-top: 22px;
  padding: clamp(20px, 4vw, 34px);
  border: 1px solid var(--line);
  border-radius: 34px;
  background: rgba(15, 19, 28, .66);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 30px 70px rgba(0,0,0,.18);
  backdrop-filter: blur(20px);
}
.deck-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.deck-header > div:first-child { display: grid; gap: 3px; }
.deck-header span { color: var(--faint); font-size: 12px; }
.deck-header strong { font: 13px var(--mono); }
.deck-controls { display: flex; gap: 8px; }
.deck-controls button { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: rgba(255,255,255,.055); color: var(--text); }
.deck-controls button:hover { border-color: var(--line-bright); background: rgba(255,255,255,.09); }
.deck-controls button:disabled { cursor: default; opacity: .3; }

.formula-slide { min-height: 515px; padding: clamp(35px, 6vw, 72px) clamp(0px, 3vw, 40px) 40px; }
.slide-topline { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.slide-symbol { display: grid; min-width: 50px; height: 36px; padding: 0 12px; place-items: center; border: 1px solid rgba(121,168,255,.28); border-radius: 999px; background: rgba(121,168,255,.08); color: var(--blue-strong); font: 13px var(--mono); }
.slide-topline span:last-child { color: var(--faint); font: 12px var(--mono); }
.formula-slide h2 { max-width: 800px; margin: 24px 0 32px; font-size: clamp(2rem, 5vw, 4rem); font-weight: 610; letter-spacing: -.055em; line-height: 1.02; }
.formula-display { padding: 25px 28px; border: 1px solid rgba(121,168,255,.19); border-radius: 21px; background: rgba(58, 89, 150, .09); color: #dce8ff; font: clamp(1rem, 2.1vw, 1.35rem)/1.6 var(--mono); white-space: pre-wrap; }
.substitution-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(250px, .6fr); gap: 14px; margin-top: 14px; }
.substitution, .slide-result { min-width: 0; padding: 21px 23px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.035); }
.substitution span, .slide-result span { display: block; margin-bottom: 10px; color: var(--faint); font-size: 12px; }
.substitution pre { margin: 0; color: var(--muted); font: 13px/1.75 var(--mono); white-space: pre-wrap; word-break: break-word; }
.slide-result strong { display: block; font-size: clamp(1.8rem, 4vw, 3rem); font-weight: 620; letter-spacing: -.05em; }
.slide-result small { display: block; margin-top: 3px; color: var(--muted); font-size: 13px; }
.slide-interpretation { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, .55fr); gap: 28px; margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--line); }
.slide-interpretation h3 { margin: 0 0 5px; font-size: 13px; }
.slide-interpretation p { margin: 0; color: var(--muted); font-size: 14px; }
.slide-range { padding-left: 22px; border-left: 1px solid var(--line); }
.slide-range strong { display: block; margin-bottom: 5px; font-size: 13px; }
.slide-note { margin: 20px 0 0; padding: 14px 16px; border-left: 2px solid var(--amber); border-radius: 0 12px 12px 0; background: rgba(239,196,111,.07); color: #d8c59e; font-size: 13px; }

.slide-dots { display: flex; justify-content: center; flex-wrap: wrap; gap: 7px; padding-top: 20px; border-top: 1px solid var(--line); }
.slide-dots button { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 50%; background: rgba(255,255,255,.18); }
.slide-dots button.active { width: 25px; border-radius: 999px; background: var(--blue); }

.results-card { margin-top: 22px; }
.results-card > header > span { color: var(--faint); font: 12px var(--mono); }
.all-outputs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 28px; }
.output-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 20px; padding: 15px 0; border-top: 1px solid var(--line); }
.output-label { min-width: 0; }
.output-label strong, .output-label span { display: block; }
.output-label strong { font-size: 13px; font-weight: 590; }
.output-label span { margin-top: 3px; color: var(--faint); font: 12px var(--mono); }
.output-value { align-self: center; color: var(--blue-strong); font: 13px var(--mono); text-align: right; white-space: nowrap; }

.section-checks { display: grid; gap: 10px; }
.check-row { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 15px; align-items: start; padding: 17px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.03); }
.check-chip { min-width: 62px; padding: 4px 8px; border: 1px solid currentColor; border-radius: 999px; font: 12px var(--mono); text-align: center; }
.check-copy strong, .check-copy span { display: block; }
.check-copy strong { font-size: 14px; }
.check-copy span { margin-top: 4px; color: var(--muted); font-size: 13px; }
.check-value { color: var(--blue-strong); font: 12px var(--mono); white-space: nowrap; }

.table-wrap { width: 100%; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 10px; border-top: 1px solid var(--line); font-size: 13px; text-align: right; }
th { color: var(--faint); font-weight: 550; }
th:first-child, td:first-child { padding-left: 0; text-align: left; }
th:last-child, td:last-child { padding-right: 0; color: var(--blue-strong); }

.config-header { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-bottom: 38px; }
.config-header h1 { margin-bottom: 12px; }
.config-header p:last-child { max-width: 680px; margin: 0; color: var(--muted); }
.config-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.config-card { padding: 27px; border: 1px solid var(--line); border-radius: 25px; background: linear-gradient(150deg, rgba(31,37,51,.76), rgba(14,18,27,.7)); box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 22px 55px rgba(0,0,0,.14); }
.config-wide { grid-column: 1/-1; }
.config-card-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 23px; }
.config-card-head > span { color: var(--blue); font: 12px var(--mono); }
.config-card h2 { margin: -5px 0 3px; font-size: 19px; font-weight: 620; letter-spacing: -.025em; }
.config-card-head p { margin: 0; color: var(--faint); font-size: 13px; }
.field { display: grid; gap: 8px; margin-top: 14px; color: var(--muted); font-size: 13px; font-weight: 600; }
.field:first-of-type { margin-top: 0; }
.field > span { display: flex; justify-content: space-between; gap: 10px; }
.field small { color: var(--faint); font-size: 12px; font-weight: 500; }
input, select { width: 100%; min-width: 0; min-height: 46px; padding: 10px 13px; border: 1px solid var(--line-bright); border-radius: 14px; outline: 0; background: rgba(7,9,14,.46); color: var(--text); font-size: 14px; }
input:hover, select:hover { border-color: rgba(121,168,255,.45); }
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(121,168,255,.12); }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 13px; }
.scenario-expect { display: grid; grid-template-columns: minmax(150px,.4fr) minmax(0,1fr); gap: 24px; margin-top: 18px; padding: 17px; border-radius: 17px; background: rgba(121,168,255,.065); }
.scenario-expect strong { font-size: 13px; }
.scenario-expect p, .field-note { margin: 0; color: var(--muted); font-size: 13px; }
.switch-field { display: flex; gap: 12px; align-items: flex-start; margin-top: 21px; }
.switch-field input { width: 18px; min-height: 18px; margin: 2px 0 0; accent-color: var(--blue); }
.switch-field strong, .switch-field small { display: block; }
.switch-field strong { font-size: 13px; }
.switch-field small { margin-top: 3px; color: var(--faint); font-size: 12px; }
.scope-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
.scope-grid label { display: flex; align-items: center; gap: 10px; min-height: 45px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.025); color: var(--muted); font-size: 13px; }
.scope-grid input { width: 16px; min-height: 16px; margin: 0; accent-color: var(--blue); }

.toast { position: fixed; z-index: 50; top: 90px; right: 24px; max-width: min(440px, calc(100% - 48px)); padding: 14px 17px; border: 1px solid rgba(255,139,150,.35); border-radius: 16px; background: rgba(62,20,28,.92); box-shadow: 0 18px 50px rgba(0,0,0,.35); color: #ffd2d7; font-size: 13px; backdrop-filter: blur(18px); }
.site-footer { display: flex; justify-content: space-between; gap: 25px; width: min(1280px, calc(100% - 44px)); margin: 0 auto; padding: 24px 0 36px; border-top: 1px solid var(--line); color: var(--faint); font-size: 12px; }

@media (max-width: 980px) {
  .app-bar { grid-template-columns: 1fr auto; }
  .mode-switch { order: 3; grid-column: 1 / -1; justify-self: center; margin-top: 10px; }
  .bar-actions .engine-pill { display: none; }
  .hero-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-hero { grid-template-columns: 1fr; min-height: 0; }
  .detail-hero-metrics { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .hero-result:first-child { grid-column: auto; }
  .substitution-grid { grid-template-columns: 1fr; }
  .slide-interpretation { grid-template-columns: 1fr; }
  .slide-range { padding: 18px 0 0; border-top: 1px solid var(--line); border-left: 0; }
  .config-layout { grid-template-columns: 1fr; }
  .config-wide { grid-column: auto; }
}
@media (max-width: 720px) {
  .app-bar { min-height: 70px; padding-inline: 18px; }
  .brand small { display: none; }
  .soft-button { padding-inline: 12px; }
  .mode-switch { width: 100%; }
  .mode-switch button { flex: 1; }
  .site-main { width: min(100% - 32px, 1280px); padding-top: 38px; }
  .design-header, .section-intro { align-items: flex-start; flex-direction: column; }
  .design-status { min-width: 0; text-align: left; }
  .dashboard-context { grid-template-columns: 1fr auto; }
  .dashboard-context > p { grid-column: 1/-1; grid-row: 2; }
  .hero-metrics { grid-template-columns: 1fr; }
  .hero-metrics article { min-height: 135px; }
  .section-intro { margin-top: 54px; }
  .section-grid { grid-template-columns: 1fr; }
  .section-card { min-height: 360px; padding: 24px; border-radius: 25px; }
  .section-card footer { right: 24px; left: 24px; }
  .review-summary, .candidate-grid, .all-outputs { grid-template-columns: 1fr; }
  .detail-hero { padding: 30px 24px; border-radius: 28px; }
  .detail-hero-metrics { grid-template-columns: 1fr; }
  .formula-slide { min-height: 0; padding-top: 42px; }
  .formula-display { padding: 20px; font-size: 14px; }
  .deck-shell, .results-card, .review-card { border-radius: 25px; }
  .config-header { align-items: flex-start; flex-direction: column; }
  .config-card { padding: 23px; }
  .scenario-expect { grid-template-columns: 1fr; gap: 7px; }
  .site-footer { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 520px) {
  .brand strong { display: none; }
  .bar-actions { gap: 6px; }
  .soft-button, .run-button { padding-inline: 11px; }
  .run-button > span:last-child { display: none; }
  .field-grid, .scope-grid { grid-template-columns: 1fr; }
  .section-card dl { grid-template-columns: 1fr; gap: 6px; }
  .section-card dl div { display: flex; justify-content: space-between; gap: 18px; }
  .section-card { min-height: 430px; }
  .check-row { grid-template-columns: 1fr; }
  .check-value { text-align: left; }
  table, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  tr { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); padding: 10px 0; border-top: 1px solid var(--line); }
  td, td:first-child, td:last-child { padding: 8px 6px; border: 0; text-align: left; }
  td::before { content: attr(data-label); display: block; margin-bottom: 3px; color: var(--faint); font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition-duration: 0.01ms !important; } }

/* Mode-aware controls */
.help-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255,255,255,.04);
  color: var(--muted);
  font: 650 13px var(--mono);
}
.help-button:hover { border-color: rgba(121,168,255,.45); color: var(--text); }
[data-config-modes][hidden] { display: none !important; }
.focus-config {
  border-color: rgba(121,168,255,.24);
  background:
    radial-gradient(circle at 88% -20%, rgba(121,168,255,.13), transparent 25rem),
    linear-gradient(150deg, rgba(31,37,51,.84), rgba(14,18,27,.74));
}
.scope-cards { grid-template-columns: repeat(3, minmax(0,1fr)); }
.scope-cards label {
  align-items: flex-start;
  min-height: 78px;
  padding: 15px;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}
.scope-cards label:hover { transform: translateY(-1px); border-color: var(--line-bright); }
.scope-cards label:has(input:checked) { border-color: rgba(121,168,255,.48); background: rgba(80,124,210,.12); }
.scope-cards input { flex: 0 0 auto; margin-top: 3px; }
.scope-cards span, .scope-cards strong, .scope-cards small { display: block; }
.scope-cards strong { color: var(--text); font-size: 13px; }
.scope-cards small { margin-top: 4px; color: var(--faint); font-size: 11px; }
.selection-summary {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(121,168,255,.07);
  color: var(--muted);
  font-size: 12px;
}
.range-groups { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.range-groups fieldset { min-width: 0; margin: 0; padding: 16px; border: 1px solid var(--line); border-radius: 18px; }
.range-groups legend { padding: 0 7px; color: var(--text); font-size: 13px; font-weight: 620; }
.range-groups legend small { margin-left: 4px; color: var(--faint); font-weight: 500; }
.range-pair { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.range-pair .field { margin: 0; }
.objective-note { display: grid; grid-template-columns: minmax(130px,.25fr) minmax(0,1fr); gap: 20px; margin-top: 14px; padding: 14px 16px; border-radius: 15px; background: rgba(255,255,255,.035); }
.objective-note span { color: var(--blue-strong); font-size: 12px; font-weight: 650; }
.objective-note p { margin: 0; color: var(--muted); font-size: 12px; }

/* Optimization recommendation */
.optimization-card {
  margin-top: 30px;
  padding: clamp(25px, 4vw, 38px);
  border: 1px solid rgba(121,168,255,.22);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 90% -20%, rgba(121,168,255,.18), transparent 30rem),
    linear-gradient(150deg, rgba(31,37,51,.82), rgba(14,18,27,.72));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 26px 65px rgba(0,0,0,.18);
}
.optimization-card > header { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.optimization-card h2 { margin: 0; font-size: clamp(1.5rem,3vw,2rem); letter-spacing: -.035em; }
.optimization-card > header > strong { color: var(--blue-strong); font: 12px var(--mono); }
.optimization-lead {
  display: grid;
  grid-template-columns: minmax(260px,1fr) minmax(430px,1.25fr) auto;
  align-items: center;
  gap: 24px;
  margin: 24px 0 14px;
  padding: 22px;
  border: 1px solid rgba(121,168,255,.24);
  border-radius: 21px;
  background: rgba(76,113,185,.09);
}
.recommendation-copy > span { color: var(--blue); font: 11px var(--mono); }
.recommendation-copy h3 { margin: 7px 0 5px; font-size: 17px; letter-spacing: -.02em; }
.recommendation-copy p { margin: 0; color: var(--muted); font-size: 12px; }
.recommendation-values { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; margin: 0; }
.recommendation-values div { padding-left: 12px; border-left: 1px solid var(--line); }
.recommendation-values dt { color: var(--faint); font-size: 11px; }
.recommendation-values dd { margin: 5px 0 0; font-size: 14px; font-weight: 650; }
.recommendation-values small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 500; }
.apply-recommendation {
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid rgba(121,168,255,.45);
  border-radius: 999px;
  background: rgba(121,168,255,.14);
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}
.candidate-grid { margin-top: 10px; }
.candidate-item.recommended { border-color: rgba(121,168,255,.32); background: rgba(121,168,255,.07); }

/* Compact in-page calculation deck */
.detail-hero { min-height: 310px; padding: clamp(28px,4vw,46px); }
.deck-controls .present-button { display: flex; width: auto; padding: 0 16px; gap: 8px; border-radius: 999px; font-size: 12px; font-weight: 650; }
.formula-slide { min-height: 430px; padding: clamp(28px,4vw,44px) clamp(0px,2vw,26px) 26px; }
.formula-slide h2 { margin: 18px 0 22px; font-size: clamp(1.8rem,3.8vw,3.15rem); }
.formula-display { padding: 19px 22px; font-size: clamp(.9rem,1.6vw,1.12rem); }
.substitution, .slide-result { padding: 17px 19px; }
.substitution pre { font-size: 12px; line-height: 1.6; }
.slide-interpretation { margin-top: 20px; padding-top: 18px; }
.slide-note { margin-top: 14px; padding-block: 10px; }

/* Full-window calculation presentation */
body.presenting, body.tutorial-open { overflow: hidden; }
.presentation-mode {
  position: fixed;
  z-index: 120;
  inset: 0;
  display: grid;
  grid-template-rows: 68px minmax(0,1fr) 70px;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(circle at 86% -15%, rgba(76,113,205,.17), transparent 35rem),
    #080b12;
}
.presentation-header, .presentation-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 clamp(22px,3vw,48px);
  border-color: var(--line);
  background: rgba(8,11,18,.78);
  backdrop-filter: blur(20px);
}
.presentation-header { border-bottom: 1px solid var(--line); }
.presentation-footer { border-top: 1px solid var(--line); }
.presentation-header > div:first-child { display: grid; min-width: 0; grid-template-columns: auto minmax(0,1fr); align-items: baseline; gap: 15px; }
.presentation-header .kicker { margin: 0; white-space: nowrap; }
.presentation-header strong { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.presentation-status { display: flex; align-items: center; gap: 18px; color: var(--muted); font: 12px var(--mono); }
.presentation-status button {
  display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: rgba(255,255,255,.05); color: var(--text); font-size: 21px;
}
.present-slide {
  display: grid;
  grid-template-rows: auto auto auto auto auto;
  align-content: center;
  gap: clamp(9px,1.5vh,16px);
  width: min(1420px,100%);
  height: 100%;
  min-height: 0;
  margin: 0 auto;
  padding: clamp(18px,2.8vw,42px) clamp(24px,5vw,76px);
  overflow: hidden;
}
.present-topline { display: flex; align-items: center; justify-content: space-between; }
.present-topline > span:last-child { color: var(--faint); font: 11px var(--mono); }
.present-slide h2 { margin: 0; font-size: clamp(2rem,4.5vw,4.6rem); font-weight: 610; letter-spacing: -.055em; line-height: .98; }
.present-formula {
  padding: clamp(14px,2vh,22px) clamp(18px,2.2vw,30px);
  border: 1px solid rgba(121,168,255,.22);
  border-radius: 19px;
  background: rgba(58,89,150,.1);
  color: #dce8ff;
  font: clamp(.88rem,1.5vw,1.2rem)/1.45 var(--mono);
  white-space: pre-wrap;
}
.present-work { display: grid; grid-template-columns: minmax(0,1.5fr) minmax(240px,.5fr); gap: 12px; }
.present-substitution, .present-result { min-width: 0; padding: clamp(14px,1.8vw,22px); border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.035); }
.present-substitution > span, .present-result > span { display: block; margin-bottom: 8px; color: var(--faint); font-size: 10px; }
.present-substitution pre { margin: 0; color: var(--muted); font: clamp(.7rem,1.05vw,.88rem)/1.5 var(--mono); white-space: pre-wrap; word-break: break-word; }
.present-result strong { display: block; font-size: clamp(2rem,4vw,4rem); font-weight: 620; letter-spacing: -.05em; line-height: 1; }
.present-result small { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }
.present-explanation { display: grid; grid-template-columns: minmax(0,1fr) minmax(240px,.55fr); gap: 24px; padding-top: 13px; border-top: 1px solid var(--line); }
.present-explanation strong { font-size: 12px; }
.present-explanation p { margin: 4px 0 0; color: var(--muted); font-size: clamp(.7rem,1vw,.86rem); line-height: 1.45; }
.present-basis { padding-left: 20px; border-left: 1px solid var(--line); }
.present-note { margin: 0; padding: 9px 13px; border-left: 2px solid var(--amber); border-radius: 0 10px 10px 0; background: rgba(239,196,111,.06); color: #d8c59e; font-size: 11px; }
.presentation-footer button {
  display: flex; align-items: center; gap: 9px; min-width: 130px; min-height: 40px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.05); color: var(--text); font-size: 12px; font-weight: 650;
}
.presentation-footer button:last-child { justify-content: flex-end; margin-left: auto; border-color: rgba(121,168,255,.35); background: rgba(121,168,255,.1); }
.presentation-footer button:disabled { opacity: .28; cursor: default; }
.present-progress { display: flex; gap: 7px; margin-left: auto; }
.present-progress i { width: 25px; height: 3px; border-radius: 999px; background: rgba(255,255,255,.14); }
.present-progress i.done { background: rgba(121,168,255,.42); }
.present-progress i.active { background: var(--blue); }

/* First-launch tutorial */
.tutorial-overlay { position: fixed; z-index: 140; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(3,5,9,.78); backdrop-filter: blur(24px); }
.tutorial-dialog {
  display: grid;
  grid-template-rows: auto minmax(0,1fr) auto;
  width: min(760px,100%);
  min-height: min(590px,calc(100dvh - 48px));
  padding: 24px;
  border: 1px solid var(--line-bright);
  border-radius: 30px;
  background: radial-gradient(circle at 90% 0%,rgba(121,168,255,.15),transparent 24rem),rgba(17,22,32,.97);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12),0 40px 120px rgba(0,0,0,.55);
}
.tutorial-dialog > header, .tutorial-dialog > footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.tutorial-brand { display: flex; align-items: center; gap: 12px; color: var(--faint); font: 11px var(--mono); }
#skipTutorial { border: 0; background: transparent; color: var(--muted); font-size: 12px; }
.tutorial-content { align-self: center; padding: clamp(28px,6vw,54px) clamp(4px,4vw,30px); }
.tutorial-eyebrow { margin: 0 0 12px; color: var(--blue); font: 11px var(--mono); }
.tutorial-content h2 { max-width: 590px; margin: 0; font-size: clamp(2.25rem,5.5vw,4.35rem); letter-spacing: -.055em; line-height: 1; }
.tutorial-body { max-width: 610px; margin: 20px 0 32px; color: var(--muted); font-size: 15px; }
.tutorial-dialog > footer { padding-top: 18px; border-top: 1px solid var(--line); }
.tutorial-dots { display: flex; gap: 6px; }
.tutorial-dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.18); }
.tutorial-dots i.active { width: 22px; border-radius: 999px; background: var(--blue); }
.tutorial-mode-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.tutorial-mode-row > span { padding: 14px; border: 1px solid var(--line); border-radius: 15px; color: var(--muted); font-size: 12px; font-weight: 650; }
.tutorial-mode-row > span.active { border-color: rgba(121,168,255,.42); background: rgba(121,168,255,.1); color: var(--text); }
.tutorial-mode-row small { display: block; margin-top: 3px; color: var(--faint); font-size: 10px; font-weight: 500; }
.tutorial-schematic, .tutorial-run, .tutorial-sequence { display: flex; align-items: center; gap: 11px; min-height: 58px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.035); color: var(--muted); font-size: 12px; }
.tutorial-schematic i { width: 12px; height: 12px; border: 2px solid var(--blue); border-radius: 4px; }
.tutorial-schematic b, .tutorial-sequence b { color: var(--faint); font-weight: 400; }
.tutorial-engine-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 12px rgba(121,168,255,.7); }
.tutorial-run strong { color: var(--text); }
.tutorial-run em { margin-left: auto; color: var(--blue-strong); font-style: normal; font-family: var(--mono); }
.tutorial-sequence { flex-wrap: wrap; }
.tutorial-sequence span { padding: 6px 9px; border-radius: 999px; background: rgba(121,168,255,.09); color: var(--text); }

@media (max-width: 1100px) {
  .optimization-lead { grid-template-columns: 1fr; }
  .recommendation-values { grid-row: 2; }
  .apply-recommendation { justify-self: start; }
}
@media (max-width: 980px) {
  .scope-cards, .range-groups { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .range-groups fieldset:last-child { grid-column: 1/-1; }
}
@media (max-width: 720px) {
  .bar-actions .help-button { display: none; }
  .scope-cards, .range-groups { grid-template-columns: 1fr; }
  .range-groups fieldset:last-child { grid-column: auto; }
  .objective-note { grid-template-columns: 1fr; gap: 5px; }
  .recommendation-values { grid-template-columns: 1fr; }
  .presentation-mode { grid-template-rows: 58px minmax(0,1fr) 60px; }
  .presentation-header > div:first-child { display: block; }
  .presentation-header .kicker { display: none; }
  .present-slide { gap: 8px; padding: 13px 16px; }
  .present-slide h2 { font-size: clamp(1.6rem,8vw,2.45rem); }
  .present-formula { padding: 11px 13px; font-size: 11px; }
  .present-work { grid-template-columns: minmax(0,1.4fr) minmax(110px,.6fr); gap: 7px; }
  .present-substitution, .present-result { padding: 11px 12px; border-radius: 13px; }
  .present-result strong { font-size: 1.75rem; }
  .present-explanation { grid-template-columns: 1fr; gap: 6px; padding-top: 8px; }
  .present-basis { padding: 6px 0 0; border-top: 1px solid var(--line); border-left: 0; }
  .present-note { font-size: 9px; line-height: 1.25; }
  .present-progress { display: none; }
  .presentation-footer button { min-width: 0; }
  .tutorial-dialog { min-height: min(540px,calc(100dvh - 24px)); padding: 18px; border-radius: 24px; }
  .tutorial-content { padding: 24px 2px; }
  .tutorial-body { margin-bottom: 22px; font-size: 13px; }
  .tutorial-mode-row { grid-template-columns: 1fr; }
  .tutorial-run { flex-wrap: wrap; }
  .tutorial-run em { width: 100%; margin-left: 20px; }
}
