/* ==========================================================================
   Zodex Link
   Dirección: sobrio y preciso, con ADN de HUD. Un solo acento (lima) reservado
   para lo accionable y lo "mejor". Esquinas biseladas en controles primarios.
   ========================================================================== */

:root {
  /* Superficies */
  --bg: #0a0b0d;
  --surface-1: #111317;
  --surface-2: #171a1f;
  --surface-3: #1f232a;
  --line: #262a31;
  --line-strong: #363b44;

  /* Texto */
  --text: #eceef1;
  --text-2: #a8aeb8;
  --text-3: #858c97;

  /* Acento y estados */
  --accent: #c6f135;
  --accent-hover: #d4f75f;
  --accent-press: #b2da2a;
  --accent-ink: #0a0b0d;
  --accent-soft: rgba(198, 241, 53, 0.1);
  --accent-line: rgba(198, 241, 53, 0.35);
  --warn: #f2b33d;
  --info: #8fb4ff;
  --danger: #ff6b6b;

  /* Tipografía */
  --font-display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --font-body: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace;

  --fs-11: 0.6875rem;
  --fs-12: 0.75rem;
  --fs-13: 0.8125rem;
  --fs-14: 0.875rem;
  --fs-16: 1rem;
  --fs-20: 1.25rem;
  --fs-28: 1.75rem;
  --fs-display: clamp(2rem, 1.3rem + 3vw, 3.5rem);

  /* Espaciado (base 4) */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;
  --s-12: 48px;
  --s-16: 64px;

  --radius: 2px;
  --cut: 8px;
  --cut-sm: 6px;
  --page: 1180px;
  --gutter: clamp(16px, 4vw, 32px);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-1: 120ms;
  --dur-2: 200ms;
  --dur-3: 320ms;

  --shadow-pop: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 16px 40px -12px rgba(0, 0, 0, 0.7), 0 2px 6px rgba(0, 0, 0, 0.4);

  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-16);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; }
[hidden] { display: none !important; }

svg { width: 18px; height: 18px; flex: none; }

::selection { background: var(--accent); color: var(--accent-ink); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: var(--s-4);
  top: -48px;
  z-index: 100;
  padding: var(--s-2) var(--s-4);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: var(--s-2); }

kbd {
  font-family: var(--font-mono);
  font-size: var(--fs-11);
  padding: 1px 6px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: var(--radius);
  color: var(--text-2);
  background: var(--surface-2);
}

/* ---------- Botones base ---------- */
.btn {
  --cut-size: var(--cut-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 40px;
  padding: 0 var(--s-4);
  font-weight: 600;
  font-size: var(--fs-14);
  letter-spacing: 0.01em;
  white-space: nowrap;
  clip-path: polygon(var(--cut-size) 0, 100% 0, 100% calc(100% - var(--cut-size)), calc(100% - var(--cut-size)) 100%, 0 100%, 0 var(--cut-size));
  transition: background-color var(--dur-1) ease, color var(--dur-1) ease, transform var(--dur-1) ease;
}
/* clip-path recorta el outline: el foco se dibuja por dentro */
.btn:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--text); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; }

.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-accent:hover:not(:disabled) { background: var(--accent-hover); }
.btn-accent:active:not(:disabled) { background: var(--accent-press); }
.btn-accent:focus-visible { box-shadow: inset 0 0 0 2px var(--accent-ink); }

.btn-ghost { background: var(--surface-3); color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: var(--line-strong); }
.btn-ghost:active:not(:disabled) { background: var(--line); }

.btn-lg { min-height: 48px; padding: 0 var(--s-6); font-size: var(--fs-16); --cut-size: var(--cut); }
.btn-lg svg { width: 20px; height: 20px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text-2);
  background: var(--surface-1);
  transition: color var(--dur-1) ease, border-color var(--dur-1) ease, background-color var(--dur-1) ease;
}
.icon-btn:hover:not(:disabled) { color: var(--text); border-color: var(--line-strong); background: var(--surface-2); }
.icon-btn:active:not(:disabled) { background: var(--surface-3); }
.icon-btn:disabled { opacity: 0.35; }
.icon-btn.is-done { color: var(--accent); border-color: var(--accent-line); }

