: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, select { font: inherit; }
[hidden] { display: none !important; }

.tool { width: min(100%, 1040px); 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: #4b47a8; font-size: .76rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h2, h3, 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, .result { display: grid; gap: 18px; }
.form-section, .result { padding: clamp(18px, 3vw, 28px); border: 1px solid #dddde5; border-radius: 18px; background: #fff; }
.section-heading, .result__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.section-heading > div, .result__header > div { display: flex; align-items: center; gap: 10px; }
.section-heading h3, .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: #403aa1; font-weight: 850; }
.hint { max-width: 480px; margin: 0; color: #676a79; line-height: 1.5; }

label > span, legend { display: block; margin-bottom: 7px; font-weight: 750; }
input[type="file"], input[type="number"], select { width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid #babdca; border-radius: 10px; color: inherit; background: #fff; }
.file-picker { display: block; padding: 18px; border: 1px dashed #9c99c9; border-radius: 14px; background: #f8f7ff; }
.file-picker input { padding: 8px; background: #fff; }
.source-summary, .metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 16px 0 0; }
.source-summary > div, .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; }

fieldset { margin: 0; padding: 0; border: 0; }
.segmented { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.segmented legend { width: 100%; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { margin: 0; padding: 9px 14px; border: 1px solid #c8c7d2; border-radius: 999px; cursor: pointer; }
.segmented input:checked + span { border-color: #403aa1; color: #302b80; background: #efeffb; }
.settings-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 14px; margin-bottom: 18px; }
.checkbox { display: flex; align-items: center; min-height: 44px; gap: 9px; }
.checkbox span { margin: 0; }
.checkbox input { width: 20px; height: 20px; accent-color: #403aa1; }
input[type="range"] { width: 100%; accent-color: #403aa1; }
input[type="color"] { display: block; width: 100%; min-height: 44px; padding: 4px; border: 1px solid #babdca; border-radius: 10px; background: #fff; }
.calculated { align-self: end; margin: 0; min-height: 44px; padding: 11px 12px; border-radius: 10px; color: #343052; background: #f0effa; font-weight: 750; }
.boundary, .result-note { color: #676a79; line-height: 1.55; }

button, .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; text-decoration: none; }
button:hover, .button:hover { background: #302b80; }
button:focus-visible, .button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgb(77 70 180 / 28%); outline-offset: 2px; }
.error, .warning { margin: 16px 0 0; padding: 12px 14px; border-left: 3px solid #b42318; color: #7a271a; background: #fff3f2; }
.warning { border-left-color: #b54708; color: #7a2e0e; background: #fff8eb; }

.result { margin-top: 18px; }
.result__header { align-items: center; }
.preview-shell { display: grid; place-items: center; min-height: 220px; max-height: 560px; padding: 14px; overflow: hidden; border-radius: 14px; background-color: #f2f2f5; background-image: linear-gradient(45deg,#ddd 25%,transparent 25%),linear-gradient(-45deg,#ddd 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#ddd 75%),linear-gradient(-45deg,transparent 75%,#ddd 75%); background-size: 24px 24px; background-position: 0 0,0 12px,12px -12px,-12px 0; }
.preview-shell img { display: block; max-width: 100%; max-height: 530px; object-fit: contain; box-shadow: 0 8px 30px rgb(22 25 42 / 18%); }
.metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 18px; }
.metrics dd { font-size: 1.05rem; }
.test-evidence { display: none; }
.result-note { margin: 16px 0 0; }

@media (max-width: 700px) {
  .tool__header, .section-heading, .result__header { display: grid; }
  .privacy { justify-self: start; }
  .hint { max-width: none; }
  .settings-grid, .source-summary, .metrics { grid-template-columns: 1fr; }
  .result__header .button { width: 100%; }
  .preview-shell { min-height: 180px; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }
