/* =========================================================================
   Movie Ranking — hoja de estilos única
   Mobile-first, oscura y cinematográfica.
   Movimiento: sólo transform/opacity, curvas suaves, respeto a reduced-motion.
   ========================================================================= */

/* ------------------------------- Tokens -------------------------------- */
:root {
  --bg:        #08080b;
  --bg-soft:   #0d0d12;
  --card:      #131318;
  --card-2:    #1a1a21;
  --line:      rgba(255, 255, 255, .08);
  --line-2:    rgba(255, 255, 255, .14);

  --txt:       #f4f4f7;
  --muted:     #9c9cad;
  --dim:       #6c6c7d;

  --gold:      #ffc95c;
  --gold-2:    #f5a524;
  --brand:     #8b5cff;
  --brand-2:   #c46bff;
  --fire:      #ff5f45;
  --ok:        #2fd6a5;

  --r-sm: 12px;
  --r:    18px;
  --r-lg: 24px;
  --r-xl: 30px;

  --ease:     cubic-bezier(.32, .72, 0, 1);
  --ease-out: cubic-bezier(.22, 1, .36, 1);

  --shadow:    0 18px 40px -22px rgba(0, 0, 0, .95);
  --shadow-lg: 0 30px 70px -30px rgba(0, 0, 0, 1);

  --topbar-h: 58px;
  --tabbar-h: 62px;
  --gutter: 16px;
}

/* ------------------------------- Reset --------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--txt);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: -.011em;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px);
  overflow-x: hidden;
}
body.no-scroll { overflow: hidden; }

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -.03em; font-weight: 700; }
ul { list-style: none; padding: 0; }
:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--brand); color: #fff; }

/* Fondo ambiental muy sutil */
.ambient {
  position: fixed;
  inset: -20% -20% auto -20%;
  height: 60vh;
  z-index: -1;
  background:
    radial-gradient(60% 60% at 25% 0%, rgba(139, 92, 255, .20), transparent 70%),
    radial-gradient(50% 50% at 85% 10%, rgba(245, 165, 36, .12), transparent 70%);
  filter: blur(20px);
  pointer-events: none;
}

/* ------------------------------- Layout -------------------------------- */
.app {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px var(--gutter) 40px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease, background .3s ease;
}
.topbar.is-stuck { border-bottom-color: var(--line); }
.topbar__inner {
  max-width: 1180px;
  margin: 0 auto;
  height: var(--topbar-h);
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar__left { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }

.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; letter-spacing: -.04em; }
.brand__dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  box-shadow: 0 0 16px rgba(245, 165, 36, .7);
}
.brand__name { font-size: 1.02rem; }
.brand__name span { color: var(--muted); font-weight: 600; }

.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted); font-weight: 600; font-size: .9rem;
  padding: 8px 12px 8px 8px; margin-left: -8px; border-radius: 99px;
  transition: color .2s ease, background .2s ease;
}
.back-link:hover { color: var(--txt); background: rgba(255, 255, 255, .06); }

.topnav { display: none; }
.topnav a {
  padding: 8px 13px; border-radius: 99px; font-size: .9rem; font-weight: 600;
  color: var(--muted); transition: color .2s ease, background .2s ease;
}
.topnav a:hover { color: var(--txt); background: rgba(255, 255, 255, .05); }
.topnav a.is-active { color: var(--txt); background: rgba(255, 255, 255, .09); }

.user-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 5px; border-radius: 99px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--line);
  font-weight: 600; font-size: .88rem;
  transition: transform .2s var(--ease), background .2s ease;
}
.user-chip:active { transform: scale(.95); }
.user-chip:hover { background: rgba(255, 255, 255, .1); }
.user-chip__name { display: inline; }

/* ------------------------------ Tab bar -------------------------------- */
.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 50;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  height: var(--tabbar-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: .68rem; font-weight: 600; letter-spacing: -.01em;
  color: var(--dim);
  transition: color .25s ease, transform .25s var(--ease);
}
.tab__icon { font-size: 1.15rem; line-height: 1; transition: transform .35s var(--ease); }
.tab:active { transform: scale(.92); }
.tab.is-active { color: var(--txt); }
.tab.is-active .tab__icon { transform: translateY(-2px) scale(1.12); }

