:root {
  --bg: #0a0b0e;
  --panel: #14161b;
  --ink: #f3f2ee;
  --mute: rgba(243, 242, 238, .62);
  --line: rgba(255, 255, 255, .12);
  --accent: #8fd0ff;
  --bien: #66c0f4;
  --mal: #e0787a;
  --oferta: #a4d007;
  --gut: clamp(20px, 4.4vw, 76px);
  --cw: clamp(100px, 21dvh, 232px);
  --gap: clamp(10px, 1.1vw, 18px);
  --spring: cubic-bezier(.2, .9, .25, 1);
  --out: cubic-bezier(.16, 1, .3, 1);
  --font: "Segoe UI Variable Display", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; }

html, body { height: 100%; overflow: hidden; }

body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  touch-action: none;
}

button, select { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
button:focus-visible, a:focus-visible, select:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* ---------- Fondo: solo opacidad y transform, sin máscaras ni filtros ---------- */
#fondo {
  position: fixed;
  inset: 0 0 0 30%;
  z-index: -2;
  overflow: hidden;
  contain: strict;
}

.lamina {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity .55s ease;
  will-change: opacity;
}

.lamina.ve { opacity: .62; }

#velo {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(90deg, var(--bg) 30%, rgba(10, 11, 14, .55) 58%, rgba(10, 11, 14, .1) 100%),
    linear-gradient(0deg, var(--bg) 34%, transparent 74%);
}

/* ---------- Barra superior ---------- */
#top {
  display: flex;
  align-items: center;
  gap: clamp(16px, 3vw, 48px);
  padding: clamp(14px, 2.6dvh, 28px) var(--gut) 0;
  transition: opacity .3s ease;
}

.marca { font-weight: 600; letter-spacing: -.01em; }

#tabs {
  position: relative;
  display: flex;
  gap: clamp(14px, 2vw, 30px);
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 8px;
  margin-bottom: -8px;
}

#tabs::-webkit-scrollbar { display: none; }
#tabs button { color: var(--mute); white-space: nowrap; transition: color .2s; }
#tabs button:hover, #tabs button.on { color: var(--ink); }

#tinta {
  position: absolute;
  left: 0;
  bottom: 2px;
  width: 1px;
  height: 2px;
  background: var(--accent);
  transform-origin: 0 50%;
  transition: transform .5s var(--spring);
}

.estado { margin-left: auto; display: flex; align-items: center; gap: 12px; color: var(--mute); }

.selector select {
  max-width: 170px;
  height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  color: var(--mute);
  font-size: 14px;
}

.selector select option { background: var(--panel); color: var(--ink); }
.selector select:hover { color: var(--ink); }

#buscador {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 8px;
  border-radius: 16px;
  cursor: text;
}

#buscador svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }

#busca {
  width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  transition: width .35s var(--out);
  user-select: text;
}

#busca::placeholder { color: var(--mute); }
#busca::-webkit-search-cancel-button { display: none; }
.buscando #busca { width: clamp(100px, 13vw, 170px); }
.buscando #buscador { background: rgba(255, 255, 255, .09); }

#cuenta { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
#cuenta img { width: 28px; height: 28px; border-radius: 6px; }
#cuenta .nombre { max-width: 120px; overflow: hidden; text-overflow: ellipsis; color: var(--ink); font-size: 14px; }

.steam {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .1);
  color: var(--ink);
  font-size: 14px;
  text-decoration: none;
  transition: background .2s;
}

.steam:hover { background: rgba(255, 255, 255, .18); }

/* ---------- Portada ---------- */
#hero {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 0;
  padding: 0 var(--gut) clamp(12px, 2.6dvh, 28px);
  pointer-events: none;
  transition: opacity .25s ease;
}

#ceja { color: var(--mute); font-size: 13px; margin-bottom: 6px; }
#ceja b { font-weight: 500; color: var(--accent); }
#titulos { display: grid; }