.link-btn {
  font-size: var(--fs-13);
  color: var(--text-2);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
  padding: var(--s-1) 0;
}
.link-btn:hover { color: var(--text); text-decoration-color: currentColor; }
.link-btn:active { color: var(--text-3); }

/* ---------- Barra superior ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(10, 11, 13, 0.86);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  backdrop-filter: blur(12px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: var(--page);
  margin: 0 auto;
  padding: var(--s-3) var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--text);
  text-decoration: none;
  min-width: 0;
}
.brand-mark { width: 26px; height: 26px; color: var(--accent); }
.brand-word {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-20);
  letter-spacing: 0.06em;
  line-height: 1;
}
.brand-tag {
  font-family: var(--font-mono);
  font-size: var(--fs-11);
  color: var(--text-3);
  letter-spacing: 0.12em;
  padding-left: var(--s-2);
  border-left: 1px solid var(--line-strong);
  line-height: 1;
}

.topbar-actions { display: flex; align-items: center; gap: var(--s-2); }

.player-pref {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  height: 40px;
  padding: 0 var(--s-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-1);
  font-size: var(--fs-13);
  transition: border-color var(--dur-1) ease, background-color var(--dur-1) ease;
}
.player-pref svg { width: 14px; height: 14px; color: var(--accent); }
.player-pref-label { color: var(--text-3); }
.player-pref-name { font-weight: 600; color: var(--text); }
.player-pref:hover { border-color: var(--line-strong); background: var(--surface-2); }
.player-pref:active { background: var(--surface-3); }

/* ---------- Página ---------- */
.page {
  flex: 1;
  width: 100%;
  max-width: var(--page);
  margin: 0 auto;
  padding: var(--s-8) var(--gutter) var(--s-16);
}

/* ---------- Buscador ---------- */
.search-block { margin-bottom: var(--s-10); }

.search {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 0;
  background: var(--surface-1);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  transition: border-color var(--dur-2) ease, box-shadow var(--dur-2) ease;
}
.search:focus-within {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.seg {
  display: flex;
  padding: var(--s-1);
  gap: 2px;
  border-right: 1px solid var(--line);
  flex: none;
}
.seg-btn {
  padding: 0 var(--s-3);
  min-height: 40px;
  font-size: var(--fs-13);
  font-weight: 500;
  color: var(--text-2);
  border-radius: var(--radius);
  transition: color var(--dur-1) ease, background-color var(--dur-1) ease;
}
.seg-btn:hover { color: var(--text); background: var(--surface-2); }
.seg-btn:active { background: var(--surface-3); }
.seg-btn.is-active { color: var(--text); background: var(--surface-3); box-shadow: inset 0 -2px 0 var(--accent); }

.search-field {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}
.search-ico { position: absolute; left: var(--s-4); color: var(--text-3); pointer-events: none; }
.search-field input {
  width: 100%;
  min-width: 0;
  height: 100%;
  min-height: 48px;
  padding: 0 var(--s-10) 0 calc(var(--s-4) + 18px + var(--s-3));
  background: transparent;
  border: 0;
  outline: none;
  font-size: var(--fs-16);
  color: var(--text);
}
.search-field input::placeholder { color: var(--text-3); }
.search-field input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-field input:focus-visible { outline: none; }
.kbd-hint { position: absolute; right: var(--s-3); pointer-events: none; }
.search-field:focus-within .kbd-hint,
.search-field.has-value .kbd-hint { display: none; }

.field-clear {
  position: absolute;
  right: var(--s-2);
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--text-3);
  border-radius: var(--radius);
}
.field-clear:hover { color: var(--text); background: var(--surface-2); }
.field-clear:active { background: var(--surface-3); }
.field-clear svg { width: 16px; height: 16px; }

.search-go { margin: var(--s-1); min-height: 40px; padding: 0 var(--s-6); }

