:root {
  color-scheme: dark;
  --bg: #0b0b0c;
  --panel: #111113;
  --panel-2: #161619;
  --line: #2a2a2f;
  --muted: #8b8b94;
  --text: #f3f3ef;
  --accent: #e9b44c;
  --good: #9ad29a;
  --bad: #66666f;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px),
    var(--bg);
  background-size: 32px 32px;
  color: var(--text);
}

button, input { font: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.topbar,
footer {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar { height: 76px; border-bottom: 1px solid var(--line); }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -.02em;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 11px;
}
.beta,
.eyebrow {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .15em;
}

main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.hero {
  min-height: 650px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 850px;
  padding: 70px 0 90px;
}
.hero h1 {
  margin: 12px 0 24px;
  max-width: 820px;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(56px, 10vw, 116px);
  line-height: .86;
  letter-spacing: -.07em;
  font-weight: 780;
}
.hero h1 em { color: var(--accent); font-style: normal; font-weight: 480; }
.intro {
  width: min(680px, 100%);
  margin: 0 0 34px;
  color: #b6b6bc;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 18px;
  line-height: 1.65;
}
.scanner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  width: min(760px, 100%);
  border: 1px solid #424249;
  background: rgba(17,17,19,.94);
  box-shadow: 0 18px 60px rgba(0,0,0,.35);
}
.prompt { padding-left: 18px; color: #686870; }
.scanner input {
  width: 100%;
  min-width: 0;
  padding: 18px 8px;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}
.scanner input::placeholder { color: #4c4c54; }
.scanner:focus-within { border-color: var(--accent); }
.scanner button,
.secondary {
  border: 0;
  cursor: pointer;
  background: var(--accent);
  color: #111;
  font-weight: 800;
}
.scanner button { align-self: stretch; padding: 0 22px; }
.scanner button:disabled { opacity: .55; cursor: wait; }
.hint { margin: 12px 0 0; color: #686870; font-size: 11px; }

.loading,
.error {
  margin: -40px 0 80px;
  padding: 34px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.loading { text-align: center; }
.loading p { margin: 12px 0 4px; }
.loading small { color: var(--muted); }
.loader { display: flex; justify-content: center; gap: 7px; }
.loader span {
  width: 7px;
  height: 7px;
  background: var(--accent);
  animation: pulse 1s infinite alternate;
}
.loader span:nth-child(2) { animation-delay: .2s; }
.loader span:nth-child(3) { animation-delay: .4s; }
@keyframes pulse { from { opacity: .2; transform: translateY(0); } to { opacity: 1; transform: translateY(-5px); } }
.error { color: #ffb4ab; border-color: #65322e; }

.results { padding: 20px 0 90px; }
.specimen-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 28px;
  align-items: end;
  padding: 32px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.specimen-head h2 {
  margin: 8px 0 7px;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: clamp(34px, 5vw, 64px);
  letter-spacing: -.05em;
  overflow-wrap: anywhere;
}
#result-url {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.species {
  display: flex;
  align-items: center;
  gap: 18px;
  max-width: 470px;
  padding: 20px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.species-emoji { font-size: 46px; }
.species small { display: block; color: var(--muted); font-size: 10px; letter-spacing: .15em; }
.species strong { display: block; margin: 4px 0; font-size: 17px; }
.species p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }

.score-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin: 1px 0 38px;
  background: var(--line);
  border: 1px solid var(--line);
}
.score { padding: 22px; background: var(--panel); }
.score > div:first-child { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.score span { color: var(--muted); text-transform: capitalize; font-size: 11px; }
.score strong { font-size: 29px; }
.score-track { height: 4px; margin-top: 18px; background: #29292e; overflow: hidden; }
.score-track span { display: block; height: 100%; background: var(--accent); }

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 16px;
}
.panel {
  border: 1px solid var(--line);
  background: rgba(17,17,19,.92);
}
.panel-title {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.panel-title span { color: var(--accent); font-size: 10px; }
.panel-title h3 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
.observation-list { padding: 7px 18px 14px; }
.observation {
  display: grid;
  grid-template-columns: 22px minmax(0,1fr);
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px dashed #29292e;
}
.observation:last-child { border-bottom: 0; }
.observation .state { font-weight: 900; }
.observation .yes { color: var(--good); }
.observation .no { color: var(--bad); }
.observation strong { display: block; font-size: 12px; font-weight: 600; }
.observation small {
  display: block;
  margin-top: 3px;
  max-width: 100%;
  color: #66666f;
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fossil-panel > div:last-child { padding: 18px; }
.fossil-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.fossil-grid span {
  padding: 7px 9px;
  border: 1px solid #55462b;
  background: #1f1a10;
  color: #deb86a;
  font-size: 11px;
}
.empty { margin: 0; color: var(--muted); font-size: 12px; }

.metrics { margin-top: 16px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.metric-grid > div { padding: 18px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.metric-grid > div:nth-child(4n) { border-right: 0; }
.metric-grid > div:nth-last-child(-n+4) { border-bottom: 0; }
.metric-grid small { display: block; color: var(--muted); font-size: 10px; }
.metric-grid strong { display: block; margin-top: 7px; font-size: 15px; }

.share {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(300px,460px);
  gap: 34px;
  align-items: center;
  margin-top: 16px;
  padding: 30px;
}
.share h3 { margin: 8px 0; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 28px; }
.share p { color: var(--muted); line-height: 1.6; }
.share img { width: 100%; border-radius: 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.secondary,
.button-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid #3a3a40;
  background: #1a1a1d;
  color: var(--text);
  text-decoration: none;
  font-size: 11px;
  font-weight: 700;
}
.secondary:hover,
.button-link:hover { border-color: var(--accent); }

footer {
  min-height: 90px;
  border-top: 1px solid var(--line);
  color: #5f5f67;
  font-size: 11px;
}

@media (max-width: 800px) {
  .beta { display: none; }
  .hero { min-height: 580px; }
  .scanner { grid-template-columns: auto 1fr; }
  .scanner button { grid-column: 1 / -1; min-height: 48px; }
  .specimen-head,
  .share { grid-template-columns: 1fr; }
  .species { max-width: none; }
  .score-grid { grid-template-columns: repeat(2, 1fr); }
  .field-grid { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .metric-grid > div:nth-child(2n) { border-right: 0; }
  .metric-grid > div:nth-last-child(-n+4) { border-bottom: 1px solid var(--line); }
  .metric-grid > div:nth-last-child(-n+2) { border-bottom: 0; }
}

@media (max-width: 470px) {
  .topbar,
  main,
  footer { width: min(100% - 24px, 1180px); }
  .hero h1 { font-size: 54px; }
  .intro { font-size: 16px; }
  .prompt { padding-left: 12px; font-size: 12px; }
  .scanner input { padding: 16px 5px; }
  .score-grid { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric-grid > div { border-right: 0; border-bottom: 1px solid var(--line) !important; }
  .metric-grid > div:last-child { border-bottom: 0 !important; }
  .share { padding: 20px; }
}
