:root {
  color-scheme: light;
  --ink: #151712;
  --muted: #62655f;
  --page: #f2f0e9;
  --surface: #fffefa;
  --surface-strong: #ffffff;
  --line: #d8d8d0;
  --accent: #2854ff;
  --accent-dark: #1736b9;
  --left: #2fc768;
  --right: #00aeca;
  --top: #dd48c6;
  --bottom: #f18a22;
  --shadow: 0 24px 80px rgba(35, 39, 30, 0.1);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  width: 100%;
  height: 100%;
  height: -webkit-fill-available;
  min-width: 320px;
  overflow: hidden;
  background: var(--page);
}

body {
  width: 100vw;
  height: 100vh;
  height: -webkit-fill-available;
  height: 100dvh;
  min-width: 320px;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 12%, rgba(255, 255, 255, 0.92), transparent 28rem),
    radial-gradient(circle at 88% 18%, rgba(40, 84, 255, 0.07), transparent 24rem),
    var(--page);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  opacity: 0.2;
  background-image: linear-gradient(rgba(21, 23, 18, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(21, 23, 18, 0.08) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 70%);
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

.app-shell {
  display: grid;
  width: 100vw;
  height: 100vh;
  height: -webkit-fill-available;
  height: 100dvh;
  grid-template-rows: auto minmax(0, 1fr) auto;
  margin: 0 auto;
  padding-right: max(clamp(20px, 4vw, 64px), env(safe-area-inset-right));
  padding-left: max(clamp(20px, 4vw, 64px), env(safe-area-inset-left));
  overflow: hidden;
}

main {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding-top: env(safe-area-inset-top);
  border-bottom: 1px solid rgba(21, 23, 18, 0.12);
}

.brand {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.brand-home {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.17em;
  text-decoration: none;
}

.brand-credit {
  color: #5d6259;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0;
}

.brand-credit a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(21, 23, 18, 0.3);
  text-underline-offset: 3px;
}

.brand-credit a:hover {
  color: var(--ink);
  text-decoration-color: currentColor;
}

.brand-mark {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, 7px);
  grid-template-rows: repeat(2, 7px);
  gap: 3px;
  width: 22px;
  height: 22px;
}

.brand-mark span {
  display: block;
  border: 2px solid var(--ink);
}

.brand-mark span:nth-child(1) {
  border-right: 0;
  border-bottom: 0;
}

.brand-mark span:nth-child(2) {
  border-left: 0;
  border-bottom: 0;
}

.brand-mark span:nth-child(3) {
  border-top: 0;
  border-right: 0;
}

.brand-mark span:nth-child(4) {
  border-top: 0;
  border-left: 0;
}

