:root {
  --red: #ff5f56;
  --dark: #d6e0ea;
  --bg: #0b0f14;
  --card: #11161d;
  --muted: #7c8a9a;
  --border: #232b36;
  --accent: #3fd98a;
  --accent-dim: rgba(63, 217, 138, .12);
  --rad: 10px;
  font-family: ui-monospace, "JetBrains Mono", "Fira Code", "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--dark);
  padding-bottom: 40px;
  -webkit-tap-highlight-color: transparent;
}

.jn-titlebar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.jn-titlebar .jn-dot { width: 11px; height: 11px; border-radius: 50%; }
.jn-titlebar .jn-dot.r { background: #ff5f56; }
.jn-titlebar .jn-dot.y { background: #ffbd2e; }
.jn-titlebar .jn-dot.g { background: #27c93f; }
.jn-titlebar span:last-child { margin-left: 10px; color: var(--muted); font-size: .8rem; }
.jn-titlebar .jn-home { margin-left: auto; text-decoration: none; font-size: .95rem; opacity: .75; }
.jn-titlebar .jn-home:hover { opacity: 1; }

.topbar {
  background: var(--card);
  color: var(--dark);
  border-bottom: 1px solid var(--border);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar h1 { font-size: 18px; margin: 0; }

main { max-width: 560px; margin: 0 auto; padding: 16px; }

.hidden { display: none !important; }

.capture-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--rad);
  padding: 16px;
}

.preview-wrap { margin-bottom: 12px; }
.preview-wrap img { width: 100%; border-radius: var(--rad); display: block; max-height: 360px; object-fit: cover; }

.capture-buttons { display: flex; gap: 10px; }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1;
  padding: 14px 10px;
  border-radius: var(--rad);
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.btn.primary { background: var(--accent); color: var(--bg); }
.btn.secondary { background: var(--card); color: var(--dark); border: 1px solid var(--border); }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn.wide { width: 100%; margin-top: 10px; }

.ghost-btn {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--rad);
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
}
.ghost-btn.small { padding: 6px 10px; font-size: 12px; background: var(--card); color: var(--dark); border: 1px solid var(--border); }

.status-box {
  margin-top: 16px;
  padding: 14px;
  border-radius: var(--rad);
  background: rgba(255,189,46,.08);
  border: 1px solid rgba(255,189,46,.35);
  color: var(--dark);
  font-size: 14px;
}
.status-box.error { background: rgba(255,95,86,.1); border-color: rgba(255,95,86,.4); color: #ff8a80; }

.result-card {
  margin-top: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--rad);
  padding: 18px;
}

.result-card h2 { margin: 0 0 4px; font-size: 20px; }
.result-card .meta { color: var(--muted); font-size: 14px; margin-bottom: 12px; }

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  margin-right: 6px;
}
.badge.common { background: rgba(124,138,154,.15); color: var(--muted); }
.badge.rare { background: rgba(255,189,46,.15); color: #ffbd2e; }
.badge.epic { background: rgba(167,139,250,.15); color: #a78bfa; }

.field-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.field-row:last-child { border-bottom: none; }
.field-row span:first-child { color: var(--muted); }

.price-box {
  margin-top: 14px;
  padding: 14px;
  border-radius: var(--rad);
  background: var(--accent-dim);
  border: 1px solid var(--accent);
}
.price-box h3 { margin: 0 0 6px; font-size: 15px; color: var(--accent); }
.price-box .amount { font-size: 22px; font-weight: 700; color: var(--accent); }
.price-box .sources { margin-top: 8px; font-size: 12px; }
.price-box .sources a { color: var(--accent); display: block; margin-bottom: 2px; }
.price-box.note-only { background: var(--card); border-color: var(--border); }
.price-box.note-only h3 { color: var(--muted); }

.save-row { margin-top: 16px; display: flex; gap: 10px; }

.collection-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}
.collection-actions { display: flex; gap: 8px; align-items: center; }
#searchInput {
  padding: 8px 10px;
  border-radius: var(--rad);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--dark);
  font-size: 13px;
}

.muted { color: var(--muted); font-size: 13px; }

.collection-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.car-tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--rad);
  overflow: hidden;
  position: relative;
}
.car-tile img { width: 100%; height: 120px; object-fit: cover; display: block; }
.car-tile .tile-body { padding: 8px 10px; }
.car-tile .tile-name { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.car-tile .tile-meta { font-size: 11px; color: var(--muted); }
.car-tile .delete-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0,0,0,0.55);
  color: white;
  border: none;
  border-radius: 999px;
  width: 24px;
  height: 24px;
  font-size: 13px;
  cursor: pointer;
}