.fab {
  position: fixed; z-index: 45;
  right: var(--gutter);
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
  width: 54px; height: 54px; border-radius: 50%;
  display: grid; place-items: center;
  color: #fff;
  background: linear-gradient(140deg, var(--brand-2), var(--brand));
  box-shadow: 0 14px 30px -10px rgba(139, 92, 255, .8), 0 0 0 1px rgba(255, 255, 255, .1) inset;
  transition: transform .28s var(--ease), box-shadow .28s ease;
}
.fab:active { transform: scale(.9); }
.fab:hover { transform: translateY(-2px); box-shadow: 0 20px 40px -12px rgba(139, 92, 255, .9); }

/* ------------------------------ Tipografía ----------------------------- */
.page-head { margin: 6px 0 20px; }
.page-title {
  font-size: clamp(1.75rem, 7vw, 2.4rem);
  font-weight: 800; letter-spacing: -.045em;
}
.page-sub { color: var(--muted); font-size: .95rem; margin-top: 6px; }

.section { margin-top: 30px; }
.section-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 12px;
}
.section-head h2 { font-size: 1.12rem; letter-spacing: -.035em; }
.section-head a { color: var(--muted); font-size: .84rem; font-weight: 600; }
.section-head a:hover { color: var(--txt); }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.num { font-variant-numeric: tabular-nums; }

/* -------------------------------- Botones ------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; border-radius: 99px;
  font-weight: 650; font-size: .92rem;
  background: rgba(255, 255, 255, .08);
  border: 1px solid var(--line);
  transition: transform .22s var(--ease), background .22s ease, opacity .2s ease;
  min-height: 44px;
}
.btn:active { transform: scale(.96); }
.btn:hover { background: rgba(255, 255, 255, .13); }
.btn--primary {
  background: linear-gradient(140deg, var(--brand-2), var(--brand));
  border-color: transparent; color: #fff;
  box-shadow: 0 12px 26px -14px rgba(139, 92, 255, .9);
}
.btn--primary:hover { filter: brightness(1.08); background: linear-gradient(140deg, var(--brand-2), var(--brand)); }
.btn--gold {
  background: linear-gradient(140deg, var(--gold), var(--gold-2));
  border-color: transparent; color: #1a1204; font-weight: 750;
}
.btn--gold:hover { filter: brightness(1.06); background: linear-gradient(140deg, var(--gold), var(--gold-2)); }
.btn--ghost { background: transparent; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .07);
  color: var(--muted); font-size: .9rem;
  transition: transform .2s var(--ease), background .2s ease, color .2s ease;
}
.icon-btn:hover { background: rgba(255, 255, 255, .13); color: var(--txt); }
.icon-btn:active { transform: scale(.9); }
.icon-btn.is-on { color: var(--fire); background: rgba(255, 95, 69, .16); }

/* -------------------------- Chips / tags / badges ---------------------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 99px;
  font-size: .7rem; font-weight: 650; letter-spacing: -.005em;
  background: rgba(255, 255, 255, .07); color: var(--muted);
  white-space: nowrap;
}
.chip--mine { background: rgba(47, 214, 165, .14); color: var(--ok); }
.chip--pending { background: rgba(255, 95, 69, .13); color: #ff8f7d; }

.tag { font-size: .72rem; font-weight: 650; }
.tag--fire { color: var(--fire); }
.tag--ok { color: var(--ok); }
.tag-demo {
  font-size: .62rem; text-transform: uppercase; letter-spacing: .08em;
  padding: 1px 6px; border-radius: 5px;
  background: rgba(255, 255, 255, .1); color: var(--dim);
}

.badges { display: flex; flex-wrap: wrap; gap: 7px; }
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px; border-radius: 99px;
  font-size: .74rem; font-weight: 650;
  background: rgba(255, 255, 255, .07);
  border: 1px solid var(--line);
}
.badge--polemica { background: rgba(255, 95, 69, .14); border-color: rgba(255, 95, 69, .3); color: #ff9b8b; }
.badge--consenso { background: rgba(47, 214, 165, .12); border-color: rgba(47, 214, 165, .28); color: #74e6c4; }
.badge--perfecta { background: rgba(255, 201, 92, .14); border-color: rgba(255, 201, 92, .3); color: var(--gold); }
.badge--favorita { background: rgba(255, 92, 138, .14); border-color: rgba(255, 92, 138, .3); color: #ff8fb0; }

/* -------------------------------- Avatares ----------------------------- */
.avatar {
  display: inline-grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--user-color, var(--brand)), color-mix(in srgb, var(--user-color, var(--brand)) 55%, #000));
  color: #fff; font-weight: 750; letter-spacing: -.02em;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .12) inset;
  flex: none;
}
.avatar--sm { width: 30px; height: 30px; font-size: .72rem; }
.avatar--md { width: 42px; height: 42px; font-size: .9rem; }
.avatar--lg { width: 60px; height: 60px; font-size: 1.2rem; }
.avatar--xl { width: 86px; height: 86px; font-size: 1.8rem; }