.privacy-chip {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  padding: 8px 12px;
  color: #3e423b;
  border: 1px solid rgba(21, 23, 18, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  font-size: 12px;
  font-weight: 700;
}

.icon-lock {
  position: relative;
  display: inline-block;
  width: 15px;
  height: 12px;
  border: 1.6px solid currentColor;
  border-radius: 2px;
}

.icon-lock::before {
  position: absolute;
  right: 3px;
  bottom: 9px;
  left: 3px;
  height: 6px;
  border: 1.6px solid currentColor;
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
  content: "";
}

.upload-view {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(420px, 0.72fr);
  height: 100%;
  min-height: 0;
  gap: clamp(36px, 7vw, 104px);
  align-items: center;
  padding: clamp(16px, 3dvh, 36px) 0;
  overflow: hidden;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.15em;
}

.hero-copy h1,
.editor-heading h1,
.processing-card h1 {
  margin: 0;
  font-size: clamp(42px, 5.2vw, 76px);
  font-weight: 760;
  letter-spacing: -0.055em;
  line-height: 1.06;
}

.hero-description {
  max-width: 640px;
  margin: 28px 0 30px;
  color: var(--muted);
  font-size: clamp(17px, 1.5vw, 21px);
  line-height: 1.72;
}

.feature-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.feature-list span {
  padding: 8px 12px;
  color: #474a44;
  border: 1px solid rgba(21, 23, 18, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  font-size: 12px;
  font-weight: 650;
}

.upload-panel {
  position: relative;
  max-height: 100%;
  padding: clamp(24px, 3vw, 38px);
  overflow: hidden;
  border: 1px solid rgba(21, 23, 18, 0.12);
  border-radius: 28px;
  background: rgba(255, 254, 250, 0.92);
  box-shadow: var(--shadow);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.upload-panel.is-drop-target {
  border-color: var(--accent);
  box-shadow: 0 28px 90px rgba(40, 84, 255, 0.18);
  transform: translateY(-2px);
}

.upload-illustration {
  display: grid;
  height: clamp(150px, 24dvh, 210px);
  min-height: 0;
  place-items: center;
  margin: calc(clamp(24px, 3vw, 38px) * -1) calc(clamp(24px, 3vw, 38px) * -1) 24px;
  background:
    linear-gradient(135deg, rgba(40, 84, 255, 0.1), transparent 55%),
    repeating-linear-gradient(45deg, rgba(21, 23, 18, 0.03) 0 8px, transparent 8px 16px),
    #e8e7e0;
}

.sample-card {
  position: relative;
  width: 132px;
  height: 180px;
  overflow: hidden;
  border: 7px solid #fdfcf7;
  border-radius: 8px;
  background: #111612;
  box-shadow: 0 18px 38px rgba(15, 20, 16, 0.24);
  transform: rotate(5deg);
}

.sample-card::before {
  position: absolute;
  inset: 15px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  content: "";
}

.sample-line {
  position: absolute;
  z-index: 2;
  background: transparent;
  box-shadow: 0 0 10px currentColor;
}

.sample-line-left,
.sample-line-right {
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 1px dashed currentColor;
}

.sample-line-top,
.sample-line-bottom {
  right: 0;
  left: 0;
  height: 0;
  border-top: 1px dashed currentColor;
}

.sample-line-left { left: 13px; color: var(--left); }
.sample-line-right { right: 13px; color: var(--right); }
.sample-line-top { top: 13px; color: var(--top); }
.sample-line-bottom { bottom: 13px; color: var(--bottom); }

.sample-ball {
  width: 58px;
  height: 58px;
  margin: 38px auto 18px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  background: repeating-linear-gradient(90deg, transparent 0 11px, rgba(255, 255, 255, 0.4) 11px 13px);
}

.sample-copy {
  width: 72%;
  height: 7px;
  margin: 0 auto 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
}

.sample-copy.short {
  width: 48%;
  opacity: 0.5;
}

.upload-kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.upload-panel h2 {
  margin: 0 0 9px;
  font-size: 26px;
  letter-spacing: -0.03em;
}

.upload-panel-copy > p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.upload-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 26px;
}

.button {
  display: inline-flex;
  min-height: 48px;
  gap: 9px;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 13px;
  font-size: 14px;
  font-weight: 760;
  cursor: pointer;
  transition: transform 130ms ease, box-shadow 130ms ease, background 130ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.button:focus-visible,
.text-button:focus-visible {
  outline: 3px solid rgba(40, 84, 255, 0.35);
  outline-offset: 3px;
}

.button-icon {
  display: inline-grid;
  width: 20px;
  height: 20px;
  place-items: center;
  font-size: 21px;
  font-weight: 500;
  line-height: 1;
}

.camera-icon {
  position: relative;
  width: 19px;
  height: 14px;
  border: 1.6px solid currentColor;
  border-radius: 3px;
}

.camera-icon::before {
  position: absolute;
  top: -4px;
  left: 4px;
  width: 8px;
  height: 4px;
  border: 1.6px solid currentColor;
  border-bottom: 0;
  border-radius: 2px 2px 0 0;
  content: "";
}

.camera-icon::after {
  position: absolute;
  top: 3px;
  left: 6px;
  width: 4px;
  height: 4px;
  border: 1.6px solid currentColor;
  border-radius: 50%;
  content: "";
}

.button-primary {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 12px 28px rgba(40, 84, 255, 0.23);
}

.button-primary:hover {
  background: var(--accent-dark);
}

.button-secondary {
  color: var(--ink);
  border-color: rgba(21, 23, 18, 0.13);
  background: #f5f4ef;
}

.button-dark {
  color: #fff;
  background: var(--ink);
}

.button.compact {
  min-height: 44px;
  padding: 0 15px;
  font-size: 13px;
}

.drop-hint {
  margin: 15px 0 0;
  color: #858780;
  text-align: center;
  font-size: 11px;
}

.error-message {
  display: grid;
  gap: 3px;
  margin-top: 16px;
  padding: 12px 14px;
  color: #8d2929;
  border: 1px solid rgba(176, 49, 49, 0.2);
  border-radius: 12px;
  background: #fff1ef;
  font-size: 13px;
  line-height: 1.45;
}

.processing-view {
  display: grid;
  height: 100%;
  min-height: 0;
  place-items: center;
  padding: clamp(16px, 4dvh, 44px) 0;
  overflow: hidden;
}

.processing-card {
  width: min(520px, 100%);
  padding: 42px;
  text-align: center;
  border: 1px solid rgba(21, 23, 18, 0.12);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.processing-card h1 {
  font-size: clamp(34px, 5vw, 54px);
}

.processing-card > p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.6;
}

.processing-graphic {
  position: relative;
  width: 124px;
  height: 164px;
  margin: 0 auto 34px;
}

.scan-card {
  position: absolute;
  inset: 0;
  border: 8px solid #f5f3e9;
  border-radius: 10px;
  background:
    radial-gradient(circle at 50% 40%, transparent 0 24px, rgba(255, 255, 255, 0.55) 25px 27px, transparent 28px),
    linear-gradient(150deg, #1e2822, #101410);
  box-shadow: 0 18px 38px rgba(15, 20, 16, 0.2);
}

.scan-line {
  position: absolute;
  right: -8px;
  left: -8px;
  top: 15%;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 18px var(--accent);
  animation: scan 1.8s ease-in-out infinite alternate;
}

@keyframes scan {
  to { top: 84%; }
}

.text-button {
  padding: 8px;
  color: var(--accent);
  border: 0;
  background: transparent;
  font-weight: 760;
  cursor: pointer;
}

.editor-view {
  display: flex;
  height: 100%;
  min-height: 0;
  padding: clamp(12px, 2.2dvh, 22px) 0 max(10px, env(safe-area-inset-bottom));
  overflow: hidden;
  flex-direction: column;
}

.editor-heading {
  display: flex;
  flex: 0 0 auto;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: clamp(10px, 1.8dvh, 18px);
}

.editor-heading h1 {
  font-size: clamp(32px, 3.4vw, 48px);
}

.editor-heading > div:first-child > p:last-child {
  max-width: 660px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.editor-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 9px;
}

.measurement-workspace {
  display: grid;
  min-height: 0;
  flex: 1 1 auto;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  overflow: hidden;
}

.results-panel,
.image-column {
  border: 1px solid rgba(21, 23, 18, 0.12);
  background: var(--surface);
  box-shadow: 0 18px 55px rgba(35, 39, 30, 0.07);
}

.results-panel {
  min-height: 0;
  overflow: auto;
  border-radius: 20px;
  overscroll-behavior: contain;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.live-dot {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: #3c8e55;
}

.live-dot i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--left);
  box-shadow: 0 0 0 4px rgba(47, 199, 104, 0.12);
}

.axis-result {
  padding: 22px 18px 20px;
  border-bottom: 1px solid var(--line);
}

.axis-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #40433e;
  font-size: 13px;
  font-weight: 760;
}

.axis-direction {
  color: #90928d;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10px;
  font-weight: 600;
}

.axis-result output {
  display: block;
  margin: 9px 0 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 36px;
  font-weight: 720;
  letter-spacing: -0.065em;
}

.axis-result.is-invalid output {
  color: #a6a8a3;
}

.ratio-bar {
  display: flex;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--right);
}

.ratio-first {
  width: 50%;
  background: var(--left);
  transition: width 70ms linear;
}

.vertical-ratio {
  background: var(--bottom);
}

.vertical-ratio .ratio-first {
  background: var(--top);
}

.measurement-status {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin: 16px;
  padding: 12px;
  color: #3c754d;
  border-radius: 12px;
  background: #edf8ef;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.status-check {
  display: grid;
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  place-items: center;
  font-size: 15px;
  line-height: 1;
}

.measurement-status.is-invalid {
  color: #9c4a30;
  background: #fff0e8;
}

.legend {
  padding: 2px 18px 18px;
}

.legend > p {
  margin: 0 0 9px;
  color: #969891;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.legend ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  color: #62655f;
  font-size: 11px;
  list-style: none;
}

.legend li {
  display: flex;
  gap: 8px;
  align-items: center;
}

.legend-line {
  width: 24px;
  border-top: 2px solid #4c5048;
}

.legend-line.dashed {
  border-top-style: dashed;
}

.legend-handle {
  min-width: 42px;
  padding: 3px 5px;
  color: #40443d;
  border: 1px solid #bfc2ba;
  border-radius: 999px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 9px;
  font-style: normal;
  font-weight: 800;
  text-align: center;
}

.result-disclaimer {
  margin: 0;
  padding: 14px 18px;
  color: #7b7e77;
  border-top: 1px solid var(--line);
  background: #f7f6f1;
  font-size: 10px;
  line-height: 1.55;
}

.image-column {
  display: flex;
  height: 100%;
  min-height: 0;
  min-width: 0;
  padding: clamp(12px, 2.3vw, 28px);
  border-radius: 20px;
  flex-direction: column;
  overflow: hidden;
}

.image-stage {
  position: relative;
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  padding: clamp(24px, 3vw, 42px);
  overflow: hidden;
  border-radius: 14px;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.035) 25%, transparent 25% 75%, rgba(255, 255, 255, 0.035) 75%),
    linear-gradient(45deg, rgba(255, 255, 255, 0.035) 25%, transparent 25% 75%, rgba(255, 255, 255, 0.035) 75%),
    #111510;
  background-position: 0 0, 8px 8px;
  background-size: 16px 16px;
}

.zoom-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 30;
  display: grid;
  grid-template-columns: 38px minmax(58px, auto) 38px;
  min-height: 38px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 11px;
  background: rgba(17, 21, 16, 0.88);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px);
}

.zoom-button,
.zoom-value {
  display: grid;
  min-width: 0;
  min-height: 38px;
  padding: 0;
  place-items: center;
  color: #fff;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.zoom-button {
  font-size: 22px;
  line-height: 1;
}

.zoom-value {
  padding: 0 8px;
  border-right: 1px solid rgba(255, 255, 255, 0.14);
  border-left: 1px solid rgba(255, 255, 255, 0.14);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  font-weight: 760;
}

.zoom-button:hover,
.zoom-value:hover {
  background: rgba(255, 255, 255, 0.1);
}

.zoom-button:focus-visible,
.zoom-value:focus-visible {
  position: relative;
  z-index: 1;
  outline: 2px solid #fff;
  outline-offset: -3px;
}

.zoom-button:disabled {
  color: rgba(255, 255, 255, 0.32);
  cursor: default;
}

.measurement-frame {
  --canvas-zoom: 1;
  --canvas-pan-x: 0px;
  --canvas-pan-y: 0px;
  --guide-inverse-zoom: 1;
  --guide-active-scale: 1.12;
  --guide-line-width: 2px;
  --guide-shadow-size: 3px;
  position: relative;
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  border-radius: 2px;
  line-height: 0;
  touch-action: none;
  user-select: none;
  cursor: zoom-in;
}

.measurement-frame.is-zoomed {
  cursor: grab;
}

.measurement-frame.is-panning {
  cursor: grabbing;
}

.measurement-frame:focus-visible {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.92), 0 0 0 6px var(--accent);
}

.source-image {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: min(calc(100vh - 330px), 860px);
  max-height: min(calc(100dvh - 330px), 860px);
  object-fit: contain;
  transform: translate3d(var(--canvas-pan-x), var(--canvas-pan-y), 0) scale(var(--canvas-zoom));
  transform-origin: 50% 50%;
  -webkit-user-drag: none;
  user-select: none;
  will-change: transform;
}

.guide-layer {
  position: absolute;
  inset: 0;
  transform: translate3d(var(--canvas-pan-x), var(--canvas-pan-y), 0) scale(var(--canvas-zoom));
  transform-origin: 50% 50%;
  pointer-events: none;
  will-change: transform;
}

.guide {
  --guide-color: var(--left);
  position: absolute;
  z-index: 3;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  pointer-events: auto;
  touch-action: none;
  cursor: grab;
}

.guide:active,
.guide.is-dragging {
  z-index: 10;
  cursor: grabbing;
}

.guide-left { --guide-color: var(--left); }
.guide-right { --guide-color: var(--right); }
.guide-top { --guide-color: var(--top); }
.guide-bottom { --guide-color: var(--bottom); }

.guide-vertical {
  top: 0;
  bottom: 0;
  width: calc(44px * var(--guide-inverse-zoom));
  transform: translateX(-50%);
}