/* Sugerencias */
.suggest {
  position: absolute;
  z-index: 30;
  left: -1px;
  right: -1px;
  top: calc(100% + var(--s-2));
  background: var(--surface-1);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  animation: pop-in var(--dur-2) var(--ease-out);
}
.suggest-list { list-style: none; margin: 0; padding: var(--s-1); max-height: min(60vh, 520px); overflow-y: auto; }
.suggest-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: var(--s-3);
  align-items: center;
  padding: var(--s-2);
  border-radius: var(--radius);
  cursor: pointer;
}
.suggest-item:hover,
.suggest-item.is-active { background: var(--surface-3); }
.suggest-item.is-active { box-shadow: inset 2px 0 0 var(--accent); }
.suggest-thumb {
  width: 40px;
  height: 60px;
  object-fit: cover;
  background: var(--surface-3);
  border-radius: var(--radius);
}
.suggest-name {
  font-weight: 600;
  font-size: var(--fs-14);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.suggest-name mark { background: none; color: var(--accent); }
.suggest-sub {
  font-size: var(--fs-12);
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.suggest-foot {
  display: flex;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  border-top: 1px solid var(--line);
  font-size: var(--fs-12);
  color: var(--text-3);
}
.suggest-empty { padding: var(--s-5) var(--s-4); color: var(--text-2); font-size: var(--fs-14); }
.suggest-empty strong { color: var(--text); }

.type-tag {
  font-family: var(--font-mono);
  font-size: var(--fs-11);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
  padding: 2px 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  white-space: nowrap;
}

/* ---------- Inicio ---------- */
.rail { margin-bottom: var(--s-10); }
.rail-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-4);
}
.eyebrow {
  margin: 0;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: var(--fs-12);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.eyebrow::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--accent);
}

.chip-row { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.recent-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 36px;
  padding: 0 var(--s-3);
  font-size: var(--fs-13);
  color: var(--text-2);
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  max-width: 100%;
  transition: color var(--dur-1) ease, border-color var(--dur-1) ease;
}
.recent-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-chip small { font-family: var(--font-mono); color: var(--text-3); font-size: var(--fs-11); }
.recent-chip:hover { color: var(--text); border-color: var(--line-strong); }
.recent-chip:active { background: var(--surface-2); }

.continue-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--s-3);
}
.continue-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: var(--s-3);
  align-items: center;
  padding: var(--s-2);
  padding-right: var(--s-4);
  text-align: left;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color var(--dur-1) ease, background-color var(--dur-1) ease;
}
.continue-card:hover { border-color: var(--line-strong); background: var(--surface-2); }
.continue-card:active { background: var(--surface-3); }
.continue-card img { width: 48px; height: 72px; object-fit: cover; background: var(--surface-3); border-radius: var(--radius); }
.continue-name { font-weight: 600; font-size: var(--fs-14); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.continue-ep { font-family: var(--font-mono); font-size: var(--fs-12); color: var(--text-3); }
.continue-go { font-family: var(--font-mono); font-size: var(--fs-12); color: var(--accent); }

.poster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--s-5) var(--s-4);
}
.poster-card {
  display: block;
  text-align: left;
  min-width: 0;
}
.poster-frame {
  position: relative;
  aspect-ratio: 2 / 3;
  background: var(--surface-2);
  border-radius: var(--radius);
  overflow: hidden;
  outline: 1px solid rgba(255, 255, 255, 0.06);
  outline-offset: -1px;
}
.poster-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-3) var(--ease-out), opacity var(--dur-2) ease;
}
.poster-frame::after {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 2px var(--accent);
  opacity: 0;
  transition: opacity var(--dur-1) ease;
}
.poster-card:hover .poster-frame img { transform: scale(1.04); }
.poster-card:hover .poster-frame::after,
.poster-card:focus-visible .poster-frame::after { opacity: 1; }
.poster-card:active .poster-frame img { transform: scale(1.01); }
.poster-card:focus-visible { outline: none; }
.poster-rating {
  position: absolute;
  top: var(--s-2);
  left: var(--s-2);
  font-family: var(--font-mono);
  font-size: var(--fs-11);
  font-weight: 500;
  padding: 2px 6px;
  background: rgba(10, 11, 13, 0.82);
  color: var(--text);
  border-radius: var(--radius);
}
.poster-name {
  margin-top: var(--s-2);
  font-weight: 600;
  font-size: var(--fs-14);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.poster-year { font-family: var(--font-mono); font-size: var(--fs-12); color: var(--text-3); }

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: var(--radius);
}

