:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #5d6678;
  --line: #d9dfeb;
  --paper: #ffffff;
  --wash: #f4f6fa;
  --navy: #17315e;
  --blue: #2e64c7;
  --blue-soft: #eaf1ff;
  --green: #1e6d4d;
  --green-soft: #e9f7f0;
  --amber: #8a5810;
  --amber-soft: #fff4da;
  --red: #a33b46;
  --shadow: 0 18px 50px rgba(32, 52, 86, 0.1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: linear-gradient(180deg, #f9fbff 0, #f4f6fa 36rem, #ffffff 100%);
  color: var(--ink);
  line-height: 1.55;
}

a { color: var(--blue); }
a:hover { color: var(--navy); }
button, input { font: inherit; }

.site-header,
main,
footer {
  width: min(1160px, calc(100% - 40px));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
}

.brand {
  color: var(--ink);
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.prototype-badge {
  border: 1px solid #b7c3d7;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 10px;
  text-transform: uppercase;
}

.hero {
  max-width: 810px;
  padding: 70px 0 38px;
}

.eyebrow,
.step {
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  margin: 0 0 8px;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }

h1 {
  font-size: clamp(2.4rem, 6vw, 5.1rem);
  letter-spacing: -0.055em;
  line-height: 0.98;
  margin-bottom: 22px;
}

h2 {
  font-size: clamp(1.25rem, 2vw, 1.65rem);
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin-bottom: 12px;
}

.lede {
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  max-width: 720px;
}

.boundary {
  align-items: flex-start;
  background: var(--amber-soft);
  border: 1px solid #edcc82;
  border-radius: 14px;
  color: #5f4212;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 24px 0 0;
  padding: 14px 16px;
}

.boundary strong { letter-spacing: 0.035em; }

.workspace {
  align-items: start;
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1.6fr) minmax(300px, 0.9fr);
}

.panel,
.result,
.rule-card,
.limits-grid article,
.prose {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.panel { padding: clamp(20px, 4vw, 36px); }

.section-heading {
  align-items: start;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.button {
  border: 0;
  border-radius: 11px;
  cursor: pointer;
  font-weight: 750;
  min-height: 44px;
  padding: 10px 15px;
}

.button:focus-visible,
.guide-tabs button:focus-visible,
input:focus-visible,
.photo-stage:focus-visible,
a:focus-visible {
  outline: 3px solid #7ba4ee;
  outline-offset: 3px;
}

.button--quiet {
  background: var(--wash);
  color: var(--ink);
}

.button--primary {
  background: var(--navy);
  color: #fff;
  margin-top: 18px;
  width: 100%;
}

.button:hover { filter: brightness(0.96); }

.file-picker {
  align-items: center;
  background: var(--blue-soft);
  border: 1px dashed #80a0d9;
  border-radius: 14px;
  color: var(--navy);
  cursor: pointer;
  display: flex;
  font-weight: 800;
  justify-content: center;
  margin-top: 12px;
  min-height: 64px;
  padding: 14px;
}

.file-picker input {
  height: 1px;
  opacity: 0;
  overflow: hidden;
  position: absolute;
  width: 1px;
}

.privacy-note,
.image-facts,
.guide-controls p,
.rule-card p {
  color: var(--muted);
}

.privacy-note { font-size: 0.9rem; margin: 12px 0 2px; }
.image-facts { font-size: 0.85rem; margin-bottom: 20px; }

.stage-shell {
  background: #e8ecf3;
  border-radius: 18px;
  display: grid;
  overflow: hidden;
  place-items: center;
}

.photo-stage {
  max-height: 640px;
  max-width: 100%;
  min-height: 320px;
  overflow: hidden;
  position: relative;
  touch-action: none;
  user-select: none;
  width: 100%;
}

.photo-stage[data-ready="true"] {
  cursor: crosshair;
  min-height: 0;
  width: fit-content;
}

.photo-stage img {
  display: block;
  max-height: 640px;
  max-width: 100%;
  object-fit: contain;
  pointer-events: none;
  width: auto;
}

.stage-placeholder {
  align-items: center;
  color: #667087;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 320px;
  justify-content: center;
}

.synthetic-mark {
  background: linear-gradient(180deg, #bfc9da 0 34%, #d6ddea 34% 100%);
  border: 4px solid #fff;
  border-radius: 50%;
  box-shadow: 0 8px 30px rgba(50, 66, 92, 0.15);
  height: 108px;
  position: relative;
  width: 108px;
}

.synthetic-mark::after {
  background: #f4f6fa;
  border-radius: 50% 50% 43% 43%;
  content: "";
  height: 58px;
  left: 24px;
  position: absolute;
  top: 22px;
  width: 52px;
}

.guide {
  color: #fff;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.45));
  pointer-events: none;
  position: absolute;
  z-index: 3;
}

.guide[hidden] { display: none; }

.guide--horizontal {
  border-top: 3px solid currentColor;
  left: 0;
  right: 0;
}

.guide--top { color: #ffdf62; }
.guide--chin { color: #6ee7ca; }

.guide--vertical {
  border-left: 3px solid #ffa8b1;
  bottom: 0;
  top: 0;
}

.guide span {
  background: currentColor;
  border-radius: 4px;
  color: #172033;
  font-size: 0.7rem;
  font-weight: 800;
  left: 8px;
  padding: 2px 5px;
  position: absolute;
  top: 4px;
  white-space: nowrap;
}

.guide--vertical span {
  left: 4px;
  top: 8px;
  transform: rotate(90deg);
  transform-origin: left top;
}

.guide-controls {
  border-top: 1px solid var(--line);
  margin-top: 28px;
  padding-top: 28px;
}

.guide-tabs {
  display: grid;
  gap: 7px;
  grid-template-columns: repeat(3, 1fr);
  margin: 20px 0;
}

.guide-tabs button {
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  cursor: pointer;
  min-height: 45px;
  padding: 8px;
}

.guide-tabs button[aria-pressed="true"] {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.number-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, 1fr);
}

.number-grid label > span:first-child {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.number-wrap {
  align-items: center;
  border: 1px solid #bdc8da;
  border-radius: 10px;
  display: flex;
  overflow: hidden;
}

.number-wrap:focus-within {
  border-color: var(--blue);
}

.number-wrap input {
  border: 0;
  min-width: 0;
  outline: 0;
  padding: 11px;
  width: 100%;
}

.number-wrap span {
  color: var(--muted);
  padding-right: 10px;
}

.result {
  padding: clamp(22px, 4vw, 34px);
  position: sticky;
  top: 20px;
}

.result--within { border-color: #8cc8ad; }
.result--outside { border-color: #e3acb2; }
.result--unknown { border-color: #e0bd73; }

.verdict {
  background: var(--amber-soft);
  border-radius: 7px;
  color: var(--amber);
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  padding: 5px 8px;
}

.metrics {
  display: grid;
  gap: 0;
  margin: 25px 0;
}

.metrics div {
  border-top: 1px solid var(--line);
  padding: 15px 0;
}

.metrics div:last-child { border-bottom: 1px solid var(--line); }
.metrics dt { color: var(--muted); font-size: 0.8rem; }
.metrics dd { font-size: 1.08rem; font-weight: 780; margin: 2px 0 0; }
.result-explanation { font-weight: 650; }
.checklist { color: var(--muted); padding-left: 20px; }
.checklist li + li { margin-top: 9px; }

.rule-card {
  margin-top: 48px;
  padding: clamp(24px, 5vw, 48px);
}

.rule-values {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, 1fr);
  margin: 28px 0;
}

.rule-values div {
  background: var(--wash);
  border-radius: 12px;
  padding: 18px;
}

.rule-values strong { display: block; font-size: 1.35rem; }
.rule-values span { color: var(--muted); font-size: 0.85rem; }
.source-link { font-weight: 750; }

.limits-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr 1fr;
  margin-top: 20px;
}

.limits-grid article { padding: 28px; }
.limits-grid ul { margin-bottom: 0; padding-left: 20px; }
.limits-grid li + li { margin-top: 8px; }

.prose {
  margin-top: 60px;
  max-width: 820px;
  padding: clamp(25px, 6vw, 64px);
}

.prose h1 { font-size: clamp(2.2rem, 5vw, 4rem); }
.prose h2 { margin-top: 36px; }
.prose li + li { margin-top: 9px; }

footer {
  align-items: center;
  color: var(--muted);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-top: 60px;
  min-height: 120px;
}

footer p { margin: 0; }
footer nav { display: flex; gap: 18px; }

@media (max-width: 850px) {
  .workspace { grid-template-columns: 1fr; }
  .result { position: static; }
  .number-grid, .rule-values { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .site-header, main, footer { width: min(100% - 24px, 1160px); }
  .site-header { align-items: flex-start; flex-direction: column; justify-content: center; }
  .hero { padding-top: 44px; }
  .section-heading { align-items: stretch; flex-direction: column; }
  .guide-tabs { grid-template-columns: 1fr; }
  .limits-grid { grid-template-columns: 1fr; }
  footer { align-items: flex-start; flex-direction: column; justify-content: center; }
  footer nav { flex-wrap: wrap; }
}

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