.guide-horizontal {
  right: 0;
  left: 0;
  height: calc(44px * var(--guide-inverse-zoom));
  transform: translateY(-50%);
}

.guide-stroke {
  position: absolute;
  display: block;
  filter: drop-shadow(0 0 var(--guide-shadow-size) rgba(0, 0, 0, 0.7));
}

.guide-vertical .guide-stroke {
  top: 0;
  bottom: 0;
  left: 50%;
  border-left: var(--guide-line-width) dashed var(--guide-color);
}

.guide-horizontal .guide-stroke {
  top: 50%;
  right: 0;
  left: 0;
  border-top: var(--guide-line-width) dashed var(--guide-color);
}

.guide-handle {
  position: absolute;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #0d120e;
  border: 2px solid rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  background: var(--guide-color);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  line-height: 1;
  transition: transform 130ms ease, box-shadow 130ms ease;
}

.guide-handle b {
  font-size: 10px;
  font-weight: 900;
}

.guide-vertical .guide-handle {
  top: var(--handle-position);
  left: 50%;
  transform: scale(var(--guide-inverse-zoom)) translate(-50%, -50%);
}

.guide-horizontal .guide-handle {
  top: 50%;
  left: var(--handle-position);
  transform: scale(var(--guide-inverse-zoom)) translate(-50%, -50%);
}

.guide.is-dragging .guide-handle,
.guide:focus-visible .guide-handle {
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--guide-color) 32%, transparent), 0 6px 18px rgba(0, 0, 0, 0.5);
  transform: scale(var(--guide-active-scale)) translate(-50%, -50%);
}

.is-dragging-guide {
  cursor: grabbing;
  user-select: none;
}

.image-caption {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin: 17px 0 0;
  color: #757872;
  font-size: 11px;
}

.caption-icon {
  color: var(--accent);
  font-size: 16px;
  font-weight: 800;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding-bottom: env(safe-area-inset-bottom);
  color: #777a73;
  border-top: 1px solid rgba(21, 23, 18, 0.12);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10px;
}

