:root {
  /* Colores del logo CanastaPY: navy + rojo */
  --bg: #f4f6f9;
  --bg-deep: #e8ecf2;
  --ink: #0b1f3a;
  --ink-soft: #132a4a;
  --muted: #5a6b7d;
  --accent: #e30613;
  --accent-ink: #ffffff;
  --accent-soft: #ffd0d3;
  --brand-navy: #0b1f3a;
  --brand-red: #e30613;
  --surface: #ffffff;
  --surface-solid: #ffffff;
  --line: rgba(11, 31, 58, 0.12);
  --line-strong: rgba(11, 31, 58, 0.2);
  --ok: #1f7a4c;
  --danger: #e30613;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(11, 31, 58, 0.06);
  --font-display: "Mulish", "Roboto", sans-serif;
  --font-body: "Lato", "Roboto", sans-serif;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-base: 15px;
  --fs-md: 16px;
  --fs-lg: 18px;
  --fs-xl: 22px;
  --fs-2xl: 28px;
  --max: 720px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
}

body {
  position: relative;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
  font-size: var(--fs-base);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

.page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(900px 480px at 0% -10%, rgba(227, 6, 19, 0.08), transparent 55%),
    radial-gradient(700px 420px at 100% 0%, rgba(11, 31, 58, 0.08), transparent 50%),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 45%, var(--bg-deep) 100%);
}

.page-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg width='48' height='48' viewBox='0 0 48 48' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='24' cy='24' r='2' fill='%230b1f3a'/%3E%3C/svg%3E");
  background-size: 48px 48px;
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.5rem 0.75rem;
  z-index: 10;
  border-radius: 8px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.85rem 1.25rem 0;
}

.top-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
}

.top-logo img {
  display: block;
  height: 42px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
}

.nav {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.nav-btn,
.back,
.primary,
.ghost,
.search button,
.explore-match-btn {
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 700;
  cursor: pointer;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 0.55rem 1rem;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.15s ease;
}

.nav-btn:hover,
.ghost:hover,
.back:hover,
.explore-match-btn:hover {
  border-color: var(--line-strong);
  background: var(--surface-solid);
}

.nav-btn[aria-current="page"],
.primary,
.search button {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
  font-weight: 700;
}

.nav-btn[aria-current="page"]:hover,
.primary:hover,
.search button:hover {
  filter: brightness(1.06);
}

.primary:active,
.search button:active,
.nav-btn:active {
  transform: translateY(1px);
}

.primary:disabled,
.search button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

.ghost {
  background: transparent;
}

.badge {
  display: inline-block;
  margin-left: 0.2rem;
  background: var(--brand-red);
  color: #fff;
  border-radius: 6px;
  padding: 0.05rem 0.4rem;
  font-size: var(--fs-xs);
  font-weight: 700;
}

main {
  flex: 1 0 auto;
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.5rem 1.25rem 2rem;
}

.hero {
  padding: 1rem 0 0.35rem;
  animation: rise-in 0.55s ease both;
}

.brand-logo {
  display: block;
  width: min(100%, 520px);
  height: auto;
  margin: 0 0 0.85rem;
  animation: brand-in 0.6s ease both;
}

.hero-title {
  margin: 0.35rem 0 0.3rem;
  font-family: var(--font-display);
  font-size: clamp(var(--fs-xl), 4.5vw, 24px);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--brand-navy);
  line-height: 1.25;
}

.product-heading {
  margin-top: 0.75rem;
}

.hero-sub,
.section-sub {
  margin: 0 0 1.1rem;
  color: var(--muted);
  max-width: 28rem;
  font-size: var(--fs-md);
  line-height: 1.4;
}

.search {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.55rem;
  animation: rise-in 0.65s ease 0.08s both;
}

.search .icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  padding: 0;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--surface-solid);
  color: var(--accent);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    transform 0.1s ease;
}

.search .icon-btn svg {
  display: block;
  width: 22px;
  height: 22px;
}

.search .icon-btn:hover {
  border-color: var(--accent);
  background: #fff;
  filter: none;
}

.search .icon-btn:active {
  transform: translateY(1px);
}

.search .icon-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.search .icon-btn.busy {
  animation: pulse-soft 1s ease-in-out infinite;
}

@keyframes pulse-soft {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

.sheet-overlay[hidden] {
  display: none;
}

.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(11, 31, 58, 0.45);
  backdrop-filter: blur(2px);
  animation: rise-in 0.2s ease both;
}