/* ---------- Ficha ---------- */
.title-view { margin-top: calc(var(--s-10) * -1 + var(--s-2)); }

.hero {
  position: relative;
  margin: 0 calc(var(--gutter) * -1);
  padding: var(--s-6) var(--gutter) var(--s-8);
  isolation: isolate;
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  background-size: cover;
  background-position: center 25%;
  opacity: 0;
  transition: opacity 600ms ease;
}
.hero-bg.is-loaded { opacity: 0.32; }
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(10, 11, 13, 0.55) 0%, rgba(10, 11, 13, 0.75) 55%, var(--bg) 100%),
    linear-gradient(90deg, var(--bg) 0%, rgba(10, 11, 13, 0.4) 60%, rgba(10, 11, 13, 0.7) 100%);
}
.hero-inner { max-width: var(--page); margin: 0 auto; }

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  min-height: 36px;
  padding: 0 var(--s-3) 0 var(--s-2);
  margin-bottom: var(--s-5);
  font-size: var(--fs-13);
  color: var(--text-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(17, 19, 23, 0.7);
}
.back-btn:hover { color: var(--text); border-color: var(--line-strong); }
.back-btn:active { background: var(--surface-2); }
.back-btn svg { width: 16px; height: 16px; }

.hero-grid {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: var(--s-8);
  align-items: start;
}
.hero-poster {
  width: 180px;
  height: 270px;
  object-fit: cover;
  background: var(--surface-2);
  border-radius: var(--radius);
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.9);
  outline: 1px solid rgba(255, 255, 255, 0.08);
  outline-offset: -1px;
}
.hero-info { min-width: 0; }
.hero-kicker {
  margin: 0 0 var(--s-2);
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.hero-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-display);
  line-height: 0.95;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-3);
  margin: var(--s-3) 0 0;
  font-family: var(--font-mono);
  font-size: var(--fs-13);
  color: var(--text-2);
}
.hero-meta span {
  padding-left: var(--s-3);
  border-left: 1px solid var(--line-strong);
  line-height: 1.1;
}
.hero-meta span:first-child { padding-left: 0; border-left: 0; }
.hero-meta .imdb { color: var(--warn); }
.hero-desc {
  margin: var(--s-4) 0 0;
  max-width: 68ch;
  color: var(--text-2);
  font-size: var(--fs-16);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: pointer;
}
.hero-desc.is-open { -webkit-line-clamp: unset; }

.episode-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--s-3);
  margin-top: var(--s-6);
  max-width: 640px;
}
.ep-nav { display: flex; gap: var(--s-2); }
.ep-nav .icon-btn { width: 44px; height: 44px; }

.best {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  margin-top: var(--s-6);
  padding: var(--s-4);
  max-width: 720px;
  background: rgba(17, 19, 23, 0.78);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius);
}
.best-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.best-label {
  font-family: var(--font-mono);
  font-size: var(--fs-11);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}
.best-spec { font-family: var(--font-mono); font-size: var(--fs-14); color: var(--text); overflow-wrap: anywhere; }
.best-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }

/* ---------- Campos ---------- */
.field { display: flex; flex-direction: column; gap: var(--s-1); min-width: 0; }
.field-grow { flex: 1; min-width: 180px; }
.field label,
.field-label {
  font-size: var(--fs-12);
  font-weight: 500;
  color: var(--text-2);
}
.field input,
.field select,
.select-compact {
  min-height: 44px;
  padding: 0 var(--s-3);
  background: var(--surface-1);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text);
  font-size: var(--fs-14);
  min-width: 0;
  transition: border-color var(--dur-1) ease;
}
.field select,
.select-compact {
  appearance: none;
  -webkit-appearance: none;
  padding-right: var(--s-8);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5' fill='none' stroke='%23a8aeb8' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  cursor: pointer;
}
.field input:hover,
.field select:hover,
.select-compact:hover { border-color: var(--text-3); }
.field input:focus-visible,
.field select:focus-visible,
.select-compact:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.field input::placeholder { color: var(--text-3); }
.select-compact { min-height: 40px; font-size: var(--fs-13); }
select option { background: var(--surface-1); color: var(--text); }

