/* ===================== Header ===================== */
.site-header { position: relative; z-index: 30; background: var(--bg-hero); }
.site-header__bar {
  width: min(100% - 2 * var(--pad), 1340px); margin-inline: auto;
  height: var(--header-h);
  display: flex; align-items: center; gap: clamp(12px, 2vw, 28px);
}
.nav-toggle { flex: none; color: var(--primary); margin-left: -10px; }
.ico--menu { width: 28px; height: 28px; }
.logo { font-size: 1.45rem; font-weight: 500; letter-spacing: .12em; white-space: nowrap; }
.logo img { display: block; width: auto; height: 40px; max-width: 100%; object-fit: contain; object-position: left center; } /* si no cabe, encoge sin deformarse */
.logo--footer img { height: clamp(38px, 3vw, 50px); }

.main-nav { flex: 1; }
.main-nav ul { display: flex; justify-content: space-between; align-items: center; max-width: 860px; margin-inline: auto; }
.main-nav a, .main-nav button {
  display: inline-flex; align-items: center; gap: .45em;
  padding: .5em .2em; font-size: .95rem; color: #E6E6EA; position: relative;
  transition: color var(--t-ui) var(--ease-out);
}
.main-nav a[aria-current="page"] { color: var(--primary-hi); }
/* Al pasar el ratón todo el menú de la cabecera se vuelve morado: enlaces, sobre, campana y avatar */
.header-actions .icon-btn { transition: transform var(--t-press) var(--ease-out), color var(--t-ui) var(--ease-out); }
.avatar-btn img { transition: box-shadow var(--t-ui) var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .main-nav a:hover, .main-nav button:hover, .header-actions .icon-btn:hover { color: var(--primary-hi); }
  .avatar-btn:hover img { box-shadow: 0 0 0 2px var(--bg-hero), 0 0 0 4px var(--primary-hi), 0 0 18px 2px rgb(109 87 232 / .55); }
  .avatar-btn:hover .ico--caret { color: var(--primary-hi); }
}
.main-nav__search { position: relative; }

