/* Car-dex — standalone app styling. Dark, gold, card-first. */

:root {
  --bg: #0b0b0d;
  --bg-soft: #101013;
  --card: #141417;
  --card-2: #1a1a1f;
  --line: #26262c;
  --gold: #f0a500;
  --gold-dim: #8a6100;
  --text: #ffffff;
  --muted: #9a9a9a;
  --good: #33d17a;
  --bad: #ff6b6b;
  --radius: 14px;
  --font-head: 'Montserrat', system-ui, sans-serif;
  --font-body: 'Open Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
}

body { padding-bottom: env(safe-area-inset-bottom); }

a { color: var(--gold); }

button { font-family: var(--font-head); }

.shell {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px calc(90px + env(safe-area-inset-bottom));
}

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: rgba(11, 11, 13, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.wordmark {
  font-family: var(--font-head);
  font-weight: 800;
  letter-spacing: 0.14em;
  font-size: 1rem;
  margin: 0;
  flex: 1;
}
.wordmark span { color: var(--gold); }

.iconbtn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-size: 1.05rem;
  cursor: pointer;
}
.iconbtn:hover { background: var(--card-2); }

/* ---------- home ---------- */

.landing {
  position: relative;
  overflow: hidden;
  border-radius: 0 0 24px 24px;
  margin: -1px -16px 0;
  padding: 62px 20px 40px;
  min-height: 92vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: #0b0b0d;
}
.landing::before {
  content: '';
  position: absolute;
  inset: 0;
  /* crop low on the frame: the car, not the dealership's wall sign */
  background: url('/img/huracan_feature.jpg') center 60% / cover no-repeat;
  opacity: 0.55;
  filter: saturate(0.9);
}
.landing::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(11,11,13,0.55) 0%, rgba(11,11,13,0.25) 35%, rgba(11,11,13,0.92) 78%, #0b0b0d 100%);
}
.landing > * { position: relative; z-index: 1; }
.landing .kicker {
  font-family: var(--font-head);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #ffce6a;
  margin: 0 0 14px;
}
.landing h1 {
  font-family: var(--font-head);
  font-size: clamp(2.4rem, 12vw, 3.4rem);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -0.03em;
  margin: 0 0 14px;
}
.landing h1 span { color: var(--gold); }
.landing .lede { color: #eeeeee; font-size: 1.02rem; font-weight: 400; line-height: 1.5; margin: 0 0 22px; max-width: 30ch; }
.landing .cta { display: grid; gap: 10px; }
.landing .fine { color: #c4c4c4; font-size: 0.8rem; margin: 14px 0 0; }

.strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 26px 0 0; }
.strip figure { margin: 0; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--card); }
.strip img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.strip figcaption {
  font-family: var(--font-head);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px 8px;
}

.how { margin: 34px 0 0; display: grid; gap: 12px; }
.how .step { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start; }
.how .num {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-head); font-weight: 800; font-size: 0.85rem;
  color: #14100a; background: linear-gradient(135deg, #f0a500, #d98800);
}
.how h3 { font-family: var(--font-head); font-size: 0.98rem; margin: 4px 0 3px; }
.how p { margin: 0; color: var(--muted); font-size: 0.88rem; line-height: 1.45; }

.hero { padding: 22px 0 6px; text-align: center; }
.hero h1 {
  font-family: var(--font-head);
  font-size: clamp(1.9rem, 8vw, 2.5rem);
  font-weight: 800;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}
.hero h1 span { color: var(--gold); }
.hero p { color: var(--muted); margin: 0 0 18px; font-size: 0.92rem; }

.snap {
  width: 100%;
  min-height: 56px;
  border: none;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #f0a500, #d98800);
  color: #14100a;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(240, 165, 0, 0.18);
}
.snap:active { transform: scale(0.99); }
.snap[disabled] { opacity: 0.6; cursor: progress; }

