:root {
  --bg: #0a0d0b;
  --surface: #141a16;
  --surface-2: #1c2420;
  --line: rgba(255, 255, 255, .08);
  --ink: #f4efe4;
  --muted: #9aa69f;
  --accent: #eab54d;
  --accent-deep: #c98f24;
  --ok: #5fc39b;
  --serif: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", "Noto Serif", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.3, 1.4, .5, 1);
  --sab: env(safe-area-inset-bottom, 0px);
  --sat: env(safe-area-inset-top, 0px);
  --dock: 72px;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; background: #050706; }
body { margin: 0; background: #050706; color: var(--ink); font: 16px/1.4 var(--sans); -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; text-align: inherit; }
a { color: var(--accent); text-decoration: none; font-weight: 600; }
svg { width: 24px; height: 24px; flex: none; }
img { display: block; }
[hidden] { display: none !important; }
/* the photo inputs stay in the page (just invisible): phones can ignore the first tap aimed at a display:none file input */
.file-in { position: fixed; left: -100px; top: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.app { position: relative; min-height: 100dvh; background: var(--bg); overflow-x: clip; }
.view { display: none; min-height: 100dvh; padding-bottom: calc(var(--dock) + var(--sab) + 40px); }
body[data-view="home"] #home, body[data-view="scan"] #scan, body[data-view="birds"] #birds { display: block; }
body[data-view="crop"] #crop, body[data-view="listen"] #listen { display: flex; }
body[data-view="crop"] .dock, body[data-view="scan"] .dock, body[data-view="listen"] .dock { display: none; }

.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); }
h2 { font: 600 22px/1.15 var(--serif); letter-spacing: -.01em; }
.sci { font-style: italic; color: var(--muted); }

/* ---------- hero ---------- */
.hero { position: relative; height: min(80dvh, 720px); min-height: 540px; overflow: hidden; display: flex; flex-direction: column; isolation: isolate; }
.hero-media { position: absolute; inset: 0; z-index: -3; background: #0d1410; }
.hero-media video { width: 100%; height: 100%; object-fit: cover; }
.slide { position: absolute; inset: 0; background-size: cover; background-position: center 22%; opacity: 0; transition: opacity 1.8s ease; will-change: opacity, transform; }
.slide.on { opacity: 1; }
.slide.drift-a { animation: driftA 9s linear both; }
.slide.drift-b { animation: driftB 9s linear both; }
@keyframes driftA { from { transform: scale(1.02) translate3d(-1%, 0, 0); } to { transform: scale(1.1) translate3d(1%, -1%, 0); } }
@keyframes driftB { from { transform: scale(1.1) translate3d(1%, -1%, 0); } to { transform: scale(1.02) translate3d(-1%, 0, 0); } }
.hero-scrim { position: absolute; inset: 0; z-index: -1; background:
  linear-gradient(to bottom, rgba(5, 8, 6, .5) 0%, rgba(5, 8, 6, 0) 16%, rgba(5, 8, 6, 0) 46%, rgba(10, 13, 11, .8) 70%, var(--bg) 96%); }


.top { display: flex; align-items: center; justify-content: space-between; padding: calc(var(--sat) + 18px) 20px 0; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .01em; text-shadow: 0 1px 12px rgba(0, 0, 0, .5); }
.brand svg { color: var(--accent); width: 26px; height: 26px; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 12px 0 9px; border-radius: 99px; font-size: 13px; font-weight: 700;
  background: rgba(20, 26, 22, .55); backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4); border: 1px solid var(--line); }
.chip svg { width: 16px; height: 16px; color: var(--accent); }
.top-right { display: flex; gap: 8px; }
#installBtn { padding: 0 14px; color: var(--ink); }
.backup { display: flex; flex-wrap: wrap; gap: 0 6px; margin-top: 6px; }
.field { width: 100%; height: 54px; padding: 0 20px; border-radius: 99px; background: rgba(255, 255, 255, .06); border: 1px solid var(--line); color: var(--ink); font: inherit; font-size: 16px; outline: 0; }
.field:focus { border-color: var(--accent); }
.field::placeholder { color: var(--muted); }
.account-msg { min-height: 18px; padding: 0 8px; font-size: 13px; color: var(--accent); }
.backup .link { padding: 6px 12px 6px 0; }

.hero-copy { margin-top: auto; padding: 0 20px 20px; }
.hero h1 { font: 500 clamp(44px, 13.500vw, 62px)/.98 var(--serif); letter-spacing: -.035em; margin: 10px 0 18px; text-wrap: balance; }
.hero h1 em, .listen-body h1 em { font-style: italic; padding-right: .08em; background: linear-gradient(100deg, #f8dc94, var(--accent) 45%, var(--accent-deep)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.btn:active, .ghost:active { transform: scale(.965); }
.slide-cta { position: relative; height: 68px; border-radius: 99px; overflow: hidden; touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: grab; outline-offset: 3px;
  background: rgba(16, 20, 17, .6); border: 1px solid rgba(234, 181, 77, .45); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 10px 34px rgba(234, 181, 77, .18); }
.slide-cta:active { cursor: grabbing; }
/* the scan slider shares its row with a round shortcut to the photo library */
.cta-row { display: flex; gap: 10px; align-items: center; }
.cta-row .slide-cta { flex: 1; min-width: 0; }
.cta-row .slide-chev { display: none; } /* the narrower slider has no room for the arrows beside its label */
.cta-row .slide-label { padding-left: 58px; }
.round { flex: none; width: 68px; height: 68px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .16);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); transition: transform .18s var(--spring); }
.round svg { width: 24px; height: 24px; }
.round:active { transform: scale(.92); }
.slide-fill { position: absolute; left: 0; top: 0; bottom: 0; width: calc(68px + var(--x, 0px)); border-radius: 99px; background: linear-gradient(90deg, rgba(234, 181, 77, .12), rgba(234, 181, 77, .55)); opacity: var(--k, 0); }
.slide-label { position: absolute; inset: 0; display: grid; place-items: center; padding-left: 44px; font-weight: 700; font-size: 17px; letter-spacing: -.01em; opacity: calc(1 - var(--k, 0) * 1.8);
  background: linear-gradient(100deg, rgba(244, 239, 228, .55) 30%, #fff 50%, rgba(244, 239, 228, .55) 70%) 0 0 / 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 2.6s linear infinite; }
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -130% 0; } }
.slide-chev { position: absolute; right: 22px; top: 0; bottom: 0; display: grid; place-items: center; color: var(--accent); opacity: calc(.7 - var(--k, 0)); }
.slide-chev svg { width: 30px; height: 20px; }
.slide-knob { position: absolute; left: 6px; top: 6px; transform: translateX(var(--x, 0px)); background: linear-gradient(135deg, #f6cf74, var(--accent) 45%, var(--accent-deep)); color: #1d1400; box-shadow: 0 6px 20px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .5); }
.slide-knob::before, .slide-knob::after { border-color: var(--accent); }
.settling .slide-knob { transition: transform .5s var(--spring); }
.settling .slide-fill { transition: width .5s var(--spring), opacity .4s; }
.nudge .slide-knob { animation: nudge .7s var(--ease); }
@keyframes nudge { 35% { transform: translateX(46px); } }
.link { color: var(--accent); font-size: 13px; font-weight: 600; padding: 6px 0 6px 12px; }
.cta-ring { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.cta-ring::before, .cta-ring::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid; animation: ping 2.400s ease-out infinite; }
.cta-ring::after { animation-delay: 1.200s; }
@keyframes ping { from { transform: scale(1); opacity: .55; } to { transform: scale(1.75); opacity: 0; } }
.ghost { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 48px; margin-top: 10px; border-radius: 99px; font-weight: 600; font-size: 15px;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); transition: transform .18s var(--spring); }
.ghost svg { width: 20px; height: 20px; }
/* the sound slider: the same gold control, a little slimmer so scanning stays the main action */
.slide-cta.sound { height: 56px; margin-top: 10px; }
.sound .slide-fill { width: calc(56px + var(--x, 0px)); }
.sound .slide-knob { width: 44px; height: 44px; left: 5px; top: 5px; }
.sound .slide-knob svg { width: 21px; height: 21px; }
.sound .slide-label { font-size: 15px; padding-left: 34px; }
.sound .slide-chev svg { width: 26px; height: 17px; }
.hero-caption { position: absolute; right: 20px; top: calc(var(--sat) + 62px); font-size: 11px; letter-spacing: .04em; color: rgba(255, 255, 255, .7); text-shadow: 0 1px 8px rgba(0, 0, 0, .7); transition: opacity .6s; }

/* ---------- home sections ---------- */
#home section:not(.hero) { margin-top: 34px; }
#home h2, .row-head { padding: 0 20px; }
.row-head { display: flex; align-items: baseline; justify-content: space-between; }
#home .row-head h2 { padding: 0; }
.row-head a { font-size: 13px; }

.life-card { display: flex; align-items: center; gap: 16px; width: calc(100% - 32px); margin: 6px 16px 0; padding: 16px; border-radius: 24px;
  background: linear-gradient(140deg, #1b241f, #121814); border: 1px solid var(--line); box-shadow: 0 20px 50px rgba(0, 0, 0, .4); transition: transform .18s var(--spring); }
.life-card:active { transform: scale(.98); }
.life-text { flex: 1; min-width: 0; }
.life-text b { display: block; font: 600 20px/1.2 var(--serif); margin-top: 3px; }
.life-text small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.life-card .go { color: var(--muted); width: 20px; height: 20px; }

.ring { position: relative; display: grid; place-items: center; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke: rgba(255, 255, 255, .1); stroke-width: 5; }
.ring .v { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 176; stroke-dashoffset: 176; transition: stroke-dashoffset 1.200s var(--ease); }
.ring b { position: absolute; font-variant-numeric: tabular-nums; }
.ring.big { width: 68px; height: 68px; }
.ring.big b { font: 600 22px var(--serif); }

.strip { display: flex; gap: 12px; overflow-x: auto; padding: 14px 20px 6px; scroll-snap-type: x proximity; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.strip::-webkit-scrollbar { display: none; }
.tile { position: relative; flex: none; width: 148px; height: 196px; border-radius: 20px; overflow: hidden; scroll-snap-align: start; background: var(--surface); transition: transform .18s var(--spring); }
.tile:active { transform: scale(.96); }
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0, 0, 0, .82), transparent 55%); }
.tile .cap { position: absolute; left: 12px; right: 12px; bottom: 11px; z-index: 1; }
.tile b { display: block; font-size: 14px; line-height: 1.2; }
.tile small { color: rgba(255, 255, 255, .7); font-size: 12px; }
.tile .pill { position: absolute; top: 10px; left: 10px; z-index: 1; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 99px; background: rgba(0, 0, 0, .55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.badge { position: absolute; top: 8px; right: 8px; z-index: 1; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #1d1400; display: grid; place-items: center; box-shadow: 0 2px 8px rgba(0, 0, 0, .4); }
.badge svg { width: 13px; height: 13px; }

.feature { position: relative; display: block; width: calc(100% - 32px); margin: 14px 16px 0; aspect-ratio: 4 / 3; border-radius: 26px; overflow: hidden; background: var(--surface); transition: transform .18s var(--spring); }
.feature:active { transform: scale(.98); }
.feature img { width: 100%; height: 100%; object-fit: cover; }
.feature::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0, 0, 0, .85), transparent 60%); }
.feature .cap { position: absolute; left: 20px; right: 20px; bottom: 18px; z-index: 1; }
.feature b { display: block; font: 500 30px/1.05 var(--serif); letter-spacing: -.02em; margin-top: 6px; }

/* ---------- buttons / bars ---------- */
.btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 58px; padding: 0 20px; border-radius: 99px; font-weight: 700; font-size: 17px; transition: transform .18s var(--spring), background .3s, color .3s; }
.btn svg { width: 22px; height: 22px; }
.btn.primary { color: #1d1400; background: linear-gradient(135deg, #f6cf74, var(--accent) 45%, var(--accent-deep)); box-shadow: 0 10px 30px rgba(234, 181, 77, .28), inset 0 1px 0 rgba(255, 255, 255, .5); }
.btn.glass { color: var(--ink); background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12); }
.btn.done { background: rgba(95, 195, 155, .16); color: var(--ok); box-shadow: none; border: 1px solid rgba(95, 195, 155, .35); }
.bar { display: flex; align-items: center; justify-content: space-between; padding: calc(var(--sat) + 8px) 8px 8px; font-weight: 600; font-size: 15px; letter-spacing: .01em; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; }
.icon-btn:active { background: rgba(255, 255, 255, .12); }

/* ---------- crop ---------- */
#crop { flex-direction: column; padding-bottom: calc(var(--sab) + 20px); background: #050706; }
.stage-wrap { padding: 0 14px; margin-top: auto; }
#stage { position: relative; width: 100%; aspect-ratio: 1; overflow: hidden; background: #000; border-radius: 28px; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; box-shadow: 0 0 0 1px rgba(255, 255, 255, .1), 0 30px 80px rgba(0, 0, 0, .6); }
#cropCanvas { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.thirds { position: absolute; inset: 0; pointer-events: none; opacity: .22;
  background: linear-gradient(#fff, #fff) 33.330% 0 / 1px 100% no-repeat, linear-gradient(#fff, #fff) 66.660% 0 / 1px 100% no-repeat,
    linear-gradient(#fff, #fff) 0 33.330% / 100% 1px no-repeat, linear-gradient(#fff, #fff) 0 66.660% / 100% 1px no-repeat; }
.brackets { position: absolute; inset: 18px; pointer-events: none; --c: var(--accent);
  background:
    linear-gradient(var(--c), var(--c)) left top / 30px 3px, linear-gradient(var(--c), var(--c)) left top / 3px 30px,
    linear-gradient(var(--c), var(--c)) right top / 30px 3px, linear-gradient(var(--c), var(--c)) right top / 3px 30px,
    linear-gradient(var(--c), var(--c)) left bottom / 30px 3px, linear-gradient(var(--c), var(--c)) left bottom / 3px 30px,
    linear-gradient(var(--c), var(--c)) right bottom / 30px 3px, linear-gradient(var(--c), var(--c)) right bottom / 3px 30px;
  background-repeat: no-repeat; border-radius: 4px; }
.hint { display: block; width: 100%; background: none; border: 0; font: inherit; text-align: center; padding: 20px 20px 4px; color: var(--muted); font-size: 14px; }
.hint[data-state="framed"], .hint[data-state="moved"] { color: var(--accent); }
.hint[data-state="moved"] { cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
#cropCanvas.glide { transition: transform .5s var(--ease); }
.near-place { display: inline-flex; align-items: center; gap: 5px; margin: 4px 20px 0; padding: 4px 0; color: var(--accent); font-size: 14px; font-weight: 700; }
.near-place svg { width: 16px; height: 16px; }
.near-place:active { opacity: .7; }
.sheet-note { padding: 4px 6px 10px; }
.sheet-note b { display: block; font: 600 20px var(--serif); }
.sheet-note small { display: block; color: var(--muted); font-size: 14px; line-height: 1.4; margin-top: 6px; }
.near-card { display: flex; align-items: center; gap: 12px; width: calc(100% - 40px); margin: 12px 20px 0; padding: 14px 16px; border-radius: 18px; text-align: left;
  background: rgba(234, 181, 77, .08); border: 1px solid rgba(234, 181, 77, .3); transition: transform .18s var(--spring); }
.near-card:active { transform: scale(.98); }
.near-card span { flex: 1; min-width: 0; }
.near-card b { display: block; font-size: 15px; }
.near-card small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; line-height: 1.35; }
.near-card .pin { color: var(--accent); width: 22px; height: 22px; }
.near-card .go { color: var(--muted); width: 18px; height: 18px; }
.loc-pill { display: flex; align-items: center; gap: 6px; margin: 10px auto 0; height: 34px; padding: 0 14px 0 10px; border-radius: 99px; font-size: 13px; font-weight: 600; color: var(--muted); background: rgba(255, 255, 255, .06); border: 1px solid var(--line); }
.loc-pill svg { width: 16px; height: 16px; }
.loc-pill.on { color: var(--accent); border-color: rgba(234, 181, 77, .4); background: rgba(234, 181, 77, .1); }
#zoom { display: block; width: calc(100% - 72px); margin: 12px 36px; accent-color: var(--accent); height: 28px; }
.crop-actions { padding: 8px 16px 0; margin-bottom: auto; }

/* ---------- scanning ---------- */
#scanBody { padding: 4px 16px 0; }
.scanner { padding-top: 4dvh; text-align: center; }
.scanner .shot { position: relative; width: min(100%, 52dvh); aspect-ratio: 1; margin: 0 auto; border-radius: 28px; overflow: hidden; box-shadow: 0 0 0 1px rgba(255, 255, 255, .1), 0 0 90px rgba(234, 181, 77, .18); animation: breathe 1.600s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(.985); box-shadow: 0 0 0 1px rgba(255, 255, 255, .1), 0 0 120px rgba(234, 181, 77, .32); } }
.scanner .shot img { width: 100%; height: 100%; object-fit: cover; }
/* a sound scan: the recording's own waveform stands where the photo would be, under the same sweep */
.scanner .soundshot { display: grid; place-items: center; aspect-ratio: 16 / 10; background: radial-gradient(80% 90% at 50% 50%, rgba(234, 181, 77, .16), transparent 72%), #0b0f0c; }
.scanner .soundshot .wave { margin: 0; width: 82%; max-width: none; height: 56%; gap: 3px; -webkit-mask-image: none; mask-image: none; }
.scanner .soundshot .wave i { max-width: 6px; opacity: .95; animation-duration: 1.400s; }
.scanner .brackets { animation: lock 1.200s var(--ease) infinite alternate; }
@keyframes lock { from { inset: 14px; opacity: .6; } to { inset: 34px; opacity: 1; } }
.sweep { position: absolute; left: 0; right: 0; top: -45%; height: 45%; pointer-events: none;
  background: linear-gradient(to bottom, transparent, rgba(234, 181, 77, .22) 80%, rgba(255, 226, 150, .95)); border-bottom: 2px solid #fff3cf; box-shadow: 0 6px 30px rgba(234, 181, 77, .9);
  animation: sweep 1.500s cubic-bezier(.6, 0, .4, 1) infinite alternate; mix-blend-mode: screen; }
@keyframes sweep { to { top: 100%; } }
.dots { position: absolute; inset: 0; pointer-events: none; background-image: radial-gradient(rgba(255, 255, 255, .5) 1px, transparent 1.500px); background-size: 22px 22px; opacity: .0; animation: dots 1.500s ease-in-out infinite alternate; }
@keyframes dots { to { opacity: .35; } }
.scan-status { margin-top: 30px; font: 500 24px/1.2 var(--serif); min-height: 30px; }
.scan-sub { margin-top: 20px; color: var(--muted); font-size: 13px; min-height: 18px; font-variant-numeric: tabular-nums; }
.scan-bar { height: 3px; width: min(260px, 70%); margin: 30px auto 0; border-radius: 99px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.scan-bar i { display: block; height: 100%; width: 4%; border-radius: 99px; background: linear-gradient(90deg, var(--accent-deep), #f6cf74); transition: width .8s var(--ease); }
.steps { list-style: none; margin: 22px auto 0; padding: 0; width: fit-content; text-align: left; display: grid; gap: 12px; }
.steps li { display: flex; align-items: center; gap: 12px; font-size: 16px; color: rgba(255, 255, 255, .28); transition: color .4s; }
.steps li.active { color: var(--ink); font-weight: 600; }
.steps li.done { color: var(--muted); }
.tick { position: relative; width: 22px; height: 22px; border-radius: 50%; flex: none; display: grid; place-items: center; border: 2px solid rgba(255, 255, 255, .14); transition: background .3s, border-color .3s; }
.tick svg { width: 13px; height: 13px; color: #1d1400; opacity: 0; transform: scale(.3); transition: opacity .25s, transform .4s var(--spring); }
.active .tick { border-color: var(--accent) transparent var(--accent) transparent; animation: spin .8s linear infinite; }
.done .tick { background: var(--accent); border-color: var(--accent); }
.done .tick svg { opacity: 1; transform: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.scan-error { margin: 26px 0 18px; }
.nobird .shot { animation: none; width: min(74%, 38dvh); filter: saturate(.7); }
.nobird .eyebrow { margin-top: 28px; }
.nobird h2 { font: 500 clamp(32px, 10vw, 42px)/1.05 var(--serif); letter-spacing: -.03em; margin-top: 8px; }
.nobird .scan-sub { margin: 10px auto 24px; max-width: 300px; font-size: 15px; }
.nobird .btn + .btn { margin-top: 10px; }

/* ---------- result ---------- */
.match { position: relative; border-radius: 30px; overflow: hidden; aspect-ratio: 4 / 5; max-height: 62dvh; width: 100%; background: var(--surface); box-shadow: 0 30px 80px rgba(0, 0, 0, .55); animation: reveal .7s var(--ease) both; }
@keyframes reveal { from { opacity: 0; transform: scale(.92) translateY(20px); filter: blur(12px); } }
.match > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: opacity .35s; }
.match .yours { opacity: 0; }
.match.compare .yours { opacity: 1; }
.match .shade { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0, 0, 0, .92) 0%, rgba(0, 0, 0, .35) 42%, transparent 62%); pointer-events: none; }
.mine { position: absolute; top: 14px; left: 14px; width: 76px; border-radius: 16px; overflow: hidden; border: 2px solid rgba(255, 255, 255, .9); box-shadow: 0 8px 24px rgba(0, 0, 0, .5); animation: pop .5s .35s var(--spring) both; }
.mine img { width: 100%; aspect-ratio: 1; object-fit: cover; }
/* a sound scan has no photo of yours: the same corner holds a play button for the recording instead */
.mine.play { width: 64px; height: 64px; border-radius: 50%; border: 0; display: grid; place-items: center; color: #1d1400; background: linear-gradient(135deg, #f6cf74, var(--accent) 45%, var(--accent-deep));
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .5); }
.mine.play svg { width: 28px; height: 28px; }
.mine.play:active { transform: scale(.92); }
.play-tile { width: 132px; height: 132px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; color: #1d1400; background: linear-gradient(135deg, #f6cf74, var(--accent) 45%, var(--accent-deep));
  box-shadow: 0 16px 50px rgba(234, 181, 77, .3), 0 0 0 10px rgba(234, 181, 77, .08), inset 0 1px 0 rgba(255, 255, 255, .5); transition: transform .2s var(--spring); }
.play-tile svg { width: 52px; height: 52px; }
.play-tile:active { transform: scale(.94); }
.tile .kind { position: absolute; left: 8px; top: 8px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .6); color: var(--accent); }
.tile .kind svg { width: 14px; height: 14px; }
.mine span { display: block; font-size: 10px; font-weight: 700; text-align: center; padding: 3px 0 4px; background: rgba(0, 0, 0, .7); letter-spacing: .04em; text-transform: uppercase; }
@keyframes pop { from { opacity: 0; transform: scale(.4); } }
.ring.conf { position: absolute; top: 14px; right: 14px; width: 76px; height: 76px; border-radius: 50%; background: rgba(8, 11, 9, .6); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); animation: pop .5s .45s var(--spring) both; }
.ring.conf circle { stroke-width: 4; }
.ring.conf b { font: 600 24px var(--serif); }
.ring.conf b small { font-size: 12px; opacity: .7; margin-left: 1px; }
.ring.low .v { stroke: #e58b5a; }
.match-copy { position: absolute; left: 20px; right: 20px; bottom: 20px; }
.match-copy > * { animation: rise .6s var(--ease) both; }
.match-copy h2 { font: 500 clamp(32px, 10vw, 42px)/1 var(--serif); letter-spacing: -.03em; margin-top: 8px; animation-delay: .25s; text-wrap: balance; }
.match-copy .sci { margin-top: 6px; font-size: 16px; animation-delay: .35s; color: rgba(255, 255, 255, .75); }
.match-copy .verdict { animation-delay: .15s; }
.credit { position: absolute; right: 12px; bottom: 6px; font-size: 9px; color: rgba(255, 255, 255, .4); max-width: 60%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

.note { margin-top: 14px; padding: 13px 16px; border-radius: 18px; background: rgba(229, 139, 90, .12); border: 1px solid rgba(229, 139, 90, .25); font-size: 14px; color: #f3cdb6; }
.actions { display: grid; gap: 10px; margin-top: 16px; animation: rise .6s .5s var(--ease) both; }
.lifer { text-align: center; margin-top: 14px; font: 500 20px var(--serif); color: var(--accent); animation: pop .6s var(--spring) both; }
.lifer small { display: block; font: 13px var(--sans); color: var(--muted); margin-top: 2px; }
#scanBody h3 { font: 600 20px var(--serif); margin: 30px 4px 12px; }
.cand { display: flex; align-items: center; gap: 14px; width: 100%; padding: 10px 14px 10px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; margin-bottom: 10px; animation: rise .5s var(--ease) both; transition: transform .18s var(--spring); }
.cand:active { transform: scale(.975); }
.cand img { width: 64px; height: 64px; border-radius: 14px; object-fit: cover; flex: none; background: var(--surface-2); }
.cand .mid { flex: 1; min-width: 0; }
.cand b { display: block; font-size: 16px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cand .sci { font-size: 13px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meter { height: 4px; border-radius: 99px; background: rgba(255, 255, 255, .08); overflow: hidden; margin-top: 8px; }
.meter i { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--accent); transition: width .9s var(--ease); }
.cand .p { font: 600 17px var(--serif); color: var(--ink); min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; }
.again { margin-top: 12px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 18px; }

/* ---------- life list ---------- */
.birds-head { position: sticky; top: 0; z-index: 5; padding: calc(var(--sat) + 22px) 16px 12px; background: linear-gradient(to bottom, var(--bg) 82%, transparent); }
.birds-head h1 { font: 500 52px/1 var(--serif); letter-spacing: -.03em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.birds-head h1 small { font: 500 17px var(--sans); color: var(--muted); letter-spacing: 0; }
.progress { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .08); margin-top: 14px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; min-width: 6px; border-radius: 99px; background: linear-gradient(90deg, var(--accent-deep), #f6cf74); transition: width 1s var(--ease); }
.next { color: var(--muted); font-size: 13px; margin-top: 8px; }
.search { display: flex; align-items: center; gap: 8px; margin-top: 16px; padding: 0 14px; height: 46px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.search svg { width: 19px; height: 19px; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font: inherit; color: var(--ink); height: 100%; }
.seg { display: flex; gap: 6px; margin-top: 10px; }
.seg button { height: 34px; padding: 0 14px; border-radius: 99px; font-size: 13px; font-weight: 600; color: var(--muted); background: var(--surface); border: 1px solid var(--line); transition: background .2s, color .2s; }
.seg button.on { background: var(--ink); color: #111; border-color: transparent; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 6px 16px 0; }
.cell { position: relative; aspect-ratio: 3 / 4; border-radius: 16px; overflow: hidden; background: var(--surface); content-visibility: auto; contain-intrinsic-size: auto 150px; transition: transform .18s var(--spring); }
.cell:active { transform: scale(.95); }
.cell img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) brightness(.5) contrast(1.1); transition: filter .6s; }
.cell.seen img { filter: none; }
.cell::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0, 0, 0, .85), transparent 55%); }
.cell b { position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 1; font-size: 12px; line-height: 1.15; font-weight: 600; color: rgba(255, 255, 255, .62); }
.cell.seen b { color: #fff; }
.cell .badge { width: 20px; height: 20px; top: 6px; right: 6px; }
.empty { text-align: center; color: var(--muted); padding: 56px 28px; font-size: 15px; }

/* ---------- listen (sound ID) ---------- */
#listen { flex-direction: column; padding-bottom: calc(var(--sab) + 20px);
  background: radial-gradient(90% 46% at 50% 66%, rgba(234, 181, 77, .13), transparent 70%), radial-gradient(120% 60% at 50% 0%, rgba(95, 195, 155, .09), transparent 70%), #050706; }
.listen-body { flex: 1; display: flex; flex-direction: column; align-items: center; padding: clamp(16px, 9dvh, 110px) 24px 24px; text-align: center; } /* top-anchored so the message appearing moves nothing */
.listen-body h1 { font: 500 clamp(40px, 12vw, 56px)/1 var(--serif); letter-spacing: -.035em; margin-top: 10px; text-wrap: balance; }
.listen-sub { color: var(--muted); font-size: 15px; margin-top: 12px; max-width: 300px; }
.wave { display: flex; align-items: center; justify-content: center; gap: 4px; width: 100%; max-width: 380px; height: 76px; margin: 34px 0 40px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 24%, #000 76%, transparent); mask-image: linear-gradient(90deg, transparent, #000 24%, #000 76%, transparent); }
.wave i { flex: 1; max-width: 4px; height: calc(var(--h) * 1%); border-radius: 99px; background: linear-gradient(to top, var(--accent-deep), #f6cf74); opacity: .75; animation: wave 2.600s ease-in-out infinite; animation-delay: var(--d); transition: opacity .5s; }
@keyframes wave { 50% { transform: scaleY(.4); } }
.mic { position: relative; width: 116px; height: 116px; border-radius: 50%; display: grid; place-items: center; flex: none; color: #1d1400; background: linear-gradient(135deg, #f6cf74, var(--accent) 45%, var(--accent-deep));
  box-shadow: 0 16px 50px rgba(234, 181, 77, .35), 0 0 0 10px rgba(234, 181, 77, .08), inset 0 1px 0 rgba(255, 255, 255, .5); transition: transform .2s var(--spring); }
.mic svg { width: 46px; height: 46px; }
.mic:active { transform: scale(.94); }
.mic::before, .mic::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--accent); pointer-events: none; animation: ping 3.200s ease-out infinite; }
.mic::after { animation-delay: 1.600s; }
.listen-msg { display: grid; place-items: start center; margin-top: 30px; }
.listen-hint { color: var(--muted); font-size: 15px; font-weight: 600; }
.listen-note { max-width: 340px; padding: 16px 20px; border-radius: 22px; background: rgba(234, 181, 77, .08); border: 1px solid rgba(234, 181, 77, .3); animation: rise .5s var(--ease) both; }
.listen-note b { display: block; font: 600 20px/1.2 var(--serif); margin-top: 6px; }
.listen-note small { display: block; color: var(--muted); font-size: 14px; line-height: 1.4; margin-top: 6px; }
/* recording: the bars follow the microphone, the button becomes a stop button with quicker rings */
#listen[data-state="recording"] .wave i { animation: none; opacity: 1; transition: height .09s linear; }
#listen[data-state="recording"] .mic::before, #listen[data-state="recording"] .mic::after { animation-duration: 1.400s; }
#listen[data-state="recording"] .mic::after { animation-delay: .700s; }
#listen[data-state="recording"] .listen-hint { color: var(--accent); }
/* working, or something went wrong: the screen goes quiet */
#listen[data-state="working"] .wave i, #listen[data-state="error"] .wave i { animation-play-state: paused; opacity: .3; }
#listen[data-state="working"] .mic::before, #listen[data-state="working"] .mic::after, #listen[data-state="error"] .mic::before, #listen[data-state="error"] .mic::after { animation: none; opacity: 0; }
#listen[data-state="working"] .mic { opacity: .55; pointer-events: none; }
#listen[data-state="working"] .mic svg { animation: micwork 1.200s ease-in-out infinite; }
@keyframes micwork { 50% { transform: scale(.82); opacity: .6; } }
.listen-upload { margin-top: 18px; padding: 10px 18px; border-radius: 99px; color: var(--accent); font-size: 14px; font-weight: 600; border: 1px solid rgba(234, 181, 77, .3); background: rgba(234, 181, 77, .06); }
.listen-upload:active { transform: scale(.96); }
#listen[data-state="recording"] .listen-upload, #listen[data-state="working"] .listen-upload { visibility: hidden; }

/* ---------- dock ---------- */
.dock { position: fixed; left: 50%; bottom: calc(var(--sab) + 14px); transform: translateX(-50%); z-index: 10; display: flex; align-items: center; gap: 6px; height: 64px; padding: 0 10px; border-radius: 99px;
  background: rgba(22, 28, 24, .72); backdrop-filter: blur(22px) saturate(1.6); -webkit-backdrop-filter: blur(22px) saturate(1.6); border: 1px solid rgba(255, 255, 255, .1); box-shadow: 0 16px 44px rgba(0, 0, 0, .55); }
.dock a { width: 92px; height: 48px; border-radius: 99px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-size: 10px; font-weight: 600; color: var(--muted); transition: color .2s; }
.dock a svg { width: 22px; height: 22px; }
.dock a.on { color: var(--ink); }
.fab { width: 62px; height: 62px; margin-top: -22px; border-radius: 50%; display: grid; place-items: center; color: #1d1400; background: linear-gradient(135deg, #f6cf74, var(--accent) 45%, var(--accent-deep));
  box-shadow: 0 10px 30px rgba(234, 181, 77, .45), 0 0 0 5px var(--bg), inset 0 1px 0 rgba(255, 255, 255, .5); transition: transform .2s var(--spring); }
.fab svg { width: 27px; height: 27px; }
.fab:active { transform: scale(.9); }
/* sound, one tap from anywhere: a smaller partner to the camera, in the same gold */
.mic-fab { width: 46px; height: 46px; margin-top: -8px; box-shadow: 0 8px 22px rgba(234, 181, 77, .35), 0 0 0 4px var(--bg), inset 0 1px 0 rgba(255, 255, 255, .5); }
.mic-fab svg { width: 21px; height: 21px; }
.dock a { width: 80px; }

/* ---------- overlays ---------- */
.picker, .sheet { position: fixed; inset: 0; z-index: 20; }
.backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .62); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade .25s ease both; }
.picker-panel { position: absolute; left: 50%; bottom: 0; width: 100%; max-width: 520px; transform: translateX(-50%); padding: 20px 16px calc(var(--sab) + 20px); display: grid; gap: 10px; background: var(--surface); border-radius: 30px 30px 0 0; border-top: 1px solid var(--line); animation: up .35s var(--ease) both; }
.panel { position: absolute; left: 50%; bottom: 0; width: 100%; max-width: 520px; transform: translateX(-50%); max-height: 94dvh; overflow-y: auto; background: var(--bg); border-radius: 30px 30px 0 0; padding-bottom: calc(var(--sab) + 28px); animation: up .4s var(--ease) both; overscroll-behavior: contain; scrollbar-width: none; }
.panel::-webkit-scrollbar { display: none; }
.panel .close { position: sticky; float: right; top: 12px; margin: 12px 12px -56px 0; z-index: 3; background: rgba(0, 0, 0, .5); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translate(-50%, 100%); } }
.sheet-hero { position: relative; aspect-ratio: 1; max-height: 56dvh; width: 100%; overflow: hidden; background: var(--surface); }
.sheet-hero img { width: 100%; height: 100%; object-fit: cover; }
.sheet-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, var(--bg) 0%, rgba(10, 13, 11, .5) 26%, transparent 52%); }
.sheet-info { position: relative; margin-top: -84px; padding: 0 20px; }
.sheet-info h3 { font: 500 clamp(34px, 10vw, 42px)/1 var(--serif); letter-spacing: -.03em; margin: 8px 0 0; text-wrap: balance; }
.sheet-info .sci { margin-top: 6px; font-size: 16px; }
.stats { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.stat { padding: 7px 12px; border-radius: 99px; font-size: 13px; font-weight: 600; background: var(--surface); border: 1px solid var(--line); }
.stat.hot { color: var(--accent); border-color: rgba(234, 181, 77, .35); background: rgba(234, 181, 77, .1); }
.sheet-info .btn { margin-top: 18px; }
.sheet-info .btn + .btn { margin-top: 10px; }
.sheet h4 { font: 600 18px var(--serif); margin: 28px 20px 0; }
.shots { display: flex; gap: 10px; overflow-x: auto; padding: 12px 20px 0; scrollbar-width: none; scroll-snap-type: x proximity; }
.shots::-webkit-scrollbar { display: none; }
.shots figure { position: relative; flex: none; margin: 0; height: 190px; border-radius: 18px; overflow: hidden; scroll-snap-align: start; background: var(--surface); }
.shots img { height: 100%; width: auto; min-width: 150px; object-fit: cover; }
.shots figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 8px 5px; font-size: 9px; color: rgba(255, 255, 255, .8); background: linear-gradient(transparent, rgba(0, 0, 0, .7)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fine { color: var(--muted); font-size: 11px; margin: 22px 20px 0; line-height: 1.5; }

#confetti { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 40; pointer-events: none; }
#toast { position: fixed; left: 50%; bottom: calc(var(--dock) + var(--sab) + 30px); transform: translate(-50%, 20px); z-index: 50; background: rgba(244, 239, 228, .96); color: #14110a; padding: 12px 18px; border-radius: 99px; font-size: 14px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .35s var(--spring); max-width: calc(100% - 32px); text-align: center; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
#toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.drop-hint { display: none; }
body.dragging::after { content: "Drop a bird photo or recording"; position: fixed; inset: 16px; z-index: 60; display: grid; place-items: center; border-radius: 32px; border: 2px dashed var(--accent);
  background: rgba(10, 13, 11, .82); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font: 500 clamp(28px, 4vw, 48px) var(--serif); color: var(--ink); pointer-events: none; }

/* ---------- desktop ---------- */
@media (min-width: 860px) {
  :root { --wrap: min(1180px, 100vw - 96px); --gutter: calc((100vw - var(--wrap)) / 2); }
  .hero { height: 100vh; min-height: 640px; max-height: 980px; }
  .slide { background-position: center 30%; }
  .hero-scrim { background:
    linear-gradient(90deg, rgba(5, 8, 6, .82) 0%, rgba(5, 8, 6, .45) 38%, transparent 68%),
    linear-gradient(to bottom, rgba(5, 8, 6, .5) 0%, transparent 20%, transparent 62%, var(--bg) 100%); }
  .top { padding: 28px var(--gutter) 0; }
  .brand { font-size: 18px; }
  .hero-copy { margin: auto 0; padding: 0 var(--gutter) 40px; max-width: calc(var(--gutter) + 640px); }
  .hero h1 { font-size: clamp(64px, 7vw, 104px); margin: 16px 0 34px; }
  .cta-row, .slide-cta.sound, .ghost { width: 420px; }
  .round:hover { filter: brightness(1.2); }
  .drop-hint { display: block; margin-top: 18px; color: rgba(255, 255, 255, .6); font-size: 14px; }
  .hero-caption { right: var(--gutter); top: auto; bottom: 150px; font-size: 13px; }

  #home section:not(.hero) { margin: 56px auto 0; width: var(--wrap); }
  #home h2, .row-head { padding: 0; }
  h2 { font-size: 28px; }
  .life-card { width: 460px; margin: -108px var(--gutter) 0 auto; position: relative; z-index: 2; padding: 20px; }
  .near-card { width: 460px; margin: 16px 0 0; }
  .near-place { margin: 6px 0 0; font-size: 15px; }
  .strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 16px; overflow: visible; padding: 18px 0 0; }
  .tile { width: auto; height: auto; aspect-ratio: 3 / 4; }
  .tile b { font-size: 16px; }
  #common .tile:nth-child(n + 13), #recent .tile:nth-child(n + 7) { display: none; }
  .feature { width: 100%; margin: 18px 0 0; aspect-ratio: 21 / 9; }
  .feature img { object-position: center 35%; }
  .feature .cap { left: 36px; bottom: 32px; }
  .feature b { font-size: 52px; }
  .tile, .cell, .feature, .cand, .life-card { transition: transform .35s var(--ease), box-shadow .35s; }
  .tile:hover, .cell:hover { transform: translateY(-4px); box-shadow: 0 18px 40px rgba(0, 0, 0, .5); }
  .feature img, .tile img { transition: transform .8s var(--ease); }
  .feature:hover img, .tile:hover img { transform: scale(1.05); }
  .btn:hover, .ghost:hover, .fab:hover { filter: brightness(1.08); }

  .bar { width: var(--wrap); margin: 0 auto; padding: 20px 0 12px; font-size: 16px; }
  .stage-wrap, .hint, .crop-actions { width: min(560px, 62vh); margin-left: auto; margin-right: auto; padding-left: 0; padding-right: 0; }
  #zoom { width: min(480px, 54vh); margin: 12px auto; }

  #scanBody { width: var(--wrap); margin: 0 auto; padding: 12px 0 0; display: grid; grid-template-columns: minmax(0, 500px) minmax(0, 460px); justify-content: center; column-gap: 56px; align-items: start; }
  #scanBody > * { grid-column: 2; }
  #scanBody > .scanner { grid-column: 1 / -1; }
  #scanBody > .match { grid-column: 1; grid-row: 1 / span 30; max-height: 78vh; position: sticky; top: 24px; }
  #scanBody > .actions { margin-top: 0; }
  #scanBody h3 { font-size: 24px; }
  .scanner .shot { width: min(480px, 52vh); }
  .scan-error + .btn, .scanner .btn { max-width: 360px; margin-left: auto; margin-right: auto; }

  .listen-body h1 { font-size: 72px; }
  .listen-sub { font-size: 17px; max-width: 420px; }
  .wave { max-width: 520px; height: 92px; gap: 6px; }
  .mic:hover { filter: brightness(1.08); }

  .birds-head { padding: 48px var(--gutter) 16px; }
  .birds-head h1 { font-size: 84px; }
  .progress, .search { max-width: 560px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; padding: 10px var(--gutter) 0; }
  .cell b { font-size: 14px; left: 12px; bottom: 12px; }

  .panel { bottom: auto; top: 50%; max-width: 560px; max-height: 90vh; border-radius: 30px; border: 1px solid var(--line); transform: translate(-50%, -50%); animation-name: modal; box-shadow: 0 40px 120px rgba(0, 0, 0, .7); }
  .picker-panel { bottom: auto; top: 50%; max-width: 400px; border-radius: 30px; border: 1px solid var(--line); padding: 24px; transform: translate(-50%, -50%); animation-name: modal; }
  @keyframes modal { from { opacity: 0; transform: translate(-50%, -46%) scale(.96); } }
  .sheet-hero { max-height: 46vh; aspect-ratio: 4 / 3; }
}
