:root {
  color-scheme: light;
  --bg: #F4F4F1;
  --surface: #FFFFFF;
  --ink: #121212;
  --ink-2: #5C5C58;
  --ink-3: #8A8A86;
  --line: rgba(0, 0, 0, .1);
  --field: rgba(0, 0, 0, .06);
  /* iAge categories: same hues as the live results page */
  --lower: #2A78D6;     --lower-tint: #E4EEFA;
  --expected: #898781;  --expected-tint: #ECEBE7;
  --higher: #EB6834;    --higher-tint: #FCEAE1;
  --cat: var(--expected); --cat-tint: var(--expected-tint);
  --radius: 22px;
  --display: 'Outfit', system-ui, sans-serif;
  --body: 'Figtree', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 16px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
/* No double-tap zoom (quick taps on + / − zoomed in on iPhone); pinch zoom still works */
html, button, a, input, label { touch-action: manipulation; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; margin: 0; letter-spacing: -0.02em; text-wrap: balance; }
h1 { font-size: clamp(32px, 9vw, 40px); line-height: 1.05; letter-spacing: -0.03em; }
h2 { font-size: 28px; line-height: 1.1; }
h3 { font-size: 18px; }
p { margin: 0; text-wrap: pretty; }

.app {
  min-height: 100dvh; max-width: 480px; margin: 0 auto;
  display: flex; flex-direction: column;
  padding: 0 16px env(safe-area-inset-bottom);
}

/* Top bar */
.topbar { display: flex; align-items: center; gap: 10px; height: 64px; }
.brand { font-family: var(--display); font-weight: 600; font-size: 17px; flex: 1; }
.logo { height: 34px; width: auto; }
.back {
  width: 40px; height: 40px; margin-left: -8px; border: 0; border-radius: 50%;
  background: transparent; display: grid; place-items: center; cursor: pointer;
}
.back:hover { background: var(--field); }

main { flex: 1; display: flex; flex-direction: column; }
.screen { flex: 1; display: flex; flex-direction: column; gap: 20px; padding: 8px 0 24px; animation: enter .35s ease-out both; }
.screen.center { align-items: center; text-align: center; justify-content: center; }
@keyframes enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.lede { font-size: 18px; color: var(--ink-2); }
.sub { font-size: 16px; color: var(--ink-2); }
.fine { font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.center { text-align: center; }

/* Buttons */
.btn {
  height: 56px; width: 100%; border: 0; border-radius: 999px; cursor: pointer;
  font-weight: 600; font-size: 17px; transition: transform .1s, background .15s, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--ink); color: #fff; }
.btn.primary:hover { background: #2A2A2A; }
.btn.secondary { background: var(--surface); border: 1.5px solid var(--line); }
.btn.light { background: #fff; color: var(--ink); }
.btn.small { height: 46px; width: auto; padding: 0 22px; font-size: 15px; }
.btn:disabled { opacity: .35; cursor: default; transform: none; }
.dock {
  position: sticky; bottom: 0; margin-top: auto; padding: 16px 0 calc(8px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, rgba(244, 244, 241, 0));
  display: flex; flex-direction: column; gap: 10px; width: 100%;
}

/* Landing */
.hero-art { position: relative; height: 230px; display: grid; place-items: center; margin-top: 4px; }
.hero-oval {
  position: relative; width: 168px; height: 216px; border-radius: 50%; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 20%, #FFFFFF 0%, #E4EEFA 70%, #D3E3F7 100%);
  box-shadow: 0 30px 60px -30px rgba(42, 120, 214, .55), inset 0 0 0 2px rgba(255, 255, 255, .8);
}
.hero-oval::after {
  content: ""; position: absolute; inset: 10px; border-radius: 50%;
  border: 2px dashed rgba(42, 120, 214, .45);
}
.hero-face { position: absolute; left: 50%; bottom: -6px; width: 150px; transform: translateX(-50%); fill: rgba(42, 120, 214, .22); }
.scanline {
  position: absolute; left: 0; right: 0; height: 38%; pointer-events: none;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, .7));
  border-bottom: 2px solid rgba(255, 255, 255, .95);
  animation: scan 1.8s ease-in-out infinite alternate;
}
.hero-oval .scanline {
  background: linear-gradient(to bottom, rgba(42, 120, 214, 0), rgba(42, 120, 214, .28));
  border-bottom-color: rgba(42, 120, 214, .8);
}
@keyframes scan { from { top: -40%; } to { top: 100%; } }
.hero-dots { position: absolute; bottom: 6px; display: flex; gap: 8px; }
.hero-dots span { width: 10px; height: 10px; border-radius: 50%; background: var(--lower); animation: pop 2.4s ease-in-out infinite; }
.hero-dots span:nth-child(2) { background: var(--expected); animation-delay: .25s; }
.hero-dots span:nth-child(3) { background: var(--higher); animation-delay: .5s; }
@keyframes pop { 0%, 60%, 100% { transform: none; } 30% { transform: translateY(-5px); } }

.how { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.how li { display: flex; gap: 14px; align-items: flex-start; font-size: 15px; color: var(--ink-2); line-height: 1.4; }
.how b { color: var(--ink); font-weight: 600; }
.how .num {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); border: 1.5px solid var(--line); font: 600 14px var(--display); color: var(--ink);
}

/* Progress */
.progress { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.progress span { height: 4px; border-radius: 2px; background: rgba(0, 0, 0, .1); transition: background .3s; }
.progress span.on { background: var(--ink); }

/* Metrics */
.title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.segmented { display: flex; padding: 3px; border-radius: 999px; background: rgba(0, 0, 0, .07); flex: none; }
.segmented button {
  height: 34px; min-width: 44px; padding: 0 14px; border: 0; border-radius: 999px;
  background: transparent; color: var(--ink-2); font-weight: 600; font-size: 14px; cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.fields { display: flex; flex-direction: column; gap: 16px; }
.field label { display: flex; justify-content: space-between; align-items: baseline; padding: 0 4px 8px; font-weight: 600; font-size: 15px; }
.consent { display: flex; gap: 8px; align-items: flex-start; padding: 0 4px; font-size: 12px; line-height: 1.4; color: var(--ink-3); cursor: pointer; }
.consent input { flex: none; width: 14px; height: 14px; margin: 1px 0 0; accent-color: var(--ink-2); }
.field .hint { font-weight: 400; font-size: 13px; color: var(--ink-2); }
.stepper {
  display: grid; grid-template-columns: 64px 1fr 64px; height: 68px;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.stepper:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(0, 0, 0, .06); }
.field.invalid .stepper { border-color: var(--higher); }
.stepper button { border: 0; background: transparent; font: 500 30px var(--display); cursor: pointer; }
.stepper button:hover { background: var(--field); }
.stepper .value { display: flex; align-items: baseline; justify-content: center; gap: 6px; align-self: center; }
.stepper input {
  width: 4.2ch; border: 0; outline: 0; background: transparent; padding: 0;
  text-align: center; font: 600 30px var(--display); color: var(--ink);
}
.stepper input::placeholder { color: #C4C3BE; }
.stepper .unit { font-size: 15px; color: var(--ink-2); font-weight: 500; }

.captured {
  display: flex; align-items: center; gap: 14px; padding: 10px; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--line);
}
.captured img { width: 56px; height: 72px; border-radius: 12px; object-fit: cover; flex: none; }
.captured div { flex: 1; display: flex; flex-direction: column; font-size: 13px; color: var(--ink-2); line-height: 1.35; }
.captured b { font: 600 16px var(--display); color: var(--ink); }
.captured .btn.small { height: 40px; padding: 0 16px; font-size: 14px; }

/* Camera: 3:4, as wide as the column but never taller than the window allows */
.camera {
  position: relative; aspect-ratio: 3 / 4; width: min(100%, calc((100dvh - 210px) * .75)); min-width: 260px;
  margin: 0 auto; border-radius: 26px; overflow: hidden;
  background: #17181A; box-shadow: 0 26px 50px -30px rgba(0, 0, 0, .6);
}
.camera video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.camera video.mirrored { transform: scaleX(-1); }
.guide { position: absolute; inset: 0; pointer-events: none; }
.guide .oval {
  position: absolute; left: 50%; top: 45%; width: 62%; aspect-ratio: 3 / 4; transform: translate(-50%, -50%);
  border-radius: 50%; border: 2.5px dashed rgba(255, 255, 255, .85);
  box-shadow: 0 0 0 999px rgba(0, 0, 0, .28);
}
.pill, .chip {
  background: rgba(0, 0, 0, .45); color: #fff; border-radius: 999px;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.guide .pill { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); white-space: nowrap; padding: 7px 13px; font-size: 13px; font-weight: 500; }
.chip { height: 44px; padding: 0 16px; border: 0; font-weight: 600; font-size: 14px; cursor: pointer; }
.flip { position: absolute; top: 12px; right: 12px; height: 40px; }
.cam-msg {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 32px; text-align: center; color: rgba(255, 255, 255, .85); font-size: 15px;
}
.cam-msg b { font: 600 21px var(--display); color: #fff; }
.cam-check { position: absolute; inset: 0; z-index: 3; background: #17181A; }
.cam-check img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam-check-msg {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 22px 24px; display: flex; flex-direction: column;
  align-items: center; gap: 6px; text-align: center; color: rgba(255, 255, 255, .88); font-size: 15px;
  background: linear-gradient(to top, rgba(0, 0, 0, .75), rgba(0, 0, 0, 0));
}
.cam-check-msg b { font: 600 21px var(--display); color: #fff; }
.cam-check-msg .btn { margin-top: 10px; }
.cam-check.failed img { filter: brightness(.55); }
.cam-check.failed .scanline { display: none; }
.cam-controls {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 30px 18px 20px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  background: linear-gradient(to top, rgba(0, 0, 0, .6), rgba(0, 0, 0, 0));
}
.cam-controls .chip { justify-self: start; background: rgba(255, 255, 255, .2); }
.shutter {
  width: 78px; height: 78px; border-radius: 50%; padding: 5px; cursor: pointer;
  border: 4px solid rgba(255, 255, 255, .95); background: rgba(255, 255, 255, .15); transition: transform .1s;
}
.shutter span { display: block; width: 100%; height: 100%; border-radius: 50%; background: #fff; }
.shutter:active { transform: scale(.93); }
.shutter:disabled { opacity: .35; cursor: default; }

/* Analysing */
.scan-photo {
  position: relative; width: 200px; aspect-ratio: 3 / 4; border-radius: 28px; overflow: hidden;
  background: #E9E9E5; box-shadow: 0 28px 50px -30px rgba(0, 0, 0, .55);
}
.scan-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bar { position: relative; width: 160px; height: 4px; border-radius: 999px; background: rgba(0, 0, 0, .1); overflow: hidden; }
.bar span { position: absolute; top: 0; bottom: 0; width: 40%; border-radius: 999px; background: var(--ink); animation: slide 1.2s ease-in-out infinite alternate; }
@keyframes slide { from { left: -40%; } to { left: 100%; } }

/* Result */
.result-main { display: flex; flex-direction: column; gap: 14px; }
.result-head { display: flex; align-items: center; gap: 12px; }
.result-head > div:nth-child(2) { flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.result-head b { font: 600 20px var(--display); }
.result-head span { font-size: 14px; color: var(--ink-2); }
.your-age { text-align: right; display: flex; flex-direction: column; }
.your-age span { font-size: 12px; font-weight: 600; }
.your-age b { font: 700 26px/1 var(--display); }
.avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px #fff; flex: none; }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cards.single { grid-template-columns: 1fr; }
.result-card {
  --cat: var(--expected); --cat-tint: var(--expected-tint);
  border-radius: 24px; padding: 16px 16px 18px; background: var(--cat-tint);
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0;
}
.result-card[data-cat="lower"] { --cat: var(--lower); --cat-tint: var(--lower-tint); }
.result-card[data-cat="higher"] { --cat: var(--higher); --cat-tint: var(--higher-tint); }
.card-name { font: 600 16px/1.2 var(--display); }
.card-tag { font-size: 12.5px; line-height: 1.3; color: var(--ink-2); }
.card-value {
  margin-top: 10px; font: 700 clamp(44px, 13vw, 60px)/.95 var(--display); letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums; animation: enter .5s .1s ease-out both;
}
.delta { margin-top: 8px; padding: 4px 10px; border-radius: 999px; background: var(--cat); color: #fff; font-weight: 700; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.result-card[data-cat="expected"] .delta { background: #6E6D68; }
.card-verdict { margin-top: 8px; font: 600 14.5px/1.25 var(--display); }
.age-chart { margin: 0; padding: 14px 10px 12px; border-radius: 20px; background: var(--surface); }
.chart-title { margin: 0 6px 6px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.age-chart svg { display: block; width: 100%; height: auto; font-family: var(--body); }
.age-chart .band.lower { fill: var(--lower-tint); }
.age-chart .band.expected { fill: var(--expected-tint); }
.age-chart .band.higher { fill: var(--higher-tint); }
.age-chart .grid { stroke: rgba(0, 0, 0, .06); stroke-width: 1; }
.age-chart .ref { stroke: var(--ink-3); stroke-width: 1.5; stroke-dasharray: 4 4; }
.age-chart .tick { font-size: 11px; fill: var(--ink-3); font-variant-numeric: tabular-nums; }
.age-chart .axis { font-size: 11px; font-weight: 700; fill: var(--ink-2); letter-spacing: .02em; }
.age-chart .band-label { font-size: 8.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; fill: var(--ink-2); }
.age-chart .you-guide { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 2 3; opacity: .45; }
.age-chart .dot { filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .22)); animation: enter .5s .3s ease-out both; }
.age-chart .dot.appearance { stroke: #fff; stroke-width: 3; }
.age-chart .dot.appearance.lower { fill: var(--lower); } .age-chart .dot.appearance.expected { fill: #6E6D68; } .age-chart .dot.appearance.higher { fill: var(--higher); }
.age-chart .dot.iage { fill: #fff; stroke-width: 4; }
.age-chart .dot.iage.lower { stroke: var(--lower); } .age-chart .dot.iage.expected { stroke: #6E6D68; } .age-chart .dot.iage.higher { stroke: var(--higher); }
.age-chart .dot-label { font: 600 12.5px var(--display); fill: var(--ink); paint-order: stroke; stroke: rgba(255, 255, 255, .85); stroke-width: 3px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 8px 6px 0; font-size: 13px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.key { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }
.key.appearance { background: var(--ink-2); }
.key.iage { border: 3px solid var(--ink-2); background: #fff; }
.key.line { width: 16px; height: 0; border-radius: 0; border-top: 2px dashed var(--ink-3); }
.meaning h4 { margin: 6px 0 0; font: 600 15px var(--display); }
.result-side { display: flex; flex-direction: column; gap: 20px; flex: 1; }
.meaning { display: flex; flex-direction: column; gap: 8px; padding: 2px 4px 0; }
.meaning p { font-size: 15px; color: #3A3A37; }
.dock.stack { gap: 10px; }
.share { display: flex; flex-direction: column; gap: 10px; }
.share-label { font: 600 17px var(--display); padding: 0 4px; }
.share-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.share-btn {
  height: 52px; border-radius: 999px; display: grid; place-items: center;
  color: #fff; font-weight: 600; font-size: 15px; text-decoration: none; transition: transform .1s, filter .15s;
}
.share-btn:hover { filter: brightness(1.12); color: #fff; }
.share-btn:active { transform: scale(.97); }
.share-btn.x { background: #000; }
.share-btn.linkedin { background: #0A66C2; }
.share-btn.facebook { background: #1877F2; }

/* Error */
.error-icon { color: var(--higher); }

/* Footer */
footer { padding: 12px 0 24px; display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); }
footer .fine { font-size: 12px; }

/* Computer screens: wider canvas, two columns where it helps */
@media (min-width: 900px) {
  .app { max-width: 1040px; padding: 0 32px; }
  .topbar { height: 80px; }
  .screen { padding-top: 24px; }
  .screen[data-screen="camera"], .screen[data-screen="metrics"], .screen[data-screen="error"] {
    width: 100%; max-width: 520px; margin: 0 auto;
  }
  .landing { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 56px; }
  .landing .hero-art { height: 420px; }
  .landing .hero-oval { width: 280px; height: 360px; }
  .landing .hero-face { width: 250px; }
  .landing-text { display: flex; flex-direction: column; gap: 22px; }
  .landing .dock, .result .dock { position: static; background: none; padding-top: 8px; }
  .landing .dock .btn { max-width: 320px; }
  .landing .dock .fine { text-align: left; }
  .result { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: start; }
  .result-side { padding-top: 12px; }
  footer { flex-direction: row; justify-content: space-between; gap: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.demo-note { margin: 0; padding: 12px 14px; border-radius: 14px; background: var(--surface); text-align: center; font-size: 14px; color: var(--ink-2); }
