/* Design tokens taken from coarena.ai so the two look like one family. */
:root {
  --bg: #fff;
  --card: #fafafa;
  --fill: #f4f4f5;
  --border: #e4e4e7;
  --text: #09090b;
  --muted: #71717a;
  --faint: #a1a1aa;
  --success: #16a34a;
  --danger: #dc2626;
  --hairline: #e8e8ed;
  --ink-2: #6e6e73;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --link: #06c;
  --tile: #f5f5f7;
  --tile-hover: #ededf0;
  --frost: rgba(245, 245, 247, .86);

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-code: ui-monospace, "SF Mono", SFMono-Regular, "IBM Plex Mono", Menlo, Consolas, monospace;

  --t-12: 12px; --t-14: 13px; --t-17: 15px; --t-21: 17px; --t-28: 22px; --t-40: 32px; --t-56: 44px;
  --track-title: -.03em;
  --track-section: -.02em;
  --radius-tile: 20px;
  --radius-control: 980px;
  --page-max: 1040px;
  --page-pad: 24px;
  --gap-section: 56px;
  --dur-hover: .16s;
  --ease-out: cubic-bezier(.215, .61, .355, 1);
  --fade-line: linear-gradient(90deg, #0000 0%, #00000017 14%, #00000017 86%, #0000 100%);
}

@media (max-width: 640px) {
  :root { --page-pad: 16px; --gap-section: 40px; }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--t-17);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0; font-weight: 600; color: var(--text); }
p { margin: 0; }

.mono, .mono-label, .eyebrow, .step, .mono-note, .tag, .pill, .count {
  font-family: var(--font-code);
}

.muted { color: var(--muted); }
.small { font-size: var(--t-14); }

/* ----------------------------------------------------------- beta strip */
.beta-strip {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  padding: 8px var(--page-pad);
  background: var(--text);
  color: #e3e3e8;
  font-size: var(--t-12);
  text-align: center;
}
.beta-strip .mono {
  padding: 1px 8px;
  border-radius: var(--radius-control);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  letter-spacing: .04em;
}

