:root {
  --bg: #f5f3ef;
  --surface: #ffffff;
  --text: #1a1a2e;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border: #e8e5e0;
  --badge-bg: #059669;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 4px 8px rgba(0, 0, 0, 0.06), 0 12px 28px rgba(0, 0, 0, 0.1);
  --transition: 0.2s ease;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  padding: 32px 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  width: min(440px, 100%);
}

/* ── Header ── */

.page-header {
  text-align: center;
  margin-bottom: 28px;
}

.product-title {
  font-size: clamp(1.15rem, 3vw, 1.4rem);
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.product-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* ── Error ── */

.error-message {
  color: #b91c1c;
  background: #fee2e2;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 0.9rem;
  text-align: center;
}

/* ── Market List ── */

.markets-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Card Entrance ── */

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Market Card ── */

.market-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-decoration: none;
  color: inherit;
  position: relative;
  box-shadow: var(--shadow);
  transition:
    box-shadow var(--transition),
    border-color var(--transition),
    transform var(--transition);
  animation: card-in 0.4s ease both;
}

.market-card:hover {
  box-shadow: var(--shadow-hover);
  border-color: #d0cdc8;
  transform: translateY(-2px);
}

.market-card:active {
  transform: translateY(0);
}

/* ── Best Price Variant ── */

.market-card.best-price {
  border-color: var(--badge-bg);
  background: linear-gradient(145deg, #ecfdf5 0%, var(--surface) 55%);
}

.market-card.best-price:hover {
  border-color: #047857;
}

.best-badge {
  position: absolute;
  top: -9px;
  right: 14px;
  background: var(--badge-bg);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* ── Logo ── */

.market-logo-wrap {
  width: 100px;
  min-width: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.market-logo {
  width: 100%;
  height: 24px;
  object-fit: contain;
}

/* ── Info ── */

.market-info {
  flex: 1;
  min-width: 0;
}

.market-name {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 2px;
}

.basket-discount-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.5;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}

.market-price-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.market-price {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.market-card.higher-price .market-price {
  color: var(--text);
}

.market-price-compare {
  font-size: 0.76rem;
  color: var(--text-muted);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  text-decoration-color: #9ca3af;
  line-height: 1.25;
}

/* ── CTA ── */

.market-cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--card-accent, #111827);
  color: var(--card-accent-text, #fff);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--transition);
  flex-shrink: 0;
}

.market-card:hover .market-cta {
  background: var(--card-accent-hover, #374151);
}

.market-cta svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* ── Footer ── */

.page-footer {
  text-align: center;
  margin-top: 24px;
}

.page-footer p {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ── Reduced Motion ── */

@media (prefers-reduced-motion: reduce) {
  .market-card {
    animation: none;
    transition: none;
  }

  .market-cta {
    transition: none;
  }
}

/* ── Mobile ── */

@media (max-width: 480px) {
  body {
    padding: 20px 14px;
  }

  .page-header {
    margin-bottom: 22px;
  }

  .market-card {
    padding: 14px;
    gap: 12px;
  }

  .market-logo-wrap {
    width: 80px;
    min-width: 80px;
  }

  .market-logo {
    height: 20px;
  }

  .market-price {
    font-size: 1.3rem;
  }

  .market-price-compare {
    font-size: 0.72rem;
  }

  .market-cta {
    padding: 9px 14px;
    font-size: 0.78rem;
  }
}
