:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #171926;
  background: #fbfaf7;
}

* { box-sizing: border-box; }
body { margin: 0; background: #fbfaf7; }
button, input { font: inherit; }
[hidden] { display: none !important; }

.tool { width: min(100%, 960px); margin: auto; padding: clamp(20px, 4vw, 40px); }
.tool__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.eyebrow { margin: 0 0 8px; color: #684b16; font-size: .76rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h2, h3, h4, p { margin-top: 0; }
h2 { margin-bottom: 10px; font-size: clamp(1.65rem, 4vw, 2.35rem); line-height: 1.08; letter-spacing: -.035em; }
.lead { max-width: 680px; margin-bottom: 0; color: #626578; line-height: 1.6; }
.privacy { flex: none; padding: 7px 10px; border-radius: 999px; color: #175d72; background: #e6f7fb; font-size: .78rem; font-weight: 750; }

.form-card, .result { padding: clamp(18px, 3vw, 28px); border: 1px solid #dddde5; border-radius: 18px; background: #fff; }
.form-card { display: grid; gap: 18px; }
fieldset { margin: 0; padding: 0; border: 0; }
.segmented { display: flex; flex-wrap: wrap; gap: 8px; }
.segmented legend, .input-field > span { width: 100%; margin-bottom: 7px; font-weight: 750; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { display: block; padding: 9px 14px; border: 1px solid #c8c7d2; border-radius: 999px; cursor: pointer; }
.segmented input:checked + span { border-color: #4b47a8; color: #302b80; background: #efeffb; }
.input-field { display: grid; gap: 7px; }
.input-field input { width: 100%; min-height: 52px; padding: 11px 14px; border: 1px solid #aeb1bf; border-radius: 10px; color: inherit; background: #fff; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.05rem; text-transform: uppercase; }
.input-field small, .boundary, .result-note { color: #676a79; line-height: 1.55; }
.boundary { margin: 0; }

button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 20px; border: 0; border-radius: 10px; color: #fff; background: #403aa1; cursor: pointer; font-weight: 800; }
button:hover { background: #302b80; }
button.secondary { border: 1px solid #c8c7d2; color: #302b80; background: #fff; }
button.secondary:hover { background: #f3f2fb; }
button:focus-visible, input:focus-visible { outline: 3px solid rgb(77 70 180 / 28%); outline-offset: 2px; }
.error { display: grid; gap: 8px; margin: 16px 0 0; padding: 14px 16px; border-left: 3px solid #b42318; color: #7a271a; background: #fff3f2; }
.error p { margin: 0; overflow-wrap: anywhere; }
.error button { justify-self: start; margin-top: 4px; }

.result { display: grid; gap: 18px; margin-top: 18px; }
.result__header { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.result__header > div { display: flex; align-items: center; gap: 10px; }
.result__header h3 { margin: 0; font-size: 1.22rem; }
.step { display: grid; place-items: center; width: 30px; height: 30px; margin: 0; border-radius: 50%; color: #fff; background: #6d531f; font-weight: 850; }
.primary-output { display: block; padding: 20px; overflow-wrap: anywhere; border: 1px solid #dfd5bd; border-radius: 14px; color: #2d250f; background: #fffaf0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: clamp(1.8rem, 8vw, 3.4rem); font-weight: 850; letter-spacing: .04em; text-align: center; }
.copy-status { min-height: 1.4em; margin: -10px 0 0; color: #236b42; font-size: .88rem; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0; }
.metrics > div { min-width: 0; padding: 13px; border: 1px solid #e5e5eb; border-radius: 12px; background: #fafafd; }
dt { color: #686b7b; font-size: .78rem; }
dd { margin: 5px 0 0; overflow-wrap: anywhere; font-weight: 800; }
.evidence { padding: 18px; border-radius: 14px; background: #f6f5fa; }
.evidence h4 { margin-bottom: 12px; }
.evidence ol { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.evidence li { padding: 10px 12px; border-radius: 9px; background: #fff; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.equation { margin: 14px 0 0; overflow-wrap: anywhere; }
.result-note { margin: 0; }

@media (max-width: 700px) {
  .tool__header, .result__header { display: grid; }
  .privacy, .error button { justify-self: start; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .result__header button { width: 100%; }
}

@media (max-width: 420px) { .metrics { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }
