:root {
  --ground: #131110;
  --surface: #1b1817;
  --line: #2b2724;
  --text: #ece7e0;
  --muted: #8f8880;
  --bone: #e5ddcf;
  --ok: #b7c9a8;
  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--ground);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.screen {
  position: fixed; inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  padding: max(20px, env(safe-area-inset-top)) 22px max(24px, env(safe-area-inset-bottom));
  overflow-y: auto;
}
.screen.active { display: flex; }

.wordmark {
  font-size: 11px;
  letter-spacing: .34em;
  color: var(--bone);
  padding: 14px 0 8px;
  z-index: 5;
  flex-shrink: 0;
}
.wordmark.on-cam { position: absolute; top: max(18px, env(safe-area-inset-top)); left: 0; right: 0; text-align: center; }

/* intro */
.intro-center { flex: 1; display: flex; flex-direction: column; justify-content: center; text-align: center; gap: 18px; }
h1 {
  font-weight: 200;
  font-size: clamp(40px, 11.5vw, 58px);
  line-height: 1.06;
  letter-spacing: .01em;
}
h2 { font-weight: 200; font-size: 30px; letter-spacing: .02em; }
.intro-sub { color: var(--muted); font-size: 15px; }

.btn-primary {
  width: 100%;
  max-width: 340px;
  padding: 16px;
  background: var(--bone);
  color: #131110;
  border: 0;
  border-radius: 2px;
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: .22em;
  text-transform: uppercase;
  cursor: pointer;
  flex-shrink: 0;
}
.btn-primary:active { opacity: .85; }
.btn-quiet {
  display: block;
  text-align: center;
  width: 100%;
  max-width: 340px;
  padding: 15px;
  color: var(--bone);
  border: 1px solid var(--line);
  border-radius: 2px;
  font-size: 12px;
  letter-spacing: .22em;
  text-transform: uppercase;
  text-decoration: none;
}
.fineprint {
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: .06em;
  text-align: center;
  padding-top: 14px;
  flex-shrink: 0;
}

/* capture */
#capture { padding: 0; }
#cam {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}
.cam-shade {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 62% 44% at 50% 44%, transparent 62%, rgba(19,17,16,.55) 100%);
  pointer-events: none;
}
#oval {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
#oval ellipse {
  fill: none;
  stroke: rgba(229, 221, 207, .55);
  stroke-width: .45;
  stroke-dasharray: 2 2.6;
}
#oval.locked ellipse { stroke: var(--ok); stroke-dasharray: none; }
.coach {
  position: absolute;
  left: 0; right: 0;
  bottom: calc(max(24px, env(safe-area-inset-bottom)) + 74px);
  text-align: center;
  font-size: 15px;
  letter-spacing: .06em;
  color: var(--text);
  text-shadow: 0 1px 12px rgba(0,0,0,.6);
  padding: 0 30px;
}
.chips {
  position: absolute;
  left: 0; right: 0;
  bottom: max(28px, env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  gap: 10px;
}
.chip {
  font-size: 9.5px;
  letter-spacing: .2em;
  color: var(--muted);
  border: 1px solid var(--line);
  background: rgba(19,17,16,.6);
  padding: 6px 12px;
  border-radius: 2px;
  transition: all .3s;
}
.chip.on { color: #131110; background: var(--ok); border-color: var(--ok); }
.btn-shutter {
  position: absolute;
  bottom: calc(max(28px, env(safe-area-inset-bottom)) + 40px);
  left: 50%;
  transform: translateX(-50%);
  width: 66px; height: 66px;
  border-radius: 50%;
  border: 3px solid var(--bone);
  background: rgba(229,221,207,.25);
}
.hidden { display: none !important; }
.flash {
  position: fixed; inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 50;
}
.flash.go { animation: flash .5s ease; }
@keyframes flash { 20% { opacity: .9; } 100% { opacity: 0; } }

/* diagnostic — full-bleed */
.screen.full { padding: 0; overflow: hidden; }
.screen.full::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 120px;
  background: linear-gradient(180deg, rgba(19,17,16,.6), transparent);
  pointer-events: none;
  z-index: 4;
}
.bleed {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.panel {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 44px 22px calc(max(20px, env(safe-area-inset-bottom)) + 8px);
  background: linear-gradient(180deg, transparent 0%, rgba(19,17,16,.82) 34%, rgba(19,17,16,.94) 100%);
}
#scanline {
  position: absolute;
  left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(229,221,207,.9), transparent);
  top: -2px;
  animation: scan 5.5s cubic-bezier(.45,0,.55,1) infinite;
  opacity: .8;
}
@keyframes scan {
  0% { top: 2%; opacity: 0; }
  8% { opacity: .8; }
  46% { top: 96%; opacity: .8; }
  50% { opacity: 0; }
  54% { top: 96%; opacity: .8; }
  92% { top: 2%; opacity: .8; }
  100% { top: 2%; opacity: 0; }
}

.pct {
  text-align: center;
  color: var(--bone);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.pct b {
  font-size: 46px;
  font-weight: 200;
  letter-spacing: .02em;
}
.pct i {
  font-style: normal;
  font-size: 13px;
  letter-spacing: .1em;
  color: var(--muted);
  margin-left: 3px;
}
.phase {
  text-align: center;
  font-size: 9.5px;
  letter-spacing: .3em;
  color: var(--muted);
  padding: 7px 0 13px;
}
.baro {
  position: relative;
  width: min(400px, 100%);
  height: 2px;
  background: rgba(236,231,224,.16);
}
#baro-fill {
  height: 100%;
  width: 0%;
  background: var(--bone);
  transition: width .45s linear;
}
.baro .tick {
  position: absolute;
  top: -2px;
  width: 1px;
  height: 6px;
  background: var(--line);
}
.caption {
  width: 100%;
  max-width: 420px;
  min-height: 52px;
  padding: 15px 2px 0;
  flex-shrink: 0;
  opacity: 1;
  transition: opacity .45s;
  text-align: center;
}
.caption.fade { opacity: 0; }
.caption b {
  display: block;
  font-weight: 500;
  font-size: 9.5px;
  letter-spacing: .3em;
  color: var(--bone);
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}
.caption span { font-size: 13.5px; color: var(--text); line-height: 1.45; }

/* reveal — full-bleed slider */
.slider.bleed-slider {
  position: absolute; inset: 0;
  overflow: hidden;
  touch-action: pan-y;
  cursor: ew-resize;
  user-select: none;
  -webkit-user-select: none;
}
.slider img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.clip {
  position: absolute; inset: 0;
  width: 50%;
  overflow: hidden;
  border-right: 1px solid rgba(236,231,224,.85);
}
.clip img { width: 100vw; max-width: none; }
.handle { position: absolute; top: 0; bottom: 0; left: 50%; width: 0; pointer-events: none; }
.knob {
  position: absolute; top: 50%; left: 0;
  transform: translate(-50%, -50%);
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(19,17,16,.82);
  border: 1px solid var(--bone);
  color: var(--bone);
  display: grid; place-items: center;
  font-size: 14px;
}
.tag {
  position: absolute;
  top: calc(max(18px, env(safe-area-inset-top)) + 44px);
  font-size: 9.5px; letter-spacing: .2em;
  padding: 5px 9px;
  background: rgba(19,17,16,.6);
  border: 1px solid rgba(236,231,224,.18);
  border-radius: 2px;
  color: var(--text);
}
.tag-b { left: 16px; }
.tag-a { right: 16px; }

.btn-row {
  display: flex;
  gap: 10px;
  width: min(400px, 100%);
}
.btn-row .btn-primary { flex: 1.4; max-width: none; }
.btn-row .btn-quiet { flex: 1; max-width: none; display: flex; align-items: center; justify-content: center; }
.panel .fineprint { padding-top: 12px; }

@media (min-width: 700px) {
  .screen { justify-content: flex-start; }
  .stage, .slider { max-width: 460px; }
}

.link-quiet {
  background: none;
  border: 0;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 11.5px;
  letter-spacing: .08em;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 14px;
  cursor: pointer;
}
.save-overlay {
  position: fixed; inset: 0;
  background: rgba(19,17,16,.96);
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
}
.save-overlay img {
  max-width: 86%;
  max-height: 64vh;
  border: 1px solid var(--line);
  border-radius: 2px;
}
.save-overlay p {
  color: var(--text);
  font-size: 13px;
  letter-spacing: .04em;
  text-align: center;
}
.save-overlay button {
  background: none;
  border: 1px solid var(--line);
  color: var(--bone);
  padding: 12px 26px;
  font-size: 11px;
  letter-spacing: .22em;
  border-radius: 2px;
}
.sample-chip {
  position: absolute;
  top: 12px; right: 12px;
  font-size: 9px;
  letter-spacing: .24em;
  color: var(--muted);
  border: 1px solid var(--line);
  background: rgba(19,17,16,.7);
  padding: 5px 9px;
  border-radius: 2px;
  z-index: 6;
}

.count {
  position: absolute;
  left: 50%; top: 36%;
  transform: translate(-50%, -50%) scale(.9);
  font-size: 92px;
  font-weight: 100;
  color: var(--bone);
  text-shadow: 0 2px 22px rgba(0,0,0,.55);
  opacity: 0;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
  transition: opacity .18s, transform .25s;
  z-index: 6;
}
.count.tick { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.lab-chip {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  left: 14px;
  font-size: 9px;
  letter-spacing: .24em;
  color: var(--ok);
  border: 1px solid var(--ok);
  padding: 4px 8px;
  border-radius: 2px;
  z-index: 40;
  opacity: .75;
}