/* ---------- Resultados ---------- */
.results { margin-top: var(--s-2); }

.toolbar {
  position: sticky;
  top: 65px;
  z-index: 20;
  padding: var(--s-3) 0;
  margin-bottom: var(--s-3);
  background: rgba(10, 11, 13, 0.92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.toolbar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}
.count { margin: 0; font-size: var(--fs-14); color: var(--text-2); min-width: 0; }
.count strong { font-family: var(--font-mono); color: var(--text); font-weight: 500; }
.toolbar-right { display: flex; align-items: center; gap: var(--s-2); flex: none; }

.filters {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 calc(var(--gutter) * -1);
  padding: 2px var(--gutter);
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 var(--gutter), #000 calc(100% - var(--gutter)), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 var(--gutter), #000 calc(100% - var(--gutter)), transparent 100%);
}
.filters::-webkit-scrollbar { display: none; }
.chip-group { display: flex; gap: 2px; flex: none; }
.chip-sep { width: 1px; height: 20px; background: var(--line-strong); flex: none; margin: 0 var(--s-1); }

.chip {
  flex: none;
  min-height: 34px;
  padding: 0 var(--s-3);
  font-size: var(--fs-13);
  font-weight: 500;
  color: var(--text-2);
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  white-space: nowrap;
  transition: color var(--dur-1) ease, background-color var(--dur-1) ease, border-color var(--dur-1) ease;
}
.chip:hover { color: var(--text); border-color: var(--line-strong); }
.chip:active { background: var(--surface-2); }
.chip.is-on,
.chip[aria-pressed='true'] {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent-line);
}
.chip-more[aria-expanded='true'] { color: var(--text); border-color: var(--line-strong); background: var(--surface-2); }
.chip-count {
  font-family: var(--font-mono);
  font-size: var(--fs-11);
  color: var(--text-3);
  margin-left: var(--s-1);
}
.chip.is-on .chip-count { color: inherit; opacity: 0.8; }

.more-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--s-4);
  align-items: end;
  padding-top: var(--s-4);
  margin-top: var(--s-3);
  border-top: 1px dashed var(--line);
}
.more-filters .chip-group { flex-wrap: wrap; }
.more-filters .field:has(.chip-group) { grid-column: span 2; }
.more-filters > .link-btn { justify-self: start; }

.menu-wrap { position: relative; }
.menu {
  position: absolute;
  right: 0;
  top: calc(100% + var(--s-2));
  z-index: 35;
  min-width: 260px;
  padding: var(--s-1);
  background: var(--surface-1);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  animation: pop-in var(--dur-2) var(--ease-out);
}
.menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--s-2) var(--s-3);
  min-height: 40px;
  font-size: var(--fs-14);
  color: var(--text);
  border-radius: var(--radius);
}
.menu button:hover,
.menu button:focus-visible { background: var(--surface-3); outline: none; }
.menu button:active { background: var(--line-strong); }

/* Lista de versiones */
.release-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s-2); }

.release {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-3) var(--s-3) var(--s-3) 0;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color var(--dur-1) ease, background-color var(--dur-1) ease;
  animation: row-in var(--dur-3) var(--ease-out) both;
}
.release:hover { border-color: var(--line-strong); background: var(--surface-2); }
.release.is-best { border-color: var(--accent-line); }

.rel-q {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-1);
  border-right: 1px solid var(--line);
}
.rel-q-res {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-20);
  line-height: 1;
  letter-spacing: 0.02em;
}
.rel-q-res.q-4k { color: var(--accent); }
.rel-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}
.rel-status::before { content: ''; width: 6px; height: 6px; background: var(--text-3); }
.rel-status.is-instant { color: var(--accent); }
.rel-status.is-instant::before { background: var(--accent); }