.titulo {
  grid-area: 1 / 1;
  align-self: end;
  max-width: min(72vw, 15em);
  font-size: clamp(30px, min(5vw, 9dvh), 84px);
  font-weight: 300;
  line-height: 1.05;
  letter-spacing: -.03em;
  text-wrap: balance;
  animation: entra .5s var(--out) both;
}

.titulo.sale { animation: sale .16s ease forwards; }

@keyframes entra { from { opacity: 0; transform: translate3d(0, 14px, 0); } }
@keyframes sale { to { opacity: 0; transform: translate3d(0, -8px, 0); } }

#resena { max-width: 52ch; min-height: 3em; margin-top: 8px; color: var(--mute); }

#datos {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
  min-height: 24px;
  margin-top: 6px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.positivo { color: var(--bien); }
.negativo { color: var(--mal); }

.precio { display: inline-flex; align-items: center; gap: 6px; }
.precio s { color: var(--mute); }
.dcto { padding: 0 6px; border-radius: 4px; background: var(--oferta); color: #16200a; font-weight: 600; font-size: 13px; }

/* ---------- Carrusel ---------- */
#riel {
  position: relative;
  height: calc(var(--cw) * 1.5 * 1.12 + 20px);
  overflow-x: clip;
  cursor: grab;
  transition: opacity .25s ease;
}

#riel.arrastre { cursor: grabbing; }
#pista { position: absolute; inset: 0; }

.card {
  position: absolute;
  left: 0;
  bottom: 6px;
  width: var(--cw);
  aspect-ratio: 2 / 3;
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel);
  transform-origin: 0 100%;
  opacity: 0;
  contain: layout paint;
}

.card.cerca { will-change: transform, opacity; }

.card img { width: 100%; height: 100%; display: block; object-fit: cover; pointer-events: none; }
.card img.ancha { object-position: 30% 50%; }

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 3px #fff;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}

.card.on::after { opacity: 1; }

.card .dcto { position: absolute; left: 8px; bottom: 8px; }

.sello { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; pointer-events: none; }

.sello span {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(10, 11, 14, .78);
}

.sello svg { width: 12px; height: 12px; fill: #fff; }

/* ---------- Pie ---------- */
#pie {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 52px;
  padding: 0 var(--gut);
  background: #101115;
  border-top: 1px solid var(--line);
}

.izq { display: flex; align-items: center; gap: 12px; color: var(--mute); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
#barra { width: clamp(40px, 8vw, 120px); height: 2px; background: var(--line); overflow: hidden; }
#barra i { display: block; height: 100%; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); transition: transform .3s var(--out); }

#pistas { display: flex; align-items: center; gap: clamp(8px, 1.4vw, 22px); }

.pista {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 7px;
  border-radius: 8px;
  font-size: 13.5px;
  white-space: nowrap;
  transition: background .15s;
}

.pista:hover { background: rgba(255, 255, 255, .09); }

.glifo {
  min-width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  padding: 0 6px;
  border-radius: 11px;
  background: var(--ink);
  color: #101115;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1;
}

.glifo.tecla { border-radius: 5px; font-weight: 600; }

/* ---------- Ficha ---------- */
#ficha {
  position: fixed;
  inset: 0 0 52px;
  z-index: 4;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: clamp(24px, 4vw, 72px);
  padding: clamp(16px, 4dvh, 40px) 0 0 var(--gut);
  background: rgba(10, 11, 14, .9);
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility 0s .25s;
}

.en-ficha #ficha { opacity: 1; visibility: visible; transition: opacity .25s ease; }
.en-ficha #top, .en-ficha #hero, .en-ficha #riel { opacity: 0; pointer-events: none; }

#f-poster {
  height: min(70dvh, 52vw);
  aspect-ratio: 2 / 3;
  border-radius: 14px;
  overflow: hidden;
  background: var(--panel);
  transform-origin: 0 0;
}

#f-poster img { width: 100%; height: 100%; display: block; object-fit: cover; }

#f-info {
  display: grid;
  align-content: start;
  gap: 26px;
  overflow-y: auto;
  padding: 0 var(--gut) 40px 0;
  outline: 0;
  touch-action: pan-y;
  user-select: text;
  overscroll-behavior: contain;
}