.sheet {
  width: min(24rem, 100%);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--surface-solid);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
}

.sheet-title {
  margin: 0 0 0.25rem;
  font-weight: 800;
  font-size: var(--fs-md);
  color: var(--ink);
  text-align: center;
}

.sheet-btn {
  font: inherit;
  font-size: var(--fs-md);
  font-weight: 700;
  cursor: pointer;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface-solid);
  color: var(--ink);
  min-height: 48px;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    transform 0.1s ease;
}

.sheet-btn:hover {
  border-color: var(--accent);
}

.sheet-btn:active {
  transform: translateY(1px);
}

.sheet-cancel {
  color: var(--muted);
  border-color: transparent;
  background: transparent;
}

@media (max-width: 600px) {
  .sheet-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .sheet {
    width: 100%;
    border-radius: 16px 16px 0 0;
    padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom));
  }
}

.search input {
  font: inherit;
  font-size: var(--fs-md);
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--surface-solid);
  color: var(--ink);
  padding: 0.8rem 1rem;
  box-shadow: var(--shadow);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.search input::placeholder {
  color: #8aa094;
}

.search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(227, 6, 19, 0.18);
}

.search button {
  padding-inline: 1.25rem;
}

.status {
  min-height: 1.25rem;
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: var(--fs-sm);
}

.section-title {
  margin: 1.5rem 0 0.3rem;
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.results,
.featured,
.totals {
  display: grid;
  gap: 0.55rem;
  margin-top: 1rem;
}

/* Interactive rows — light surfaces, not dashboard cards */
.card,
.explore-item,
.basket-list li {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow);
  animation: rise-in 0.4s ease both;
}

.card {
  display: grid;
  gap: 0.3rem;
  transition: border-color 0.2s ease;
}

.card:hover {
  border-color: var(--line-strong);
}

.card button.linkish {
  all: unset;
  cursor: pointer;
  color: var(--ink);
  font-weight: 700;
  font-size: var(--fs-md);
  font-family: var(--font-body);
}
.card button.linkish:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.meta {
  color: var(--muted);
  font-size: var(--fs-sm);
}

.price {
  font-weight: 700;
  font-size: var(--fs-md);
  color: var(--ok);
  font-variant-numeric: tabular-nums;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-solid);
  margin: 0.5rem 0 1.25rem;
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
}

th {
  color: var(--muted);
  font-weight: 700;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tr:last-child td {
  border-bottom: 0;
}

tr:hover td {
  background: rgba(11, 31, 58, 0.04);
}

a.ext {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
a.ext:hover {
  text-decoration: underline;
}

.basket-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.basket-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.basket-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.back {
  margin-bottom: 0.25rem;
}

.explore {
  margin: 1.75rem 0 1rem;
  padding-top: 0.25rem;
  animation: rise-in 0.45s ease both;
}

.explore-list {
  display: grid;
  gap: 0.55rem;
  margin: 0.85rem 0 1rem;
  max-height: min(28rem, 55vh);
  overflow: auto;
  padding-right: 0.15rem;
}

.explore-item {
  display: grid;
  gap: 0.55rem;
}

.explore-item-main {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: start;
  cursor: pointer;
}

.explore-item-main--solo {
  grid-template-columns: 1fr auto;
  cursor: default;
}

.explore-item input {
  margin-top: 0.25rem;
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--accent);
}

.explore-item .name {
  margin: 0;
  font-weight: 700;
  font-size: var(--fs-md);
  line-height: 1.35;
  color: var(--ink);
}

.explore-item .meta {
  margin: 0.2rem 0 0;
  font-size: var(--fs-sm);
}

.explore-item .price {
  margin: 0;
  white-space: nowrap;
  font-weight: 700;
  font-size: var(--fs-md);
  color: var(--accent);
}

.explore-match-btn {
  justify-self: start;
  font-size: var(--fs-sm);
  padding: 0.4rem 0.85rem;
}

.explore-compare-out {
  display: grid;
  gap: 0.6rem;
  margin: 0 0 1rem;
  padding: 0.85rem 0.9rem;
  border-radius: 12px;
  background: #fff5f5;
  border: 1px solid var(--accent-soft);
  scroll-margin-top: 5.5rem;
}

.explore-compare-out[hidden] {
  display: none !important;
}

.explore-compare-out:not([hidden]) + .explore-actions {
  margin-top: 0.15rem;
}

.explore.has-compare .explore-list {
  max-height: min(12rem, 28vh);
}

.explore-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}

