:root {
  --ink: #082f49;
  --deep: #031f2f;
  --blue: #0e7490;
  --aqua: #67e8f9;
  --ice: #edfafa;
  --sand: #f6f1e7;
  --coral: #f9735b;
  --white: #fff;
  --muted: #56707e;
  --radius: 24px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--sand);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: linear-gradient(180deg, var(--deep) 0 420px, var(--sand) 420px); }
button { font: inherit; }
.app-shell { width: min(100%, 760px); margin: auto; padding: 0 18px 40px; }
.hero { color: white; padding: 58px 8px 34px; }
.eyebrow, .step { text-transform: uppercase; letter-spacing: .14em; font-size: 11px; font-weight: 800; }
.eyebrow { color: #b8f3f7; display: flex; align-items: center; gap: 9px; }
.pulse { width: 8px; height: 8px; background: var(--aqua); border-radius: 50%; box-shadow: 0 0 0 5px rgba(103,232,249,.12); }
h1 { font-size: clamp(48px, 12vw, 82px); line-height: .86; letter-spacing: -.055em; margin: 22px 0; }
h1 em { color: var(--aqua); font-style: normal; }
.hero p { color: #c8dbe2; font-size: 17px; line-height: 1.55; max-width: 490px; margin: 0; }
.card { background: var(--white); border-radius: var(--radius); box-shadow: 0 16px 44px rgba(3,31,47,.12); }
.scanner { padding: 20px; }
.scanner-head, .section-title, .scanner-head > div, .section-title > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.scanner-head > div, .section-title > div { justify-content: flex-start; }
h2 { margin: 0; font-size: 23px; letter-spacing: -.025em; }
.step { color: var(--coral); white-space: nowrap; }
.model-status { font-size: 11px; color: var(--muted); text-align: right; }
.camera-stage { position: relative; aspect-ratio: 4/5; max-height: 510px; margin: 18px 0; border-radius: 18px; overflow: hidden; background: #dbe9e8; }
.camera-stage img { width: 100%; height: 100%; object-fit: cover; display: none; }
.camera-stage.has-image img { display: block; }
.camera-stage.has-image .camera-empty { display: none; }
.camera-empty { height: 100%; display: grid; place-content: center; justify-items: center; gap: 7px; color: var(--muted); }
.camera-empty strong { color: var(--ink); font-size: 18px; }
.camera-empty span { font-size: 13px; }
.penguin-mark { width: 86px; height: 108px; border-radius: 50% 50% 42% 42%; display: grid; place-items: center; background: var(--ink); color: white; font-size: 36px; font-weight: 900; border: 7px solid white; box-shadow: 0 10px 26px rgba(8,47,73,.2); margin-bottom: 10px; }
.viewfinder { position: absolute; inset: 16px; z-index: 2; pointer-events: none; }
.viewfinder i { width: 34px; height: 34px; position: absolute; border-color: rgba(255,255,255,.95); border-style: solid; filter: drop-shadow(0 1px 2px rgba(0,0,0,.3)); }
.viewfinder i:nth-child(1) { top: 0; left: 0; border-width: 3px 0 0 3px; }
.viewfinder i:nth-child(2) { top: 0; right: 0; border-width: 3px 3px 0 0; }
.viewfinder i:nth-child(3) { bottom: 0; left: 0; border-width: 0 0 3px 3px; }
.viewfinder i:nth-child(4) { bottom: 0; right: 0; border-width: 0 3px 3px 0; }
.actions { display: grid; grid-template-columns: 1.35fr 1fr; gap: 10px; }
.actions button { border-radius: 14px; border: 0; padding: 15px 12px; font-weight: 800; cursor: pointer; }
.primary { background: var(--coral); color: white; box-shadow: 0 7px 18px rgba(249,115,91,.25); }
.secondary { background: var(--ice); color: var(--ink); }
.privacy { text-align: center; font-size: 11px; color: var(--muted); margin: 14px 0 0; }
.result { margin-top: 16px; padding: 24px; overflow: hidden; }
.analyzing { text-align: center; padding: 22px 0; }
.analyzing p { color: var(--muted); }
.loader { width: 42px; height: 42px; border: 4px solid #cfe8e9; border-top-color: var(--coral); border-radius: 50%; margin: 0 auto 18px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.match-hero { margin: -24px -24px 20px; height: 280px; position: relative; }
.match-hero img { width: 100%; height: 100%; object-fit: cover; }
.confidence { position: absolute; left: 16px; bottom: 16px; background: rgba(3,31,47,.88); color: white; padding: 9px 12px; border-radius: 99px; font-size: 12px; font-weight: 800; backdrop-filter: blur(8px); }
.match-name { font-size: 42px; margin: 0; letter-spacing: -.05em; }
.species { color: var(--blue); font-weight: 700; font-style: italic; margin: 3px 0 18px; }
.facts-grid { display: grid; grid-template-columns: repeat(2,1fr); border-top: 1px solid #dde8ea; border-left: 1px solid #dde8ea; }
.facts-grid div { padding: 14px; border-right: 1px solid #dde8ea; border-bottom: 1px solid #dde8ea; }
.facts-grid span { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 4px; }
.no-match { text-align: center; padding: 12px 0; }
.no-match .penguin-mark { margin: 0 auto 18px; }
.no-match p { color: var(--muted); line-height: 1.5; }
.residents { padding: 52px 2px 20px; }
.section-title > span { font-size: 12px; color: var(--muted); }
.profile-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; margin-top: 18px; }
.profile-card { min-height: 230px; border: 0; border-radius: 20px; overflow: hidden; position: relative; padding: 0; text-align: left; background: var(--ink); cursor: pointer; box-shadow: 0 10px 25px rgba(8,47,73,.12); }
.profile-card:first-child { grid-column: 1/-1; height: 320px; }
.profile-card img { width: 100%; height: 100%; object-fit: cover; opacity: .86; transition: transform .35s; }
.profile-card:hover img { transform: scale(1.03); }
.profile-card .card-copy { position: absolute; inset: auto 0 0; padding: 30px 15px 14px; color: white; background: linear-gradient(transparent, rgba(3,31,47,.95)); }
.profile-card strong { display: block; font-size: 24px; letter-spacing: -.03em; }
.profile-card span { color: #bcecf0; font-size: 12px; }
.photo-needed { height: 100%; display: grid; place-content: center; text-align: center; color: #bcecf0; padding: 20px; }
.photo-needed b { font-size: 42px; color: white; }
.how { padding: 28px; margin-top: 32px; background: var(--ink); color: white; }
.how h2 { font-size: 31px; margin: 10px 0; }
.how p { color: #bed2da; line-height: 1.65; margin-bottom: 0; }
footer { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; padding: 28px 5px 0; }
dialog { width: min(calc(100% - 28px), 550px); border: 0; border-radius: 24px; padding: 0; color: var(--ink); box-shadow: 0 28px 80px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(3,31,47,.72); backdrop-filter: blur(5px); }
.dialog-close { position: absolute; right: 13px; top: 13px; width: 38px; height: 38px; border: 0; border-radius: 50%; background: rgba(255,255,255,.9); color: var(--ink); font-size: 26px; z-index: 2; cursor: pointer; }
.dialog-photo { height: 300px; width: 100%; object-fit: cover; background: var(--ink); }
.dialog-body { padding: 25px; }
.dialog-body h2 { font-size: 42px; }
.dialog-body p { line-height: 1.55; }
.fact-list { margin: 18px 0 0; padding: 0; list-style: none; display: grid; gap: 9px; }
.fact-list li { background: var(--ice); padding: 11px 13px; border-radius: 10px; font-size: 13px; }

@media (min-width: 650px) {
  .scanner { padding: 28px; }
  .profile-grid { grid-template-columns: repeat(3,1fr); }
  .profile-card:first-child { grid-column: span 2; }
}
@media (max-width: 380px) {
  .actions { grid-template-columns: 1fr; }
  .profile-grid { grid-template-columns: 1fr; }
  .profile-card:first-child { grid-column: auto; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