.rel-body { min-width: 0; }
.rel-name {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--fs-13);
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rel-tags { display: flex; flex-wrap: wrap; gap: var(--s-1); margin-top: var(--s-2); }
.tag {
  font-family: var(--font-mono);
  font-size: var(--fs-11);
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  color: var(--text-2);
  background: var(--surface-3);
  border-radius: var(--radius);
  white-space: nowrap;
}
.tag-lang { color: var(--text); background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); }
.tag-hdr { color: var(--warn); }
.tag-remux { color: var(--info); }
.tag-best { color: var(--accent-ink); background: var(--accent); }

.rel-side { display: flex; align-items: center; gap: var(--s-4); }
.rel-size { text-align: right; font-family: var(--font-mono); white-space: nowrap; }
.rel-size b { display: block; font-weight: 500; font-size: var(--fs-14); color: var(--text); }
.rel-size small { font-size: var(--fs-11); color: var(--text-3); }
.rel-actions { display: flex; gap: var(--s-2); }
.rel-play { min-width: 112px; }
.rel-play svg { width: 14px; height: 14px; }

.empty {
  padding: var(--s-12) var(--s-6);
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}
.empty h3 { margin: 0 0 var(--s-2); font-family: var(--font-display); font-size: var(--fs-28); text-transform: uppercase; letter-spacing: 0.02em; }
.empty p { margin: 0 auto var(--s-5); max-width: 46ch; color: var(--text-2); }

.release-skel {
  height: 76px;
  border: 1px solid var(--line);
}
.loading-note {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin: 0 0 var(--s-3);
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  color: var(--text-3);
}
.loading-note::before {
  content: '';
  width: 10px;
  height: 10px;
  background: var(--accent);
  animation: blink 900ms steps(2, jump-none) infinite;
}

/* ---------- Hoja / diálogo ---------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: var(--s-4);
  background: rgba(5, 6, 8, 0.72);
  animation: fade-in var(--dur-2) ease;
}
.sheet {
  width: min(440px, 100%);
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  background: var(--surface-1);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  animation: pop-in var(--dur-3) var(--ease-out);
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
}
.sheet-wide { width: min(560px, 100%); }
.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-4);
  padding: var(--s-5) var(--s-5) var(--s-3);
}
.sheet-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-28);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.sheet-sub {
  margin: var(--s-2) 0 0;
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  color: var(--text-3);
  overflow-wrap: anywhere;
}
.sheet-body { padding: var(--s-2) var(--s-5) var(--s-3); overflow-y: auto; }
.sheet-note {
  margin: 0;
  padding: var(--s-3) var(--s-5) var(--s-5);
  font-size: var(--fs-12);
  color: var(--text-3);
}
.sheet-note:empty { display: none; }
.sheet-foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--s-2);
  padding: var(--s-4) var(--s-5) var(--s-5);
  border-top: 1px solid var(--line);
}
.settings-body { display: flex; flex-direction: column; gap: var(--s-4); }
.hint { margin: 0; font-size: var(--fs-12); color: var(--text-3); }

.app-group + .app-group { margin-top: var(--s-4); }
.app-group-title {
  margin: 0 0 var(--s-2);
  font-family: var(--font-mono);
  font-size: var(--fs-11);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}
.app-list { display: flex; flex-direction: column; gap: 2px; }
.app-opt {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  min-height: 52px;
  padding: var(--s-2);
  text-align: left;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: background-color var(--dur-1) ease, border-color var(--dur-1) ease;
}
.app-opt:hover { background: var(--surface-3); }
.app-opt:active { background: var(--line-strong); }
.app-opt:focus-visible { outline: none; border-color: var(--accent); }
.app-opt.is-default { border-color: var(--accent-line); background: var(--accent-soft); }
.app-ico {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-14);
  letter-spacing: 0.02em;
  color: var(--text);
  background: var(--surface-3);
  border-radius: var(--radius);
}
.app-ico.is-vlc { background: #b84a00; color: #fff; }
.app-opt.is-default .app-desc { color: var(--text-2); }
.app-name { font-weight: 600; font-size: var(--fs-14); }
.app-desc { font-size: var(--fs-12); color: var(--text-3); }
.app-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.other-toggle { margin-top: var(--s-4); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--s-6) + env(safe-area-inset-bottom));
  z-index: 80;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: var(--s-3) var(--s-4);
  font-size: var(--fs-14);
  font-weight: 500;
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  animation: toast-in var(--dur-3) var(--ease-out);
}
.toast.is-error { background: var(--danger); color: #140404; }

/* ---------- Pie ---------- */
.footer {
  max-width: var(--page);
  width: 100%;
  margin: 0 auto;
  padding: var(--s-5) var(--gutter) calc(var(--s-5) + env(safe-area-inset-bottom));
  display: flex;
  justify-content: space-between;
  gap: var(--s-4);
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  color: var(--text-3);
  border-top: 1px solid var(--line);
}