.header-actions { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.dropdown { position: relative; }
.mail-btn { color: #fff; }
.ico--mail { width: 28px; height: 28px; }
.ico--bell { width: 26px; height: 26px; }
.online-dot {
  position: absolute; top: 8px; right: 5px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--online); box-shadow: 0 0 0 2px var(--bg-hero);
}
.avatar-btn { display: flex; flex: none; align-items: center; gap: 6px; transition: transform var(--t-press) var(--ease-out); }
.avatar-btn:active { transform: scale(.95); }
.avatar-btn img {
  width: 50px; height: 50px; border-radius: 50%; object-fit: cover;
  flex: none; max-width: none; /* en la cabecera apretada del móvil Safari la encogía a lo ancho y quedaba ovalada */
  box-shadow: 0 0 0 2px var(--bg-hero), 0 0 0 4px var(--primary);
}
.ico--caret { width: 18px; height: 18px; color: var(--primary); }

/* ===== Popovers: crecen desde su disparador, se cierran más rápido de lo que abren ===== */
.popover {
  position: absolute; top: calc(100% + 12px); right: 0; z-index: 40;
  min-width: 200px; padding: 10px; border-radius: var(--r-md);
  background: #1B1B24; border: 1px solid var(--line);
  box-shadow: 0 24px 48px -12px rgb(0 0 0 / .65);
  transform-origin: top right;
  opacity: 0; transform: translateY(-6px) scale(.96); visibility: hidden;
  transition: opacity 140ms ease-in, transform 140ms ease-in, visibility 0s 140ms;
}
.popover.is-open {
  opacity: 1; transform: none; visibility: visible;
  transition: opacity var(--t-ui) var(--ease-out), transform var(--t-ui) var(--ease-out), visibility 0s;
}
.popover--menu a, .popover--menu button { display: block; width: 100%; text-align: left; padding: .6em .9em; border-radius: var(--r-sm); font-size: var(--fs-sm); }
.popover--menu a:hover, .popover--menu a:focus-visible, .popover--menu button:hover, .popover--menu button:focus-visible { background: var(--surface-2); }
.popover--menu [aria-current="true"] { color: var(--primary-hi); }
.popover--menu .menu-admin { display: flex; align-items: center; gap: 8px; color: var(--gold); font-weight: 600; }
.menu-admin .ico { width: 18px; height: 18px; }
.popover--search { left: 0; right: auto; transform-origin: top left; padding: 6px; }
.popover--search input {
  width: 280px; padding: .7em 1em; border-radius: var(--r-sm);
  background: var(--bg); border: 1px solid var(--line);
}
.popover--notif { width: 350px; padding: 0; overflow: hidden; border-color: rgb(109 87 232 / .35); }
.notif-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 12px; border-bottom: 1px solid var(--line); }
.notif-head__title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .95rem; }
.notif-head__count { min-width: 20px; padding: 1px 6px; border-radius: var(--r-pill); background: var(--primary); font-size: .7rem; text-align: center; transition: opacity var(--t-ui), transform var(--t-ui) var(--ease-out); }
.notif-head__count.is-zero { opacity: 0; transform: scale(.6); }
.notif-head__read { font-size: .75rem; color: var(--primary-soft); transition: color var(--t-ui); }
.notif-head__read:hover { color: #fff; }
.notif-head__read:disabled { color: var(--dim); cursor: default; }
.notif {
  position: relative; display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 12px;
  padding: 12px 16px 12px 20px; font-size: .82rem; line-height: 1.4; color: #C9C9D0;
  transition: background-color var(--t-ui);
}
.notif:hover { background: rgb(109 87 232 / .1); }
.notif.is-new { color: #fff; }
.notif.is-new::before { content: ""; position: absolute; left: 8px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--primary-hi); box-shadow: 0 0 8px var(--primary); }
.notif img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; border: 2px solid rgb(109 87 232 / .5); }
.notif p a { color: var(--primary-hi); font-weight: 600; }
.notif p a:hover { text-decoration: underline; }
.notif__ico { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: rgb(109 87 232 / .16); color: var(--primary-hi); }
.notif__ico .ico { width: 17px; height: 17px; }
.notif .btn { padding: .45em 1em; font-size: .78rem; }
.popover--notif .popover__more { margin-top: 0; color: var(--primary-hi); transition: background-color var(--t-ui); }
.popover--notif .popover__more:hover { background: rgb(109 87 232 / .1); }
.popover__more { display: block; text-align: center; padding: 14px; font-size: .78rem; color: var(--blue); border-top: 1px solid var(--line); margin-top: 6px; }

/* ===== Drawer (menú completo, panel lateral pegado al borde) ===== */
.drawer {
  position: fixed; inset: 0 auto 0 0; z-index: 60;
  width: min(320px, 86vw); padding: 96px 24px 24px;
  background: #15151d; border-right: 1px solid var(--line);
  transform: translateX(-102%); visibility: hidden;
  transition: transform 500ms var(--ease-sheet), visibility 0s 500ms;
}
.drawer.is-open { transform: none; visibility: visible; transition: transform 500ms var(--ease-sheet), visibility 0s; }
.drawer a { display: flex; align-items: center; gap: 12px; padding: 14px 8px; font-size: 1.05rem; border-bottom: 1px solid var(--line); }
.drawer a[aria-current="page"] { color: var(--primary-hi); }
body::after {
  content: ""; position: fixed; inset: 0; z-index: 55; background: rgb(0 0 0 / .55);
  opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 500ms var(--ease-sheet), visibility 0s 500ms;
}
/* visibility y no solo opacity: Safari iOS 26 toma el color de la barra de estado del fijo más alto, y un velo transparente encima de la cabecera se lo robaba */
body.drawer-open::after { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity 500ms var(--ease-sheet), visibility 0s; }
.drawer-open .nav-toggle { position: relative; z-index: 70; }
/* el drawer vive dentro de la cabecera (z-index 30): sin esto el velo (55) lo tapa y sus enlaces no reciben clics */
.drawer-open .site-header { z-index: 60; }

