:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #171717;
  background: #f6f6f3;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input { font: inherit; }
.page-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 64px 0 80px; }
.hero { max-width: 820px; margin-bottom: 28px; }
.eyebrow, .step { margin: 0 0 10px; font-size: 12px; font-weight: 750; letter-spacing: .12em; color: #676767; }
h1 { margin: 0; max-width: 760px; font-size: clamp(42px, 7vw, 78px); line-height: .98; letter-spacing: -.055em; }
.lede { margin: 22px 0 16px; max-width: 760px; font-size: clamp(18px, 2.2vw, 24px); line-height: 1.45; color: #4c4c4c; }
.runtime-note { display: inline-flex; border: 1px solid #d6d6d0; border-radius: 999px; padding: 8px 12px; font-size: 13px; background: #fff; }
.card { border: 1px solid #deded8; border-radius: 22px; background: rgba(255,255,255,.88); box-shadow: 0 8px 32px rgba(0,0,0,.035); }
.controls { padding: 18px; margin: 26px 0 18px; display: grid; gap: 18px; }
.control-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
#file-upload { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.upload-button, button { border: 0; border-radius: 12px; padding: 12px 17px; font-weight: 720; cursor: pointer; }
.upload-button { background: #ecece6; }
button { background: #171717; color: white; }
button:disabled { opacity: .35; cursor: not-allowed; }
.threshold-control { display: grid; grid-template-columns: minmax(190px, 240px) 1fr; gap: 18px; align-items: center; font-size: 14px; }
#threshold { width: 100%; accent-color: #171717; }
.status { margin: 0; min-height: 20px; color: #5f5f5f; font-size: 14px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, .75fr); gap: 18px; align-items: start; }
.image-card, .results-card, .explain { padding: 20px; }
.card-heading { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
h2 { margin: 0 0 16px; font-size: 22px; letter-spacing: -.025em; }
.badge { white-space: nowrap; padding: 7px 10px; border-radius: 999px; background: #f0f0ea; font-size: 12px; font-weight: 700; }
.image-stage { position: relative; overflow: visible; display: grid; place-items: center; min-height: 380px; border-radius: 16px; background: #efefe9; }
.image-stage.empty { border: 1px dashed #c9c9c1; }
.image-stage > img { display: block; width: 100%; height: auto; max-height: 650px; object-fit: contain; border-radius: 16px; }
#empty-hint { color: #777; }
.bounding-box { position: absolute; box-sizing: border-box; border: 2px solid #ff5a1f; pointer-events: none; }
.bounding-box-label { position: absolute; top: -25px; left: -2px; max-width: 180px; padding: 4px 7px; border-radius: 6px 6px 6px 0; background: #171717; color: white; font-size: 12px; font-weight: 750; white-space: nowrap; }
.summary { margin: 0 0 18px; line-height: 1.55; }
.muted { color: #838383; }
.table-wrap { max-height: 500px; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 6px; text-align: left; border-bottom: 1px solid #ecece7; }
th { color: #676767; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.explain { margin-top: 18px; }
.flow { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0 14px; }
.flow span { padding: 9px 12px; border-radius: 10px; background: #efefe9; font-weight: 700; }
.explain p:last-child { color: #5c5c5c; line-height: 1.6; }
code { background: #efefe9; border-radius: 6px; padding: 2px 5px; }
@media (max-width: 820px) {
  .page-shell { padding-top: 36px; }
  .workspace { grid-template-columns: 1fr; }
  .threshold-control { grid-template-columns: 1fr; gap: 8px; }
  .image-stage { min-height: 260px; }
}