.bloque { display: grid; gap: 10px; max-width: 760px; min-width: 0; }
.bloque h3 { font-size: 15px; font-weight: 600; }
.sub { color: var(--mute); font-size: 13px; }

#f-info h2 {
  font-size: clamp(26px, min(3.4vw, 6dvh), 54px);
  font-weight: 300;
  line-height: 1.08;
  letter-spacing: -.025em;
  text-wrap: balance;
}

.etiquetas { display: flex; flex-wrap: wrap; gap: 6px; }
.etiquetas span { padding: 2px 10px; border-radius: 12px; background: rgba(255, 255, 255, .09); font-size: 13px; }

.notas-fila { display: flex; flex-wrap: wrap; gap: 10px 28px; font-variant-numeric: tabular-nums; }
.nota b { display: block; font-size: 20px; font-weight: 500; }

.acciones { display: flex; flex-wrap: wrap; gap: 8px; }

.boton {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .1);
  font-size: 14px;
  text-decoration: none;
  transition: background .15s;
}

.boton:hover { background: rgba(255, 255, 255, .18); }
.boton.on { background: var(--ink); color: #101115; }
.boton svg { width: 16px; height: 16px; fill: currentColor; }

.video {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
}

.video video, .video img { width: 100%; height: 100%; display: block; object-fit: cover; }

.video button {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .25);
  transition: background .15s;
}

.video button:hover { background: rgba(0, 0, 0, .05); }
.video button span { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--ink); color: #101115; }
.video button svg { width: 24px; height: 24px; fill: currentColor; }

.capturas { display: flex; gap: 8px; overflow-x: auto; touch-action: pan-x pan-y; padding-bottom: 4px; }
.capturas a { flex: none; }
.capturas img { display: block; height: 96px; aspect-ratio: 16 / 9; border-radius: 6px; object-fit: cover; }

.tiendas { display: grid; gap: 2px; }

.tienda {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 6px;
  text-decoration: none;
  font-variant-numeric: tabular-nums;
  transition: background .15s;
}

.tienda:hover { background: rgba(255, 255, 255, .08); }

.opinion { display: grid; gap: 4px; padding: 12px 0; border-top: 1px solid var(--line); min-width: 0; }
.opinion p { overflow-wrap: anywhere; }
.opinion .cab { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.opinion img { width: 28px; height: 28px; border-radius: 6px; }
.opinion a { color: var(--mute); font-size: 13px; }

.formulario { display: grid; gap: 8px; }

.formulario textarea {
  width: 100%;
  min-height: 92px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .05);
  color: var(--ink);
  font: inherit;
  resize: vertical;
}

.estrellas { display: flex; gap: 2px; }
.estrellas button { width: 30px; height: 30px; display: grid; place-items: center; }
.estrellas svg { width: 20px; height: 20px; fill: rgba(255, 255, 255, .2); }
.estrellas button.on svg { fill: var(--accent); }
.aviso { color: var(--mute); font-size: 14px; }
.error { color: var(--mal); font-size: 14px; }

/* Arranque */
.boot #top, .boot #hero { opacity: 0; }

/* ---------- Pantallas pequeñas ---------- */
@media (max-width: 900px) {
  :root { --cw: clamp(92px, 20dvh, 132px); }
  #top { flex-wrap: wrap; row-gap: 6px; }
  #tabs { order: 3; flex: 1 0 100%; }
  #barra { display: none; }
  .titulo { max-width: 100%; }
  #resena { font-size: 14px; }
  .pista.opc { display: none; }
  #fondo { inset: 0; }
  #velo { background: linear-gradient(0deg, var(--bg) 40%, rgba(10, 11, 14, .35) 100%); }

  #ficha { display: block; overflow-y: auto; padding: 16px var(--gut) 32px; touch-action: pan-y; }
  #f-poster { height: 30dvh; margin-bottom: 18px; }
  #f-info { overflow: visible; padding: 0; }
  .selector select { max-width: 120px; }
}

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