/* ===================== Carrusel de géneros ===================== */
.genres {
  position: relative; z-index: 20;
  width: min(100% - 2 * var(--pad), 1000px); margin-inline: auto;
  height: var(--genres-h);
  display: flex; align-items: center; gap: 10px;
}
.genres__arrow { display: grid; place-items: center; width: 36px; height: 44px; color: #fff; flex: none; transition: transform var(--t-press) var(--ease-out), opacity var(--t-ui); }
.genres__arrow:active { transform: scale(.85); }
.genres__arrow[disabled] { opacity: .3; cursor: default; }
.genres__scroller {
  flex: 1; display: flex; gap: clamp(12px, 1.4vw, 22px);
  overflow-x: auto; scrollbar-width: none; padding-block: 6px;
  cursor: grab; touch-action: pan-x pan-y;
}
.genres__scroller::-webkit-scrollbar { display: none; }
.genres__scroller {
  --fl: 0px; --fr: 0px;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--fl), #000 calc(100% - var(--fr)), transparent);
  mask-image: linear-gradient(to right, transparent, #000 var(--fl), #000 calc(100% - var(--fr)), transparent);
}
.genres__scroller.fade-l { --fl: 56px; }
.genres__scroller.fade-r { --fr: 56px; }
.chip {
  flex: 0 0 auto; min-width: clamp(104px, 8vw, 122px); height: clamp(52px, 4.2vw, 62px);
  display: inline-flex; align-items: center; justify-content: center; gap: .7em;
  padding-inline: 1.1em; border-radius: var(--r-lg);
  background: var(--chip); backdrop-filter: blur(6px);
  font-size: .9rem; color: #EDEDF0; user-select: none; -webkit-user-drag: none;
  transition: transform var(--t-press) var(--ease-out), background-color var(--t-ui) var(--ease-out);
}
.chip .ico { width: 24px; height: 24px; }
.chip:active { transform: scale(.95); }
.chip[aria-current="true"] { background: var(--primary); }
@media (hover: hover) and (pointer: fine) { .chip:not([aria-current]):hover { background: rgb(80 80 86 / .85); } }
.chip__brand { font-weight: 800; font-size: 1.35rem; letter-spacing: -.04em; font-style: italic; }

/* ===================== Encabezado de sección + pestañas ===================== */
.section { padding-block: clamp(28px, 3.4vw, 48px) 0; }
.section-head { display: flex; align-items: center; gap: clamp(18px, 3.2vw, 60px); margin-bottom: 20px; }
.section-title { font-size: var(--fs-xl); font-weight: 600; white-space: nowrap; }
.section-title--ink { position: relative; padding-bottom: 6px; }
.section-title--ink::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; border-radius: 2px; background: var(--primary); }

