/* A clean consumer app: neutral surfaces, one blue action, verdict colours for judgement. */
@font-face { font-family: "Figtree"; src: url(fonts/figtree-latin-var.woff2) format("woff2"); font-weight: 400 800; font-display: swap; }

[hidden] { display: none !important; }
:root {
  --bg: #ffffff; --surface: #f3f4f6; --surface-2: #e5e7eb; --line: #e5e7eb;
  --ink: #111827; --soft: #4b5563; --accent: #2563eb; --accent-hover: #1d4ed8; --accent-ink: #ffffff; --link: #2563eb;
  --good: #15803d; --warn: #b26a00; --warn-text: #92400e; --bad: #c81e1e;
  --good-bg: #dcfce7; --warn-bg: #fef3c7; --bad-bg: #fee2e2; --need-bg: #e5e7eb;
  --card-shadow: 0 10px 30px rgb(0 0 0 / .14);
  --r: 12px; --r-s: 8px;
  font-family: "Figtree", ui-sans-serif, system-ui, sans-serif;
  color-scheme: light dark;
  accent-color: var(--accent);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1115; --surface: #1a1d23; --surface-2: #272b33; --line: #2a2f38;
    --ink: #f3f4f6; --soft: #a0a7b4; --link: #60a5fa;
    --good: #4ade80; --warn: #fbbf24; --warn-text: #fbbf24; --bad: #f87171;
    --good-bg: #123322; --warn-bg: #3a2c0a; --bad-bg: #3f1616; --need-bg: #272b33;
    --card-shadow: 0 10px 30px rgb(0 0 0 / .5); }
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--bg); line-height: 1.5; font-size: 1rem; font-variant-numeric: tabular-nums; }
::selection { background: var(--accent); color: var(--accent-ink); }
html { scroll-padding-bottom: 96px; }
a { color: var(--link); text-underline-offset: .18em; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.i { width: 1em; height: 1em; flex: none; vertical-align: -.12em; }

h1, h2, h3 { font-weight: 800; line-height: 1.1; letter-spacing: -.02em; text-wrap: balance; }
h1 { font-size: clamp(1.9rem, 6vw, 2.5rem); margin: 12px 0 6px; }
h2 { font-size: 1.2rem; margin: 0; }
h3 { font-size: 1.05rem; margin: 8px 0; }
.soft { color: var(--soft); }
.small { font-size: .875rem; }
.center { text-align: center; }
.lede { color: var(--soft); margin: 0 0 16px; max-width: 58ch; }

/* ---------- shell ---------- */
header.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; max-width: 1040px; margin: 0 auto;
  padding: max(2px, env(safe-area-inset-top)) 20px 2px; }
.brand { display: inline-flex; align-items: center; min-width: 44px; min-height: 44px; gap: 7px; font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em; color: var(--ink); text-decoration: none; white-space: nowrap; }
header.top nav { display: flex; gap: 2px; }
header.top nav a { color: var(--soft); text-decoration: none; font-weight: 500; font-size: .95rem; padding: 6px 10px; border-radius: var(--r-s); min-height: 44px; display: inline-flex; align-items: center; }
header.top nav a:hover { background: var(--surface); }
header.top nav a[aria-current] { color: var(--ink); font-weight: 700; }
main { max-width: 1040px; margin: 0 auto; padding: 0 20px 8px; }
footer { max-width: 1040px; margin: 28px auto 0; padding: 16px 20px calc(24px + env(safe-area-inset-bottom)); color: var(--soft); font-size: .8rem; }
footer p { max-width: 58ch; margin: 0; }

/* ---------- controls ---------- */
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; font: inherit; font-weight: 700; line-height: 1.2;
  border: 0; border-radius: var(--r); padding: 12px 18px; cursor: pointer; text-decoration: none; background: var(--accent); color: var(--accent-ink);
  transition: background-color .15s; }