.hint { color: #b5b5b5; font-size: 0.78rem; text-align: center; margin: 10px 0 0; }

.status { min-height: 1.3rem; text-align: center; color: var(--muted); font-size: 0.88rem; margin: 10px 0 0; }
.status[data-tone='error'] { color: var(--bad); }
.status[data-tone='good'] { color: var(--good); }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 30px 0 12px;
}
.section-head h2 {
  font-family: var(--font-head);
  font-size: 1.05rem;
  margin: 0;
}
.pill {
  background: var(--gold);
  color: #14100a;
  border-radius: 999px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.75rem;
  padding: 3px 9px;
}

.toolrow { display: flex; gap: 8px; margin: -4px 0 12px; }
.btn.tiny { min-height: 36px; padding: 0 14px; font-size: 0.78rem; border-radius: 9px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.tile {
  position: relative;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: inherit;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
}
.tile:hover { border-color: var(--gold-dim); }
.tile .thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: var(--card-2);
}
.tile .thumb.empty { display: grid; place-items: center; color: #3a3a42; font-size: 2rem; }
.tile .meta { padding: 9px 11px 11px; display: grid; gap: 3px; }
.tile strong { font-family: var(--font-head); font-size: 0.86rem; }
.tile .sub { color: var(--muted); font-size: 0.75rem; }
.tile .dex {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: var(--font-head);
  font-size: 0.68rem;
  color: #d8d8d8;
  padding: 2px 6px;
}

.empty-state { color: var(--muted); font-size: 0.9rem; margin: 0; }

/* ---------- the card ---------- */

.card-screen { padding-top: 14px; }

.photoframe {
  position: relative;
  margin: 8px auto 20px;
  width: min(100%, 340px);
  background: #fdfdfb;
  padding: 10px 10px 34px;
  border-radius: 6px;
  transform: rotate(-1.4deg);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
}
.photoframe img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; border-radius: 3px; }
.photoframe .sticker-no {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: var(--gold);
  color: #14100a;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 5px;
}
.photoframe.placeholder { display: grid; place-items: center; color: #9a9a9a; font-family: var(--font-head); }

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.chip {
  font-family: var(--font-head);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.chip.rare { color: #ffd166; border-color: #6b4c00; background: rgba(240, 165, 0, 0.1); }
.chip.uncommon { color: #9ad0ff; border-color: #1f4b6b; background: rgba(154, 208, 255, 0.08); }
.card-head .hp { font-family: var(--font-head); font-weight: 800; font-size: 0.85rem; color: var(--muted); }

.card-title {
  font-family: var(--font-head);
  font-size: clamp(1.5rem, 6.5vw, 1.9rem);
  font-weight: 800;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.card-meta { color: var(--muted); font-size: 0.84rem; margin: 0 0 16px; }

.valuebar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 14px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--gold-dim);
  background: linear-gradient(100deg, rgba(240, 165, 0, 0.14), rgba(240, 165, 0, 0.04));
  margin-bottom: 16px;
}
.valuebar .label { grid-column: 1 / -1; font-family: var(--font-head); font-size: 0.64rem; letter-spacing: 0.12em; color: #d8b464; }
.valuebar .amount { font-family: var(--font-head); font-weight: 800; font-size: 1.35rem; color: #ffce6a; }
.valuebar .klass { font-family: var(--font-head); font-size: 0.7rem; letter-spacing: 0.1em; color: #ffce6a; text-transform: uppercase; }

.specgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--card);
}
.specgrid .cell { padding: 11px 13px; border-bottom: 1px solid var(--line); }
.specgrid .cell:nth-child(odd) { border-right: 1px solid var(--line); }
.specgrid .cell:nth-last-child(-n + 2) { border-bottom: none; }
.specgrid .k { font-family: var(--font-head); font-size: 0.6rem; letter-spacing: 0.11em; color: var(--muted); text-transform: uppercase; display: block; margin-bottom: 3px; }
.specgrid .v { font-size: 0.88rem; }

.blurb { color: #c9c9c9; font-size: 0.9rem; line-height: 1.5; margin: 16px 0; }

.cardfoot {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-head);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  color: #6a6a72;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 14px;
}

.spotted { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 18px 0 4px; color: var(--muted); font-size: 0.84rem; }
.badge-verified {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-head);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #14100a;
  background: var(--gold);
  border-radius: 999px;
  padding: 3px 9px;
}

/* ---------- sections ---------- */

.panel { margin-top: 30px; }
.panel .eyebrow {
  font-family: var(--font-head);
  font-size: 0.64rem;
  letter-spacing: 0.16em;
  color: var(--gold);
  margin: 0 0 4px;
  text-transform: uppercase;
}
.panel h3 { font-family: var(--font-head); font-size: 1.15rem; margin: 0 0 12px; }

.trio {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  border-radius: 12px 12px 0 0;
  border-bottom: none;
  background: var(--card);
}
.trio div { padding: 12px 10px; text-align: center; }
.trio div + div { border-left: 1px solid var(--line); }
.trio .k { font-family: var(--font-head); font-size: 0.58rem; letter-spacing: 0.1em; color: var(--muted); display: block; margin-bottom: 3px; }
.trio .v { font-family: var(--font-head); font-weight: 700; font-size: 1rem; }

.enginerow {
  background: var(--card);
  border: 1px solid var(--line);
  border-bottom: none;
  padding: 11px 13px;
}
.enginerow .k { font-family: var(--font-head); font-size: 0.58rem; letter-spacing: 0.1em; color: var(--muted); display: block; margin-bottom: 3px; }

.figures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: 0 0 12px 12px;
  overflow: hidden;
  background: var(--card);
}
.figures .cell { padding: 11px 13px; border-bottom: 1px solid var(--line); }
.figures .cell:nth-child(odd) { border-right: 1px solid var(--line); }
.figures .cell:nth-last-child(-n + 2) { border-bottom: none; }
.figures .k { font-family: var(--font-head); font-size: 0.58rem; letter-spacing: 0.1em; color: var(--muted); display: block; margin-bottom: 3px; text-transform: uppercase; }
.figures .v { font-size: 0.9rem; }

.rarity-wrap { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; }
.rarity-row { display: flex; justify-content: space-between; font-size: 0.85rem; margin-bottom: 9px; }
.rarity-row span:last-child { color: var(--muted); }
.bar { height: 7px; border-radius: 999px; background: #232329; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #d98800, #ffce6a); }

.chart { width: 100%; height: 150px; display: block; }
.chart-labels { display: flex; justify-content: space-between; font-family: var(--font-head); font-size: 0.6rem; letter-spacing: 0.1em; color: var(--muted); margin-top: 6px; }

.actions { display: grid; gap: 10px; margin-top: 26px; }
.btn {
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
}
.btn.primary { background: linear-gradient(135deg, #f0a500, #d98800); border: none; color: #14100a; }
.btn[disabled] { opacity: 0.55; }

.disclaimer { color: #7f7f86; font-size: 0.74rem; line-height: 1.45; margin: 14px 0 0; }

/* ---------- picker sheet ---------- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  z-index: 40;
  display: flex;
  align-items: flex-end;
}
.sheet {
  width: 100%;
  max-height: 76vh;
  background: var(--bg-soft);
  border-top: 1px solid var(--line);
  border-radius: 18px 18px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  overflow: auto;
}
.sheet h3 { font-family: var(--font-head); margin: 0 0 10px; font-size: 1rem; }
.input {
  width: 100%;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 0.95rem;
}
.picklist { list-style: none; padding: 0; margin: 12px 0 0; }
.picklist li { border-bottom: 1px solid var(--line); }
.picklist button {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  padding: 12px 2px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--font-body);
  font-size: 0.92rem;
}
.picklist small { color: var(--muted); }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--card-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  z-index: 60;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