.feedback {
  margin-top: 1.15rem;
  padding: 1rem 0 0;
  border-top: 1px solid var(--line);
}

.stars {
  display: flex;
  gap: 0.35rem;
  margin: 0.5rem 0;
}

.star-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface-solid);
  color: #b0bfb6;
  font-size: 1.35rem;
  line-height: 1;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 10px;
  cursor: pointer;
  padding: 0;
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}

.star-btn:hover,
.star-btn.on {
  color: var(--brand-red);
  border-color: var(--accent-soft);
  background: #fff5f5;
}

.star-btn:disabled {
  cursor: default;
  opacity: 0.9;
}

.feedback-status {
  min-height: 1.2em;
}

.foot {
  flex-shrink: 0;
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 2.25rem 1.25rem max(2.75rem, calc(1.75rem + env(safe-area-inset-bottom, 0px)));
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.85rem;
  color: var(--muted);
  font-size: var(--fs-sm);
}

.foot p {
  margin: 0;
  max-width: 36rem;
}

.foot a {
  color: var(--ink-soft);
  font-weight: 600;
}

.support-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  border: none;
  background: none;
  padding: 0.35rem 0.5rem;
  color: var(--brand-navy);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.support-link:active {
  opacity: 0.7;
}

.foot-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}

.coffee-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid rgba(11, 31, 58, 0.16);
  background: #fff;
  color: var(--brand-navy);
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(11, 31, 58, 0.1);
  transition:
    transform 0.1s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.coffee-link:hover {
  border-color: var(--brand-red);
  box-shadow: 0 2px 8px rgba(11, 31, 58, 0.14);
}

.coffee-link:active {
  transform: translateY(1px);
}

.coffee-alias {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 2px 0 0;
}

.coffee-alias-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
}

.coffee-alias-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.coffee-alias-row code {
  flex: 1;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  background: #f7f9fb;
  border: 1px solid rgba(11, 31, 58, 0.16);
  border-radius: 10px;
  padding: 10px 12px;
  word-break: break-all;
}

.coffee-copy {
  border: none;
  border-radius: 10px;
  background: var(--brand-red);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 10px 14px;
  cursor: pointer;
  white-space: nowrap;
}

.coffee-copy:active {
  opacity: 0.75;
}

.coffee-copy.copied {
  background: #1a7f37;
}

/* Closed by default via [hidden]; only .open shows the modal */
.support-overlay[hidden] {
  display: none !important;
}

.support-overlay {
  position: fixed;
  inset: 0;
  z-index: 10200;
  background: rgba(11, 31, 58, 0.45);
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s, visibility 0.25s;
}

.support-overlay.open {
  display: flex;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.support-panel {
  width: 100%;
  max-width: 430px;
  max-height: min(88vh, 640px);
  overflow-y: auto;
  background: var(--surface);
  border-radius: 14px 14px 0 0;
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom, 0px));
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  border-top: 1px solid rgba(11, 31, 58, 0.12);
  box-shadow: 0 -8px 40px rgba(11, 31, 58, 0.18);
}

.support-overlay.open .support-panel {
  transform: translateY(0);
}

.support-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.support-topbar h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--brand-navy);
  font-family: Mulish, Lato, sans-serif;
}

.support-close {
  border: none;
  background: #eef2f6;
  color: var(--muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}

.support-hint {
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--muted);
  margin: 0 0 14px;
}

.support-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.support-form label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
}

.support-form input,
.support-form textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(11, 31, 58, 0.16);
  background: #f7f9fb;
  color: var(--ink);
  font-size: 0.95rem;
  padding: 10px 12px;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
}

.support-form textarea {
  min-height: 120px;
  resize: vertical;
}

.support-form input:focus,
.support-form textarea:focus {
  border-color: var(--brand-red);
}

.support-send {
  margin-top: 4px;
  height: 44px;
  border: none;
  border-radius: 10px;
  background: var(--brand-red);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}

.support-send:active {
  opacity: 0.75;
}

.support-send:disabled {
  opacity: 0.55;
  cursor: wait;
}

.support-note {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.4;
  margin: 6px 0 0;
}

.support-status {
  font-size: 0.85rem;
  line-height: 1.4;
  margin: 8px 0 0;
  min-height: 1.2em;
}