[data-view="editor-view"] .site-footer {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

noscript {
  display: block;
  padding: 24px;
  color: #8d2929;
  text-align: center;
  background: #fff1ef;
}

@media (max-width: 980px) {
  .upload-view {
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-columns: 1fr;
    gap: clamp(18px, 3dvh, 32px);
    min-height: 0;
  }

  .hero-copy {
    max-width: 720px;
  }

  .upload-panel {
    width: min(620px, 100%);
    min-height: 0;
  }

  .editor-heading {
    align-items: center;
  }

  .measurement-workspace {
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .results-panel {
    position: relative;
    top: auto;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    overflow: hidden;
  }

  .results-header,
  .measurement-status,
  .legend,
  .result-disclaimer {
    grid-column: 1 / -1;
  }

  .axis-result:nth-of-type(2) {
    border-right: 1px solid var(--line);
  }

  .legend,
  .result-disclaimer {
    display: none;
  }

  .source-image {
    max-height: calc(100vh - 510px);
    max-height: calc(100dvh - 510px);
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding-right: max(12px, env(safe-area-inset-right));
    padding-left: max(12px, env(safe-area-inset-left));
  }

  .site-header {
    min-height: 56px;
  }

  .privacy-chip {
    padding: 7px 9px;
    font-size: 10px;
  }

  .upload-view {
    gap: 12px;
    padding: 12px 0 max(10px, env(safe-area-inset-bottom));
  }

  .hero-copy h1 {
    font-size: clamp(28px, 9vw, 38px);
  }

  .hero-copy h1 br {
    display: none;
  }

  .hero-description {
    margin: 10px 0 0;
    font-size: 13px;
    line-height: 1.5;
  }

  .feature-list {
    display: none;
  }

  .upload-panel {
    display: flex;
    padding: 18px;
    overflow: auto;
    border-radius: 18px;
    flex-direction: column;
    overscroll-behavior: contain;
  }

  .upload-illustration {
    height: auto;
    min-height: 104px;
    max-height: 154px;
    flex: 1 1 120px;
    margin: -18px -18px 16px;
  }

  .sample-card {
    width: 82px;
    height: 112px;
  }

  .upload-actions {
    grid-template-columns: 1fr;
    margin-top: 12px;
  }

  .camera-button {
    display: inline-flex;
  }

  .drop-hint {
    display: none;
  }

  .processing-view {
    padding: 12px 0 max(10px, env(safe-area-inset-bottom));
  }

  .processing-card {
    padding: 34px 22px;
    border-radius: 22px;
  }

  .editor-view {
    padding: 8px 0 max(8px, env(safe-area-inset-bottom));
  }

  .editor-heading {
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
  }

  .editor-heading h1 {
    font-size: clamp(25px, 7.5vw, 30px);
    white-space: nowrap;
  }

  .editor-heading .eyebrow,
  .editor-heading > div:first-child > p:last-child {
    display: none;
  }

  .editor-actions {
    display: grid;
    width: auto;
    grid-template-columns: repeat(2, auto);
    gap: 6px;
  }

  .button.compact {
    min-height: 44px;
    padding: 0 10px;
    font-size: 11px;
  }

  .results-panel,
  .image-column {
    border-radius: 16px;
  }

  .axis-result {
    padding: 9px 12px 10px;
  }

  .axis-result output {
    margin: 4px 0 7px;
    font-size: clamp(24px, 7.5vw, 30px);
  }

  .results-header {
    padding: 9px 12px;
  }

  .measurement-status,
  .legend,
  .result-disclaimer {
    display: none;
  }

  .image-column {
    padding: 10px;
  }

  .image-stage {
    min-height: 0;
    padding: 24px;
    overflow: hidden;
  }

  .source-image {
    max-height: calc(100vh - 310px);
    max-height: calc(100dvh - 310px);
  }

  .guide-handle {
    width: 36px;
    height: 36px;
  }

  .image-caption {
    display: none;
  }

  .site-footer {
    display: none;
  }
}

@media (max-width: 640px) and (max-height: 720px) {
  .hero-description,
  .upload-illustration {
    display: none;
  }

  .upload-view {
    grid-template-rows: auto minmax(0, 1fr);
  }

  .processing-graphic {
    width: 92px;
    height: 122px;
    margin-bottom: 18px;
  }
}

@media (min-width: 641px) {
  .camera-button {
    display: none;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .site-header {
    min-height: 48px;
  }

  .site-footer {
    display: none;
  }

  .upload-view {
    grid-template-columns: minmax(0, 0.8fr) minmax(340px, 0.72fr);
    grid-template-rows: minmax(0, 1fr);
    gap: 20px;
    padding: 8px 0;
  }

  .hero-copy h1 {
    font-size: clamp(28px, 5vw, 40px);
  }

  .hero-description {
    margin: 10px 0 0;
    font-size: 12px;
    line-height: 1.5;
  }

  .feature-list,
  .upload-illustration,
  .drop-hint {
    display: none;
  }

  .upload-panel {
    align-self: stretch;
    padding: 16px;
    overflow: auto;
    border-radius: 16px;
  }

  .upload-panel h2 {
    margin-bottom: 4px;
    font-size: 20px;
  }

  .upload-actions {
    margin-top: 12px;
  }

  .camera-button {
    display: inline-flex;
  }

  .processing-view {
    padding: 8px 0;
  }

  .processing-card {
    width: min(680px, 100%);
    padding: 18px;
  }

  .processing-graphic {
    display: none;
  }

  .editor-view {
    padding: 6px 0 max(6px, env(safe-area-inset-bottom));
  }

  .editor-heading {
    gap: 12px;
    margin-bottom: 6px;
  }

  .editor-heading .eyebrow,
  .editor-heading > div:first-child > p:last-child {
    display: none;
  }

  .editor-heading h1 {
    font-size: 28px;
    white-space: nowrap;
  }

  .measurement-workspace {
    grid-template-rows: minmax(0, 1fr);
    grid-template-columns: 230px minmax(0, 1fr);
    gap: 8px;
  }

  .results-panel {
    display: block;
    overflow: auto;
  }

  .results-header {
    padding: 8px 12px;
  }

  .axis-result {
    padding: 9px 12px;
  }

  .axis-result:nth-of-type(2) {
    border-right: 0;
  }

  .axis-result output {
    margin: 3px 0 6px;
    font-size: 26px;
  }

  .measurement-status,
  .legend,
  .result-disclaimer,
  .image-caption {
    display: none;
  }

  .image-column {
    padding: 7px;
  }

  .image-stage {
    padding: 22px;
  }

  .source-image {
    max-height: calc(100vh - 170px);
    max-height: calc(100dvh - 170px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