/* --------------------------------- Poster ------------------------------ */
.poster {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: linear-gradient(155deg, #21212b, #101015);
  box-shadow: var(--shadow);
  isolation: isolate;
}
.poster img {
  position: absolute; inset: 0; z-index: 1;
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .6s var(--ease);
}
.poster__fallback {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-weight: 800; font-size: 1.5rem; color: rgba(255, 255, 255, .22);
}
.poster__score {
  position: absolute; z-index: 2; left: 7px; bottom: 7px;
  padding: 3px 8px; border-radius: 8px;
  font-size: .78rem; font-weight: 750; font-variant-numeric: tabular-nums;
  color: #1a1204;
  background: linear-gradient(140deg, var(--gold), var(--gold-2));
  box-shadow: 0 6px 16px -8px rgba(0, 0, 0, .9);
}
.poster__fav {
  position: absolute; z-index: 2; right: 7px; top: 7px;
  font-size: .82rem; color: #ff6b95;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .8);
}
.poster--xs { width: 46px; border-radius: 9px; flex: none; box-shadow: none; }
.poster--xs .poster__score, .poster--xs .poster__fav { display: none; }
.poster--sm { width: 62px; border-radius: 10px; flex: none; }
.poster--sm .poster__fav { display: none; }

/* ---------------------------- Tarjeta película ------------------------- */
.grid-posters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 12px;
}
.card-movie {
  display: block;
  transition: transform .3s var(--ease);
}
.card-movie:active { transform: scale(.96); }
.card-movie__body { padding: 9px 2px 0; }
.card-movie__title {
  font-size: .88rem; font-weight: 650; line-height: 1.3;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical;
}
.card-movie__meta { font-size: .76rem; color: var(--dim); margin-top: 2px; }
.card-movie__foot { display: flex; align-items: center; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.votes { font-size: .7rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Carrusel horizontal (últimas películas) */
.rail {
  display: grid; grid-auto-flow: column;
  grid-auto-columns: 42vw;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding-bottom: 6px;
  margin: 0 calc(var(--gutter) * -1);
  padding-inline: var(--gutter);
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.rail > * { scroll-snap-align: start; }

/* ------------------------------- Ranking ------------------------------- */
.rank-list { display: flex; flex-direction: column; gap: 9px; }
.rank-row {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 13px 9px 9px;
  border-radius: var(--r);
  background: var(--card);
  border: 1px solid var(--line);
  transition: transform .28s var(--ease), background .25s ease, border-color .25s ease;
}
.rank-row:hover { background: var(--card-2); border-color: var(--line-2); }
.rank-row:active { transform: scale(.985); }
.rank-row__pos {
  width: 30px; flex: none; text-align: center;
  font-size: 1rem; font-weight: 750; color: var(--dim);
  font-variant-numeric: tabular-nums;
}
.rank-row__info { flex: 1; min-width: 0; }
.rank-row__info h3 {
  font-size: .95rem; font-weight: 650;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rank-row__info p { font-size: .76rem; color: var(--dim); margin-top: 2px; }
.rank-row__score {
  font-size: 1.18rem; font-weight: 800; letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
}
.rank-row--top { background: linear-gradient(120deg, rgba(255, 201, 92, .09), transparent 55%), var(--card); }
.rank-row--1 { border-color: rgba(255, 201, 92, .4); }
.rank-row--2 { border-color: rgba(214, 222, 235, .28); }
.rank-row--3 { border-color: rgba(214, 148, 92, .3); }
.rank-row--top .rank-row__pos { font-size: 1.25rem; }

/* --------------------------- Tarjetas genéricas ------------------------ */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px;
}
.card--pad-lg { padding: 20px; }

.quick-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
}
.quick {
  display: flex; align-items: center; gap: 11px;
  padding: 15px 14px;
  border-radius: var(--r);
  background: var(--card);
  border: 1px solid var(--line);
  font-weight: 650; font-size: .93rem;
  transition: transform .28s var(--ease), background .25s ease, border-color .25s ease;
}
.quick:hover { background: var(--card-2); border-color: var(--line-2); transform: translateY(-2px); }
.quick:active { transform: scale(.97); }
.quick__icon {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  display: grid; place-items: center; font-size: 1.1rem;
  background: rgba(255, 255, 255, .06);
}
.quick small { display: block; font-size: .71rem; color: var(--dim); font-weight: 500; }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 15px 14px;
}
.stat__label { font-size: .73rem; color: var(--dim); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.stat__value {
  font-size: 1.9rem; font-weight: 800; letter-spacing: -.05em; margin-top: 5px;
  font-variant-numeric: tabular-nums; line-height: 1.05;
}
.stat__value--gold { background: linear-gradient(120deg, var(--gold), var(--gold-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat__value--sm { font-size: 1.15rem; letter-spacing: -.03em; }
.stat__foot { font-size: .76rem; color: var(--muted); margin-top: 4px; }
.stat--wide { grid-column: 1 / -1; }
.stat--movie { display: flex; align-items: center; gap: 12px; }

/* ------------------------------- Detalle ------------------------------- */
.hero { position: relative; margin: -14px calc(var(--gutter) * -1) 0; }
.hero__backdrop {
  position: relative; aspect-ratio: 16 / 9; max-height: 46vh; overflow: hidden;
  background: linear-gradient(150deg, #1b1b24, #0b0b0f);
}
.hero__backdrop img { width: 100%; height: 100%; object-fit: cover; opacity: .68; }
.hero__backdrop::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(8, 8, 11, .35) 0%, rgba(8, 8, 11, .1) 35%, var(--bg) 96%);
}
/* Sin backdrop no reservamos un hueco enorme */
.hero--flat .hero__backdrop { aspect-ratio: auto; height: 132px; }
.hero--flat .hero__body { margin-top: -46px; }

.hero__body {
  position: relative; z-index: 2;
  margin-top: -74px; padding: 0 var(--gutter);
  display: flex; gap: 14px; align-items: flex-end;
}
.hero__poster { width: 108px; flex: none; box-shadow: var(--shadow-lg); border-radius: var(--r-sm); }
.hero__poster .poster__score { display: none; }
.hero__title { font-size: clamp(1.4rem, 6.2vw, 2rem); font-weight: 800; letter-spacing: -.045em; }
.hero__meta { font-size: .82rem; color: var(--muted); margin-top: 5px; }
.hero__actions { display: flex; align-items: center; gap: 8px; margin-top: 11px; flex-wrap: wrap; }

.score-hero {
  display: flex; align-items: center; gap: 16px;
  margin-top: 20px; padding: 18px;
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, rgba(255, 201, 92, .12), rgba(255, 255, 255, .03));
  border: 1px solid rgba(255, 201, 92, .22);
}
.score-hero__value {
  font-size: 3.1rem; font-weight: 800; letter-spacing: -.055em; line-height: 1;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(120deg, #fff0cf, var(--gold-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.score-hero__side { flex: 1; }
.score-hero__side p { font-size: .82rem; color: var(--muted); }
.score-hero__side strong { display: block; font-size: .95rem; }
.score-hero__ring { display: flex; gap: 4px; margin-top: 8px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, .15); }
.dot.is-on { background: var(--gold); }

/* Notas de cada amigo */
.score-list { display: flex; flex-direction: column; gap: 8px; }
.score-row {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 14px; border-radius: var(--r);
  background: var(--card); border: 1px solid var(--line);
  transition: border-color .25s ease, background .25s ease;
}
.score-row--me { border-color: rgba(139, 92, 255, .45); background: linear-gradient(120deg, rgba(139, 92, 255, .12), transparent 60%), var(--card); }
.score-row__name { flex: 1; font-weight: 650; font-size: .92rem; }
.score-row__name small { display: block; font-size: .7rem; color: var(--dim); font-weight: 500; }
.score-row__val {
  font-size: 1.25rem; font-weight: 800; letter-spacing: -.04em;
  font-variant-numeric: tabular-nums; color: var(--gold);
}
.score-row__val--empty { font-size: .8rem; font-weight: 600; color: var(--dim); letter-spacing: 0; }
.score-row__bar {
  position: absolute; left: 0; bottom: 0; height: 2px;
  background: linear-gradient(90deg, var(--gold-2), var(--gold));
}

.facts { display: flex; flex-direction: column; gap: 7px; margin-top: 12px; }
.fact {
  font-size: .85rem; color: var(--muted);
  padding: 10px 13px; border-radius: 14px;
  background: rgba(255, 255, 255, .04);
  border-left: 2px solid var(--brand);
}

.info-list { display: grid; gap: 1px; background: var(--line); border-radius: var(--r); overflow: hidden; }
.info-list > div {
  display: flex; justify-content: space-between; gap: 14px;
  padding: 12px 14px; background: var(--card); font-size: .87rem;
}
.info-list dt, .info-list span:first-child { color: var(--muted); }
.info-list span:last-child { font-weight: 600; text-align: right; }

.overview { color: #c9c9d6; font-size: .92rem; line-height: 1.62; }

/* ---------------------------- Slider de nota --------------------------- */
.rater { margin-top: 12px; }
.rater__display { text-align: center; padding: 6px 0 2px; }
.rater__value {
  font-size: clamp(3.6rem, 17vw, 5rem);
  font-weight: 800; letter-spacing: -.06em; line-height: 1;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(120deg, #fff3d6, var(--gold-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  display: inline-block;
  transition: transform .18s var(--ease);
}
.rater__value.is-bump { transform: scale(1.055); }
.rater__den { font-size: 1rem; color: var(--dim); font-weight: 650; margin-left: 4px; }

.range-wrap { position: relative; padding: 10px 2px 0; }
.range {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 40px; background: transparent; cursor: pointer;
  touch-action: pan-y;
}
.range::-webkit-slider-runnable-track {
  height: 12px; border-radius: 99px;
  background:
    linear-gradient(90deg, var(--gold-2), var(--gold)) left / var(--fill, 50%) 100% no-repeat,
    rgba(255, 255, 255, .1);
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 30px; height: 30px; border-radius: 50%; margin-top: -9px;
  background: #fff;
  box-shadow: 0 5px 16px rgba(0, 0, 0, .6), 0 0 0 1px rgba(0, 0, 0, .06);
  transition: transform .2s var(--ease);
}
.range:active::-webkit-slider-thumb { transform: scale(1.16); }
.range::-moz-range-track { height: 12px; border-radius: 99px; background: rgba(255, 255, 255, .1); }
.range::-moz-range-progress { height: 12px; border-radius: 99px; background: linear-gradient(90deg, var(--gold-2), var(--gold)); }
.range::-moz-range-thumb {
  width: 30px; height: 30px; border: 0; border-radius: 50%; background: #fff;
  box-shadow: 0 5px 16px rgba(0, 0, 0, .6);
}
.range-scale {
  display: flex; justify-content: space-between;
  font-size: .72rem; color: var(--dim); font-variant-numeric: tabular-nums;
  padding: 2px 4px 0;
}
.rater__row { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.step-btn {
  width: 46px; height: 46px; flex: none; border-radius: 14px;
  background: rgba(255, 255, 255, .07); border: 1px solid var(--line);
  font-size: 1.15rem; font-weight: 700;
  display: grid; place-items: center;
  transition: transform .2s var(--ease), background .2s ease;
}
.step-btn:active { transform: scale(.9); }
.step-btn:hover { background: rgba(255, 255, 255, .13); }
.rater__input {
  flex: 1; height: 46px; text-align: center; border-radius: 14px;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--line);
  font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums;
}
.rater__actions { display: flex; gap: 8px; margin-top: 12px; }
.rater__actions .btn { flex: 1; }

/* -------------------------------- Filtros ------------------------------ */
.filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.filter-row {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px;
  margin: 0 calc(var(--gutter) * -1); padding-inline: var(--gutter);
  scrollbar-width: none;
}
.filter-row::-webkit-scrollbar { display: none; }
.pill {
  flex: none; padding: 8px 14px; border-radius: 99px;
  background: rgba(255, 255, 255, .06); border: 1px solid var(--line);
  font-size: .82rem; font-weight: 620; color: var(--muted); white-space: nowrap;
  transition: transform .2s var(--ease), background .2s ease, color .2s ease;
  min-height: 38px; display: inline-flex; align-items: center;
}
.pill:active { transform: scale(.95); }
.pill.is-active { background: #fff; color: #0b0b0f; border-color: transparent; }
.pill--gold.is-active { background: linear-gradient(140deg, var(--gold), var(--gold-2)); color: #1a1204; }

.select, .text-input {
  height: 42px; padding: 0 14px; border-radius: 12px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line);
  font-size: .88rem;
}
.select { appearance: none; padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: right 15px center, right 10px center;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.select option { background: #16161c; }
.filter-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }

.search-field {
  position: relative; display: flex; align-items: center; gap: 10px;
  padding: 0 14px; height: 50px; border-radius: 16px;
  background: rgba(255, 255, 255, .06); border: 1px solid var(--line);
  transition: border-color .25s ease, background .25s ease;
}
.search-field:focus-within { border-color: var(--line-2); background: rgba(255, 255, 255, .09); }
.search-field input { flex: 1; background: none; border: 0; outline: none; font-size: 1rem; min-width: 0; }
.search-field input::-webkit-search-cancel-button { filter: invert(.6); }
.search-field__icon { opacity: .55; }
.search-field__spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .2); border-top-color: #fff;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.field-inline {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 10px; font-size: .86rem; color: var(--muted);
}
.field-inline input {
  height: 40px; padding: 0 12px; border-radius: 12px;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--line);
  font-size: .88rem;
}

/* --------------------------- Resultados búsqueda ----------------------- */
.search-results { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.search-hint { color: var(--dim); font-size: .86rem; text-align: center; padding: 24px 0; }
.result {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 8px; border-radius: 14px;
  transition: background .2s ease, transform .2s var(--ease);
}
.result:hover { background: rgba(255, 255, 255, .06); }
.result:active { transform: scale(.98); }
.result__info { flex: 1; min-width: 0; }
.result__info h4 { font-size: .9rem; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result__info p { font-size: .75rem; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result__add { font-size: .75rem; font-weight: 650; color: var(--brand-2); flex: none; }
.result.is-added .result__add { color: var(--dim); }

/* -------------------------------- Sheets ------------------------------- */
.sheet { position: fixed; inset: 0; z-index: 90; visibility: hidden; }
.sheet.is-open { visibility: visible; }
.sheet__backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, .6);
  opacity: 0; transition: opacity .4s var(--ease);
}
.sheet.is-open .sheet__backdrop { opacity: 1; }
.sheet__panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: 90dvh; overflow-y: auto; overscroll-behavior: contain;
  background: #17171e;
  border-top: 1px solid var(--line-2);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 8px 16px calc(22px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform .46s var(--ease);
  box-shadow: 0 -20px 60px -20px rgba(0, 0, 0, .9);
}
.sheet.is-open .sheet__panel { transform: translateY(0); }
.sheet.is-dragging .sheet__panel { transition: none; }
.sheet__panel--tall { min-height: 62dvh; }
.sheet__handle {
  width: 38px; height: 4px; border-radius: 99px;
  background: rgba(255, 255, 255, .22);
  margin: 4px auto 12px; cursor: grab;
}
.sheet__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sheet__head h2 { font-size: 1.15rem; }

.notice {
  font-size: .82rem; color: #ffd9a8; line-height: 1.5;
  background: rgba(245, 165, 36, .1); border: 1px solid rgba(245, 165, 36, .25);
  border-radius: 14px; padding: 12px 14px; margin-bottom: 12px;
}
.notice code { background: rgba(0, 0, 0, .3); padding: 1px 5px; border-radius: 5px; font-size: .95em; }

.user-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.user-card {
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  padding: 18px 10px; border-radius: var(--r-lg);
  background: var(--card-2); border: 1px solid var(--line);
  font-weight: 650;
  transition: transform .28s var(--ease), border-color .25s ease, background .25s ease;
}
.user-card:hover { transform: translateY(-3px); border-color: var(--user-color); }
.user-card:active { transform: scale(.96); }
.user-card.is-current { border-color: var(--user-color); background: color-mix(in srgb, var(--user-color) 12%, var(--card-2)); }
.user-card__name { font-size: .95rem; }

/* -------------------------------- Toaster ------------------------------ */
.toaster {
  position: fixed; z-index: 100;
  left: 12px; right: 12px;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 78px);
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  width: 100%; max-width: 420px;
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-radius: 16px;
  background: #1c1c23; border: 1px solid var(--line-2);
  box-shadow: var(--shadow-lg);
  font-size: .88rem; font-weight: 600;
  opacity: 0; transform: translateY(14px) scale(.96);
  transition: opacity .3s var(--ease-out), transform .4s var(--ease);
  pointer-events: auto;
}
.toast.is-in { opacity: 1; transform: none; }
.toast.is-out { opacity: 0; transform: translateY(8px) scale(.97); }
.toast__icon { font-size: 1rem; }
.toast--error { border-color: rgba(255, 95, 69, .4); }
.toast--success { border-color: rgba(47, 214, 165, .35); }

/* ------------------------------- Amigos -------------------------------- */
.pair {
  display: flex; align-items: center; gap: 12px;
  padding: 14px; border-radius: var(--r);
  background: var(--card); border: 1px solid var(--line);
}
.pair__avatars { display: flex; }
.pair__avatars .avatar + .avatar { margin-left: -12px; box-shadow: 0 0 0 2px var(--card); }
.pair__body { flex: 1; min-width: 0; }
.pair__names { font-weight: 650; font-size: .92rem; }
.pair__meta { font-size: .74rem; color: var(--dim); margin-top: 1px; }
.pair__pct { font-size: 1.15rem; font-weight: 800; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.bar { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .08); overflow: hidden; margin-top: 7px; }
.bar__fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  transform-origin: left;
  animation: grow .8s var(--ease-out) both;
}
.bar__fill--gold { background: linear-gradient(90deg, var(--gold-2), var(--gold)); }
@keyframes grow { from { transform: scaleX(0); } }

.genre-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: .86rem; }
.genre-row__name { width: 34%; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.genre-row__bar { flex: 1; }
.genre-row__val { width: 44px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--gold); }

/* -------------------------------- Vacío -------------------------------- */
.empty { text-align: center; padding: 46px 20px; }
.empty__icon { font-size: 2.6rem; margin-bottom: 10px; }
.empty h3 { font-size: 1.1rem; margin-bottom: 6px; }
.empty p { color: var(--muted); font-size: .9rem; max-width: 34ch; margin: 0 auto 16px; }

/* ------------------------- Pantalla "¿Quién eres?" --------------------- */
.who {
  min-height: 100dvh; display: grid; place-items: center;
  padding: 30px 20px calc(30px + env(safe-area-inset-bottom));
  text-align: center;
}
.who__inner { width: 100%; max-width: 460px; }
.who__logo { font-size: 2.6rem; margin-bottom: 12px; }
.who h1 { font-size: clamp(2rem, 9vw, 2.8rem); font-weight: 800; letter-spacing: -.05em; }
.who p { color: var(--muted); margin-top: 8px; margin-bottom: 28px; font-size: .95rem; }
.who .user-grid { gap: 12px; }
.who .user-card { padding: 24px 12px; }

/* ------------------------------ Animaciones ---------------------------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to   { opacity: 1; transform: none; }
}
.stagger { animation: rise .5s var(--ease) both; animation-delay: calc(min(var(--i, 0), 14) * 34ms); }
.fade-in { animation: rise .55s var(--ease-out) both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ------------------------------ Responsive ----------------------------- */
@media (min-width: 560px) {
  .grid-posters { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 14px; }
  .rail { grid-auto-columns: 27vw; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .user-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 768px) {
  :root { --gutter: 24px; }
  body { font-size: 15.5px; }
  .grid-posters { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .rail { grid-auto-columns: 190px; }
  .quick-grid { grid-template-columns: repeat(4, 1fr); }
  .hero__poster { width: 140px; }
  .hero__body { margin-top: -92px; }
  .filter-grid { grid-template-columns: repeat(4, 1fr); }

  .sheet__panel {
    left: 50%; right: auto; bottom: auto; top: 50%;
    width: min(560px, 92vw);
    border-radius: var(--r-lg);
    border: 1px solid var(--line-2);
    transform: translate(-50%, -48%) scale(.97);
    opacity: 0;
    transition: transform .38s var(--ease-out), opacity .25s ease;
  }
  .sheet.is-open .sheet__panel { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  .sheet__handle { display: none; }
  .toaster { left: auto; right: 24px; bottom: 24px; align-items: flex-end; }
  .toast { width: auto; min-width: 260px; }
}

@media (min-width: 900px) {
  body { padding-bottom: 40px; }
  .tabbar { display: none; }
  .topnav { display: flex; gap: 4px; }
  .topbar__left { flex: none; }
  .fab { bottom: 28px; right: 28px; width: 58px; height: 58px; }
  .grid-posters { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .app { padding-top: 22px; }
  .detail-cols { display: grid; grid-template-columns: 1.35fr 1fr; gap: 24px; align-items: start; }
}

@media (min-width: 1120px) {
  .grid-posters { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

@media (hover: hover) {
  .card-movie:hover .poster img { transform: scale(1.07); }
  .card-movie:hover .card-movie__title { color: #fff; }
  .poster { transition: box-shadow .35s var(--ease); }
  .card-movie:hover .poster { box-shadow: 0 26px 50px -24px rgba(0, 0, 0, 1); }
}

/* Pantallas sin barras (selector de usuario) */
.body--plain { padding-bottom: 0; }

/* Pareja con gustos mas similares (destacada) */
.pair-hero { display: flex; align-items: center; gap: 14px; margin-top: 10px; flex-wrap: wrap; }
.pair-hero__body { flex: 1 1 150px; min-width: 0; }
.pair-hero__names { font-weight: 750; font-size: 1.05rem; }
.pair-hero__pct { font-size: 2rem; margin-left: auto; }

/* En desktop el hero del detalle no necesita tanto alto */
@media (min-width: 900px) {
  .hero--flat .hero__backdrop { height: 168px; }
}

/* Alta manual dentro del sheet de agregar */
.manual { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.manual summary {
  cursor: pointer; list-style: none; font-size: .85rem; font-weight: 620;
  color: var(--muted); padding: 6px 0;
}
.manual summary::-webkit-details-marker { display: none; }
.manual summary::before { content: '＋ '; color: var(--brand-2); }
.manual[open] summary::before { content: '－ '; }
.manual summary:hover { color: var(--txt); }
.manual__form { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.manual__form .text-input { width: 100%; }

/* Promedio todavia sin notas */
.score-hero--empty { border-color: var(--line); background: rgba(255, 255, 255, .03); }
.score-hero--empty .score-hero__value {
  font-size: 1.15rem; letter-spacing: -.02em; font-weight: 700;
  background: none; color: var(--dim); -webkit-text-fill-color: var(--dim);
}