.support-status.ok {
  color: #1a7f37;
}

.support-status.err {
  color: var(--brand-red);
}

@media (min-width: 769px) {
  .support-overlay {
    align-items: center;
    padding: 16px;
  }

  .support-panel {
    max-width: 420px;
    border-radius: 12px;
    transform: scale(0.96);
  }

  .support-overlay.open .support-panel {
    transform: scale(1);
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes brand-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* —— Loading / wait screen —— */
.view[hidden] {
  display: none !important;
}

.view-loading {
  min-height: 68vh;
  display: grid;
  place-items: center;
  padding: 2rem 0 3rem;
}

.view-loading[hidden] {
  display: none !important;
}

.loading-stage {
  width: min(100%, 26rem);
  text-align: center;
  animation: rise-in 0.4s ease both;
}

.loading-brand {
  display: none;
}

.loading-logo {
  display: block;
  width: min(240px, 70%);
  height: auto;
  margin: 0 auto 1.25rem;
}

.magnifier-handle {
  stroke: var(--brand-red);
}

.magnifier-glint {
  fill: rgba(227, 6, 19, 0.4);
  animation: glint-pulse 1.4s ease-in-out infinite;
}

.magnifier-scan {
  position: absolute;
  left: 18%;
  top: 22%;
  width: 38%;
  height: 38%;
  border-radius: 50%;
  background: linear-gradient(
    120deg,
    transparent 30%,
    rgba(227, 6, 19, 0.22) 50%,
    transparent 70%
  );
  animation: scan-sweep 2s linear infinite;
  pointer-events: none;
}

.magnifier {
  position: relative;
  width: 7.5rem;
  height: 7.5rem;
  margin: 0 auto 1.35rem;
}

.magnifier-svg {
  display: block;
  width: 100%;
  height: 100%;
  animation: magnifier-bob 1.6s ease-in-out infinite;
}

.magnifier-lens {
  stroke: var(--ink-soft);
}

.magnifier-handle {
  stroke: var(--accent);
}

.magnifier-glint {
  fill: rgba(226, 27, 90, 0.4);
  animation: glint-pulse 1.4s ease-in-out infinite;
}

.magnifier-scan {
  position: absolute;
  left: 18%;
  top: 22%;
  width: 38%;
  height: 38%;
  border-radius: 50%;
  background: linear-gradient(
    120deg,
    transparent 30%,
    rgba(226, 27, 90, 0.22) 50%,
    transparent 70%
  );
  animation: scan-sweep 2s linear infinite;
  pointer-events: none;
}

.loading-title {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: clamp(var(--fs-xl), 4vw, 24px);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.loading-query {
  margin: 0 0 1rem;
  color: var(--accent);
  font-weight: 700;
  font-size: var(--fs-md);
}

.loading-message {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: var(--fs-base);
  min-height: 2.8em;
  transition: opacity 0.25s ease;
}

.loading-message.is-fading {
  opacity: 0;
}

.progress {
  height: 0.55rem;
  border-radius: 999px;
  background: rgba(26, 26, 26, 0.08);
  overflow: hidden;
  margin: 0 auto;
  max-width: 18rem;
}

.progress-bar {
  height: 100%;
  width: 6%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand-navy), var(--brand-red));
  transition: width 0.45s ease;
}

.loading-hint {
  margin: 0.85rem 0 0;
  font-size: var(--fs-sm);
  color: var(--muted);
}

@keyframes magnifier-bob {
  0%,
  100% {
    transform: translate(0, 0) rotate(-8deg);
  }
  25% {
    transform: translate(10px, -6px) rotate(4deg);
  }
  50% {
    transform: translate(-6px, 4px) rotate(-12deg);
  }
  75% {
    transform: translate(8px, 6px) rotate(6deg);
  }
}

@keyframes scan-sweep {
  0% {
    transform: translate(-20%, -10%) rotate(0deg);
    opacity: 0.35;
  }
  50% {
    opacity: 0.7;
  }
  100% {
    transform: translate(30%, 25%) rotate(180deg);
    opacity: 0.35;
  }
}

@keyframes glint-pulse {
  0%,
  100% {
    opacity: 0.35;
  }
  50% {
    opacity: 0.9;
  }
}

@media (prefers-reduced-motion: reduce) {
  .magnifier-svg,
  .magnifier-scan,
  .magnifier-glint {
    animation: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* —— Mobile / narrow screens —— */
@media (max-width: 640px) {
  :root {
    --fs-base: 15px;
    --fs-md: 15px;
    --fs-lg: 17px;
    --fs-xl: 20px;
    --fs-2xl: 32px;
  }

  body {
    font-size: var(--fs-base);
  }

  .top {
    position: sticky;
    top: 0;
    z-index: 20;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.85rem;
    padding-top: max(0.55rem, env(safe-area-inset-top));
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
  }

  .top-logo img {
    height: 36px;
    max-width: 130px;
  }

  .nav {
    width: auto;
    display: flex;
    grid-template-columns: unset;
    gap: 0.4rem;
    flex-shrink: 0;
  }

  .nav-btn {
    min-height: 40px;
    width: auto;
    padding: 0.5rem 0.7rem;
    font-size: var(--fs-sm);
  }

  main {
    padding: 0.35rem 1rem 1.5rem;
  }

  .hero {
    padding: 0.75rem 0 0.25rem;
  }

  .brand-logo {
    width: min(100%, 340px);
    margin-bottom: 0.65rem;
  }

  .hero-title {
    font-size: 1.15rem;
    margin: 0.35rem 0 0.25rem;
  }

  .hero-sub,
  .section-sub {
    font-size: var(--fs-base);
    margin-bottom: 0.95rem;
    max-width: none;
  }

  .search {
    grid-template-columns: auto 1fr;
    gap: 0.5rem;
  }

  .search input {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 48px;
    font-size: 16px; /* evita zoom automático en iOS */
    padding: 0.85rem 1rem;
    border-radius: 12px;
  }

  .search .icon-btn {
    width: auto;
    min-height: 48px;
    padding-inline: 1rem;
  }

  .search button,
  .primary,
  .ghost,
  .back,
  .explore-match-btn {
    min-height: 48px;
    width: 100%;
    font-size: var(--fs-base);
    padding: 0.75rem 1rem;
  }

  .explore-actions {
    display: grid;
    gap: 0.5rem;
  }

  .explore-actions .primary,
  .explore-actions .ghost {
    width: 100%;
  }

  .status {
    font-size: var(--fs-sm);
  }

  .section-title {
    margin-top: 1.25rem;
    font-size: var(--fs-lg);
  }

  .explore-list {
    max-height: none;
    gap: 0.65rem;
    margin: 0.75rem 0 1rem;
  }

  .explore-item {
    padding: 0.85rem;
    gap: 0.65rem;
  }

  .explore-item-main {
    grid-template-columns: auto 1fr;
    gap: 0.65rem;
  }

  .explore-item-main--solo {
    grid-template-columns: 1fr;
  }

  .explore-item .price {
    grid-column: 2;
    justify-self: start;
    margin-top: 0.15rem;
  }

  .explore-item-main--solo .price {
    grid-column: 1;
  }

  .explore-match-btn {
    justify-self: stretch;
  }

  .card {
    padding: 0.85rem;
  }

  .basket-list li {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }

  .basket-list li .ghost,
  .basket-list li .linkish {
    width: 100%;
  }

  .basket-actions {
    display: grid;
    gap: 0.5rem;
  }

  .table-wrap {
    margin: 0.35rem -0.15rem 1rem;
    border-radius: 12px;
    -webkit-overflow-scrolling: touch;
  }

  th,
  td {
    padding: 0.75rem 0.7rem;
    font-size: var(--fs-sm);
  }

  th:nth-child(3),
  td:nth-child(3) {
    white-space: nowrap;
  }

  .view-loading {
    min-height: 70vh;
    padding: 1.5rem 0.5rem 2rem;
  }

  .magnifier {
    width: 6.25rem;
    height: 6.25rem;
    margin-bottom: 1.1rem;
  }

  .loading-title {
    font-size: 1.25rem;
  }

  .loading-query {
    font-size: var(--fs-base);
    word-break: break-word;
    padding: 0 0.5rem;
  }

  .loading-message {
    font-size: var(--fs-base);
    padding: 0 0.25rem;
  }

  .stars {
    justify-content: center;
    flex-wrap: wrap;
  }

  .star-btn {
    width: 2.75rem;
    height: 2.75rem;
  }

  .foot {
    padding: 2rem 1rem max(2.5rem, calc(1.5rem + env(safe-area-inset-bottom, 0px)));
    font-size: var(--fs-xs);
  }

  .feedback {
    text-align: center;
  }
}

/* Very small phones */
@media (max-width: 380px) {
  .top-logo img {
    height: 30px;
    max-width: 110px;
  }

  .nav-btn {
    font-size: var(--fs-xs);
    padding-inline: 0.45rem;
  }

  main {
    padding-inline: 0.85rem;
  }

  .brand-logo {
    width: 100%;
  }
}

/* —— Estadística (panel tipo mercado / Bloomberg) —— */
.stats-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  margin: 0.6rem 0 0.2rem;
}

.stats-controls .status {
  margin: 0;
}

.range-tabs {
  display: inline-flex;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem;
  gap: 0.15rem;
}

.range-tab {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  font-size: var(--fs-sm);
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
}

.range-tab.active {
  background: var(--brand-navy);
  color: #fff;
}

.demo-toggle {
  appearance: none;
  border: 1px dashed var(--line-strong);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  font-size: var(--fs-sm);
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
}

.demo-toggle.active {
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

/* trend colors: down = green (good), up = red, flat = gray */
.price-down {
  color: var(--ok);
}

.price-up {
  color: var(--danger);
}

.price-flat {
  color: var(--muted);
}

/* change pill (like a crypto ticker % badge) */
.change-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.15rem 0.5rem;
  border-radius: 8px;
  font-size: var(--fs-sm);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.change-pill.down {
  color: #0f7a3d;
  background: rgba(31, 122, 76, 0.14);
}

.change-pill.up {
  color: #c02626;
  background: rgba(227, 6, 19, 0.12);
}

.change-pill.flat {
  color: var(--muted);
  background: rgba(90, 107, 125, 0.12);
}

/* market board */
.market {
  margin-top: 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.market-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 7rem 5.5rem 5.5rem 8.5rem;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 0.9rem;
  border-top: 1px solid var(--line);
}

.market-row:first-child {
  border-top: none;
}

.market-row:not(.market-head):hover {
  background: var(--bg-deep);
}

.market-row--link {
  cursor: pointer;
}

.market-row--link:hover .market-title {
  color: var(--accent);
  text-decoration: underline;
}

.market-row--link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.market-head {
  background: var(--brand-navy);
  color: #fff;
  font-family: var(--font-display);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.market-head .market-price,
.market-head .market-change,
.market-head .market-spark {
  color: rgba(255, 255, 255, 0.85);
}

.market-sort {
  appearance: none;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  letter-spacing: inherit;
  text-transform: inherit;
  padding: 0;
  cursor: pointer;
  white-space: nowrap;
}

.market-head .market-price .market-sort,
.market-head .market-change .market-sort {
  width: 100%;
  text-align: right;
}

.market-sort:hover {
  color: #fff;
  text-decoration: underline;
}

.market-sort.active {
  color: #fff;
}

.market-name {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.market-title {
  font-weight: 700;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.market-sub {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: var(--fs-xs);
  color: var(--muted);
}

.market-price {
  text-align: right;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.market-change {
  display: flex;
  justify-content: flex-end;
}

.market-spark {
  display: flex;
  justify-content: flex-end;
}

.spark {
  width: 128px;
  height: 40px;
  display: block;
}

.market-head .market-spark {
  justify-content: flex-end;
}

.spark-flat {
  stroke: #9aa5b1;
  stroke-width: 2;
  stroke-dasharray: 4 4;
}

.store-badge {
  display: inline-block;
  padding: 0.08rem 0.45rem;
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: #fff;
  background: var(--brand-navy);
}

.store-badge.store-superseis {
  background: #0b5cab;
}

.store-badge.store-stock {
  background: #1f7a4c;
}

.store-badge.store-casarica {
  background: #c0392b;
}

.store-badge.store-fortis {
  background: #7b3fa0;
}

.store-badge.store-arete {
  background: #b8860b;
}

.store-badge.store-sancayetano {
  background: #2c6e7f;
}

.store-badge.store-supermas {
  background: #d35400;
}

.store-badge.store-losjardines {
  background: #2e7d32;
}

.store-badge.store-biggie {
  background: #e91e63;
}

@media (max-width: 640px) {
  /* Collapse the market table to name+price+day; hide period + sparkline */
  .market-row {
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 0.5rem;
  }

  .market-period,
  .market-spark {
    display: none;
  }
}