button:hover, .btn:hover { background: var(--accent-hover); }
button:active, .btn:active { filter: brightness(.92); }
.row > summary:active, .checks a:active, .fixcard > summary:active { opacity: .7; }
button[disabled] { opacity: .5; cursor: not-allowed; }
button.secondary { background: var(--surface); color: var(--ink); }
button.secondary:hover { background: var(--surface-2); }
.wide { width: 100%; }
.big-btn { padding: 15px; }
.small-btn { padding: 7px 12px; font-size: .875rem; border-radius: var(--r-s); }
.links { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 8px; }
.links .btn { background: var(--surface); color: var(--ink); }
.links .btn:hover { background: var(--surface-2); }
.spinner { display: none; } form.busy .spinner { display: inline; }
.no-scroll { overflow: hidden; }
.field { display: block; margin: 10px 0 4px; font-weight: 600; font-size: .9rem; }
input[type=text], input[type=number], input[type=search], select { width: 100%; min-height: 44px; padding: 10px 12px; border-radius: var(--r-s);
  border: 1px solid var(--soft); background: var(--bg); color: var(--ink); font: inherit; }
input::placeholder { color: var(--soft); }
input[type=file] { font: inherit; font-size: .9rem; max-width: 100%; }
::file-selector-button { font: inherit; font-weight: 600; border: 0; border-radius: var(--r-s); padding: 11px 12px; margin-right: 10px; background: var(--surface-2); color: var(--ink); cursor: pointer; }

