/* ============================================================
   Horticulture screening: design system
   No CDN, no build step: everything must work offline in a PWA.
   ============================================================ */

:root{
  --green-900:#0b3d2c; --green-700:#12684a; --green-600:#1f7a4d; --green-100:#e6f4ec;
  --amber-500:#f0a424; --amber-100:#fdf1dc;
  --red-600:#c0392b; --red-100:#fdecea;
  --ink:#12211a; --muted:#5f7268; --line:#dfe8e2; --bg:#f4f8f5; --card:#ffffff;
  --radius:20px; --radius-sm:14px;
  --shadow-sm:0 1px 2px rgba(11,61,44,.06), 0 4px 14px rgba(11,61,44,.05);
  --shadow-md:0 10px 30px rgba(11,61,44,.10);
  --shadow-lg:0 24px 60px rgba(11,61,44,.16);
  --font:'Noto Sans Devanagari','Nirmala UI','Mangal',system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;
}

*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  background:
    radial-gradient(900px 500px at 12% -10%, #e8f5ec 0%, transparent 60%),
    radial-gradient(700px 420px at 100% 0%, #fdf3e0 0%, transparent 55%),
    var(--bg);
  color:var(--ink); font-family:var(--font); font-size:21px; line-height:1.65;
  min-height:100vh; -webkit-font-smoothing:antialiased;
}

/* ---------- top bar ---------- */
.topbar{display:flex;align-items:center;justify-content:space-between;gap:16px;
  max-width:1180px;margin:0 auto;padding:20px 20px 0}
.brand{display:flex;align-items:center;gap:12px;text-decoration:none;color:inherit}
/* the lockup is 343x96, drawn here at 44 px so a 2x screen still gets a sharp edge */
.brand img{height:44px;width:auto;display:block}
.brand-sub{font-size:17px;color:var(--muted);font-weight:500}
.ghost-link{display:inline-flex;align-items:center;gap:7px;padding:10px 15px;border-radius:999px;
  border:1px solid var(--line);background:#fff;color:var(--green-700);text-decoration:none;
  font-size:18px;font-weight:700;box-shadow:var(--shadow-sm);
  transition:transform .18s ease, box-shadow .18s ease, background .18s ease}
.ghost-link:hover{transform:translateY(-1px);box-shadow:var(--shadow-md);background:#fbfefc}

/* ---------- shell ---------- */
.shell{max-width:1180px;margin:0 auto;padding:26px 20px 70px;
  display:grid;grid-template-columns:1.02fr 1fr;gap:28px;align-items:start}

/* ---------- capture (left) ---------- */
.capture{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);
  padding:18px;box-shadow:var(--shadow-md);position:sticky;top:22px}
.dropzone{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:14px;text-align:center;cursor:pointer;min-height:430px;border-radius:var(--radius-sm);
  border:2px dashed #c9dbd1;background:linear-gradient(180deg,#fbfefc 0%,#f2f8f4 100%);
  transition:border-color .2s, background .2s, transform .2s;overflow:hidden;padding:28px}
.dropzone:hover{border-color:var(--green-600);transform:translateY(-2px)}
.dropzone.dragover{border-color:var(--green-600);background:#eaf7ef}
.dropzone.has-image{border-style:solid;border-color:var(--green-600);padding:0;cursor:default}
.dz-icon{width:78px;height:78px;border-radius:24px;display:grid;place-items:center;
  background:linear-gradient(160deg,var(--green-600),var(--green-900));color:#fff;
  box-shadow:0 12px 26px rgba(18,104,74,.28);animation:floaty 3.4s ease-in-out infinite}
.dz-title{font-size:24px;font-weight:800}
.dz-hint{font-size:18.5px;color:var(--muted);max-width:320px}
.dz-actions{display:flex;gap:10px;flex-wrap:wrap;justify-content:center;margin-top:4px}
.dz-preview{width:100%;height:100%;min-height:430px;object-fit:cover;display:block}
.dz-overlay{position:absolute;left:0;right:0;bottom:0;display:flex;gap:10px;justify-content:center;
  padding:14px;background:linear-gradient(180deg,transparent,rgba(9,32,23,.72))}
.pill-btn{display:inline-flex;align-items:center;gap:8px;border:0;cursor:pointer;padding:11px 16px;
  border-radius:999px;font-family:inherit;font-size:18.5px;font-weight:700;background:#fff;
  color:var(--green-900);box-shadow:var(--shadow-sm);transition:transform .15s ease}
.pill-btn:hover{transform:translateY(-1px)}
.pill-btn.primary{background:linear-gradient(160deg,var(--green-600),var(--green-900));color:#fff}
.pill-btn.ghost{background:rgba(255,255,255,.16);color:#fff;backdrop-filter:blur(6px)}
.tips{margin:16px 4px 0;display:grid;gap:8px}
.tip{display:flex;gap:10px;font-size:18px;color:var(--muted);align-items:flex-start}
.tip b{color:var(--ink);font-weight:700}

/* ---------- conversation (right) ---------- */
.panel{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);
  padding:26px;box-shadow:var(--shadow-md);min-height:430px}
.step{animation:fadeUp .38s cubic-bezier(.2,.7,.3,1) both}
.step[hidden]{display:none}

.dots{display:flex;gap:7px;margin-bottom:18px}
.dot{width:9px;height:9px;border-radius:999px;background:#d7e5dd;transition:all .3s}
.dot.active{background:var(--green-600);width:26px;border-radius:999px}
.dot.done{background:var(--green-600);opacity:.45}

h2.q{font-size:29px;line-height:1.4;margin:0 0 30px;font-weight:800}
p.hint{color:var(--muted);font-size:19px;margin:0 0 20px}
.hello{font-size:32px;font-weight:800;margin:0 0 10px;line-height:1.35}
.hello span{color:var(--green-700)}
p.lead{font-size:20.5px;color:#33473d;margin:0 0 18px}

/* ---------- choices ---------- */
.choices{display:grid;gap:12px}
.choices.two{grid-template-columns:1fr 1fr}
.choices.three{grid-template-columns:1fr;gap:12px}
.choice{position:relative;display:flex;align-items:center;gap:14px;text-align:left;
  padding:17px 18px;border-radius:16px;border:1.6px solid var(--line);background:#fff;
  cursor:pointer;font-family:inherit;font-size:20.5px;font-weight:700;color:var(--ink);
  box-shadow:var(--shadow-sm);width:100%;
  transition:transform .16s ease,border-color .16s ease,box-shadow .16s ease,background .16s ease}
.choice:hover{transform:translateY(-2px);border-color:#a9cbb9;box-shadow:var(--shadow-md)}
.choice:active{transform:scale(.985)}
.choice .ico{width:46px;height:46px;border-radius:14px;display:grid;place-items:center;flex:0 0 auto;
  background:var(--green-100);color:var(--green-700);font-size:26px;transition:.18s}
.choice small{display:block;font-size:17px;font-weight:500;color:var(--muted);margin-top:2px}
.choice.selected{border-color:var(--green-600);background:#f3fbf6;box-shadow:0 0 0 4px rgba(31,122,77,.12)}
.choice.selected .ico{background:var(--green-600);color:#fff}
.choice.selected .tick{opacity:1;transform:scale(1)}
.choice .tick{position:absolute;right:14px;top:14px;opacity:0;transform:scale(.6);
  transition:.2s;color:var(--green-600)}
.choices.three .choice{flex-direction:row;justify-content:flex-start;align-items:center;gap:14px;
  padding:17px 18px;font-size:23px;font-weight:800;line-height:1.25;text-align:left}
.choices.three .choice .ico{width:46px;height:46px;font-size:26px;flex:0 0 auto}
.choices.three .choice .tick{right:14px;top:50%;margin-top:-12px}

.back{width:56px;height:56px;border-radius:50%;border:1px solid var(--line);background:#fff;
  color:var(--ink);cursor:pointer;margin-top:24px;display:inline-grid;place-items:center;
  box-shadow:var(--shadow-sm);transition:transform .15s ease,background .15s ease}
.back:hover{transform:translateX(-2px);background:#eef3f8}
.back svg{width:26px;height:26px}

/* ---------- result ---------- */
.band{display:inline-flex;align-items:center;gap:9px;padding:8px 15px;border-radius:999px;
  font-size:18px;font-weight:800;letter-spacing:.2px;animation:pop .45s ease both}
.band.suspect{background:var(--red-100);color:var(--red-600)}
.band.suspect{background:linear-gradient(135deg,#fdecea,#fad7d2);color:#a5281c;
  box-shadow:0 6px 18px rgba(192,57,43,.16)}
.band.uncertain{background:linear-gradient(135deg,#fdf1dc,#fbe3ba);color:#8a5a06;
  box-shadow:0 6px 18px rgba(240,164,36,.18)}
.band.low{background:linear-gradient(135deg,#e8f8ef,#d2efe1);color:var(--green-700);
  box-shadow:0 6px 18px rgba(18,104,74,.14)}
.band.retake,.band.error{background:#eceff3;color:#475569}
.band.not_citrus{background:#eceff3;color:#475569}
.result-title{font-size:36px;font-weight:800;margin:18px 0 0;line-height:1.22;
  letter-spacing:-.015em;animation:pop .5s .05s ease both}
.result-action{font-size:20.5px;color:#33473d;margin:12px 0 0;line-height:1.6}
.meter{height:12px;border-radius:999px;background:#eef2f0;overflow:hidden;margin:10px 0 8px}
.meter>span{display:block;height:100%;border-radius:999px;
  background:linear-gradient(90deg,var(--green-600),var(--amber-500),var(--red-600));
  transition:width .8s cubic-bezier(.2,.8,.3,1)}
.meta{font-size:17.5px;color:var(--muted);margin:3px 0}
.meta b{color:var(--ink);font-variant-numeric:tabular-nums}
.list{margin:0;padding:0;list-style:none;display:grid;gap:10px}
.note{font-size:18px;color:var(--muted);font-style:italic;margin-top:14px}
.cta-row{display:flex;gap:10px;flex-wrap:wrap;margin-top:20px}
.disclaimer{font-size:16.5px;color:var(--muted);text-align:center;margin-top:22px;line-height:1.5}

/* ---------- misc ---------- */
.banner{background:var(--amber-100);border:1px solid #f1d9a8;color:#7a5308;border-radius:12px;
  padding:11px 14px;font-size:17.5px;margin:0 0 16px}
.banner code{background:#fff8e8;padding:1px 5px;border-radius:5px}
.err{color:var(--red-600);font-weight:700}

.animate-in{animation:fadeUp .4s cubic-bezier(.2,.7,.3,1) both}
@keyframes fadeUp{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:none}}
@keyframes floaty{0%,100%{transform:translateY(0)}50%{transform:translateY(-6px)}}
@keyframes spin{to{transform:rotate(360deg)}}
@keyframes pop{0%{transform:scale(.94);opacity:0}60%{transform:scale(1.015)}100%{transform:scale(1);opacity:1}}

/* ---------- responsive ---------- */
@media (max-width:920px){
  .shell{grid-template-columns:1fr;gap:18px}
  .capture{position:static}
  .dropzone{min-height:300px}
  .dz-preview{min-height:300px}
  .panel{min-height:0;padding:22px}
  .choices.two{grid-template-columns:1fr}
  .choices.three{grid-template-columns:1fr;gap:10px}
  .choices.three .choice{font-size:21px;padding:15px 16px;gap:12px}
  .choices.three .choice .ico{width:42px;height:42px;font-size:24px}
  h2.q{font-size:26px;margin-bottom:22px}
  .hello{font-size:28px}
}

/* ---------- footer ---------- */
.site-footer{text-align:center;font-size:16.5px;color:var(--muted);line-height:1.5;
  padding:0 16px 26px;max-width:640px;margin:0 auto}

/* ---------- single centred stage (public page) ---------- */
[hidden]{display:none !important}

.stage{min-height:calc(100vh - 158px);display:grid;place-items:center;padding:18px 16px 40px}
.board{display:grid;grid-template-columns:1fr;gap:20px;width:100%;max-width:430px}

.pane{background:var(--card);border:1px solid var(--line);border-radius:28px;
  box-shadow:var(--shadow-lg);padding:24px}
.pane[hidden]{display:none}

.pane-image{display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:16px;min-height:280px}
.pane-image.has-photo{min-height:0;align-items:center;gap:0;padding:12px}

/* ---------- this browser's detection history ---------- */
/* Its own block on the home screen - never nested inside the capture card, and never shown once a
   photo is in play (see handleFile/reset in app.js). */
.history-card{width:100%;background:var(--card);border:1px solid var(--line);
  border-radius:var(--radius);box-shadow:var(--shadow-md);padding:18px 20px}
.hist{width:100%;border-collapse:collapse;font-size:17.5px;table-layout:fixed}
.hist th{font-size:14.5px;text-transform:uppercase;letter-spacing:.05em;color:var(--muted);
  text-align:left;font-weight:700;padding:0 6px 7px}
.hist th:first-child{width:48px}
.hist th:last-child{width:44px;text-align:center}
.hist td{padding:8px 6px;border-top:1px solid var(--line);vertical-align:middle}
.hist tr:last-child td{border-bottom:1px solid var(--line)}
.hist .avatar{width:40px;height:40px;border-radius:10px;object-fit:cover;display:block;
  background:#eef2f6;box-shadow:0 0 0 1px var(--line)}
.hist .what{font-weight:700;color:var(--ink);line-height:1.25;overflow-wrap:anywhere}
.hist .sci{display:block;font-weight:600;font-size:15.5px;color:var(--muted);margin-top:2px}
.hist .when{color:var(--muted);white-space:nowrap;font-size:16.5px}
.hist .approve{display:grid;place-items:center}
.hist .tick{width:26px;height:26px;border-radius:50%;display:grid;place-items:center;
  background:linear-gradient(160deg,var(--green-600),var(--green-900));color:#fff;
  font-size:17px;font-weight:900;line-height:1;
  animation:tickPop .34s cubic-bezier(.2,1.6,.4,1) both}
@keyframes tickPop{0%{transform:scale(.3);opacity:0}100%{transform:scale(1);opacity:1}}
.hist .tick.wait{background:#eef3f8;color:#a8b4c0;font-size:19px;animation:none}

.big-capture{width:132px;height:132px;border-radius:50%;border:0;cursor:pointer;
  background:linear-gradient(160deg,var(--green-600),var(--green-900));color:#fff;
  display:grid;place-items:center;box-shadow:0 18px 40px rgba(18,104,74,.30);
  transition:transform .2s cubic-bezier(.2,.7,.3,1), box-shadow .2s ease}
.big-capture:hover{transform:translateY(-3px) scale(1.03);box-shadow:0 26px 52px rgba(18,104,74,.38)}
.big-capture:active{transform:scale(.965)}
.big-capture:focus-visible{outline:3px solid var(--amber-500);outline-offset:5px}

/* ---------- pan-to-position frame ---------- */
.frame{position:relative;width:100%;aspect-ratio:4/3;overflow:hidden;border-radius:22px;
  background:#0e1418;border:1px solid var(--line);cursor:move;touch-action:none;
  animation:pop .3s ease both}
/* the way forward after a verdict: centred under the photo, straddling its bottom edge */
.frame-wrap{position:relative;width:100%}
.next-dock{position:absolute;left:50%;bottom:-26px;transform:translateX(-50%);z-index:7}
.pane-image.has-photo .frame-wrap{margin-bottom:40px}
.frame-img{position:absolute;left:0;top:0;max-width:none;max-height:none;
  user-select:none;-webkit-user-drag:none;pointer-events:none;will-change:transform}

/* zoom controls, hidden once the verdict is in */
.zoom-controls{position:absolute;right:10px;top:10px;z-index:4;display:grid;gap:8px}
.frame.done .zoom-controls{display:none}
.zoom-btn{width:42px;height:42px;border-radius:50%;border:1px solid rgba(255,255,255,.55);
  background:rgba(9,32,23,.55);color:#fff;cursor:pointer;display:grid;place-items:center;
  backdrop-filter:blur(6px);box-shadow:0 6px 16px rgba(0,0,0,.30);
  transition:transform .15s ease, background .15s ease, opacity .15s ease}
.zoom-btn svg{width:20px;height:20px}
.zoom-btn:hover{background:rgba(9,32,23,.75);transform:scale(1.06)}
.zoom-btn:active{transform:scale(.94)}
.zoom-btn:disabled{opacity:.35;cursor:default;transform:none}

/* boxes drawn over the photo for the signs the model spotted */
.mark-layer{position:absolute;inset:0;pointer-events:none;z-index:3}
.mark{position:absolute;border:3px solid #fff;border-radius:10px;background:rgba(255,255,255,.04);
  animation:markIn .45s cubic-bezier(.2,.8,.3,1) both, markPulse 2.6s ease-in-out .5s infinite}
@keyframes markIn{from{opacity:0;transform:scale(.86)}to{opacity:1;transform:none}}
@keyframes markPulse{0%,100%{opacity:1}50%{opacity:.5}}

/* blinking 4-arrow hint so people know the photo can be dragged */
.drag-hint{position:absolute;top:12px;left:50%;width:34px;height:34px;border-radius:50%;
  display:grid;place-items:center;background:rgba(9,32,23,.55);color:#fff;
  backdrop-filter:blur(4px);pointer-events:none;transform:translateX(-50%);
  animation:hintBlink 1.5s ease-in-out infinite}
.drag-hint.gone{display:none}
@keyframes hintBlink{
  0%,100%{opacity:.3;transform:translateX(-50%) scale(.92)}
  50%    {opacity:1;  transform:translateX(-50%) scale(1.08)}
}

/* big delete button overlapping the bottom-left of the photo */
.frame-delete{position:absolute;left:12px;bottom:12px;width:58px;height:58px;border-radius:50%;
  border:0;cursor:pointer;background:rgba(192,57,43,.94);color:#fff;
  display:grid;place-items:center;box-shadow:0 10px 24px rgba(0,0,0,.38);
  transition:transform .15s ease, background .15s ease}
.frame-delete:hover{transform:scale(1.07);background:#c0392b}
.frame-delete:active{transform:scale(.95)}

/* big primary action */
.btn-check{width:100%;padding:20px;border:0;border-radius:18px;cursor:pointer;font-family:inherit;
  font-size:24px;font-weight:800;color:#fff;letter-spacing:.3px;
  background:linear-gradient(160deg,var(--green-600),var(--green-900));
  box-shadow:0 12px 28px rgba(18,104,74,.30);transition:transform .15s ease, box-shadow .15s ease}
.btn-check:hover{transform:translateY(-2px);box-shadow:0 16px 34px rgba(18,104,74,.36)}
.btn-check:active{transform:scale(.98)}

/* the only way forward once a result is on screen - a round button under the photo.
   The thick light ring is deliberate: the button sits on top of a photo whose colour nobody controls,
   so the icon has to read against dark soil, bright leaf and pale sky alike. */
.btn-next{width:72px;height:72px;padding:0;border-radius:50%;
  border:4px solid #fff;
  display:grid;place-items:center;
  background:linear-gradient(160deg,var(--green-600),var(--green-900));
  box-shadow:0 0 0 1px rgba(9,32,23,.30), 0 10px 26px rgba(9,32,23,.42);
  transition:transform .18s cubic-bezier(.2,.7,.3,1), box-shadow .18s ease}
.btn-next:hover{transform:translateY(-2px) scale(1.03);
  box-shadow:0 0 0 1px rgba(9,32,23,.30), 0 16px 34px rgba(9,32,23,.50)}
.btn-next:active{transform:scale(.96)}
.btn-next:focus-visible{outline:3px solid var(--amber-500);outline-offset:4px}
.btn-next svg{width:34px;height:34px}
.pane-flow{display:flex;flex-direction:column}
.pane-flow .step{flex:1;display:flex;flex-direction:column}
#stepResult{gap:22px}

/* once a verdict is on screen the photo is fixed in place */
.frame.done{cursor:default}
.frame.done .frame-delete{display:none}

/* one plain message instead of a verdict: big icon, then the line */
#resultBody.is-plain{flex:1;display:flex;flex-direction:column}
.plain{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:18px;text-align:center;padding:24px 4px}
.plain-icon{font-size:88px;line-height:1;animation:pop .4s ease both}
.plain-text{font-size:27px;font-weight:800;line-height:1.45;color:var(--ink);margin:0}

.meta-label{font-size:16.5px;font-weight:800;color:var(--muted);letter-spacing:.2px;margin:18px 0 6px}

/* ============================================================
   The scan control: a sensing instrument, not a button
   ============================================================ */
.step-center{align-items:center;justify-content:center;text-align:center}

.btn-scan{position:relative;width:248px;height:248px;border:0;padding:0;background:none;
  cursor:pointer;display:grid;place-items:center;border-radius:50%}
.btn-scan:focus-visible{outline:3px solid var(--amber-500);outline-offset:6px}

/* rotating radar sweep behind the rings - only when ready (see .is-ready below) */
.btn-scan::before{content:'';position:absolute;inset:4%;border-radius:50%;pointer-events:none;
  -webkit-mask:radial-gradient(circle,transparent 46%,#000 47%);
          mask:radial-gradient(circle,transparent 46%,#000 47%)}
@keyframes radarSpin{to{transform:rotate(360deg)}}

.scan-rings{position:absolute;inset:0;border-radius:50%;pointer-events:none}
.scan-rings i{position:absolute;inset:0;border-radius:50%;border:2.5px solid rgba(31,157,111,.62)}
@keyframes ringPulse{
  0%  {transform:scale(.62);opacity:1}
  70% {opacity:.28}
  100%{transform:scale(1.06);opacity:0}
}

.scan-core{position:relative;width:156px;height:156px;border-radius:50%;display:grid;place-items:center;
  transition:transform .22s cubic-bezier(.2,.7,.3,1), box-shadow .22s ease}
.scan-core svg{width:86px;height:86px;filter:drop-shadow(0 3px 10px rgba(0,0,0,.35))}
@keyframes corePulse{
  0%,100%{box-shadow:0 24px 56px rgba(12,86,60,.45), inset 0 0 32px rgba(255,255,255,.20),
                     0 0 0 8px rgba(255,255,255,.55), 0 0 0 9px rgba(31,157,111,.16)}
  50%    {box-shadow:0 26px 64px rgba(12,86,60,.55), inset 0 0 40px rgba(255,255,255,.28),
                     0 0 0 8px rgba(255,255,255,.55), 0 0 0 13px rgba(31,157,111,.10)}
}

/* INERT until the photo has been positioned: monochrome, motionless, not clickable. */
.btn-scan:not(.is-ready){cursor:not-allowed}
.btn-scan:not(.is-ready) .scan-core{background:linear-gradient(165deg,#d5ded9,#a7b4ae);color:#f2f6f4;
  box-shadow:0 10px 24px rgba(20,35,28,.12), inset 0 0 20px rgba(255,255,255,.30)}
.btn-scan:not(.is-ready) .scan-rings i{opacity:0}
.btn-scan:not(.is-ready)::before{background:none}

/* Arming: a ring sweeps from red to green as the control powers up. */
.btn-scan.is-arming{cursor:progress}
.btn-scan.is-arming .scan-core{
  color:#fff;
  background:radial-gradient(circle at 32% 24%,#e88a7f,#b03a2c 55%,#6d1f16 100%);
  box-shadow:0 18px 44px rgba(176,58,44,.34), inset 0 0 26px rgba(255,255,255,.18);
  animation:armGreen 700ms cubic-bezier(.4,.1,.2,1) forwards}
@keyframes armGreen{
  0%  {background:radial-gradient(circle at 32% 24%,#e88a7f,#b03a2c 55%,#6d1f16 100%)}
  55% {background:radial-gradient(circle at 32% 24%,#e8d27f,#b0842c 55%,#6d4c16 100%)}
  100%{background:radial-gradient(circle at 32% 24%,#48e6a6,#12805a 56%,#07301f 100%)}
}
.btn-scan.is-arming::before{
  background:conic-gradient(from 0deg,rgba(192,57,43,.85) 0deg,rgba(240,164,36,.85) 140deg,
    rgba(61,220,154,.9) 280deg,rgba(192,57,43,.85) 360deg);
  animation:radarSpin 900ms linear 1}
.btn-scan.is-arming .scan-rings i{animation:ringPulse 900ms cubic-bezier(.2,.7,.3,1) 1;opacity:1}

/* once the farmer drags the photo into place it turns green - but stays still */
.btn-scan.is-ready .scan-core{
  color:#fff;background:radial-gradient(circle at 32% 24%,#48e6a6,#12805a 56%,#07301f 100%);
  box-shadow:0 24px 56px rgba(12,86,60,.45), inset 0 0 32px rgba(255,255,255,.20),
             0 0 0 8px rgba(255,255,255,.55), 0 0 0 9px rgba(31,157,111,.16)}
.btn-scan.is-ready:hover .scan-core{transform:scale(1.04)}

/* motion only once it is clicked, and only on the button */
.btn-scan.is-scanning .scan-core{animation:corePulse 1.6s ease-in-out infinite}
.btn-scan.is-scanning::before{
  background:conic-gradient(from 0deg,rgba(61,220,154,0) 0deg,rgba(61,220,154,.10) 240deg,
    rgba(61,220,154,.55) 350deg,rgba(61,220,154,0) 360deg);
  animation:radarSpin 1.1s linear infinite}
.btn-scan.is-scanning .scan-rings i{animation:ringPulse 1.5s cubic-bezier(.2,.7,.3,1) infinite;opacity:1}
.btn-scan.is-scanning .scan-rings i:nth-child(2){animation-delay:.5s}
.btn-scan.is-scanning .scan-rings i:nth-child(3){animation-delay:1s}
.btn-scan.is-scanning{cursor:progress}

.btn-scan:not(.is-ready):hover .scan-core,
.btn-scan:not(.is-ready):active .scan-core{transform:none}
.btn-scan.is-ready:active .scan-core{transform:scale(.97)}
/* ============================================================
   While analysing: a beam sweeps the photo, stages tick over
   ============================================================ */
.frame.scanning::after{content:'';position:absolute;left:0;right:0;height:26%;pointer-events:none;
  background:linear-gradient(to bottom,rgba(61,220,154,0) 0%,rgba(61,220,154,.30) 42%,
    rgba(61,220,154,.85) 50%,rgba(61,220,154,.30) 58%,rgba(61,220,154,0) 100%);
  box-shadow:0 0 26px rgba(61,220,154,.55);animation:beamSweep 1.7s ease-in-out infinite}
@keyframes beamSweep{0%{transform:translateY(-45%)}100%{transform:translateY(345%)}}

.frame.flash::after{content:'';position:absolute;inset:0;pointer-events:none;background:#fff;
  animation:flashOut .5s ease-out forwards}
@keyframes flashOut{0%{opacity:.85}100%{opacity:0}}

.pipe-title{font-size:20px;font-weight:800;color:var(--ink);margin:0 0 16px}

/* overall progress, so the list is not the only signal */
.pipe-bar{width:100%;max-width:360px;height:6px;border-radius:999px;background:#e9f0ec;
  overflow:hidden;margin:0 0 20px}
.pipe-bar>span{display:block;height:100%;width:0;border-radius:999px;
  background:linear-gradient(90deg,var(--green-600),#3ddc9a);
  box-shadow:0 0 12px rgba(61,220,154,.55);
  transition:width .5s cubic-bezier(.2,.8,.3,1)}
.pipe{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:14px;
  text-align:left;width:100%;max-width:360px}
.pipe li{display:flex;align-items:flex-start;gap:12px;font-size:19.5px;line-height:1.35;
  color:var(--muted);opacity:.34;transition:opacity .35s ease, color .35s ease}
.pipe li.active{opacity:1;color:var(--ink);font-weight:700}
.pipe li.done{opacity:1;color:#1e7d55;font-weight:600}
.pipe .dot{flex:none;width:20px;height:20px;margin-top:2px;border-radius:50%;border:2px solid currentColor;
  display:grid;place-items:center;font-size:15px;line-height:1;font-weight:900}
.pipe li.done .dot{background:currentColor}
.pipe li.done .dot::after{content:'✓';color:#fff;font-size:16px}
.pipe li.active .dot{border-style:solid;background:currentColor;
  box-shadow:0 0 0 0 rgba(30,125,85,.55);animation:dotPulse 1.2s ease-out infinite}
@keyframes dotPulse{
  0%  {box-shadow:0 0 0 0 rgba(30,125,85,.55)}
  70% {box-shadow:0 0 0 9px rgba(30,125,85,0)}
  100%{box-shadow:0 0 0 0 rgba(30,125,85,0)}
}

/* the technical stage name, then the plain-language observation under it */
.st-main{display:block;font-size:17.5px;font-weight:800;letter-spacing:.055em;line-height:1.3}
.st-meta{display:block;margin-top:4px;font-style:normal;font-weight:500;text-transform:none;
  font-size:15.5px;letter-spacing:.01em;color:var(--muted);opacity:.95;line-height:1.5;
  word-break:break-word}

/* ---------- the report card reveals one block at a time, driven by JS ---------- */
#resultBody > *{animation:none}
#resultBody > .pending{opacity:0}
#resultBody > .revealed{animation:riseIn .5s cubic-bezier(.2,.8,.3,1) both}
@keyframes riseIn{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:none}}

/* the argument an expert would make */
.defence .decisive{font-size:21.5px;font-weight:800;color:var(--ink);margin:0 0 16px;line-height:1.5}
.defence .decisive b{color:var(--green-700)}
.disc{margin-top:12px;padding:15px 17px;border-radius:15px;background:#f7faf8;
  border:1px solid var(--line)}
.disc-name{display:block;font-size:16px;font-weight:800;letter-spacing:.05em;text-transform:uppercase;
  color:#8a5a06;margin-bottom:7px}
.disc-why{display:block;font-size:18.5px;color:#33473d;line-height:1.62}
.crit li.is-decisive{color:var(--green-900);font-weight:800}
.crit li.is-decisive .tick{font-size:19px}

/* section label: a ring spins up, hands over to the tick box, then the text settles.
   Two pseudo-elements so the circle and the check are separate beats, not one pop. */
.rlabel{position:relative;display:block;padding-left:30px;
  font-size:15.5px;font-weight:800;letter-spacing:.06em;text-transform:uppercase;
  color:var(--muted);margin:0 0 10px;line-height:20px}

.rlabel::before{                        /* phase 1: the working circle */
  content:'';position:absolute;left:0;top:0;width:20px;height:20px;border-radius:50%;
  background:conic-gradient(from 0deg,
    rgba(31,157,111,0) 0deg, rgba(31,157,111,.15) 180deg,
    rgba(31,157,111,.95) 330deg, rgba(31,157,111,0) 360deg);
  -webkit-mask:radial-gradient(farthest-side,transparent calc(100% - 3px),#000 calc(100% - 2px));
          mask:radial-gradient(farthest-side,transparent calc(100% - 3px),#000 calc(100% - 2px));
  animation:labelSpin .7s linear both, labelRingOut .22s ease .7s forwards}

.rlabel::after{                         /* phase 2: the tick box it hands over to */
  content:'✓';position:absolute;left:0;top:0;width:20px;height:20px;border-radius:6px;
  display:grid;place-items:center;font-size:16px;font-weight:900;line-height:1;color:#fff;
  background:linear-gradient(160deg,var(--green-600),var(--green-900));
  box-shadow:0 3px 8px rgba(18,104,74,.28);
  /* base state is VISIBLE: if animation never runs, the tick still appears */
  opacity:1;transform:none;
  animation:labelTick .46s cubic-bezier(.2,1.7,.4,1) .62s backwards}

@keyframes labelSpin{to{transform:rotate(360deg)}}
@keyframes labelRingOut{to{opacity:0;transform:scale(.7)}}
@keyframes labelTick{
  0%  {opacity:0;transform:scale(.15) rotate(-25deg)}
  70% {opacity:1;transform:scale(1.18) rotate(4deg)}
  100%{opacity:1;transform:scale(1) rotate(0)}
}

/* the confidence sentence: a coloured card, no heading */
.conf-card{font-size:21px;font-weight:800;line-height:1.55;margin:24px 0 0;padding:18px 20px;
  border-radius:18px;border-left:6px solid currentColor;
  animation:riseIn .55s cubic-bezier(.2,.8,.3,1) both}
.conf-card.high{color:#0f6b4a;background:linear-gradient(120deg,#e9f9f0,#f7fdfa)}
.conf-card.mid{color:#8a5a06;background:linear-gradient(120deg,#fdf4e3,#fffdf7)}
.conf-card.low{color:#a5281c;background:linear-gradient(120deg,#fdeeea,#fffaf8)}

/* a relationship sentence: quiet, bordered, no title */
.note-card{font-size:19.5px;line-height:1.65;color:#2f4a3d;margin:20px 0 0;padding:16px 18px;
  border-radius:16px;background:#f6faf8;border:1px dashed #cfe0d6;
  animation:riseIn .55s cubic-bezier(.2,.8,.3,1) both}

/* typewriter caret */
.typing::after{content:'▌';margin-left:2px;opacity:.85;animation:caret .75s steps(1) infinite}
@keyframes caret{0%,49%{opacity:.85}50%,100%{opacity:0}}

/* ticks arrive one after another */
.crit li{animation:tickIn .4s cubic-bezier(.2,.8,.3,1) both}
.crit li:nth-child(1){animation-delay:.05s}
.crit li:nth-child(2){animation-delay:.13s}
.crit li:nth-child(3){animation-delay:.21s}
.crit li:nth-child(4){animation-delay:.29s}
@keyframes tickIn{from{opacity:0;transform:translateX(-6px)}to{opacity:1;transform:none}}

/* the legend for the boxes on the photo */
.legend{list-style:none;margin:0;padding:0;display:grid;gap:10px}
.legend li{display:flex;align-items:center;gap:11px;font-size:18.5px;color:#33473d;line-height:1.45}
.swatch{flex:none;width:15px;height:15px;border-radius:5px;
  box-shadow:0 0 0 2px #fff, 0 3px 10px rgba(11,61,44,.22)}

/* ---------- the report card ---------- */
.rblock{margin-top:24px;padding-top:20px;border-top:1px solid var(--line)}
/* (label styling lives with the animation, above) */

.signs{font-size:23px;font-weight:700;color:var(--ink);margin:0;line-height:1.55}
.signs-keys{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-size:15.5px;color:var(--muted);margin:6px 0 0;letter-spacing:.02em;opacity:.85;
  word-break:break-word}

/* why the model decided - its own signs */
.ev{list-style:none;margin:0;padding:0;display:grid;gap:7px}
.ev li{position:relative;padding-left:18px;font-size:18.5px;color:#33473d;line-height:1.5}
.ev li::before{content:'•';position:absolute;left:3px;color:var(--green-600);font-weight:900}

/* what it can be mistaken for */
.confuse{font-size:17px;color:var(--muted);margin:12px 0 0;line-height:1.55}
.confuse b{color:#3d5147;font-weight:800}

/* species - genus-level certainty, and it says so */
.species{font-size:22px;font-weight:800;color:var(--ink);margin:0;line-height:1.5}
.species-note{font-size:16px;color:var(--muted);margin:7px 0 0;line-height:1.5}

/* the reference signs, ticked when the photo actually contained them */
.crit{list-style:none;margin:0;padding:0;display:grid;gap:7px}
.crit li{display:flex;gap:12px;align-items:flex-start;font-size:19.5px;color:var(--muted);line-height:1.55}
.crit li.is-hit{color:var(--ink);font-weight:600}
.crit .tick{flex:none;width:17px;text-align:center;font-weight:900;color:#b9c7c0}
.crit li.is-hit .tick{color:var(--green-700)}
.crit-note{font-size:16px;color:var(--muted);margin:10px 0 0;line-height:1.5}

/* the instruction, after the reasoning */
.advice{font-size:20px;font-weight:700;color:var(--green-700);margin:0;line-height:1.55}

/* how strongly the photo supports the answer */
.conf{font-size:18.5px;color:#33473d;margin:0;line-height:1.55}

/* a question instead of a verdict - large, unmissable, and nothing else on screen */
.ask-card{display:grid;gap:20px;padding:8px 0;animation:riseIn .5s cubic-bezier(.2,.8,.3,1) both}
.ask-q{font-size:27px;font-weight:800;line-height:1.42;color:var(--ink);margin:0}
.ask-opts{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.ask-opts-3{grid-template-columns:repeat(3,1fr)}
.ask-btn{padding:22px 10px;border-radius:18px;border:2px solid #cfe6da;background:#fff;
  cursor:pointer;font-family:inherit;font-size:20.5px;font-weight:800;color:var(--ink);
  box-shadow:0 8px 20px rgba(11,61,44,.07);
  transition:border-color .16s ease, background .16s ease, transform .16s ease, box-shadow .16s ease}
.ask-btn:hover{border-color:var(--green-700);background:#effaf4;transform:translateY(-2px);
  box-shadow:0 14px 28px rgba(11,61,44,.13)}
.ask-btn:active{transform:scale(.97)}

/* a shortlist the photo cannot rank - resolved in place by one tap */
.diff-card{margin-top:24px;padding:20px 18px;border-radius:22px;
  background:linear-gradient(180deg,#f3fbf6 0%,#ffffff 100%);
  border:1px solid #d7ece1;box-shadow:0 8px 22px rgba(11,61,44,.06)}
.diff-names{font-size:21px;font-weight:800;color:var(--ink);margin:0;line-height:1.6}

.age-ask{margin-top:18px}
.age-q{font-size:17.5px;font-weight:800;color:#33473d;margin:0 0 10px}
.age-opts{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.age-btn{padding:16px 8px;border-radius:15px;border:2px solid #cfe6da;background:#fff;
  cursor:pointer;font-family:inherit;font-size:18.5px;font-weight:700;color:var(--ink);line-height:1.3;
  transition:border-color .16s ease, background-color .16s ease, box-shadow .16s ease}
.age-btn:hover{border-color:var(--green-700);background:#effaf4;
  box-shadow:0 6px 16px rgba(11,61,44,.10)}
.age-btn:active{box-shadow:inset 0 2px 6px rgba(11,61,44,.12)}
.age-btn:disabled{opacity:.45;cursor:default}
.age-note{font-size:17px;color:#3d5147;margin:0;line-height:1.5}

/* findings */
.list li{display:block;padding:15px 17px;border:1px solid var(--line);border-radius:16px;
  background:#fff;margin-bottom:10px}
.list li:last-child{margin-bottom:0}
.li-name{font-size:19.5px;font-weight:800;color:var(--ink)}
.li-pct{font-size:17px;font-weight:700;color:var(--muted);margin-left:8px;font-variant-numeric:tabular-nums}
.li-advice{display:block;font-size:17.5px;color:#33473d;margin-top:6px;line-height:1.5}

.pipe-tech{font-size:16.5px;color:var(--muted);margin:26px 0 0;font-variant-numeric:tabular-nums;
  letter-spacing:.2px}

.tech-line{font-size:15.5px;color:var(--muted);opacity:.75;margin:26px 0 0;
  font-variant-numeric:tabular-nums;letter-spacing:.2px}

.steps .step{text-align:left}

/* large screens: photo on the left, questions on the right */
@media (min-width:920px){
  .board.has-photo{max-width:1240px;grid-template-columns:1.15fr .85fr;align-items:start;gap:34px}
  .pane-flow{position:sticky;top:24px;min-height:440px}
}


/* ---------- capture chooser (both options appear together) ---------- */
.modal{position:fixed;inset:0;z-index:60;display:grid;place-items:center;padding:20px;
  background:rgba(9,32,23,.55);backdrop-filter:blur(3px);animation:fadeIn .18s ease both}
.modal[hidden]{display:none}
.modal-card{display:flex;gap:24px;animation:pop .22s cubic-bezier(.2,.7,.3,1) both}

/* Rectangle tiles, icon only. The border is always 2px and nothing moves on hover -
   only colour and shadow change, so the cards never shift under the pointer. */
.pick-option{position:relative;width:248px;height:152px;padding:0;cursor:pointer;background:#fff;
  border:2px solid var(--rim, var(--line));border-radius:26px;box-shadow:var(--shadow-lg);
  display:flex;align-items:center;justify-content:center;
  transition:border-color .18s ease, box-shadow .18s ease, background-color .18s ease}
.pick-option#pickCamera{--accent:#12684a;--rim:rgba(18,104,74,.22);--halo:rgba(18,104,74,.16)}
.pick-option#pickFile{--accent:#b8860b;--rim:rgba(184,134,11,.26);--halo:rgba(184,134,11,.20)}

.pick-option:hover{border-color:var(--accent);background:#fffefb;
  box-shadow:0 26px 56px rgba(9,32,23,.30), 0 0 0 5px var(--halo)}
.pick-option:active{box-shadow:0 14px 30px rgba(9,32,23,.26), 0 0 0 5px var(--halo)}
.pick-option:focus-visible{outline:3px solid var(--amber-500);outline-offset:4px}

.pick-option .ico{display:grid;place-items:center;background:none;color:var(--accent);
  transition:color .18s ease, opacity .2s ease}
.pick-option .ico svg{width:96px;height:96px;stroke-width:1.5;display:block}

/* while the OS file dialog is spawning: a light sweeps around the tile border, the icon breathes */
.pick-option.is-waiting{border-color:transparent}
.pick-option.is-waiting .ico{opacity:.22;animation:icoPulse 1.4s ease-in-out infinite}
@keyframes icoPulse{0%,100%{opacity:.16;transform:scale(.97)}50%{opacity:.5;transform:scale(1.02)}}

.pick-option.is-waiting::after{
  content:'';position:absolute;inset:-3px;border-radius:29px;pointer-events:none;
  background:conic-gradient(from 0deg,
    rgba(18,104,74,0) 0deg, rgba(18,104,74,0) 200deg,
    var(--accent) 320deg, rgba(18,104,74,0) 360deg);
  -webkit-mask:radial-gradient(farthest-side,transparent calc(100% - 4px),#000 calc(100% - 3px));
          mask:radial-gradient(farthest-side,transparent calc(100% - 4px),#000 calc(100% - 3px));
  animation:pickSweep 1.15s linear infinite}
@keyframes pickSweep{to{transform:rotate(360deg)}}

@keyframes fadeIn{from{opacity:0}to{opacity:1}}

@media (max-width:600px){
  .modal-card{flex-direction:column;gap:18px}
  .pick-option{width:min(78vw,300px);height:124px;border-radius:22px}
  .pick-option .ico svg{width:76px;height:76px}
  /* the lockup is much wider than the square icon it replaced, so it steps down here */
  .topbar{gap:10px;padding:16px 16px 0}
  .brand img{height:34px}
  .ghost-link{padding:9px 13px;font-size:17.5px}
}