/* ------------------------------------------------------------------ nav */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--frost);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hairline);
}
.nav-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--page-pad);
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 600;
  letter-spacing: var(--track-section);
}
.brand:hover { text-decoration: none; }
.tag {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  color: var(--muted);
}
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a, .link-btn {
  padding: 6px 10px;
  border-radius: var(--radius-control);
  color: var(--muted);
  font-size: var(--t-14);
  font-weight: 500;
  transition: color var(--dur-hover) var(--ease-out), background var(--dur-hover) var(--ease-out);
}
.nav-links a:hover, .link-btn:hover { color: var(--text); background: var(--fill); text-decoration: none; }
.nav-links a.active { color: var(--text); background: var(--fill); }
.nav-links a.btn { color: #fff; }
.nav-links a.btn:hover { color: #fff; background: #27272a; }
.nav-links form { margin: 0; }
.link-btn { border: 0; background: none; font-family: inherit; cursor: pointer; }

@media (max-width: 480px) {
  .brand .tag { display: none; }
  .nav-links a, .link-btn { padding: 6px 8px; }
}

/* ----------------------------------------------------------------- page */
.page {
  flex: 1;
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 32px var(--page-pad) 64px;
}

.eyebrow {
  font-size: var(--t-12);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 10px;
}

.hero { padding: 40px 0 8px; max-width: 720px; }
.hero h1 {
  font-size: var(--t-56);
  line-height: 1.05;
  letter-spacing: var(--track-title);
  font-weight: 700;
}
.lead { margin-top: 16px; font-size: var(--t-21); color: var(--ink-2); max-width: 560px; }
@media (max-width: 640px) { .hero h1 { font-size: var(--t-40); } }

.head { margin-bottom: 24px; max-width: 640px; }
.head .muted { margin-top: 8px; }
.h-page { font-size: var(--t-40); line-height: 1.1; letter-spacing: var(--track-title); }
.h-card { font-size: var(--t-28); letter-spacing: var(--track-section); margin-bottom: 6px; }
.h-tile { font-size: var(--t-21); letter-spacing: var(--track-section); margin-bottom: 12px; }
@media (max-width: 640px) { .h-page { font-size: 28px; } }

.section { margin-top: var(--gap-section); }
.section-tight { margin-top: 32px; }
.section h2, .section-tight h2 {
  font-size: var(--t-28);
  letter-spacing: var(--track-section);
  margin-bottom: 14px;
}
.section > .muted, .section-tight > .muted { margin: -6px 0 14px; }
.section::before {
  content: "";
  display: block;
  height: 1px;
  background: var(--fade-line);
  margin-bottom: var(--gap-section);
}
.count {
  font-size: var(--t-12);
  font-weight: 500;
  color: var(--muted);
  background: var(--fill);
  border-radius: var(--radius-control);
  padding: 2px 8px;
  vertical-align: middle;
}

.row-between { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.row-between h2 { margin-bottom: 14px; }

/* ---------------------------------------------------------------- tiles */
.grid-4, .grid-3, .grid-2 { display: grid; gap: 12px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); margin-top: 16px; }
@media (max-width: 860px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.tile {
  background: var(--tile);
  border-radius: var(--radius-tile);
  padding: 22px;
}
.tile h3 { font-size: var(--t-21); letter-spacing: var(--track-section); margin: 10px 0 6px; }
.tile p { color: var(--ink-2); font-size: var(--t-14); }
.tile-plain { background: var(--bg); border: 1px solid var(--border); }
.step { font-size: var(--t-12); font-weight: 600; color: var(--accent); }
.mono-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}
.empty { text-align: center; padding: 36px 22px; }
.empty p { margin-bottom: 14px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 6px 14px;
  background: var(--fill);
  border-radius: var(--radius-control);
  font-size: var(--t-14);
  color: var(--text);
}

/* -------------------------------------------------------------- buttons */
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; align-items: center; }
.actions form { margin: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 22px;
  border-radius: var(--radius-control);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: var(--t-17);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--dur-hover) var(--ease-out), border-color var(--dur-hover) var(--ease-out), opacity var(--dur-hover);
}
.btn:hover { text-decoration: none; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-sm { min-height: 32px; padding: 0 14px; font-size: var(--t-14); }
.btn-dark { background: var(--text); color: #fff; }
.btn-dark:hover { background: #27272a; }
.btn-tile { background: var(--tile); color: var(--text); }
.btn-tile:hover { background: var(--tile-hover); }
.btn-outline { background: var(--bg); color: var(--text); border-color: var(--border); }
.btn-outline:hover { border-color: var(--text); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* ---------------------------------------------------------------- flash */
.flash {
  padding: 12px 16px;
  border-radius: 14px;
  margin-bottom: 16px;
  font-size: var(--t-14);
  border: 1px solid var(--border);
  background: var(--card);
}
.flash-ok { border-color: #bbf7d0; background: #f0fdf4; color: #166534; }
.flash-error { border-color: #fecaca; background: #fef2f2; color: #991b1b; }

/* ----------------------------------------------------------------- auth */
.auth { display: flex; justify-content: center; padding-top: 24px; }
.card {
  width: 100%;
  max-width: 420px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-tile);
  padding: 32px;
  box-shadow: 0 1px 2px #0000000d;
}
@media (max-width: 480px) { .card { padding: 24px 20px; } }
.form { display: grid; gap: 14px; margin-top: 22px; }
.form label { display: grid; gap: 6px; }
.form input {
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 16px; /* 16px stops iOS zooming into the field */
  transition: border-color var(--dur-hover), box-shadow var(--dur-hover);
}
.form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px #0071e326; }
.hint { font-size: var(--t-12); color: var(--muted); margin-top: -6px; }
.switch { margin-top: 18px; text-align: center; font-size: var(--t-14); color: var(--muted); }

/* ----------------------------------------------------------------- scan */
.scan-form { max-width: 520px; display: grid; gap: 12px; }
.capture {
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-tile);
  background: var(--tile);
  border: 1px dashed var(--border);
  overflow: hidden;
  display: grid;
  place-items: center;
}
.capture img { width: 100%; height: 100%; object-fit: cover; }
.capture-empty { text-align: center; color: var(--faint); }
.capture-empty p { margin-top: 8px; font-size: var(--t-14); }
.capture-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.mono-note { text-align: center; font-size: var(--t-12); color: var(--muted); }

.spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid #ffffff55;
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.btn.busy { opacity: 1; cursor: progress; }
.btn.busy .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 640px) { .thumbs { grid-template-columns: repeat(2, 1fr); } }
.thumb {
  position: relative;
  display: block;
  border-radius: 16px;
  overflow: hidden;
  background: var(--tile);
  color: var(--text);
}
.thumb:hover { text-decoration: none; }
.thumb img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.thumb .pill { position: absolute; top: 8px; left: 8px; }
.thumb-name {
  display: block;
  padding: 8px 10px;
  font-size: var(--t-14);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------------------------------------------------------------- pills */
.pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: var(--radius-control);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}
.pill-match { background: #dcfce7; color: #15803d; }
.pill-new { background: #e0efff; color: var(--accent); }
.pill-demo { background: var(--fill); color: var(--muted); }

/* --------------------------------------------------------------- result */
.verdict { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 24px; }
.verdict .muted { margin-top: 8px; max-width: 560px; }
.verdict-icon {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 600;
  color: #fff;
}
.verdict-match .verdict-icon { background: var(--success); }
.verdict-match .eyebrow { color: var(--success); }
.verdict-new .verdict-icon { background: var(--accent); }
.verdict-new .eyebrow { color: var(--accent); }

.photos { display: grid; gap: 12px; max-width: 520px; }
.photos-2 { grid-template-columns: 1fr 1fr; max-width: 760px; }
.photos figure { margin: 0; }
.photos img, .photo-empty {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius-tile);
  background: var(--tile);
}
.photo-empty { display: grid; place-content: center; text-align: center; gap: 6px; color: var(--muted); font-size: var(--t-14); }
.photos figcaption { margin-top: 8px; }
@media (max-width: 480px) {
  .photos-2 { gap: 8px; }
  .photos-2 img, .photos-2 .photo-empty { aspect-ratio: 1; border-radius: 16px; }
  .photos-2 figcaption { font-size: 10px; }
}

.facts { display: grid; grid-template-columns: 120px 1fr; gap: 10px 16px; margin: 0; font-size: var(--t-14); }
.facts dt {
  font-family: var(--font-code);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  padding-top: 2px;
}
.facts dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
@media (max-width: 400px) { .facts { grid-template-columns: 1fr; gap: 2px; } .facts dd { margin-bottom: 8px; } }

/* ----------------------------------------------------------------- list */
.list { border: 1px solid var(--border); border-radius: var(--radius-tile); overflow: hidden; }
.list-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  color: var(--text);
  border-top: 1px solid var(--hairline);
  min-height: 44px;
}
.list-row:first-child { border-top: 0; }
a.list-row:hover { background: var(--card); text-decoration: none; }
.list-row img, .list-icon {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--tile);
}
.list-icon { display: grid; place-items: center; font-size: var(--t-12); font-weight: 600; color: var(--muted); }
.list-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.list-main strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-main .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --------------------------------------------------------------- footer */
.footer { border-top: 1px solid var(--hairline); background: var(--tile); }
.footer-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 20px var(--page-pad);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  font-size: var(--t-12);
  color: var(--muted);
}