.tabs { position: relative; display: flex; gap: clamp(18px, 3vw, 46px); overflow-x: auto; scrollbar-width: none; flex: 1; padding-bottom: 6px; }
.tabs::-webkit-scrollbar { display: none; }
.tab { color: #8C8C98; font-size: 1rem; white-space: nowrap; padding-block: 4px; transition: color var(--t-ui) var(--ease-out); }
.tab[aria-selected="true"] { color: #fff; }
@media (hover: hover) and (pointer: fine) { .tab:hover { color: #D8D8E0; } }
.tabs__ink {
  position: absolute; left: 0; bottom: 0; height: 2px; width: 1px; border-radius: 2px;
  background: var(--primary); transform-origin: left; opacity: 0;
  transition: transform 380ms var(--ease-out), opacity var(--t-ui);
}

.dashes { display: flex; gap: 6px; margin-left: auto; flex: none; }
.dashes span { width: 34px; height: 3px; border-radius: 2px; background: #3A3A44; transition: background-color var(--t-ui) var(--ease-out); }
.dashes span.is-on { background: var(--primary); }

/* ===================== Badges ===================== */
.badge-dot {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  font-size: 9px; font-weight: 700; line-height: 1; color: #fff;
  background: rgb(0 0 0 / .55); border: 1.5px solid #fff;
}
.badge-dot--lg { width: 30px; height: 30px; font-size: 11px; }
.badge-dot--ES, .badge-dot--SU, .badge-dot--SUB { background: var(--danger); border-color: var(--danger); }
.badge-dot--LT { background: #1FA653; border-color: #1FA653; }
.pill { display: inline-block; padding: 3px 10px; border-radius: var(--r-pill); font-size: .7rem; font-weight: 500; line-height: 1.3; }
.pill--primary { background: var(--primary); color: #fff; }
.pill--blue { background: var(--blue); color: #fff; }
.pill--gold { background: var(--gold); color: #1a1a1a; }

/* ===================== Tarjeta de episodio ===================== */
.ep-card {
  position: relative; display: block; overflow: hidden; border-radius: 4px;
  background: var(--surface); isolation: isolate;
  transition: transform var(--t-press) var(--ease-out);
}
.ep-card:active { transform: scale(.98); }
.ep-card img { width: 100%; height: 100%; object-fit: cover; transition: transform 600ms var(--ease-out); }
.ep-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgb(5 5 10 / .9), transparent 55%); z-index: 1; }
.ep-card__badges { position: absolute; top: 8px; left: 8px; z-index: 2; display: grid; gap: 8px; }
.ep-card__marks { position: absolute; top: 0; right: 10px; z-index: 2; display: grid; justify-items: center; gap: 10px; }
.ep-card__marks .ribbon { width: 22px; height: 26px; color: var(--primary); }
.ep-card__marks .rec { width: 14px; height: 14px; border-radius: 50%; background: var(--danger); }
.ep-card__foot { position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 2; }
.ep-card__row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: .95rem; text-shadow: 0 1px 6px rgb(0 0 0 / .6); }
.ep-card__ep { font-size: .85rem; }
.progress { height: 2px; margin-top: 6px; background: rgb(255 255 255 / .25); border-radius: 2px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--primary); transform-origin: left; }
@media (hover: hover) and (pointer: fine) { .ep-card:hover img { transform: scale(1.04); } }

/* ===================== Póster ===================== */
.poster { display: grid; gap: 10px; align-content: start; text-align: center; -webkit-user-drag: none; user-select: none; }
.poster__frame {
  position: relative; aspect-ratio: 2 / 3; overflow: hidden; border-radius: 4px; background: var(--surface);
  transition: transform var(--t-press) var(--ease-out), box-shadow 300ms var(--ease-out);
}
.poster__frame img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.poster:active .poster__frame { transform: scale(.97); }
@media (hover: hover) and (pointer: fine) {
  .poster:hover .poster__frame { transform: translateY(-4px); box-shadow: 0 16px 30px -12px rgb(109 87 232 / .55); }
}
.poster__badges { position: absolute; top: 8px; left: 8px; display: grid; gap: 8px; }
.poster__year { position: absolute; right: 8px; bottom: 8px; }
.poster__type { position: absolute; left: 8px; bottom: 8px; }
.poster__title { font-size: .85rem; font-weight: 500; }
.poster__title em { font-style: normal; color: var(--primary-hi); }

/* ===================== Carrusel genérico ===================== */
.rail {
  --per: 8.8; --gap: 10px;
  display: grid; grid-auto-flow: column;
  grid-auto-columns: calc((100% - (var(--per) - 1) * var(--gap)) / var(--per));
  gap: var(--gap); overflow-x: auto; scrollbar-width: none;
  cursor: grab; overscroll-behavior-x: contain;
}
.rail::-webkit-scrollbar { display: none; }
.rail.is-dragging, .genres__scroller.is-dragging { cursor: grabbing; }
@media (pointer: coarse) {
  .rail, .genres__scroller { scroll-snap-type: x mandatory; }
  .rail > *, .genres__scroller > * { scroll-snap-align: start; }
}

/* ===================== Footer ===================== */
.site-footer { position: relative; background: var(--bg); margin-top: clamp(48px, 6vw, 90px); overflow: hidden; }
.site-footer__inner {
  position: relative;
  width: min(100% - 2 * var(--pad), 1340px); margin-inline: auto;
  min-height: 330px; padding-block: 70px 40px;
  display: grid; grid-template-columns: minmax(0, 330px) auto auto auto;
  align-items: center; justify-content: space-between; column-gap: clamp(24px, 4vw, 70px);
}
.site-footer__inner { --art-w: clamp(260px, 25vw, 360px); }
.site-footer__art-link { display: contents; }
.site-footer__art-link[href] .site-footer__art { pointer-events: auto; cursor: pointer; }
.site-footer__art {
  position: absolute; left: 0; bottom: 0; width: auto; max-width: var(--art-w); max-height: calc(100% - 12px); pointer-events: none; /* las altas encogen para no cortarse arriba */
  /* difumina arriba y a la derecha: algunas imágenes traen su recuadro de fondo */
  -webkit-mask-image: linear-gradient(to right, transparent, #000 10%, #000 78%, transparent), linear-gradient(to bottom, transparent, #000 6%);
  -webkit-mask-composite: source-in; mask-composite: intersect;
  mask-image: linear-gradient(to right, transparent, #000 10%, #000 78%, transparent), linear-gradient(to bottom, transparent, #000 6%);
}
.logo--footer { grid-column: 2; font-size: clamp(1.8rem, 2.4vw, 2.3rem); }
.footer-col { display: grid; gap: 12px; align-content: start; }
.footer-col__title { font-size: 1rem; font-weight: 500; }
.footer-col__title--accent { color: var(--primary-hi); font-weight: 400; }
.footer-col ul { display: grid; gap: 8px; font-size: .95rem; }
.footer-col a { transition: color var(--t-ui); }
.footer-col a:hover { color: var(--primary-soft); }
.pill-form { display: flex; border: 1px solid rgb(255 255 255 / .55); border-radius: var(--r-pill); width: min(100%, 236px); margin-bottom: 8px; }
.pill-form input { flex: 1; min-width: 0; background: none; border: 0; padding: .55em 1em; font-size: .8rem; outline: none; }
.pill-form .btn { border-radius: var(--r-pill); padding: .65em 1.4em; font-size: .8rem; }
.pill-form:focus-within { border-color: var(--primary-soft); }
.socials { display: flex !important; gap: 8px !important; }
.socials a { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #23232b; transition: background-color var(--t-ui), transform var(--t-press) var(--ease-out); }
.socials a:active { transform: scale(.9); }
.socials a:hover { background: var(--primary); }
.socials .ico { width: 16px; height: 16px; }
.deco { position: absolute; z-index: 1; width: 22px; fill: none; stroke: var(--primary); stroke-width: 1.6; pointer-events: none; }
.deco--1 { left: 36%; top: 54px; } .deco--2 { left: 44%; top: 50px; width: 18px; }
.deco--3 { left: 70%; top: 32px; } .deco--4 { left: 79%; top: 36px; width: 22px; }
/* encima de la imagen del footer, en proporción a su ancho */
.deco--art { stroke: #fff; }
.deco--a1 { left: calc(var(--art-w) * .5); bottom: 170px; } .deco--a2 { left: calc(var(--art-w) * .78); bottom: 62px; }
.deco--a3 { left: calc(var(--art-w) * .9); bottom: 56px; width: 14px; } .deco--a4 { left: calc(var(--art-w) * .4); bottom: 8px; }
.site-footer__legal {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px 24px;
  padding: 18px max(var(--pad), (100% - 1340px) / 2); font-size: .8rem; color: var(--muted); border-top: 1px solid var(--line);
}
.site-footer__legal p:last-child { text-align: right; }
@media (max-width: 1100px) { .site-footer__legal { flex-direction: column; text-align: center; } .site-footer__legal p:last-child { text-align: center; } }

/* ===================== Páginas legales ===================== */
.site-footer__links a { color: inherit; }
.site-footer__links a:hover { color: var(--text); }
.legal { max-width: 78ch; padding-block: 32px 64px; line-height: 1.65; }
.legal__fecha { color: var(--muted); font-size: .85rem; margin-top: -.4em; }
.legal h2 { font-size: var(--fs-lg); margin: 1.8em 0 .5em; }
.legal ul, .legal ol { padding-left: 1.3em; }
.legal li + li { margin-top: .35em; }
.legal a:not(.btn) { color: var(--accent); }

/* ===================== Responsive base ===================== */
@media (max-width: 1100px) {
  .main-nav { display: none; }
  /* sin menú principal visible, la cabecera acompaña al scroll */
  /* fixed y no sticky: Safari iOS 26 solo tiñe la barra de estado con el color de una cabecera fija; con sticky se ve la página detrás */
  .site-header { position: fixed; top: 0; left: 0; right: 0; padding-top: env(safe-area-inset-top); }
  body { padding-top: calc(var(--header-h) + env(safe-area-inset-top)); }
  section, [id] { scroll-margin-top: calc(var(--header-h) + 8px); } /* que la cabecera fija no tape lo que se enlaza */
  /* pie: dibujo arriba y todo centrado (en tablet el dibujo absoluto pisaba el logotipo) */
  .site-footer__inner { grid-template-columns: 1fr; justify-items: center; row-gap: 26px; min-height: 0; padding-block: 0 36px; text-align: center; }
  .logo--footer { grid-column: 1; }
  .site-footer__art {
    position: static; order: -1; width: min(240px, 70vw); margin-bottom: -6px;
    -webkit-mask-image: linear-gradient(to right, transparent, #000 14%, #000 86%, transparent), linear-gradient(to top, transparent, #000 30%);
    mask-image: linear-gradient(to right, transparent, #000 14%, #000 86%, transparent), linear-gradient(to top, transparent, #000 30%);
  }
  .footer-col { justify-items: center; width: 100%; }
  .pill-form { width: min(100%, 320px); }
  .pill-form input { font-size: .9rem; padding-block: .7em; }
  .deco { display: none; }

  .rail { --per: 6; }
}
@media (max-width: 760px) {
  :root { --header-h: 64px; --genres-h: 76px; }
  .logo { font-size: 1.15rem; }
  .avatar-btn img { width: 38px; height: 38px; }
  .ico--caret { display: none; }
  .genres__arrow { display: none; }
  .genres { width: 100%; padding-inline: var(--pad); }
  .rail { --per: 2.6; }
  .popover--notif { position: fixed; top: calc(var(--header-h) - 4px); left: 12px; right: 12px; width: auto; }
}


/* ===================== Buscador con resultados ===================== */
.main-nav .popover--search { width: 340px; padding: 10px; left: auto; right: 0; transform-origin: top right; }
/* anula los estilos de los enlaces y botones del menú principal dentro del buscador */
.main-nav .search-results { justify-content: stretch; max-width: none; margin-inline: 0; }
.main-nav .search-results a { color: var(--text); font-size: inherit; }
.main-nav .search-tipo button { justify-content: center; }
.main-nav .popover--search input { width: 100%; }
.main-nav .popover--search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgb(109 87 232 / .25); outline: none; }
.main-nav .search-tipo { display: flex; gap: 4px; padding: 3px; margin-bottom: 8px; border-radius: var(--r-pill); background: var(--bg); }
.main-nav .search-tipo button { flex: 1; padding: .4em .6em; border-radius: var(--r-pill); font-size: .78rem; color: var(--muted); transition: background-color var(--t-ui), color var(--t-ui); }
.main-nav .search-tipo button:hover { color: #fff; }
.main-nav .search-tipo button[aria-checked="true"] { background: var(--primary); color: #fff; }
.main-nav .search-results { display: grid; gap: 2px; margin-top: 8px; max-height: 340px; overflow-y: auto; scrollbar-width: thin; }
.main-nav .search-results a { display: flex; align-items: center; gap: 12px; padding: 6px 8px; border-radius: var(--r-sm); transition: background-color var(--t-ui); }
.main-nav .search-results [aria-selected="true"] a, .main-nav .search-results a:hover { background: rgb(109 87 232 / .18); }
.main-nav .search-results img { flex: none; width: 38px; height: 54px; object-fit: cover; border-radius: 5px; border: 1.5px solid rgb(109 87 232 / .55); }
.main-nav .search-results__txt { display: grid; gap: 2px; min-width: 0; }
.main-nav .search-results__title { font-size: .9rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.main-nav .search-results__title mark { background: none; color: var(--primary-hi); font-weight: 700; }
.main-nav .search-results__meta { font-size: .75rem; color: var(--primary-soft); opacity: .8; }
.main-nav .search-empty:not(:empty) { margin-top: 10px; padding: 8px; font-size: .8rem; color: var(--muted); text-align: center; }
/* el campo va primero en el HTML (recibe el foco al abrir) y el selector se muestra encima */
.main-nav .popover--search { display: flex; flex-direction: column; }
.main-nav .search-tipo { order: -1; }

/* ----- Avisos flotantes en tiempo real (realtime.js) ----- */
.toasts { position: fixed; z-index: 90; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); translate: -50% 0; display: grid; gap: 8px; width: min(420px, calc(100vw - 24px)); pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 12px; border-radius: 14px;
  background: #1B1B24; border: 1px solid rgb(109 87 232 / .45); box-shadow: 0 18px 40px -12px rgb(0 0 0 / .7);
  pointer-events: auto; animation: toast-in 280ms var(--ease-out, cubic-bezier(.2, .8, .2, 1)) both;
}
.toast.is-leaving { animation: toast-out 220ms ease-in both; }
.toast img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; }
.toast__txt { flex: 1; min-width: 0; font-size: .85rem; line-height: 1.35; color: inherit; text-decoration: none; }
.toast__txt strong { font-weight: 600; }
.toast__txt:hover strong { text-decoration: underline; }
.toast form { display: contents; }
.toast__close { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: rgb(255 255 255 / .6); flex: none; }
.toast__close:hover { background: rgb(255 255 255 / .08); color: #fff; }
.toast__close .ico { width: 14px; height: 14px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(.97); } }
@media (prefers-reduced-motion: reduce) { .toast, .toast.is-leaving { animation-duration: 1ms; } }
/* El aviso flotante reutiliza la foto con insignia, el título y la carátula de .notif */
.toast { --kind: var(--primary); border-color: color-mix(in srgb, var(--kind) 50%, transparent); }
.toast.notif--like_comentario, .toast.notif--like_lista { --kind: #FF4D6D; }
.toast.notif--respuesta { --kind: #33BAE7; }
.toast.notif--amistad_aceptada { --kind: #1FA653; }
.toast .notif__avatar { position: relative; width: 42px; height: 42px; flex: none; }
.toast .notif__avatar img { width: 42px; height: 42px; border: 2px solid color-mix(in srgb, var(--kind) 55%, transparent); }
.toast__txt { color: #D6D6DE; }
.toast .notif__poster { width: 34px; height: 50px; border-radius: 6px; object-fit: cover; flex: none; box-shadow: 0 6px 14px -6px rgb(0 0 0 / .8), 0 0 0 1px rgb(255 255 255 / .08); }

/* Móvil y tablet: el menú principal se oculta pero la lupa se queda en la cabecera (que es fija al bajar) */
@media (max-width: 1100px) {
  /* flex-shrink 0: en Safari iOS la cabecera llena aplastaba el menú y la lupa quedaba en ~2px */
  .main-nav { display: block; flex: 1 0 auto; }
  .main-nav__search .ico { width: 24px; height: 24px; }
  .main-nav ul { justify-content: flex-end; max-width: none; }
  .main-nav li:not(.main-nav__search) { display: none; }
  .main-nav .popover--search { position: fixed; top: calc(var(--header-h) - 4px); left: auto; right: 12px; width: min(480px, 100vw - 24px); transform-origin: top right; }
  .main-nav .popover--search input { font-size: 16px; } /* menos de 16px hace zoom en iOS al enfocar */
}
@media (max-width: 760px) {
  .main-nav__search-txt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .main-nav__search button { padding: 10px; }
}

/* Enlace a /logros sobre "Información útil" */
.footer-logros { display: inline-flex; align-items: center; gap: 8px; color: #F5C451; text-decoration: none; margin-bottom: 4px; }
.footer-logros .ico { width: 18px; height: 18px; }
.footer-logros:hover { color: #FFE08A; }

/* Barra de carga al cambiar de página (pwa.js): sale ya con un tramo pintado y sin retraso, porque mientras
   espera la página nueva el navegador apenas repinta (una transición con retraso no llegaba a verse) */
.nav-progress {
  position: fixed; z-index: 9999; top: env(safe-area-inset-top, 0px); left: 0; right: 0; height: 3px; pointer-events: none;
  background: linear-gradient(90deg, var(--primary), var(--primary-hi));
  box-shadow: 0 0 10px rgb(109 87 232 / .7);
  transform-origin: left; transform: scaleX(0); opacity: 0;
}
/* avanza rápido al principio y casi se detiene: nunca llega al final hasta que carga la página nueva */
.nav-progress.is-on { opacity: 1; animation: nav-progress 10s cubic-bezier(.08, .7, .2, 1) forwards; }
@keyframes nav-progress { from { transform: scaleX(.18); } to { transform: scaleX(.92); } }

/* Tirar para recargar en la app instalada (pwa.js): --d = píxeles tirados */
.ptr {
  --d: 0;
  position: fixed; z-index: 29; /* bajo la cabecera (30) */ left: 50%; top: -44px; /* pwa.js lo pone justo bajo la cabecera */
  display: grid; place-items: center; width: 40px; height: 40px; margin-left: -20px; border-radius: 50%; pointer-events: none;
  background: #1E1E26; box-shadow: 0 6px 18px rgb(0 0 0 / .5), 0 0 0 1px rgb(255 255 255 / .08);
  transform: translateY(calc(var(--d) * 1px)); opacity: min(1, calc(var(--d) / 40));
}
.ptr.is-back { transition: transform 250ms var(--ease-out), opacity 200ms; }
.ptr__ring {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid rgb(109 87 232 / .25); border-top-color: var(--primary-hi);
  transform: rotate(calc(var(--d) * 4deg));
}
.ptr.is-ready .ptr__ring { border-color: var(--primary-hi); border-top-color: #fff; }
.ptr.is-loading .ptr__ring { border-color: rgb(109 87 232 / .25); border-top-color: var(--primary-hi); animation: ptr-spin 700ms linear infinite; }
@keyframes ptr-spin { to { transform: rotate(360deg); } }

/* Móviles estrechos (iPhone SE, 320px): menú, logo, lupa, mensajes, campana y avatar no caben a 44px con sus
   huecos y el logo se quedaba en nada; aquí se juntan y los botones bajan a 36px. Al final para ganar a los de 760px */
@media (max-width: 400px) {
  .site-header__bar { gap: 6px; }
  .header-actions { gap: 0; }
  .site-header__bar .icon-btn { width: 36px; height: 36px; }
  .main-nav__search button { padding: 6px; }
  .avatar-btn { margin-left: 4px; }
  .avatar-btn img { width: 34px; height: 34px; }
}

/* Pantalla de arranque de la app instalada (layout + pwa.js). Si el JS fallara, se oculta sola a los 8s */
.splash { display: none; }
.is-launching .splash {
  position: fixed; inset: 0; z-index: 10000; display: grid; place-content: center; justify-items: center; gap: 28px;
  background: var(--bg-hero, #141414);
  animation: splash-out 400ms 8s forwards;
}
.splash img { width: auto; height: 46px; animation: splash-in 500ms var(--ease-out) both; }
.splash__spin {
  width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid rgb(109 87 232 / .2); border-top-color: var(--primary-hi);
  animation: ptr-spin 800ms linear infinite;
}
.is-launched .splash { animation: splash-out 400ms var(--ease-out) forwards; }
@keyframes splash-in { from { opacity: 0; transform: scale(.94); } }
@keyframes splash-out { to { opacity: 0; visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { .splash img { animation: none; } }

/* ----- Aviso flotante para activar las notificaciones push (push.js) ----- */
.push-banner { --kind: var(--primary); }
.push-banner__ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; flex: none; color: #fff; background: color-mix(in srgb, var(--primary) 22%, transparent); }
.push-banner__ico .ico { width: 20px; height: 20px; color: var(--primary-hi, #8C7AF0); }
.push-banner .toast__txt span { color: var(--muted); font-size: .8rem; }
.push-banner .btn { flex: none; }
.push-banner .toast__txt b { color: #fff; font-weight: 600; }
.push-banner .ico--inline { display: inline-block; width: 15px; height: 15px; vertical-align: -2px; color: var(--primary-hi); }
/* Texto que deja un formulario enviado sin recarga (data-ajax-done, views.js) */
.ajax-done { display: inline-flex; align-items: center; padding: .35em .8em; border-radius: var(--r-pill); background: rgb(43 217 74 / .12); color: #7BE895; font-size: .8rem; }
