/* Public barcode → cheapest. Dark market + citrus accent. Less is more. */

:root {
  --bg0: #071412;
  --bg1: #0d2420;
  --ink: #f2f7f4;
  --muted: #8fa39a;
  --accent: #d4f34a;
  --accent-ink: #102016;
  --line: rgba(242, 247, 244, 0.12);
  --panel: rgba(15, 40, 34, 0.72);
  --win: #d4f34a;
  --font-display: "Bricolage Grotesque", "Segoe UI", sans-serif;
  --font-body: "Figtree", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--font-body);
  background: var(--bg0);
}

body {
  position: relative;
  overflow-x: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 55% at 50% -10%, rgba(212, 243, 74, 0.16), transparent 55%),
    radial-gradient(circle at 90% 80%, rgba(46, 120, 98, 0.28), transparent 40%),
    linear-gradient(165deg, var(--bg0), var(--bg1) 55%, #081a17);
}

.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.18;
  background-image: repeating-linear-gradient(
    90deg,
    transparent 0,
    transparent 2px,
    rgba(242, 247, 244, 0.55) 2px,
    rgba(242, 247, 244, 0.55) 3px,
    transparent 3px,
    transparent 7px,
    rgba(242, 247, 244, 0.35) 7px,
    rgba(242, 247, 244, 0.35) 9px,
    transparent 9px,
    transparent 14px
  );
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 70%);
  animation: drift 28s linear infinite;
}

@keyframes drift {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-28px);
  }
}

.shell {
  position: relative;
  z-index: 1;
  width: min(40rem, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2.5rem;
  animation: rise 0.7s ease both;
}

.brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.4rem, 8vw, 3.4rem);
  letter-spacing: -0.05em;
  line-height: 0.95;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
  color: var(--accent);
}

.rate {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.hero {
  animation: rise 0.8s ease 0.08s both;
}

.headline {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.35rem, 4.2vw, 1.75rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
  max-width: 16ch;
}

.lede {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.45;
  max-width: 32ch;
}

.scan {
  margin-top: 2rem;
}

.scan-label {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.55rem;
}

.scan-row {
  display: flex;
  gap: 0.55rem;
  align-items: stretch;
}

.scan-row input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: rgba(7, 20, 18, 0.65);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.scan-row input::placeholder {
  color: rgba(143, 163, 154, 0.55);
  letter-spacing: 0;
}

.scan-row input:focus {
  border-color: rgba(212, 243, 74, 0.65);
  box-shadow: 0 0 0 3px rgba(212, 243, 74, 0.15);
}

.scan-row button,
.scan-row .btn-go,
.scan-row .btn-cam {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  border: 0;
  border-radius: 14px;
  padding: 0 1.2rem;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}

.scan-row .btn-go {
  background: var(--accent);
  color: var(--accent-ink);
}

.scan-row .btn-cam {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.scan-row .btn-go:hover,
.scan-row .btn-cam:hover {
  filter: brightness(1.05);
}

.scan-row button:active {
  transform: translateY(1px);
}

.scan-hint {
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.4;
  max-width: 36rem;
}

body.cam-open {
  overflow: hidden;
}

.cam-sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: end center;
  padding: 1rem;
  background: rgba(4, 12, 10, 0.72);
  backdrop-filter: blur(6px);
  animation: rise 0.25s ease both;
}

.cam-sheet[hidden] {
  display: none !important;
}

.cam-panel {
  width: min(28rem, 100%);
  background: #0c1f1b;
  border: 1px solid var(--line);
  border-radius: 20px 20px 16px 16px;
  padding: 1rem 1rem 1.15rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.cam-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.cam-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.cam-close {
  font: inherit;
  font-weight: 600;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
}

.cam-reader {
  overflow: hidden;
  border-radius: 14px;
  background: #000;
  min-height: 220px;
}

.cam-reader video,
.cam-reader img {
  display: block;
  width: 100% !important;
  max-height: 55dvh;
  object-fit: cover;
  border-radius: 14px;
}

.cam-note {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.result {
  margin-top: 2.25rem;
  animation: rise 0.55s ease both;
}

.state {
  padding: 1.35rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  backdrop-filter: blur(10px);
}

.state-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
}

.state-copy {
  margin: 0.45rem 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.match {
  display: grid;
  gap: 1.1rem;
}

.match-main {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 1rem;
  align-items: center;
}

.match-img {
  width: 5.5rem;
  height: 5.5rem;
  object-fit: contain;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
}

.match-img--empty {
  background:
    linear-gradient(135deg, rgba(212, 243, 74, 0.12), transparent 60%),
    rgba(255, 255, 255, 0.04);
}

.match-brand {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.match-name {
  margin: 0.2rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 3.5vw, 1.45rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.match-ean {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
}

.winner {
  padding: 1.25rem 1.3rem;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(212, 243, 74, 0.95), #b6e028);
  color: var(--accent-ink);
  animation: pop 0.55s cubic-bezier(0.2, 0.85, 0.25, 1.15) both;
}

.winner-kicker {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  opacity: 0.75;
}

.winner-store {
  margin: 0.35rem 0 0;
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.winner-price {
  margin: 0.45rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.9rem;
  align-items: baseline;
}

.winner-usd {
  font-family: var(--font-display);
  font-size: clamp(2rem, 7vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.winner-ves {
  font-size: 0.95rem;
  opacity: 0.75;
  font-variant-numeric: tabular-nums;
}

.ladder {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: var(--panel);
  backdrop-filter: blur(10px);
}

.rung {
  display: grid;
  grid-template-columns: 2rem 1fr auto;
  grid-template-areas:
    "rank store price"
    "rank date price";
  gap: 0.1rem 0.75rem;
  align-items: center;
  padding: 0.95rem 1.05rem;
  border-top: 1px solid var(--line);
  animation: rise 0.45s ease both;
}

.rung:first-child {
  border-top: 0;
}

.rung:nth-child(1) {
  animation-delay: 0.05s;
}
.rung:nth-child(2) {
  animation-delay: 0.12s;
}
.rung:nth-child(3) {
  animation-delay: 0.18s;
}

.rung--win {
  background: rgba(212, 243, 74, 0.08);
}

.rung-rank {
  grid-area: rank;
  width: 1.55rem;
  height: 1.55rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  border: 1px solid var(--line);
}

.rung--win .rung-rank {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
}

.rung-store {
  grid-area: store;
  font-weight: 600;
}

.rung-price {
  grid-area: price;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.rung-price strong {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
}

.rung-price em {
  display: block;
  font-style: normal;
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 0.15rem;
}

.rung-date {
  grid-area: date;
  color: var(--muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.fine {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.foot {
  margin-top: auto;
  padding-top: 3rem;
  color: var(--muted);
  font-size: 0.82rem;
  display: grid;
  gap: 0.35rem;
  animation: rise 0.9s ease 0.15s both;
}

.foot p {
  margin: 0;
}

.muted {
  color: var(--muted);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 520px) {
  .scan-row {
    flex-wrap: wrap;
  }

  .scan-row input {
    flex: 1 1 100%;
  }

  .scan-row .btn-cam,
  .scan-row .btn-go {
    flex: 1 1 calc(50% - 0.3rem);
    padding: 0.95rem 1rem;
  }

  .match-main {
    grid-template-columns: 4.5rem 1fr;
  }

  .match-img {
    width: 4.5rem;
    height: 4.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .atmosphere::after,
  .top,
  .hero,
  .result,
  .rung,
  .winner,
  .foot {
    animation: none;
  }
}