/* ---------- Animaciones ---------- */
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(0.99); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes row-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@keyframes blink { 50% { opacity: 0.2; } }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }

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

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .release { grid-template-columns: 64px minmax(0, 1fr); }
  .rel-side {
    grid-column: 1 / -1;
    justify-content: space-between;
    padding-left: var(--s-3);
    padding-top: var(--s-3);
    border-top: 1px solid var(--line);
  }
  .rel-size { text-align: left; }
  .rel-size b { display: inline; margin-right: var(--s-2); }
}

@media (max-width: 720px) {
  .page { padding-top: var(--s-5); }
  .player-pref-label { display: none; }
  .search { flex-wrap: wrap; }
  .seg { width: 100%; flex: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .search-field { flex: 1 1 100%; }
  .seg-btn { flex: 1; }
  .search-go { display: none; }
  .kbd-hint { display: none; }
  .footer-keys { display: none; }

  .title-view { margin-top: calc(var(--s-10) * -1 + var(--s-3)); }
  .hero-grid { grid-template-columns: 96px minmax(0, 1fr); gap: var(--s-4); }
  .hero-poster { width: 96px; height: 144px; }
  .hero-desc,
  .episode-bar,
  .best { grid-column: 1 / -1; }
  .hero-info { display: contents; }
  .hero-head { min-width: 0; }
  .best { flex-direction: column; align-items: stretch; }
  .hero-meta { gap: var(--s-1) var(--s-4); }
  .hero-meta span { padding-left: 0; border-left: 0; }
  .best-actions { display: grid; grid-template-columns: 1fr auto; }
  .episode-bar .field:first-child { flex: 1 1 120px; }
  .toolbar { top: 61px; }
  .more-filters .field:has(.chip-group) { grid-column: auto; }

  .poster-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: var(--s-4) var(--s-3); }
  .poster-name { font-size: var(--fs-13); }

  .sheet-backdrop { place-items: end stretch; padding: 0; }
  .sheet,
  .sheet-wide {
    width: 100%;
    max-height: 88dvh;
    clip-path: polygon(14px 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%, 0 14px);
    border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom);
    animation: sheet-up var(--dur-3) var(--ease-out);
  }
}

@media (max-width: 420px) {
  .brand-tag { display: none; }
  .rel-side { gap: var(--s-3); }
  .rel-size { min-width: 0; overflow: hidden; }
  .rel-size b { display: block; margin-right: 0; }
  .rel-actions { flex: none; }
  .rel-play { min-width: 0; padding: 0 var(--s-3); }
}

@media (hover: none) {
  .poster-card:hover .poster-frame img { transform: none; }
}

.more-wrap { display: flex; justify-content: center; padding-top: var(--s-4); list-style: none; }

/* Guía de activación de VLC */
.setup-steps { list-style: none; margin: 0 0 var(--s-4); padding: 0; display: flex; flex-direction: column; gap: var(--s-5); }
.setup-steps li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: var(--s-3); }
.setup-steps p { margin: 0; }
.setup-steps .app-desc { margin-top: 2px; line-height: 1.5; }
.setup-steps b { color: var(--text); font-weight: 600; }
.setup-n {
  width: 28px; height: 28px; display: grid; place-items: center;
  font-family: var(--font-mono); font-size: var(--fs-13); font-weight: 500;
  color: var(--accent); border: 1px solid var(--accent-line); border-radius: var(--radius);
}
.setup-btn { margin-top: var(--s-3); text-decoration: none; }