/* ---------- content ---------- */
.panel { background: var(--surface); border-radius: var(--r); padding: 14px 16px; margin: 10px 0; }
.panel > p:first-child { margin-top: 0; }
details.panel { padding-top: 0; padding-bottom: 0; }
details.panel[open] { padding-bottom: 14px; }
details.panel > summary { list-style: none; display: flex; align-items: center; gap: 8px; min-height: 44px; margin: 0 -16px; padding: 14px 16px; border-radius: var(--r); cursor: pointer; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary .chev { margin-left: auto; color: var(--soft); transition: transform .2s; }
details.panel[open] > summary .chev { transform: rotate(90deg); }
.chip { display: inline-block; white-space: nowrap; background: var(--surface-2); border-radius: 999px; padding: 2px 10px; font-size: .85rem; margin: 2px 4px 2px 0; text-decoration: none; color: inherit; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .94rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--soft); font-size: .85rem; }
td.num, th.num { text-align: right; }
td.num { white-space: nowrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.overlay img { width: 100%; display: block; border-radius: var(--r-s); }
.notice { background: var(--warn-bg); padding: 10px 12px; border-radius: var(--r-s); margin: 10px 0; font-size: .94rem; }
.notice a { color: inherit; }
.notice.err { background: var(--bad-bg); }
.notice.demo { background: var(--bad); color: var(--bg); font-weight: 700; }
.sev-none { color: var(--good); } .sev-minor { color: var(--warn-text); } .sev-moderate, .sev-major { color: var(--bad); }
.prices-form .fields { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.prices-form .span { grid-column: 1 / -1; }
.results-list { list-style: none; padding: 0; margin: 6px 0; max-height: 320px; overflow: auto; }
.results-list li.soft { padding: 8px; }
.results-list button { width: 100%; justify-content: flex-start; gap: 10px; padding: 8px; border-radius: var(--r-s); background: none; color: inherit; font-weight: 400; text-align: left; }
.results-list button:focus-visible { outline-offset: -2px; }
.results-list button:hover, .results-list button[aria-pressed=true] { background: var(--surface); }
.result-text, .result-text > * { display: block; }
.results-list img { width: 44px; border-radius: 4px; }
.bars { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.bar { display: grid; grid-template-columns: 54px 1fr 48px; gap: 8px; align-items: center; font-size: .9rem; }
.bar .track { background: var(--surface-2); height: 10px; border-radius: 999px; overflow: hidden; }
.bar .fill { background: var(--accent); height: 100%; }
.vchip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-weight: 700; font-size: .8rem; white-space: nowrap; }
.vchip.v-grade { background: var(--good-bg); color: var(--good); }
.vchip.v-marginal { background: var(--warn-bg); color: var(--warn-text); }
.vchip.v-dont { background: var(--bad-bg); color: var(--bad); }
.vchip.v-need { background: var(--need-bg); color: var(--ink); }

/* ---------- lists of checks ---------- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 0 6px; }
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { border-bottom: 1px solid var(--line); }
.checks a { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; color: inherit; text-decoration: none; }
.checks a:hover strong { color: var(--accent); }
.checks a { align-items: start; }
.checks img, .checks .noimg { width: 44px; aspect-ratio: 63 / 88; object-fit: cover; border-radius: 4px; background: var(--surface-2); display: block; }
.c-main { display: grid; min-width: 0; }
.c-main strong { font-weight: 700; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.c-main .small { overflow-wrap: anywhere; }
.c-end { display: grid; justify-items: end; gap: 2px; }
.c-gain { font-weight: 600; } .c-gain.pos { color: var(--good); } .c-gain.neg { color: var(--bad); }

/* ---------- home ---------- */
.home { display: grid; gap: 24px; }
.shots { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0 12px; }
.shot { position: relative; aspect-ratio: 63 / 88; background: var(--surface); color: var(--ink); border-radius: var(--r); padding: 0; overflow: hidden;
  display: flex; align-items: flex-end; justify-content: center; font: inherit; }
.shot:hover { background: var(--surface-2); }
.shot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.shot-label { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; width: 100%; padding: 12px 8px; }
.shot-label strong { font-weight: 700; }
.shot-label .small { color: var(--soft); font-weight: 400; }
.shot.done .shot-label { background: var(--bg); }
.shot.done .shot-label .small { color: var(--good); font-weight: 600; }
.shot.warn .shot-label .small { color: var(--warn-text); }
.shot-mark { position: absolute; inset: 0 0 40px; display: flex; align-items: center; justify-content: center; font-size: 3.2rem; color: var(--soft); }
.shot-mark .i { height: 1.33em; }
.shot.done .shot-mark { display: none; }
.tilt-btn { display: flex; align-items: center; justify-content: flex-start; gap: 12px; width: 100%; text-align: left; margin: 0 0 12px; padding: 10px 12px; background: var(--surface); color: var(--ink); font: inherit; }
.tilt-btn:hover { background: var(--surface-2); }
.tilt-btn .small { color: var(--soft); }
.tilt-btn img { width: 40px; aspect-ratio: 63 / 88; object-fit: cover; border-radius: 4px; }

/* ---------- camera ---------- */
.camera { position: fixed; inset: 0; background: #000; z-index: 50; color: #fff; }
.camera video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam-top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center;
  padding: max(14px, env(safe-area-inset-top)) 16px 14px; background: linear-gradient(#000a, #0000); font-weight: 700; font-size: 1.05rem; }
.cam-close { background: #0006; color: #fff; border-radius: 999px; width: 44px; height: 44px; padding: 0; font-size: 1.2rem; }
.cam-close:hover { background: #0009; }
.cam-frame { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); width: min(52vw, calc(44vh * 63 / 88)); aspect-ratio: 63 / 88;
  border-radius: 4%; box-shadow: 0 0 0 100vmax #0008; outline: 2px solid #fff8; transition: outline-color .15s; }
.cam-frame .c { position: absolute; width: 26px; height: 26px; border: 4px solid #fff; transition: border-color .15s; }
.cam-frame .tl { top: -4px; left: -4px; border-right: 0; border-bottom: 0; border-top-left-radius: 10px; }
.cam-frame .tr { top: -4px; right: -4px; border-left: 0; border-bottom: 0; border-top-right-radius: 10px; }
.cam-frame .bl { bottom: -4px; left: -4px; border-right: 0; border-top: 0; border-bottom-left-radius: 10px; }
.cam-frame .br { bottom: -4px; right: -4px; border-left: 0; border-top: 0; border-bottom-right-radius: 10px; }
.cam-frame.good { outline-color: #4ade80; }
.cam-frame.good .c { border-color: #4ade80; }
.cam-sub { position: absolute; top: calc(max(14px, env(safe-area-inset-top)) + 50px); left: 16px; right: 16px; text-align: center; font-size: .85rem; color: #fffc; text-shadow: 0 1px 3px #000; }
.cam-hint { position: absolute; left: 16px; right: 16px; bottom: calc(118px + env(safe-area-inset-bottom)); text-align: center; font-weight: 700; font-size: 1.05rem; text-shadow: 0 1px 3px #000; }
.cam-bottom { position: absolute; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 18px 20px calc(22px + env(safe-area-inset-bottom)); background: linear-gradient(#0000, #000a); }
.shutter { --p: 0; width: 74px; height: 74px; border-radius: 50%; background: #fff; border: 5px solid #fff6; box-shadow: 0 0 0 3px #fff; padding: 0; transition: box-shadow .15s; }
.shutter:hover { background: #fff; }
.shutter:active { transform: scale(.94); }
.shutter.arming { box-shadow: 0 0 0 3px #fff, 0 0 0 7px #0000;
  background: radial-gradient(circle, #fff 58%, #0000 60%), conic-gradient(#4ade80 calc(var(--p) * 1turn), #fff6 0); }
.auto-toggle { font-size: .9rem; display: flex; gap: 6px; align-items: center; }
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.flash.go { animation: flash .35s ease-out; }
@keyframes flash { from { opacity: .8; } to { opacity: 0; } }
.flip { position: absolute; inset: 0; z-index: 5; background: var(--bg); color: var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 24px 24px calc(24px + env(safe-area-inset-bottom)); text-align: center; }
.flip img { width: 96px; aspect-ratio: 63 / 88; object-fit: cover; border-radius: 4px; }
.flip .flip-ok { display: flex; align-items: center; gap: 6px; color: var(--good); font-weight: 700; margin: 0; }
.flip .flip-icon { font-size: 2.6rem; line-height: 1; display: flex; color: var(--accent); }
.flip h2 { font-size: 2rem; }
.flip .small { margin: 0 0 12px; color: var(--soft); }
.flip .big-btn { max-width: 340px; }
.link-btn { background: none; color: var(--soft); text-decoration: underline; padding: 8px; font-weight: 500; }
.link-btn:hover { background: none; }

.analyzing { position: fixed; inset: 0; z-index: 60; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 24px; text-align: center; }
.analyzing p { margin: 4px 0; font-weight: 600; }
.analyzing .small { color: var(--soft); font-weight: 400; }
.spinner-ring { width: 44px; height: 44px; border-radius: 50%; border: 4px solid var(--surface-2); border-top-color: var(--accent); animation: spin .9s linear infinite; margin-bottom: 10px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- the answer ---------- */
.answer-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding-top: 0; }
.the-card { --cw: min(48vw, 188px, max(120px, calc(75svh - 415px))); width: var(--cw); aspect-ratio: 63 / 88; margin: 0 auto; border-radius: 12px; overflow: hidden; background: var(--surface); box-shadow: var(--card-shadow); }
.the-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.answer { position: relative; }
.card-id { text-align: center; }
.card-id .card-name { font-weight: 700; line-height: 1.25; }
.fixcard > summary { list-style: none; cursor: pointer; font-size: .875rem; color: var(--link); text-align: center; text-decoration: underline; text-underline-offset: .18em; padding: 12px 0; margin: -10px 0; }
.fixcard > summary::-webkit-details-marker { display: none; }
.fixcard[open] { margin-bottom: 10px; }
.fixcard input[type=search] { margin: 6px 0; }
.verdict { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 2.6rem; line-height: 1; margin: 8px 0 12px; }
.verdict .i { font-size: .7em; }
.verdict.v-need { font-size: 2rem; }
.verdict.v-grade { color: var(--good); } .verdict.v-marginal { color: var(--warn); } .verdict.v-dont { color: var(--bad); } .verdict.v-need { color: var(--ink); }
.facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.facts div { flex: 1 1 30%; display: flex; flex-direction: column-reverse; align-items: center; justify-content: flex-end; background: var(--surface); border-radius: var(--r); padding: 10px 6px; text-align: center; }
.facts dd { margin: 0; font-weight: 800; font-size: 1.3rem; line-height: 1.15; white-space: nowrap; }
.facts dt { font-size: .75rem; color: var(--soft); }
.facts .pos { color: var(--good); } .facts .neg { color: var(--bad); }
.facts-note { margin: 6px 0; text-align: center; }
.reason { margin: 8px 0; }
.rows { margin: 4px 0 0; }
.row { border-bottom: 1px solid var(--line); }
.row > summary { display: grid; grid-template-columns: 84px minmax(0, 1fr) 16px; gap: 8px; align-items: center; min-height: 44px; padding: 8px 0; list-style: none; cursor: pointer; font-size: .94rem; line-height: 1.3; }
.row > summary::-webkit-details-marker { display: none; }
.row-name { margin: 0; font: inherit; font-weight: 700; letter-spacing: normal; }
.row > summary span { color: var(--soft); }
.row > summary .chev { color: var(--soft); transition: transform .2s; }
.row[open] > summary .chev { transform: rotate(90deg); }
.row-body { padding: 2px 0 14px; }
.row-body > p:first-child { margin-top: 0; }
.variant-form { margin-top: 6px; }
.service { margin: 14px 0; }
.yes-path { margin: 14px 0; padding: 12px 14px; background: var(--surface); border-radius: var(--r-s); }
.yes-path p { margin: 4px 0 0; }
.yes-path form { margin-top: 8px; }
.service-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; margin-bottom: 8px; }
.seg { display: inline-flex; background: var(--surface); border-radius: var(--r); padding: 3px; margin-bottom: 10px; }
.seg button { background: none; color: var(--soft); padding: 8px 18px; min-height: 44px; border-radius: 10px; font-size: .9rem; }
.seg button.on { background: var(--bg); color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / .15); }
.tiers { --cols: 3; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, max(6.5em, (100% - (var(--cols) - 1) * 8px) / var(--cols))), 1fr)); gap: 8px; }
.tiers:has(> .tier:nth-child(4):last-child) { --cols: 2; }  /* at most 3 (or 2) across, fewer as text grows */
.tier { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 2px; padding: 8px 10px; background: var(--surface); color: var(--ink); text-align: left; font-weight: 400; border-radius: var(--r); box-shadow: inset 0 0 0 2px transparent; }
.tier:hover { background: var(--surface-2); }
.tier .t-name { font-size: .8rem; font-weight: 600; }
.tier .t-fee { font-weight: 700; }
.tier .t-gain { font-size: .8rem; font-weight: 600; }
.tier .t-gain.pos { color: var(--good); } .tier .t-gain.neg { color: var(--bad); }
.tier.on { box-shadow: inset 0 0 0 2px var(--accent); }
.disclaimer { margin: 12px 0 2px; }
.next { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding: 10px 20px calc(10px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line); }
.next .btn { width: 100%; padding: 14px; }
body:has(.next) footer { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }

@media (max-width: 379px) { header.top { padding-left: 14px; padding-right: 14px; } header.top nav a { padding-left: 6px; padding-right: 6px; } }
@media (max-width: 339px) { .brand-name { display: none; } }
@media (max-width: 259px) {
  main { padding-inline: 12px; }
  td.num { white-space: normal; }
}
@media (max-width: 379px) { .row > summary { grid-template-columns: 74px minmax(0, 1fr) 16px; gap: 6px; font-size: .9rem; } }
@media (max-width: 680px) {
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .prices-form .fields { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 760px) {
  .answer-layout { grid-template-columns: 300px minmax(0, 1fr); gap: 36px; align-items: start; padding-top: 16px; }
  .the-card { --cw: 300px; }
  .answer-card { position: sticky; top: 16px; }
  .card-id, .fixcard > summary, .facts-note { text-align: left; }
  .verdict { justify-content: flex-start; }
  .next { position: static; padding: 0; margin: 14px 0 0; background: none; border: 0; max-width: 300px; }
  body:has(.next) footer { padding-bottom: 24px; }
}
@media (min-width: 900px) {
  .tiers, .tiers:has(> .tier:nth-child(4):last-child) { grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); }
  .home { grid-template-columns: 420px minmax(0, 1fr); column-gap: 48px; align-items: start; }
  .recent { grid-column: 2; grid-row: 1; padding-top: 18px; }
  .help { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
  .help .panel { margin: 0; }
}
/* Reduced motion: nothing turns or slides, but colour changes, the capture flash and a breathing
   spinner stay, so a 5-15 second check never looks frozen. */
@media (prefers-reduced-motion: reduce) {
  .chev { transition: none; }
  .spinner-ring { border-color: var(--accent); animation: breathe 1.2s ease-in-out infinite alternate; }
  @keyframes breathe { from { opacity: 1; } to { opacity: .35; } }
}
