/* ============================================================
   XianSear — design system matched to Xiansear.html reference
   BeerCSS MDC3 tokens at :root (overridden by ThemeService at runtime)
   ============================================================ */

/* ── Design tokens ───────────────────────────────────────── */
:root {
  /* BeerCSS MDC3 tokens (Xiansear dark default) */
  --primary:               #a855f7;
  --on-primary:            #ffffff;
  --primary-container:     rgba(168,85,247,0.2);
  --on-primary-container:  #a855f7;
  --secondary:             #3b82f6;
  --on-secondary:          #ffffff;
  --secondary-container:   rgba(59,130,246,0.2);
  --on-secondary-container:#3b82f6;
  --surface:               #1e293b;
  --surface-variant:       #293548;
  --on-surface:            #e2e8f0;
  --on-surface-variant:    #94a3b8;
  --background:            #0f172a;
  --on-background:         #e2e8f0;
  --outline:               #334155;
  --outline-variant:       #334155;
  --error:                 #f87171;
  --on-error:              #ffffff;
  --inverse-surface:       #0f172a;

  /* Legacy --color-* aliases (used by all .xs-* rules below) */
  --color-primary:         #a855f7;
  --color-primary-hover:   #9333ea;
  --color-accent:          #3b82f6;
  --color-bg:              #0f172a;
  --color-bg-subtle:       #0b1222;
  --color-surface:         #1e293b;
  --color-surface-hover:   #293548;
  --color-border:          #334155;
  --color-text:            #e2e8f0;
  --color-text-muted:      #94a3b8;
  --color-text-inverted:   #0f172a;
  --color-danger:          #f87171;
  --color-success:         #4ade80;
  --color-warning:         #facc15;
  --color-topbar-bg:       rgba(15,23,42,0.88);

  /* Shape + motion */
  --xs-radius:  8px;
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --glass-blur: 16px;
  --glass-saturate: 180%;
  --motion: 200ms;
  --font-body: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Roboto, ui-sans-serif, system-ui, sans-serif;

  /* Badge tokens — shared contract for status/type/year pills so they
     stay legible over ANY poster art in either theme. Overridden per
     theme in html.light. */
  --xs-badge-bg:      rgba(15, 23, 42, 0.92);
  --xs-badge-fg:      #ffffff;
  --xs-badge-border:  rgba(255, 255, 255, 0.18);
  --xs-badge-shadow:  0 1px 2px rgba(0, 0, 0, 0.55);
}

html.light {
  --color-bg:            #f8fafc;
  --color-bg-subtle:     #f1f5f9;
  --color-surface:       #ffffff;
  --color-surface-hover: #f1f5f9;
  --color-border:        #e2e8f0;
  --color-text:          #0f172a;
  --color-text-muted:    #64748b;
  --color-topbar-bg:     rgba(248,250,252,0.92);

  /* Light-theme badge overrides — white-glass pill with dark text + subtle
     border. Text-shadow much softer because we're on light bg. */
  --xs-badge-bg:      rgba(255, 255, 255, 0.95);
  --xs-badge-fg:      #0f172a;
  --xs-badge-border:  rgba(15, 23, 42, 0.14);
  --xs-badge-shadow:  0 1px 1px rgba(255, 255, 255, 0.5);
}

/* ────────────────────────────────────────────────────────────
   LIGHT-THEME OVERRIDES — re-color elements that hard-code
   white/light values for the dark theme but break on white pages.
   Triggered by the html.light class set by ThemeService.
   ──────────────────────────────────────────────────────────── */
/* Light-theme quick-add PILL: target the trigger (visible pill) instead
   of the wrapper. The wrapper is a zero-styling positioning div — giving
   it a background would paint behind the popover menu too. The trigger
   is the actual bookmark pill the user sees. */
html.light .xs-card-quick-add-trigger {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(15, 23, 42, 0.16);
  color: var(--color-text);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
  text-shadow: none;
}
html.light .xs-card-quick-add-trigger:hover,
html.light .xs-card-quick-add:focus-within .xs-card-quick-add-trigger {
  background: var(--color-primary);
  color: var(--on-primary, #fff);
  border-color: var(--color-primary);
}
/* Light-theme popover menu — already uses var(--color-surface) via the
   base rule, but an explicit shadow override reads better on white bg. */
html.light .xs-card-quick-add-menu {
  box-shadow: 0 10px 30px -8px rgba(15, 23, 42, 0.22);
}
/* Section title: in light themes, the title color was inheriting the dark
   default. Force it to use the theme text color. */
html.light .xs-section-title,
html.light .xs-catalog-title { color: var(--color-text); }

/* Carousel arrow: dark glass doesn't read on a white page. */
html.light .xs-carousel-arrow {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(0, 0, 0, 0.15);
  color: var(--color-text);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.22);
}
html.light .xs-carousel-arrow:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--on-primary, #fff);
}

/* Hero "back" button: white text on dark glass — needs darker variant on
   light themes for readability. */
html.light a.xs-hero-back {
  background: rgba(255, 255, 255, 0.78) !important;
  border-color: rgba(0, 0, 0, 0.12) !important;
  color: var(--color-text) !important;
}
html.light a.xs-hero-back:hover { background: rgba(255, 255, 255, 0.92) !important; }

/* Cards: lighten the shadow so the elevation reads on white. */
html.light .xs-ep-card,
html.light .xs-series-card { box-shadow: 0 2px 10px rgba(15, 23, 42, 0.10); }
html.light .xs-ep-card:hover,
html.light .xs-series-card:hover { box-shadow: 0 14px 32px rgba(15, 23, 42, 0.20); }

/* Sidebar/widget surface: ensure the white-ish surface differentiates from
   the slightly off-white page bg. */
html.light .xs-sidebar-card,
html.light .xs-side-card,
html.light .xs-catalog-sidebar { background: var(--color-surface); }

/* Note: .xs-status-badge uses --xs-badge-* tokens defined at :root /
   html.light, so the per-theme override previously here is no longer
   needed. Keeping the rule deleted intentionally. */

/* Light-theme: invert the unified chips to white-glass with dark text. */
html.light span.chip.xs-tag-episodio,
html.light span.chip.xs-tag-serie,
html.light span.chip.xs-tag-especial,
html.light span.chip.xs-tag-ona,
html.light span.chip.xs-tag-pelicula,
html.light span.chip.xs-tag-película,
html.light span.chip.xs-tag-ova,
html.light span.chip.xs-tag-short,
html.light span.chip.xs-tag-shorts {
  background: rgba(255,255,255,0.92) !important;
  color: var(--color-text) !important;
  border-color: var(--color-border) !important;
}
/* "Active" status keeps green even in light mode — single semantic color. */
html.light span.chip.xs-tag-success  { color: #15803d !important; background: rgba(34,197,94,0.18) !important; border-color: rgba(34,197,94,0.40) !important; }
html.light span.chip.xs-tag-muted    { color: #475569 !important; background: rgba(148,163,184,0.18) !important; border-color: rgba(148,163,184,0.30) !important; }

/* Type filter pills on the home (Todos/Episodios/...): make sure they have
   visible borders and contrast on white. */
html.light .xs-type-tabs a {
  background: var(--color-surface) !important;
  border-color: var(--color-border) !important;
  color: var(--color-text-muted) !important;
}
html.light .xs-type-tabs a.active {
  background: var(--color-primary) !important;
  border-color: var(--color-primary) !important;
  color: var(--on-primary, #fff) !important;
}

/* Filter chips in catalog: same treatment */
html.light .xs-filter-chip-label {
  background: var(--color-surface) !important;
  color: var(--color-text-muted) !important;
}
html.light .xs-filter-chip input:checked + .xs-filter-chip-label {
  background: color-mix(in srgb, var(--color-primary) 16%, white) !important;
  color: var(--color-primary) !important;
}

/* Search dropdown / tooltip / theme menu — keep proper contrast */
html.light .xs-search-result-list,
html.light .xs-tooltip-inner,
html.light .xs-user-dropdown,
html.light .xs-theme-menu {
  background: var(--color-surface);
  border-color: var(--color-border);
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.22);
}

/* Sidebar widget tabs underline on light theme */
html.light .xs-widget-tabs a { color: var(--color-text-muted) !important; }
html.light .xs-widget-tabs a.active { color: var(--color-primary) !important; }

/* Toast on light theme */
html.light .xs-toast {
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.22);
}

* , *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  /* IMPORTANT: use overflow-x: clip (not hidden) — `hidden` turns the
     element into a scroll container which breaks `position: sticky` on
     descendants (the nav wouldn't stick on scroll). `clip` just crops
     overflow without affecting sticky. Fallback to hidden for old browsers. */
  overflow-x: hidden;
  overflow-x: clip;
  transition: background 0.25s, color 0.25s;
}
/* Sticky-footer pattern: body becomes a column flex; main grows; footer
   sits at the bottom even when content is short. */
body {
  display: flex;
  flex-direction: column;
}
.xs-main { flex: 1 0 auto; }
.xs-footer { flex-shrink: 0; margin-top: auto; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font-family: inherit; color: inherit; }
input, textarea, select { font-family: inherit; }

.bc { font-family: 'Barlow Condensed', sans-serif; letter-spacing: 0.02em; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--color-bg-subtle); }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }

.glass {
  background: var(--color-topbar-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.3s ease-out; }

/* BeerCSS safety overrides — so we don't inherit their defaults where undesired */
body { font-size: 14px; }
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }

/* Zero-height sentinel placed immediately above the nav. When this
   element scrolls out of the viewport, the IntersectionObserver in
   nav.php adds .is-docked to the nav. Critical that it has *some*
   visible height (even 1px) so IO can track it reliably. */
.xs-nav-sentinel { display: block; width: 100%; height: 1px; pointer-events: none; }

/* ============================================================
   NAVBAR — Static at top on first paint (pushes content down,
   never overlaps the hero), then sticks to the top edge and
   "docks" into a floating pill when the user scrolls past the
   initial position. Transition is animated so the switch feels
   smooth rather than snapping.
   ============================================================ */
nav.xs-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  border-left: none; border-right: none; border-top: none;
  border-radius: 0;
  box-shadow: none;
  margin: 0;
  display: flex; align-items: center;
  gap: 14px;
  height: 56px;
  padding: 0 24px 0 24px;
  transition:
    margin 220ms cubic-bezier(.4,0,.2,1),
    padding 220ms cubic-bezier(.4,0,.2,1),
    border-radius 220ms cubic-bezier(.4,0,.2,1),
    background 220ms cubic-bezier(.4,0,.2,1),
    border-color 220ms cubic-bezier(.4,0,.2,1),
    box-shadow 220ms cubic-bezier(.4,0,.2,1),
    backdrop-filter 220ms cubic-bezier(.4,0,.2,1);
}
/* DOCKED state (added by IntersectionObserver when the sentinel
   scrolls out of view). The nav floats as a rounded pill with
   glass background, side margins, and elevated shadow. */
nav.xs-nav.is-docked {
  margin: 10px 20px 0;
  padding: 0 18px 0 22px;
  border-radius: 32px;
  border: 1px solid var(--color-border);
  background: color-mix(in srgb, var(--color-surface) 82%, transparent);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.32), 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}
/* Legacy .is-scrolled: kept as an alias of .is-docked for backwards
   compatibility with the inline script that used to toggle it. */
nav.xs-nav.is-scrolled { /* no-op — see .is-docked */ }

/* Light themes: tweak the docked glass so it reads on white backgrounds. */
html.light nav.xs-nav,
html:not(.dark) nav.xs-nav {
  background: var(--color-surface);
  border-color: var(--color-border);
}
html.light nav.xs-nav.is-docked {
  background: color-mix(in srgb, #ffffff 88%, transparent);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.18);
}
/* Static nav reserves flow space — no more padding/negative-margin hacks. */
.xs-main { padding-top: 0; }
.xs-main > .xs-hero:first-child,
.xs-main > .xs-series-hero:first-child,
.xs-main > section.xs-series-hero:first-child {
  margin-top: 0;
}
/* Hero "back" buttons no longer need to clear a fixed nav. */
.xs-hero-back { top: 14px !important; }

.xs-brand {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 22px; font-weight: 800; letter-spacing: -0.02em;
  flex-shrink: 0;
}
.xs-brand-xian { color: var(--color-primary); }
.xs-brand-sear { color: var(--color-accent); }

.xs-nav-links {
  display: flex; gap: 2px; flex: 1; min-width: 0;
}
.xs-nav-links a {
  padding: 5px 11px !important;
  border-radius: 6px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  color: var(--color-text-muted);
  background: transparent !important;
  border: none !important;
  transition: all var(--motion);
  box-shadow: none !important;
  height: auto !important; min-height: 0 !important;
  line-height: 1.4;
}
.xs-nav-links a:hover {
  color: var(--color-text);
  background: var(--color-surface) !important;
}
.xs-nav-links a.active {
  color: var(--color-primary);
  background: transparent !important;
}

/* Search */
.xs-search-wrap { position: relative; max-width: 260px; flex: 1; }
.xs-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px; padding: 5px 12px;
}
.xs-search:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 18%, transparent);
}
.xs-search svg { color: var(--color-text-muted); font-size: 13px; flex-shrink: 0; }
.xs-search input {
  background: none; border: none; outline: none;
  color: var(--color-text); font-size: 13px;
  flex: 1; min-width: 0;
}
.xs-search-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  z-index: 200;
  max-height: 420px; overflow-y: auto;
}
.xs-search-dropdown:empty { display: none; }
.xs-search-result-list {
  background: var(--color-surface);
  border: 1px solid var(--color-border) !important;
  border-radius: 10px !important;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,0.45);
}
.xs-search-result-row {
  display: flex !important; align-items: center !important; gap: 10px !important;
  padding: 8px 12px !important;
  border-bottom: 1px solid var(--color-border);
  transition: background var(--motion);
}
.xs-search-result-row:last-child { border-bottom: none; }
.xs-search-result-row:hover { background: var(--color-surface-hover) !important; }
.xs-search-thumb {
  width: 48px !important; height: 28px !important;
  object-fit: cover; border-radius: 4px; flex-shrink: 0;
}
.xs-search-icon-placeholder {
  width: 48px; height: 28px; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--color-bg-subtle); border-radius: 4px;
  color: var(--color-text-muted); font-size: 12px;
}
.xs-search-result-title { font-size: 13px; font-weight: 600; color: var(--color-text); line-height: 1.3; }
.xs-search-result-type {
  font-size: 10px; color: var(--color-primary);
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700;
}

/* Login CTA */
.xs-nav-cta {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 16px;
  background: var(--color-primary); color: #fff;
  border-radius: 6px; font-size: 13px; font-weight: 600;
  flex-shrink: 0; transition: background var(--motion);
}
.xs-nav-cta:hover { background: var(--color-primary-hover); }

/* Avatar (logged-out and logged-in) */
.xs-avatar-btn {
  width: 36px; height: 36px; padding: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--color-primary) 15%, transparent);
  border: 2px solid var(--color-border);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0; cursor: pointer;
  overflow: hidden; transition: border-color var(--motion);
}
.xs-avatar-btn:hover,
.xs-user-details[open] .xs-avatar-btn {
  border-color: var(--color-primary);
}
.xs-avatar-btn img { width: 100%; height: 100%; object-fit: cover; }
.xs-avatar-initial {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 14px; font-weight: 800;
  color: var(--color-text);
}

/* ── Profile dropdown ──────────────────────────────────────
   Matches Xiansear.html ProfileDropdown: user header, language
   rows, theme row, logout row.
   ============================================================ */
.xs-user-details, .xs-theme-switcher { position: relative; }
.xs-user-details > summary, .xs-theme-switcher > summary { list-style: none; }
.xs-user-details > summary::-webkit-details-marker,
.xs-theme-switcher > summary::-webkit-details-marker { display: none; }

.xs-user-dropdown, .xs-theme-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 200;
  width: 280px;
  background: var(--color-surface) !important;
  border: 1px solid var(--color-border) !important;
  border-radius: 12px !important;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
  padding: 0 !important;
}
.xs-theme-menu { width: 240px; padding: 12px !important; }

.xs-user-dropdown-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-hover);
}
.xs-user-dropdown-avatar {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  background: color-mix(in srgb, var(--color-primary) 15%, transparent);
  border: 2px solid var(--color-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; overflow: hidden;
}
.xs-user-dropdown-avatar img { width: 100%; height: 100%; object-fit: cover; }
.xs-user-dropdown-name { font-size: 14px; font-weight: 700; color: var(--color-text); }
.xs-user-dropdown-title { font-size: 11px; color: var(--color-primary); font-weight: 500; margin-top: 2px; }

.xs-user-dropdown-row {
  display: flex !important; align-items: center !important; gap: 12px;
  width: 100%;
  padding: 12px 16px;
  font-size: 13px; font-weight: 500; color: var(--color-text);
  background: transparent; border: none; cursor: pointer;
  border-bottom: 1px solid var(--color-border);
  text-align: left; text-decoration: none;
  transition: background 0.15s;
}
.xs-user-dropdown-row:last-child { border-bottom: none; }
.xs-user-dropdown-row:hover { background: var(--color-surface-hover); }
.xs-user-dropdown-row-icon {
  font-size: 16px; width: 20px; text-align: center; flex-shrink: 0;
  color: var(--color-text-muted);
}
.xs-user-dropdown-row-danger { color: var(--color-danger); }
.xs-user-dropdown-row-danger .xs-user-dropdown-row-icon { color: var(--color-danger); }

/* Theme switcher dropdown */
.xs-theme-menu-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--color-text-muted);
  margin-bottom: 10px;
}
.xs-theme-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.xs-theme-chip {
  font-size: 11px !important; font-weight: 600 !important;
  padding: 4px 10px !important; border-radius: 20px !important;
  border: 2px solid transparent !important;
  cursor: pointer; transition: all 150ms;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
  color: #fff;
}
.xs-theme-chip:hover { transform: scale(1.05); }

/* ============================================================
   HERO CAROUSEL (by series)
   ============================================================ */
.xs-hero {
  position: relative; height: 360px; overflow: hidden; background: #0a0a0a;
}
@media (max-width: 860px) { .xs-hero { height: 280px; } }
.xs-hero-slide {
  position: absolute; inset: 0;
  opacity: 0; transition: opacity 600ms ease-out;
  pointer-events: none;
}
.xs-hero-slide.is-active { opacity: 1; pointer-events: auto; }
.xs-hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.xs-hero-shade {
  position: absolute; inset: 0;
  background:
    linear-gradient(105deg, rgba(15,23,42,0.92) 0%, rgba(15,23,42,0.55) 45%, transparent 100%),
    linear-gradient(to top, var(--color-bg) 0%, transparent 55%);
}
.xs-hero-content {
  position: relative; z-index: 2; height: 100%;
  display: flex; flex-direction: column; justify-content: flex-end;
  /* padding-top: 84px reserves space for the floating nav so the hero title
     never slides UNDER the nav when the description is long enough to fill
     the whole 360px hero. */
  padding: 84px 48px 28px; max-width: 640px;
  overflow: hidden;       /* clip any extra content instead of pushing up */
}
.xs-hero-tags {
  display: flex; gap: 8px; margin-bottom: 10px;
  flex-wrap: wrap; align-items: center;
}
.xs-hero-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: clamp(24px, 3.4vw, 38px); font-weight: 800; line-height: 1.05;
  letter-spacing: -0.01em; color: #fff; margin-bottom: 10px;
  text-shadow: 0 2px 24px rgba(0,0,0,0.6);
}
.xs-hero-alt {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 15px; color: rgba(255,255,255,0.55);
  margin-top: -6px; margin-bottom: 8px; letter-spacing: 0.03em;
}
.xs-hero-meta-line {
  font-size: 12px; color: rgba(255,255,255,0.55);
  font-family: 'Barlow Condensed', sans-serif; letter-spacing: 0.08em;
  text-transform: uppercase; margin-bottom: 12px;
}
.xs-hero-score {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: 20px;
  background: rgba(0,0,0,0.45); backdrop-filter: blur(6px);
  border: 1px solid rgba(250,204,21,0.35);
  color: #fff; font-size: 12px; font-weight: 700;
  font-family: 'Barlow Condensed', sans-serif; letter-spacing: 0.04em;
}
.xs-hero-desc {
  font-size: 14px; color: rgba(255,255,255,0.68); line-height: 1.6;
  margin-bottom: 22px; max-width: 460px;
}
.xs-hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.xs-hero-dots {
  position: absolute; bottom: 36px; right: 48px;
  display: flex; gap: 6px; z-index: 3;
}
.xs-hero-dot {
  width: 7px; height: 7px; border-radius: 4px; padding: 0;
  transition: all 300ms; background: rgba(255,255,255,0.3);
  border: none;
}
.xs-hero-dot.is-active { width: 22px; background: var(--color-primary); }

/* ============================================================
   BUTTONS — style both .xs-btn and BeerCSS .button.* semantics
   ============================================================ */
.xs-btn,
a.button, button.button,
a.button.primary.round, button.button.primary.round,
a.button.border.round, button.button.border.round {
  display: inline-flex !important;
  align-items: center; justify-content: center; gap: 8px;
  padding: 9px 22px !important;
  border-radius: 6px !important;
  font-size: 14px !important; font-weight: 600 !important;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--motion);
  line-height: 1.4;
  text-decoration: none;
  width: auto !important; min-width: 0 !important;
  height: auto !important; min-height: 0 !important;
  text-transform: none;
  letter-spacing: normal;
}
.xs-btn-primary,
a.button.primary, button.button.primary,
a.button.primary.round, button.button.primary.round {
  background: var(--color-primary) !important;
  color: #fff !important;
  box-shadow: 0 4px 20px rgba(168,85,247,0.35) !important;
  border-color: transparent !important;
}
.xs-btn-primary:hover,
a.button.primary:hover, button.button.primary:hover {
  background: var(--color-primary-hover) !important;
  transform: scale(1.02);
}
.xs-btn-ghost,
a.button.border, button.button.border,
a.button.border.round, button.button.border.round {
  background: rgba(255,255,255,0.08) !important;
  border: 1px solid rgba(255,255,255,0.15) !important;
  color: #fff !important;
  backdrop-filter: blur(8px);
  box-shadow: none !important;
}
.xs-btn-ghost:hover,
a.button.border:hover, button.button.border:hover {
  background: rgba(255,255,255,0.16) !important;
}
.xs-btn-surface {
  background: var(--color-surface-hover) !important; color: var(--color-text) !important;
  border: 1px solid var(--color-border) !important;
}
.xs-btn-surface:hover { border-color: var(--color-primary) !important; }
.xs-btn-sm, a.button.small, button.button.small {
  padding: 6px 14px !important;
  font-size: 12px !important;
  gap: 5px;
}
/* Icon-only circle buttons (nav avatar, theme switcher) */
a.button.small.circle, button.button.small.circle {
  padding: 0 !important;
  width: 36px !important; height: 36px !important;
  border-radius: 50% !important;
}
/* Responsive fill button (login submit) */
.xs-auth-submit, button.button.responsive, a.button.responsive {
  width: 100% !important;
}

/* ============================================================
   LAYOUT + SECTION HEADERS
   ============================================================ */
.xs-layout {
  max-width: 1440px; margin: 0 auto; padding: 32px 20px;
  display: flex; gap: 24px; align-items: flex-start;
}
.xs-main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 40px; }

.xs-section-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 20px; gap: 12px;
}
.xs-section-label {
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: 6px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--color-primary);
}
.xs-section-label::before {
  content: ''; display: inline-block; width: 16px; height: 2px; border-radius: 2px;
  background: var(--color-primary);
}
.xs-accent-bar {
  display: inline-block; width: 18px; height: 2px; border-radius: 2px;
  background: var(--color-primary);
}
.xs-section-title-row { display: flex; align-items: center; gap: 10px; }

/* Simplified single-title section header — single accent bar in primary, no
   eyebrow, no subtitle. Matches the unified-tone home redesign. */
.xs-home-section { margin-bottom: 36px; }
.xs-section-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 22px; font-weight: 800; letter-spacing: 0.02em;
  text-transform: uppercase; color: var(--color-text); line-height: 1.1;
  position: relative; padding-left: 14px;
  margin: 0;
}
.xs-section-title::before {
  content: ''; position: absolute; left: 0; top: 4px; bottom: 4px;
  width: 4px; border-radius: 2px;
  background: var(--color-primary);
}
/* Legacy classes (eyebrow + subtitle) — no-op so any leftover usage doesn't
   leak ugly defaults. */
.xs-section-label,
.xs-section-sub,
.xs-accent-bar { display: none !important; }

/* Section action pill "Ver todas →" — theme-aware so it stays visible in
   both dark themes (light text/background) and light themes (dark text). */
a.xs-section-action, .xs-section-action {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-body);
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 6px 14px; border-radius: 999px;
  color: var(--color-primary);
  border: 1.5px solid color-mix(in srgb, var(--color-primary) 38%, transparent);
  background: color-mix(in srgb, var(--color-primary) 12%, transparent);
  transition: background 200ms, border-color 200ms, color 200ms, transform 120ms;
  text-decoration: none;
  line-height: 1.4;
}
a.xs-section-action:hover, .xs-section-action:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--on-primary, #fff);
  transform: translateY(-1px);
}

/* ============================================================
   TAGS / CHIPS
   ============================================================ */
.xs-tag, span.chip.xs-tag-episodio, span.chip.xs-tag-serie,
span.chip.xs-tag-especial, span.chip.xs-tag-ona,
span.chip.xs-tag-pelicula, span.chip.xs-tag-película,
span.chip.xs-tag-ova, span.chip.xs-tag-success,
span.chip.xs-tag-muted, span.chip.xs-tag-primary {
  font-family: 'Barlow Condensed', sans-serif !important;
  font-weight: 700 !important;
  font-size: 11px !important;
  letter-spacing: 0.05em !important;
  padding: 2px 7px !important;
  border-radius: 4px !important;
  white-space: nowrap;
  text-transform: uppercase;
  border: 1px solid transparent !important;
  display: inline-flex !important; align-items: center; gap: 4px;
  line-height: 1.4 !important;
  height: auto !important; min-height: 0 !important;
}
/* Unified type chips: same neutral glass for every content type. The reader
   gets the type name as text; we no longer rely on a color code per type. */
span.chip.xs-tag-episodio, span.chip.xs-tag-episodes, span.chip.xs-tag-serie,
span.chip.xs-tag-especial, span.chip.xs-tag-specials,
span.chip.xs-tag-ona,
span.chip.xs-tag-movies, span.chip.xs-tag-pelicula, span.chip.xs-tag-película,
span.chip.xs-tag-ova,
span.chip.xs-tag-short, span.chip.xs-tag-shorts {
  background: rgba(0,0,0,0.55) !important;
  color: #fff !important;
  border-color: rgba(255,255,255,0.18) !important;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
span.chip.xs-tag-primary, span.chip.xs-tag-temporadas {
  background: color-mix(in srgb, var(--color-primary) 18%, transparent) !important;
  color: var(--color-primary) !important;
  border-color: color-mix(in srgb, var(--color-primary) 38%, transparent) !important;
}
span.chip.xs-tag-success {
  background: color-mix(in srgb, var(--color-success) 15%, transparent) !important;
  color: var(--color-success) !important;
  border-color: color-mix(in srgb, var(--color-success) 30%, transparent) !important;
}
span.chip.xs-tag-muted {
  background: rgba(148,163,184,0.12) !important;
  color: var(--color-text-muted) !important;
  border-color: rgba(148,163,184,0.2) !important;
}

/* ────────────────────────────────────────────────────────────
   Hero tags: `.xs-tag` WITHOUT the `chip` class — used in the
   hero slider which always sits over a dark image + shade, so
   text must be light regardless of the active theme. The
   `.xs-tag-*` variants above targeted only `span.chip.xs-tag-*`,
   so these plain `.xs-tag` pills had no color and fell through
   to the inherited body text (dark navy in light themes → the
   "letras negras en el hero" bug). Force dark-glass + light text
   here, independent of theme. */
span.xs-tag.xs-tag-episodio,  span.xs-tag.xs-tag-episodes,
span.xs-tag.xs-tag-serie,     span.xs-tag.xs-tag-especial,
span.xs-tag.xs-tag-specials,  span.xs-tag.xs-tag-ona,
span.xs-tag.xs-tag-movies,    span.xs-tag.xs-tag-pelicula,
span.xs-tag.xs-tag-película,  span.xs-tag.xs-tag-ova,
span.xs-tag.xs-tag-short,     span.xs-tag.xs-tag-shorts {
  background: rgba(0, 0, 0, 0.55) !important;
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.20) !important;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}
span.xs-tag.xs-tag-primary, span.xs-tag.xs-tag-temporadas {
  background: color-mix(in srgb, var(--color-primary) 28%, rgba(0,0,0,0.45)) !important;
  color: #fff !important;
  border-color: color-mix(in srgb, var(--color-primary) 55%, transparent) !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
span.xs-tag.xs-tag-success {
  /* "● En emisión" on the hero — bright green text on dark glass
     so it pops against colorful backgrounds. */
  background: rgba(0, 0, 0, 0.55) !important;
  color: #4ade80 !important;
  border-color: color-mix(in srgb, var(--color-success) 50%, transparent) !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}
span.xs-tag.xs-tag-muted {
  background: rgba(0, 0, 0, 0.55) !important;
  color: #e2e8f0 !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}
/* The hero stars next to tags also need forced light color (light theme
   would otherwise show a dark star on a dark banner). */
.xs-hero .xs-star, .xs-hero-score { color: #facc15 !important; }
.xs-hero .xs-star svg { fill: #facc15 !important; }

/* Star rating */
.xs-star {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 12px; color: #facc15; font-weight: 700;
}
.xs-star svg { width: 12px; height: 12px; fill: #facc15; }

/* ============================================================
   EPISODE CARD — vertical 3:4 (matches series-card aspect ratio)
   ============================================================ */
.xs-grid-ep {
  /* Force 6 columns at desktop, gracefully degrades on smaller widths. */
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
}
@media (max-width: 1280px) { .xs-grid-ep { grid-template-columns: repeat(5, 1fr); } }
@media (max-width: 1024px) { .xs-grid-ep { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 768px)  { .xs-grid-ep { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 540px)  { .xs-grid-ep { grid-template-columns: repeat(2, 1fr); } }
.xs-ep-card {
  display: block; cursor: pointer;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px; overflow: hidden;
  transition: all var(--motion);
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
}
.xs-ep-card:hover {
  background: var(--color-surface-hover);
  border-color: #475569;
  transform: translateY(-3px);
  box-shadow: 0 8px 22px rgba(0,0,0,0.40);
}
.xs-ep-article {
  background: transparent !important; border: none !important;
  padding: 0 !important; display: block;
}
.xs-card-thumb {
  position: relative; overflow: hidden;
  background: var(--color-bg-subtle);
  /* Vertical 3:4 aspect — episode cards mirror series-poster shape so they
     line up perfectly in the same 6-column grid. */
  aspect-ratio: 3/4;
}
.xs-card-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 400ms ease-out;
}
.xs-ep-card:hover .xs-card-thumb img { transform: scale(1.04); }
.xs-card-overlay-grad {
  position: absolute; inset: 0; pointer-events: none;
  /* Softer bottom gradient — text stays legible via text-shadow on the labels
     while the artwork shows through more cleanly. */
  background:
    linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.30) 35%, transparent 75%);
}
.xs-card-play-hover {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  opacity: 0; transition: opacity var(--motion);
  background: rgba(0,0,0,0.35);
}
.xs-ep-card:hover .xs-card-play-hover { opacity: 1; }
.xs-card-play-circle {
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,0.18);
  border: 2px solid rgba(255,255,255,0.55);
  color: #fff;
  display: grid; place-items: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.xs-card-season-badge {
  position: absolute; top: 8px; right: 8px;
}
.xs-card-ago {
  position: absolute; top: 8px; left: 8px;
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px; color: rgba(255,255,255,0.7);
  background: rgba(0,0,0,0.55); border-radius: 4px; padding: 2px 6px;
  backdrop-filter: blur(4px);
  font-family: 'Barlow Condensed', sans-serif;
}
.xs-card-ago i { font-size: 9px; }
.xs-card-bottom-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 10px 10px 11px;
  display: flex; flex-direction: column; gap: 3px;
}
.xs-card-ep-label,
.xs-card-ep-label-episodio,
.xs-card-ep-label-episode,
.xs-card-ep-label-episodes,
.xs-card-ep-label-especial,
.xs-card-ep-label-specials,
.xs-card-ep-label-ona,
.xs-card-ep-label-movies,
.xs-card-ep-label-pelicula,
.xs-card-ep-label-película,
.xs-card-ep-label-ova,
.xs-card-ep-label-short,
.xs-card-ep-label-shorts {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px; font-weight: 800;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: #fff;
  line-height: 1;
}
.xs-card-series-name {
  font-size: 13px; font-weight: 700; color: #fff; line-height: 1.2;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  /* Heavier double-shadow so white text is always legible on bright art. */
  text-shadow: 0 1px 3px rgba(0,0,0,0.95), 0 0 12px rgba(0,0,0,0.7);
}
.xs-card-ep-title {
  font-size: 11px; font-weight: 500; color: rgba(255,255,255,0.88);
  line-height: 1.3; margin-top: 1px;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical;
  overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9), 0 0 8px rgba(0,0,0,0.5);
}
.xs-card-ep-label {
  /* Add subtle stroke so the colored "EP 196" text stays crisp on busy art */
  text-shadow: 0 1px 3px rgba(0,0,0,0.95), 0 0 6px rgba(0,0,0,0.7);
}
.xs-card-footer {
  padding: 8px 10px 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  border: none !important; background: transparent !important;
  flex-wrap: wrap;
}
.xs-ep-stats {
  display: flex; align-items: center; gap: 8px;
}
.xs-ep-stat {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px;
  color: var(--color-text-muted);
  font-weight: 600;
  font-family: 'Barlow Condensed', sans-serif;
  letter-spacing: 0.02em;
}
.xs-ep-stat svg { width: 11px; height: 11px; opacity: 0.85; }
.xs-ep-stat i   { font-size: 10px; opacity: 0.85; }
.xs-card-footer .xs-star {
  font-size: 11px; font-weight: 700;
  font-family: 'Barlow Condensed', sans-serif;
}
.xs-card-footer .xs-star svg { width: 12px; height: 12px; }
/* Make the type chip smaller in the narrow card to leave room for stats */
.xs-card-footer .chip { padding: 2px 5px !important; font-size: 9px !important; }

/* ============================================================
   SERIES CARD (3:4 poster)
   ============================================================ */
.xs-grid-series {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
}
.xs-series-card {
  position: relative;
  display: block; cursor: pointer;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px; overflow: hidden;
  transition: all var(--motion);
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
}
.xs-series-card:hover {
  background: var(--color-surface-hover);
  border-color: #475569;
  transform: translateY(-3px);
  box-shadow: 0 8px 22px rgba(0,0,0,0.40);
}
.xs-series-card-link {
  display: block; color: inherit; text-decoration: none;
}
.xs-series-article {
  background: transparent !important; border: none !important;
  padding: 0 !important; display: block;
}
.xs-series-thumb {
  position: relative; aspect-ratio: 3/4; overflow: hidden;
  background: var(--color-bg-subtle);
}
.xs-series-thumb img { width: 100%; height: 100%; object-fit: cover; }
.xs-series-thumb::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 55%);
}
.xs-series-score-top {
  position: absolute; top: 8px; right: 8px; z-index: 1;
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 700; color: #fff;
  background: rgba(0,0,0,0.55); padding: 3px 7px; border-radius: 20px;
  backdrop-filter: blur(4px);
}
.xs-series-score-top svg { width: 10px; height: 10px; fill: #facc15; }
/* Status badge — uses --xs-badge-* tokens so it stays legible on ANY
   thumbnail in either theme. Tokens are overridden per-theme at :root. */
.xs-status-badge {
  position: absolute; bottom: 10px; left: 10px;
  display: inline-flex; align-items: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px; font-weight: 800; letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--xs-badge-bg);
  color: var(--xs-badge-fg);
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--xs-badge-border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  text-shadow: var(--xs-badge-shadow);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
/* The dot + label are colored semantically — green for ongoing, muted grey
   for completed. The badge background is neutral so the semantic color
   reads cleanly. Text-shadow is kept strong so even saturated posters
   behind a slightly-transparent pill don't overwhelm the text. */
.xs-status-ongoing   { color: #16a34a; }   /* "● En emisión" green */
.xs-status-completed { color: #6b7280; }   /* medium grey for completed */
html:not(.light) .xs-status-ongoing   { color: #4ade80; }  /* brighter on dark */
html:not(.light) .xs-status-completed { color: #cbd5e1; }
.xs-status-ongoing,
.xs-status-completed {
  text-shadow: var(--xs-badge-shadow);
}
/* Compact body: paddings tightened (12→8) and gaps reduced so series
   cards feel denser and more modern. Keep 2-line reservation on the
   title so card heights stay aligned within a grid. */
.xs-series-card-body { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 2px; }
.xs-series-card-name {
  font-size: 13px; font-weight: 700; color: var(--color-text);
  line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.5em; /* reserve 2 lines so heights match across cards */
  margin-bottom: 1px;
}
.xs-series-card-meta {
  font-size: 10px; color: var(--color-text-muted);
  font-weight: 500;
  font-family: 'Barlow Condensed', sans-serif;
  letter-spacing: 0.04em; text-transform: uppercase;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.xs-series-card-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 6px; margin-top: 3px;
  font-size: 10px;
}
.xs-series-card-eps {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--color-text-muted); font-weight: 600;
}
.xs-series-card-eps i { font-size: 9px; }
.xs-series-card-genre {
  font-size: 10px; padding: 1px 7px; border-radius: 8px;
  background: color-mix(in srgb, var(--color-primary) 14%, transparent);
  color: var(--color-primary); font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
  font-family: 'Barlow Condensed', sans-serif;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 50%;
}
/* Legacy alias still used in some places */
.xs-series-card-sub {
  font-size: 11px; color: var(--color-text-muted); font-weight: 600;
}

/* ============================================================
   HORIZONTAL CAROUSEL (series strip)
   ============================================================ */
.xs-carousel { position: relative; }
.xs-carousel-track {
  display: flex; gap: 16px; overflow-x: auto;
  scroll-snap-type: x mandatory; scroll-behavior: smooth;
  scrollbar-width: none; padding: 4px 2px 8px;
}
.xs-carousel-track::-webkit-scrollbar { display: none; }
.xs-carousel-slide {
  flex: 0 0 auto; width: 180px; scroll-snap-align: start;
}
.xs-carousel-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff; z-index: 5;
  display: grid; place-items: center;
  font-size: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  transition: all var(--motion);
  opacity: 0.9;       /* always visible */
  cursor: pointer;
}
.xs-carousel-arrow:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  transform: translateY(-50%) scale(1.08);
  box-shadow: 0 12px 32px rgba(168, 85, 247, 0.5);
  opacity: 1;
}
.xs-carousel-arrow.is-prev { left: -14px; }
.xs-carousel-arrow.is-next { right: -14px; }

.xs-placeholder {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--color-border); font-size: 1.6rem;
  background: repeating-linear-gradient(45deg, #0f172a, #0f172a 10px, #131d32 10px, #131d32 20px);
}

/* ============================================================
   TYPE FILTER PILLS (home)
   ============================================================ */
.xs-type-tabs {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px;
  scrollbar-width: none; margin-bottom: 16px;
  border: none !important; background: transparent !important;
}
.xs-type-tabs::-webkit-scrollbar { display: none; }
.xs-type-tabs a {
  flex-shrink: 0;
  padding: 4px 14px !important;
  border-radius: 20px !important;
  font-size: 12px !important; font-weight: 600 !important;
  letter-spacing: 0.03em;
  border: 1px solid var(--color-border) !important;
  background: var(--color-surface) !important;
  color: var(--color-text-muted) !important;
  cursor: pointer;
  transition: all var(--motion);
  height: auto !important; min-height: 0 !important;
  line-height: 1.5;
  text-transform: none;
}
.xs-type-tabs a:hover { color: var(--color-text) !important; }
.xs-type-tabs a.active {
  border-color: var(--color-primary) !important;
  background: color-mix(in srgb, var(--color-primary) 13%, transparent) !important;
  color: var(--color-primary) !important;
}

/* ============================================================
   SIDEBAR WIDGET (Tendencias / Calendario)
   ============================================================ */
.xs-sidebar { width: 300px; flex-shrink: 0; }
.xs-sidebar-card {
  background: var(--color-surface) !important;
  border: 1px solid var(--color-border) !important;
  border-radius: 12px !important; overflow: hidden;
  position: sticky; top: 70px;
}
.xs-widget-tabs {
  display: flex !important;
  border-bottom: 1px solid var(--color-border);
  background: transparent !important;
  margin: 0 !important;
  gap: 0 !important;
  overflow: visible;
}
.xs-widget-tabs a {
  flex: 1 !important;
  padding: 12px 0 !important;
  font-size: 12px !important; font-weight: 700 !important;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--color-text-muted) !important;
  background: transparent !important;
  border: none !important;
  border-bottom: 2px solid transparent !important;
  border-radius: 0 !important;
  text-align: center;
  cursor: pointer;
  transition: all var(--motion);
  height: auto !important; min-height: 0 !important;
}
.xs-widget-tabs a.active {
  color: var(--color-primary) !important;
  border-bottom-color: var(--color-primary) !important;
  background: transparent !important;
}

#widget-pane { padding: 12px 14px; }
.xs-widget-empty {
  padding: 16px 0; text-align: center;
  font-size: 12px; color: var(--color-text-muted);
}

/* Period tabs — 2x2 grid so Siempre no se corta */
.xs-period-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 14px;
}
.xs-period-tab {
  padding: 5px 8px; border-radius: 8px;
  font-size: 11px; font-weight: 600;
  border: 1px solid var(--color-border); background: transparent;
  color: var(--color-text-muted); cursor: pointer; text-align: center;
  transition: all var(--motion);
}
.xs-period-tab.is-active,
.xs-period-tab:hover {
  border-color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 13%, transparent);
  color: var(--color-primary);
}

/* Trending list rows */
.xs-trending-list {
  display: flex; flex-direction: column; padding: 0 !important; gap: 0;
  background: transparent !important;
}
.xs-trend-item {
  display: flex !important; align-items: center !important; gap: 10px;
  padding: 8px 6px !important;
  margin: 0 -6px;
  border-radius: 8px;
  border-bottom: 1px solid var(--color-border);
  transition: background var(--motion);
  background: transparent !important;
}
.xs-trend-item:last-child { border-bottom: none; }
.xs-trend-item:hover { background: var(--color-surface-hover) !important; }
.xs-trend-rank {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 18px; font-weight: 800;
  width: 20px; text-align: center; line-height: 1; flex-shrink: 0;
  color: var(--color-text-muted);
}
.xs-trend-top .xs-trend-rank { color: var(--color-primary); }
.xs-trend-thumb {
  width: 36px; height: 48px; border-radius: 4px; overflow: hidden; flex-shrink: 0;
  background: var(--color-bg-subtle);
}
.xs-trend-thumb img { width: 100%; height: 100%; object-fit: cover; }
.xs-trend-title {
  font-size: 12px; font-weight: 600; color: var(--color-text);
  line-height: 1.3; margin-bottom: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.xs-trend-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 10px; color: var(--color-text-muted);
}
.xs-trend-meta i { font-size: 9px; }

/* Schedule */
.xs-sched-day-group { border-bottom: 1px solid var(--color-border); }
.xs-sched-day-group:last-child { border-bottom: none; }
.xs-sched-day-group.is-today {
  background: color-mix(in srgb, var(--color-primary) 8%, transparent);
}
.xs-sched-day-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px 6px;
  font-family: 'Barlow Condensed', sans-serif;
}
.xs-sched-day-name {
  font-size: 12px; font-weight: 800; letter-spacing: 0.06em;
  color: var(--color-text-muted);
}
.xs-sched-day-group.is-today .xs-sched-day-name { color: var(--color-primary); }
.xs-sched-count {
  margin-left: auto; font-size: 11px; color: var(--color-text-muted);
  letter-spacing: 0.04em;
}
.xs-sched-today-pill {
  padding: 2px 7px !important; border-radius: 20px !important;
  background: var(--color-primary) !important; color: #fff !important;
  font-size: 9px !important; font-weight: 700 !important;
  letter-spacing: 0.06em;
  border: none !important;
}
.xs-sched-empty {
  padding: 4px 14px 8px;
  font-size: 11px; color: var(--color-text-muted); font-style: italic;
}
.xs-sched-row {
  display: flex !important; align-items: center !important; gap: 10px;
  padding: 6px 14px !important;
  transition: background var(--motion);
  background: transparent !important;
}
.xs-sched-row:hover { background: var(--color-surface-hover) !important; }
.xs-sched-thumb {
  width: 38px; height: 50px; border-radius: 4px; overflow: hidden; flex-shrink: 0;
  background: var(--color-bg-subtle);
}
.xs-sched-thumb img { width: 100%; height: 100%; object-fit: cover; }
.xs-sched-series {
  font-size: 12px; color: var(--color-text); font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  line-height: 1.3;
}
.xs-sched-day-group.is-today .xs-sched-series { font-weight: 700; }
.xs-sched-ep { font-size: 10px; color: var(--color-text-muted); margin-top: 2px; }

/* ============================================================
   CATALOG PAGE — full redesign (v2)
   ============================================================ */
.xs-catalog-v2 {
  max-width: 1440px; margin: 0 auto;
  padding: 32px 24px 48px;
}

.xs-catalog-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
  padding-bottom: 20px; margin-bottom: 24px;
  border-bottom: 1px solid var(--color-border);
}
.xs-catalog-header-text { min-width: 0; }
.xs-catalog-title {
  font-size: 32px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.01em;
  color: var(--color-text); margin: 6px 0 8px;
}
.xs-catalog-sub {
  font-size: 13px; color: var(--color-text-muted);
  font-family: 'Barlow Condensed', sans-serif; letter-spacing: 0.02em;
}
.xs-catalog-sub [data-catalog-count] {
  color: var(--color-primary); font-weight: 800;
}

/* Toolbar (search, sort, view-toggle) */
.xs-catalog-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}

/* Native search input (NO BeerCSS field — that white-on-white was unreadable) */
.xs-catalog-search {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 8px 14px;
  min-width: 240px;
  transition: border-color var(--motion), box-shadow var(--motion);
}
.xs-catalog-search:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 18%, transparent);
}
.xs-catalog-search i { color: var(--color-text-muted); font-size: 13px; }
.xs-catalog-search input {
  background: none; border: none; outline: none;
  color: var(--color-text); font-size: 13px;
  width: 100%; min-width: 0;
}
.xs-catalog-search input::placeholder { color: var(--color-text-muted); }

.xs-catalog-sort {
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px; font-weight: 600;
  color: var(--color-text);
  cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5'%3E%3Cpolyline points='6,9 12,15 18,9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.xs-catalog-sort:focus { outline: none; border-color: var(--color-primary); }
.xs-catalog-sort option { background: var(--color-surface); color: var(--color-text); }

.xs-catalog-view-toggle {
  display: inline-flex; gap: 0;
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  border-radius: 8px; overflow: hidden;
}
.xs-catalog-view-toggle button {
  padding: 8px 14px;
  background: transparent; border: none;
  color: var(--color-text-muted); cursor: pointer;
  font-size: 14px;
  transition: all var(--motion);
}
.xs-catalog-view-toggle button:hover { color: var(--color-text); }
.xs-catalog-view-toggle button.is-active {
  background: var(--color-primary); color: #fff;
}

/* ── Body: forced 2-col grid (no BeerCSS .grid; that wasn't holding) ── */
.xs-catalog-body {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

/* ── Sidebar ─────────────────────────────────────────── */
.xs-catalog-sidebar {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 18px;
  position: sticky; top: 70px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 18px;
}

/* Active filter chips at top of sidebar */
.xs-active-filters {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}
.xs-active-filters-label {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 10px; font-weight: 800;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--color-text-muted);
  display: block; margin-bottom: 8px;
}
.xs-active-filters-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.xs-active-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 12px;
  background: color-mix(in srgb, var(--color-primary) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-primary) 40%, transparent);
  color: var(--color-primary);
  font-size: 11px; font-weight: 600;
  cursor: pointer; transition: background var(--motion);
}
.xs-active-chip:hover { background: color-mix(in srgb, var(--color-primary) 32%, transparent); }
.xs-active-chip i { font-size: 9px; }

.xs-filter-block {
  display: flex; flex-direction: column; gap: 8px;
}
.xs-filter-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px; font-weight: 800;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--color-primary);
  display: flex; align-items: center; gap: 6px;
  margin: 0;
}
.xs-filter-title i { font-size: 11px; opacity: 0.85; }

/* Filter chips (checkbox-style) */
.xs-filter-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.xs-filter-chip { cursor: pointer; }
.xs-filter-chip input { display: none; }
.xs-filter-chip-label {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px; border-radius: 14px;
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 12px; font-weight: 600;
  transition: all var(--motion);
}
.xs-filter-chip:hover .xs-filter-chip-label {
  color: var(--color-text); border-color: #475569;
}
.xs-filter-chip input:checked + .xs-filter-chip-label {
  background: color-mix(in srgb, var(--color-primary) 18%, transparent);
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.xs-filter-chip-count {
  display: inline-block;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 10px; font-weight: 800;
  background: rgba(0,0,0,0.25);
  padding: 1px 6px; border-radius: 7px;
}
.xs-filter-chip-sm .xs-filter-chip-label { font-size: 11px; padding: 4px 8px; }

/* Rating slider */
.xs-rating-slider {
  display: flex; align-items: center; gap: 12px;
}
.xs-rating-slider input[type="range"] {
  flex: 1; -webkit-appearance: none; appearance: none;
  height: 4px; background: var(--color-border); border-radius: 2px;
  outline: none;
}
.xs-rating-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--color-primary);
  border: 2px solid var(--color-surface);
  cursor: pointer; transition: transform 100ms;
}
.xs-rating-slider input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); }
.xs-rating-slider input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--color-primary);
  border: 2px solid var(--color-surface);
  cursor: pointer;
}
.xs-rating-slider-value {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 14px; font-weight: 800;
  color: var(--color-warning);
  min-width: 24px; text-align: center;
}

/* Sidebar reset button */
.xs-filter-reset {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 6px; padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  color: var(--color-text-muted);
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  transition: all var(--motion);
}
.xs-filter-reset:hover {
  color: var(--color-danger);
  border-color: var(--color-danger);
}

/* ── Content (grid + empty state) ─────────────────── */
.xs-catalog-content { min-width: 0; }
.xs-catalog-grid {
  /* Forces ~5-6 columns at 1200px content width */
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 18px;
}

/* List view alternative */
.xs-catalog-grid.is-list-view {
  display: flex; flex-direction: column; gap: 8px;
}
.xs-catalog-grid.is-list-view > div { width: 100%; }
.xs-catalog-grid.is-list-view .xs-series-card {
  display: grid; grid-template-columns: 80px 1fr;
}
.xs-catalog-grid.is-list-view .xs-series-thumb { aspect-ratio: 3/4; height: auto; }
.xs-catalog-grid.is-list-view .xs-series-thumb::after { background: none; }
.xs-catalog-grid.is-list-view .xs-series-card-name { min-height: 0; }
.xs-catalog-grid.is-list-view .xs-status-badge { display: none; }

.xs-catalog-empty {
  padding: 80px 20px; text-align: center;
  color: var(--color-text-muted);
  border: 2px dashed var(--color-border);
  border-radius: 16px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  margin-top: 20px;
}
.xs-catalog-empty i { font-size: 40px; color: var(--color-text-muted); opacity: 0.6; }
.xs-catalog-empty h3 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 18px; font-weight: 800; color: var(--color-text);
  text-transform: uppercase;
}
.xs-catalog-empty p { font-size: 13px; }

/* Defensive: HTML5 [hidden] should always hide, even if a later rule sets
   display: flex/block/grid. Without this, the catalog "empty state" stayed
   visible at the bottom even when results were shown. */
[hidden] { display: none !important; }

/* ============================================================
   LOGIN + PROFILE
   ============================================================ */
.xs-auth-wrap {
  min-height: calc(100vh - 140px);
  display: grid; place-items: center;
  padding: 40px 20px;
}
.xs-auth-card {
  width: 100%; max-width: 400px;
  background: var(--color-surface) !important;
  border: 1px solid var(--color-border) !important;
  border-radius: 16px !important;
  padding: 32px 28px !important;
  box-shadow: 0 16px 48px rgba(0,0,0,0.45);
}
.xs-auth-brand {
  text-align: center; font-size: 22px; font-weight: 800;
  margin-bottom: 24px; letter-spacing: -0.02em;
  font-family: 'Barlow Condensed', sans-serif;
}
.xs-auth-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 22px; font-weight: 800; margin-bottom: 6px;
  color: var(--color-text); text-transform: uppercase;
}
.xs-auth-sub {
  font-size: 13px; color: var(--color-text-muted); margin-bottom: 20px;
}
.xs-auth-form { display: flex; flex-direction: column; gap: 14px; }
.xs-auth-label { display: flex; flex-direction: column; gap: 6px; }
.xs-auth-label > span {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--color-text-muted);
}
.xs-auth-label input {
  width: 100%; padding: 10px 14px;
  background: var(--color-bg-subtle); color: var(--color-text);
  border: 1px solid var(--color-border); border-radius: 8px;
  font-size: 14px; outline: none;
  transition: border-color var(--motion), box-shadow var(--motion);
}
.xs-auth-label input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 20%, transparent);
}
.xs-auth-error {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; margin-top: 12px;
  background: color-mix(in srgb, var(--color-danger) 12%, transparent) !important;
  border: 1px solid color-mix(in srgb, var(--color-danger) 35%, transparent) !important;
  border-radius: 8px !important;
  color: var(--color-danger) !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  font-family: var(--font-body) !important;
  text-transform: none;
  letter-spacing: normal;
}
.xs-auth-foot {
  margin-top: 18px; text-align: center;
  font-size: 12px; color: var(--color-text-muted);
}
.xs-auth-foot a { color: var(--color-primary); }

/* Profile page */
.xs-profile-banner {
  position: relative; height: 200px; overflow: hidden; background: var(--color-bg-subtle);
}
.xs-profile-banner img { width: 100%; height: 100%; object-fit: cover; }
.xs-profile-banner-shade {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(15,23,42,0.4) 0%, var(--color-bg) 100%);
}
.xs-profile-head {
  max-width: 1200px; margin: -60px auto 0; padding: 0 20px;
  position: relative; z-index: 2;
  display: flex; align-items: flex-end; gap: 20px; flex-wrap: wrap;
}
.xs-profile-avatar {
  width: 120px; height: 120px; border-radius: 50%; overflow: hidden;
  background: var(--color-surface); border: 4px solid var(--color-bg);
  display: grid; place-items: center; flex-shrink: 0;
  font-size: 48px; box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.xs-profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.xs-profile-meta { flex: 1; min-width: 200px; padding-bottom: 12px; }
.xs-profile-name { font-size: 32px; font-weight: 800; color: var(--color-text); font-family: 'Barlow Condensed', sans-serif; }
.xs-profile-uid { font-size: 14px; color: var(--color-text-muted); margin-top: 2px; }
.xs-profile-title { font-size: 13px; color: var(--color-primary); margin-top: 4px; font-weight: 600; }
.xs-profile-roles { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.xs-profile-logout { padding-bottom: 12px; }
.xs-profile-body { margin-top: 20px; max-width: 1200px; margin: 20px auto 0; padding: 0 20px; }

/* ============================================================
   SERIES DETAIL PAGE
   ============================================================ */
.xs-series-hero {
  position: relative; height: 360px; overflow: hidden; background: #0a0a0a;
}
.xs-series-hero-overlay {
  position: absolute; inset: 0;
  background:
    linear-gradient(to right, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.5) 55%, transparent 100%),
    linear-gradient(to top, var(--color-bg) 0%, transparent 25%);
}
a.xs-hero-back {
  position: absolute; top: 20px; left: 20px; z-index: 3;
  display: inline-flex !important; align-items: center !important; gap: 6px !important;
  padding: 7px 14px !important;
  background: rgba(0,0,0,0.55) !important;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.15) !important;
  border-radius: 8px !important;
  color: #fff !important;
  font-size: 13px !important; font-weight: 500 !important;
  transition: background 0.15s;
  height: auto !important;
}
a.xs-hero-back:hover { background: rgba(0,0,0,0.75) !important; }

.xs-series-info {
  position: absolute; bottom: 32px; left: 40px; right: 40%; z-index: 2;
}
.xs-series-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 40px; font-weight: 800; color: #fff; line-height: 1.05;
  margin-bottom: 6px; text-shadow: 0 2px 20px rgba(0,0,0,0.6);
}
.xs-series-alt {
  font-size: 14px; color: rgba(255,255,255,0.55); margin-bottom: 12px;
}
.xs-series-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px;
  font-size: 12px; color: rgba(255,255,255,0.55);
}
.xs-series-meta .xs-star { color: #facc15; }
.xs-genre-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.xs-genre-chip, span.chip.xs-genre-chip {
  padding: 2px 10px !important; border-radius: 20px !important;
  font-size: 11px !important; font-weight: 600 !important;
  background: rgba(255,255,255,0.1) !important;
  color: rgba(255,255,255,0.7) !important;
  border: 1px solid rgba(255,255,255,0.15) !important;
  text-transform: none;
  letter-spacing: normal;
}
.xs-series-actions { display: flex; gap: 10px; margin-top: 20px; }
.xs-series-poster {
  position: absolute; right: 40px; bottom: 20px;
  width: 130px; aspect-ratio: 3/4;
  border-radius: 10px; overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  border: 2px solid rgba(255,255,255,0.1);
}
.xs-series-poster img { width: 100%; height: 100%; object-fit: cover; }

/* Sticky tabs */
.xs-sticky-tabs {
  position: sticky; top: 54px; z-index: 50;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0;
}
.xs-series-tab-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 40px;
  display: flex !important; gap: 0 !important;
  background: transparent !important;
  border: none !important;
  margin-bottom: 0 !important;
}
.xs-series-tab-inner a {
  padding: 14px 24px !important;
  font-size: 14px !important; font-weight: 600 !important;
  color: var(--color-text-muted) !important;
  background: transparent !important;
  border: none !important;
  border-bottom: 2px solid transparent !important;
  border-radius: 0 !important;
  cursor: pointer; transition: all 0.15s;
  text-transform: none;
  letter-spacing: 0.02em;
  height: auto !important; min-height: 0 !important;
}
.xs-series-tab-inner a.active {
  color: var(--color-primary) !important;
  border-bottom-color: var(--color-primary) !important;
}

.xs-series-body { max-width: 1200px; margin: 0 auto; padding: 32px 40px; }

/* Panel (details/summary) */
details.xs-panel {
  background: var(--color-surface) !important;
  border: 1px solid var(--color-border) !important;
  border-radius: 12px !important;
  overflow: hidden; margin-bottom: 28px;
  padding: 0 !important;
}
details.xs-panel > summary.xs-panel-summary {
  display: flex !important; align-items: center !important; gap: 8px;
  width: 100%;
  padding: 14px 20px;
  border-bottom: 1px solid var(--color-border);
  background: transparent;
  transition: background 0.15s;
  cursor: pointer;
  list-style: none;
}
details.xs-panel:not([open]) > summary.xs-panel-summary { border-bottom: none; }
details.xs-panel > summary.xs-panel-summary:hover { background: var(--color-surface-hover); }
.xs-panel-summary::before {
  content: ''; display: inline-block;
  width: 3px; height: 18px;
  background: var(--color-primary);
  border-radius: 2px; flex-shrink: 0;
}
.xs-panel-title { font-size: 15px; font-weight: 700; color: var(--color-text); flex: 1; text-align: left; }
.xs-panel-sub { font-size: 12px; color: var(--color-text-muted); margin-right: 8px; }
.xs-panel-chev {
  color: var(--color-text-muted);
  transition: transform var(--motion);
  font-size: 14px;
}
details.xs-panel[open] .xs-panel-chev { transform: rotate(180deg); }

details.xs-panel > .padding, details.xs-panel > .xs-prose, details.xs-panel > div {
  padding: 16px;
}

/* Sinopsis eyebrow */
.xs-section-eyebrow {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--color-primary);
  margin-bottom: 10px;
}

/* Team grid */
.xs-team-grid {
  display: flex; flex-wrap: wrap;
  padding: 0 !important;
}
.xs-team-member {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px !important;
  border-bottom: 1px solid var(--color-border) !important;
  border-right: 1px solid var(--color-border) !important;
  width: 50%; box-sizing: border-box;
  background: transparent !important;
  border-top: none !important; border-left: none !important;
  border-radius: 0 !important;
  transition: background var(--motion);
  cursor: pointer;
  margin: 0 !important;
}
.xs-team-member:hover { background: var(--color-surface-hover) !important; }
.xs-team-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: color-mix(in srgb, var(--color-primary) 15%, transparent);
  border: 2px solid color-mix(in srgb, var(--color-primary) 40%, transparent);
  display: grid; place-items: center; font-size: 18px;
}
.xs-team-name {
  font-size: 13px; font-weight: 700; color: var(--color-text); margin-bottom: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.xs-team-role { font-size: 11px; color: var(--color-primary); font-weight: 600; }
.xs-team-stats { display: flex; gap: 16px; flex-shrink: 0; }
.xs-team-stat { text-align: center; }
.xs-team-stat-value {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 16px; font-weight: 800; color: var(--color-text);
}
.xs-team-stat-value.xs-warning-text { color: var(--color-warning); }
.xs-team-stat-label {
  font-size: 9px; color: var(--color-text-muted);
  letter-spacing: 0.04em; text-transform: uppercase;
}

/* Season pills */
.xs-season-tabs {
  display: flex !important; gap: 8px; flex-wrap: wrap;
  margin-bottom: 16px !important;
  background: transparent !important;
  border: none !important;
  overflow: visible;
}
.xs-season-tabs a {
  padding: 6px 18px !important;
  border-radius: 20px !important;
  font-size: 13px !important; font-weight: 600 !important;
  border: 1px solid var(--color-border) !important;
  background: transparent !important;
  color: var(--color-text-muted) !important;
  cursor: pointer;
  transition: all var(--motion);
  text-transform: none;
  letter-spacing: normal;
  height: auto !important; min-height: 0 !important;
}
.xs-season-tabs a.active {
  border-color: var(--color-primary) !important;
  background: var(--color-primary) !important;
  color: #fff !important;
}

/* Episode list */
.xs-ep-list { display: flex; flex-direction: column; gap: 6px; }
.xs-ep-nav-list {
  display: flex !important; flex-direction: column; gap: 6px;
  padding: 0 !important;
  background: transparent !important;
}
.xs-ep-list-row {
  display: flex !important; align-items: center !important; gap: 14px;
  padding: 10px 12px !important;
  background: var(--color-bg) !important;
  border: 1px solid var(--color-border) !important;
  border-radius: 8px !important;
  transition: all var(--motion);
  cursor: pointer;
}
.xs-ep-list-row:hover {
  background: var(--color-surface-hover) !important;
  border-color: #475569 !important;
}
.xs-ep-row-thumb {
  width: 90px; height: 50px; border-radius: 6px; overflow: hidden; flex-shrink: 0;
  background: var(--color-bg-subtle);
}
.xs-ep-row-thumb img { width: 100%; height: 100%; object-fit: cover; }
.xs-ep-row-play-icon {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: color-mix(in srgb, var(--color-primary) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-primary) 40%, transparent);
  display: grid; place-items: center;
  color: var(--color-primary); font-size: 12px;
}
.xs-ep-row-ep {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  color: var(--color-primary); margin-bottom: 2px;
}
.xs-ep-row-title {
  font-size: 13px; font-weight: 600; color: var(--color-text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.xs-ep-row-date { font-size: 11px; color: var(--color-text-muted); flex-shrink: 0; }

/* Wiki */
.xs-wiki-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
}
.xs-wiki-info {
  grid-column: 1 / -1;
  background: var(--color-surface) !important;
  border: 1px solid var(--color-border) !important;
  border-radius: 12px !important;
  overflow: hidden;
  padding: 0 !important;
}
.xs-wiki-info-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--color-border);
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--color-primary);
}
.xs-wiki-info-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
.xs-wiki-info-cell {
  padding: 14px 20px;
  border-bottom: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
}
.xs-wiki-info-k {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--color-text-muted);
  margin-bottom: 4px;
}
.xs-wiki-info-v { font-size: 13px; color: var(--color-text); font-weight: 500; }

details.xs-wiki-section {
  background: var(--color-surface) !important;
  border: 1px solid var(--color-border) !important;
  border-radius: 12px !important;
  overflow: hidden;
  margin-bottom: 0;
  padding: 0 !important;
}
details.xs-wiki-section > summary.xs-panel-summary {
  padding: 14px 20px;
  border-bottom: 1px solid var(--color-border);
  display: flex !important; align-items: center; gap: 8px;
  cursor: pointer; background: transparent;
  transition: background 0.15s;
}
details.xs-wiki-section:not([open]) > summary.xs-panel-summary { border-bottom: none; }
details.xs-wiki-section > summary.xs-panel-summary:hover { background: var(--color-surface-hover); }

/* ============================================================
   EPISODE PAGE
   ============================================================ */
.xs-ep-breadcrumb {
  max-width: 1200px; margin: 0 auto; padding: 14px 40px;
  font-size: 12px; color: var(--color-text-muted);
}
.xs-ep-breadcrumb a { color: var(--color-text-muted); transition: color 0.15s; }
.xs-ep-breadcrumb a:hover { color: var(--color-primary); }
.xs-ep-breadcrumb-sep { margin: 0 6px; opacity: 0.5; }

.xs-ep-layout {
  display: flex; gap: 24px; align-items: flex-start;
  max-width: 1440px; margin: 0 auto; padding: 0 20px 40px;
}
.xs-ep-main { flex: 1; min-width: 0; }
.xs-ep-side { width: 320px; flex-shrink: 0; position: sticky; top: 70px; }

.xs-player-wrap {
  background: #000; border-radius: 12px; overflow: hidden;
  aspect-ratio: 16/9; position: relative;
  border: 1px solid var(--color-border);
}
.xs-player-wrap iframe {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0;
}

.xs-player-tabs {
  display: flex; gap: 6px; overflow-x: auto;
  scrollbar-width: none; padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}
.xs-player-tabs::-webkit-scrollbar { display: none; }
.xs-player-tab {
  padding: 6px 14px; border-radius: 6px;
  font-size: 12px; font-weight: 600;
  border: 1px solid var(--color-border); background: transparent;
  color: var(--color-text-muted); cursor: pointer;
  white-space: nowrap; flex-shrink: 0;
  transition: all var(--motion);
}
.xs-player-tab:hover { color: var(--color-text); }
.xs-player-tab.is-active {
  border-color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 13%, transparent);
  color: var(--color-primary);
}

/* ============================================================
   FOOTER + 404 + Misc
   ============================================================ */
.xs-footer {
  border-top: 1px solid var(--color-border);
  padding: 24px 20px; margin-top: 8px;
}
.xs-footer-inner {
  max-width: 1440px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
}
.xs-footer-brand {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 18px; font-weight: 800;
}
.xs-footer-links { display: flex; gap: 16px; }
.xs-footer-links a { font-size: 12px; color: var(--color-text-muted); }
.xs-footer-links a:hover { color: var(--color-text); }
.xs-footer-copy { font-size: 11px; color: var(--color-text-muted); }

.xs-empty {
  padding: 3rem 1rem; text-align: center; color: var(--color-text-muted);
  border: 1px dashed var(--color-border); border-radius: 12px;
}

.xs-prose { color: var(--color-text); line-height: 1.75; font-size: 14px; }
.xs-prose p { margin-bottom: 12px; }
.xs-prose h1, .xs-prose h2, .xs-prose h3 {
  font-family: 'Barlow Condensed', sans-serif;
  text-transform: uppercase; font-weight: 800;
  margin-top: 16px; margin-bottom: 8px;
}
.xs-prose a { color: var(--color-accent); text-decoration: underline; }
.xs-prose ul, .xs-prose ol { margin-left: 1.25rem; margin-bottom: 12px; }
.xs-prose code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  background: var(--color-bg-subtle); padding: 1px 6px; border-radius: 4px;
}

/* 404 */
.xs-404 {
  min-height: calc(100vh - 160px);
  display: grid; place-items: center; padding: 40px 20px; text-align: center;
}
.xs-404-code {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 8rem; font-weight: 800; line-height: 1;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.xs-404-title { font-size: 1.4rem; margin: 1rem 0 0.4rem; font-family: 'Barlow Condensed', sans-serif; font-weight: 800; text-transform: uppercase; }
.xs-404-actions { display: flex; gap: 10px; justify-content: center; margin-top: 1.5rem; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
  .xs-sidebar, .xs-ep-side { display: none; }
  .xs-series-info { right: 40px; }
  .xs-series-poster { display: none; }
}
@media (max-width: 860px) {
  /* ── Nav: tighter spacing at tablet widths ── */
  nav.xs-nav           { gap: 8px; padding: 0 14px; }
  nav.xs-nav.is-docked { margin: 8px 10px 0; padding: 0 12px; }
  .xs-nav-links { display: none; }
  .xs-search-wrap { max-width: 180px; }
  .xs-brand { font-size: 20px; }

  .xs-hero-content { padding: 0 24px 28px; }
  .xs-hero-dots { right: 24px; bottom: 20px; }
  .xs-sticky-tabs, .xs-series-body { padding-left: 20px; padding-right: 20px; }
  .xs-series-tab-inner { padding: 0 20px; }
  .xs-series-info { left: 20px; right: 20px; }
  .xs-series-title { font-size: 28px; }
  .xs-team-member { width: 100%; border-right: none; }
  .xs-ep-layout { flex-direction: column; padding: 16px; }
  .xs-ep-side { width: 100%; position: static; }
  .xs-wiki-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Mobile nav — fits cleanly on 360px-width phones.
   Without these rules the brand + search + CTA + avatar + theme
   chip overflow horizontally (total ~460px vs ~320px viewport).
   ============================================================ */
@media (max-width: 560px) {
  nav.xs-nav {
    gap: 6px;
    padding: 0 10px;
    height: 52px;
  }
  nav.xs-nav.is-docked {
    margin: 6px 6px 0;
    padding: 0 10px;
    border-radius: 24px;
  }
  /* Compact brand — no letter-spacing waste */
  .xs-brand {
    font-size: 17px;
    letter-spacing: -0.03em;
  }
  /* The "Entrar" text CTA is redundant on mobile — the avatar-btn
     next to it also links to /login and takes less space. Hide
     the text version so only the icon remains. */
  .xs-nav-cta { display: none; }
  /* Search takes the remaining flex space but clamps so the
     right-side icons always fit */
  .xs-search-wrap {
    max-width: none;
    min-width: 0;
    flex: 1 1 auto;
  }
  .xs-search { padding: 5px 10px; }
  /* iOS zooms the viewport when focusing an input with font-size < 16px —
     set exactly 16px to prevent that while keeping the nav compact. */
  .xs-search input { font-size: 16px; }
  /* Smaller round icons so we don't eat the whole row */
  .xs-avatar-btn {
    width: 34px; height: 34px;
    border-width: 1px;
  }
  /* Dropdowns: on mobile we can't rely on the fixed 280px width —
     on a 360px phone with a docked nav (margin 6px + padding 10px),
     the 280px card would extend off the left edge of the viewport.
     Use min(viewport-based, reasonable cap) so the card shrinks on
     tiny screens but keeps its familiar width on larger phones. */
  .xs-user-dropdown,
  .xs-theme-menu {
    width: min(calc(100vw - 24px), 320px);
    max-width: none;
    right: 0;
  }
  /* Search dropdown: break out of the (narrow) .xs-search-wrap using
     position: fixed so autocomplete results always get the full viewport
     width regardless of where the search input sits inside the nav.
     The 60px top clears both static (52px) and docked (52+6=58px) nav. */
  .xs-search-dropdown {
    position: fixed;
    top: 60px; left: 8px; right: 8px;
    width: auto; max-width: none;
    max-height: 70vh;
  }
  /* Hero back button needs to clear the smaller nav height */
  .xs-hero-back { top: 10px !important; }
}

/* Tiny phones (iPhone SE 1st gen = 320px, old Android = 360px):
   shave a few more pixels off items that still bump into each other. */
@media (max-width: 380px) {
  nav.xs-nav { gap: 4px; padding: 0 8px; }
  nav.xs-nav.is-docked { margin: 4px 4px 0; padding: 0 8px; }
  .xs-brand { font-size: 15px; }
  .xs-avatar-btn { width: 30px; height: 30px; font-size: 13px; }
  /* On iPhone SE width we really need search + 2 icons to cohabit
     36 + 30 + 30 + gaps (~12) = 108px taken by icons. Brand 15px =
     ~72px. Remaining for search = ~320 - 108 - 72 - 16padding = ~124px. Ok. */
  .xs-search { padding: 4px 8px; gap: 6px; }
  /* Keep 16px here too — anything smaller triggers iOS input zoom. */
  .xs-search input { font-size: 16px; }
}

/* ============================================================
   PROFILE PAGE — tabs, buckets, history, stats, hover tooltip
   ============================================================ */
.xs-pill-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 6px;
  font-size: 10px; font-weight: 800;
  background: color-mix(in srgb, var(--color-primary) 22%, transparent);
  color: var(--color-primary);
  border-radius: 9px; margin-left: 4px;
  font-family: 'Barlow Condensed', sans-serif; letter-spacing: 0.04em;
}

/* Profile tabs strip (under banner) */
.xs-profile-tabs-wrap {
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  position: sticky; top: 54px; z-index: 50;
  margin-top: 24px;
}
.xs-profile-tabs {
  max-width: 1200px; margin: 0 auto; padding: 0 20px;
  display: flex; gap: 0;
}
.xs-profile-tabs a {
  padding: 14px 22px;
  font-size: 14px; font-weight: 600;
  color: var(--color-text-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer; transition: all var(--motion);
  display: inline-flex; align-items: center; gap: 8px;
  white-space: nowrap;
}
.xs-profile-tabs a:hover { color: var(--color-text); }
.xs-profile-tabs a.is-active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}
.xs-profile-tabs a i { font-size: 12px; opacity: 0.8; }

.xs-profile-body {
  max-width: 1200px; margin: 0 auto; padding: 32px 20px;
}
.xs-profile-body [data-profile-pane].is-hidden { display: none; }

/* Bucket tabs (En proceso / Por ver / etc.) */
.xs-bucket-tabs {
  display: flex; gap: 8px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.xs-bucket-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: 8px;
  color: var(--color-text-muted);
  font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all var(--motion);
}
.xs-bucket-tab:hover { color: var(--color-text); border-color: #475569; }
.xs-bucket-tab.is-active {
  background: color-mix(in srgb, var(--color-primary) 14%, transparent);
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.xs-bucket-icon { font-size: 14px; }

#bucket-pane.is-loading { opacity: 0.5; }
.xs-bucket-empty {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 60px 20px;
}
.xs-bucket-empty i { font-size: 32px; opacity: 0.5; }

.xs-bucket-grid { /* extends .xs-grid-series; nothing extra needed */ }
.xs-bucket-card-wrap {
  position: relative;
}
.xs-bucket-remove {
  position: absolute; top: 6px; right: 6px; z-index: 4;
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(0,0,0,0.6); color: #fff;
  display: grid; place-items: center;
  opacity: 0; transition: opacity var(--motion), background var(--motion);
  border: none; cursor: pointer; font-size: 12px;
}
.xs-bucket-card-wrap:hover .xs-bucket-remove { opacity: 1; }
.xs-bucket-remove:hover { background: var(--color-danger); }

/* ── Hover tooltip on series cards ─────────────────────── */
.xs-tooltip {
  position: absolute; top: 100%; left: 50%;
  transform: translateX(-50%) translateY(-6px);
  width: 320px; max-width: 90vw;
  z-index: 200;
  pointer-events: none;
  opacity: 0; visibility: hidden;
  transition: opacity 200ms, transform 200ms;
}
.xs-tooltip:not(:empty) { /* HTMX populated content */ }
/* NOTE: include .xs-series-card in the hover selector — the template uses
   that class directly (no -wrap suffix). Without this the tooltip loaded
   by HTMX never becomes visible. */
.xs-bucket-card-wrap:hover .xs-tooltip:not(:empty),
.xs-series-card-wrap:hover .xs-tooltip:not(:empty),
.xs-series-card:hover .xs-tooltip:not(:empty) {
  opacity: 1; visibility: visible;
  transform: translateX(-50%) translateY(2px);
  pointer-events: auto;
}
.xs-tooltip-inner {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px; overflow: hidden;
  box-shadow: 0 16px 48px rgba(0,0,0,0.55);
}
.xs-tooltip-banner { position: relative; aspect-ratio: 16/9; overflow: hidden; }
.xs-tooltip-banner img { width: 100%; height: 100%; object-fit: cover; }
.xs-tooltip-shade {
  position: absolute; inset: 0;
  background: linear-gradient(to top, var(--color-surface) 0%, transparent 50%);
}
.xs-tooltip-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.xs-tooltip-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 17px; font-weight: 800;
  color: var(--color-text); line-height: 1.2;
}
.xs-tooltip-alt { font-size: 11px; color: var(--color-text-muted); }
.xs-tooltip-tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.xs-tooltip-meta-pill {
  font-size: 10px; font-weight: 700; padding: 2px 8px;
  border-radius: 12px; background: var(--color-bg-subtle);
  color: var(--color-text-muted);
}
.xs-tooltip-synopsis {
  font-size: 12px; color: var(--color-text-muted); line-height: 1.5;
}
.xs-tooltip-stats {
  display: flex; gap: 12px; font-size: 11px; color: var(--color-text-muted);
}
.xs-tooltip-genres { display: flex; gap: 4px; flex-wrap: wrap; }
.xs-tooltip-genre {
  font-size: 10px; padding: 2px 6px; border-radius: 4px;
  background: rgba(168,85,247,0.12); color: var(--color-primary);
}
.xs-tooltip-cta {
  align-self: flex-start; margin-top: 4px;
}

/* ── History list ─────────────────────────────────────── */
.xs-history-list {
  display: flex; flex-direction: column; gap: 8px;
}
.xs-history-row {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  transition: all var(--motion);
}
.xs-history-row:hover {
  background: var(--color-surface-hover);
  border-color: #475569;
}
.xs-history-thumb {
  position: relative;
  width: 100px; height: 56px;
  flex-shrink: 0;
  border-radius: 6px; overflow: hidden;
  background: var(--color-bg-subtle);
}
.xs-history-thumb img { width: 100%; height: 100%; object-fit: cover; }
.xs-history-progress {
  position: absolute; bottom: 0; left: 0; height: 3px;
  background: var(--color-primary);
}
.xs-history-body { flex: 1; min-width: 0; }
.xs-history-series {
  font-size: 13px; font-weight: 600; color: var(--color-text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.xs-history-ep {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px; color: var(--color-primary); font-weight: 700;
  letter-spacing: 0.04em; margin-top: 2px;
}
.xs-history-time {
  font-size: 11px; color: var(--color-text-muted);
  flex-shrink: 0;
}

/* ── Stats grid ─────────────────────────────────────── */
.xs-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}
.xs-stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 24px 20px;
  text-align: center;
}
.xs-stat-value {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 36px; font-weight: 800;
  color: var(--color-primary); line-height: 1;
}
.xs-stat-label {
  font-size: 12px; color: var(--color-text-muted);
  margin-top: 6px; font-weight: 500;
}

.xs-genre-bars { display: flex; flex-direction: column; gap: 10px; }
.xs-genre-bar-row {
  display: grid; grid-template-columns: 140px 1fr 40px;
  align-items: center; gap: 10px;
}
.xs-genre-bar-label {
  font-size: 13px; color: var(--color-text); font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.xs-genre-bar-track {
  height: 8px; background: var(--color-bg-subtle); border-radius: 4px; overflow: hidden;
}
.xs-genre-bar-fill {
  height: 100%; background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  border-radius: 4px;
}
.xs-genre-bar-value {
  font-size: 12px; color: var(--color-text-muted); text-align: right;
  font-family: 'Barlow Condensed', sans-serif; font-weight: 700;
}

.xs-bucket-distribution { display: flex; flex-direction: column; gap: 10px; }
.xs-dist-row {
  display: grid; grid-template-columns: 14px 100px 1fr 30px;
  align-items: center; gap: 10px;
}
.xs-dist-dot { width: 10px; height: 10px; border-radius: 50%; }
.xs-dist-label { font-size: 13px; color: var(--color-text); }
.xs-dist-bar {
  height: 8px; background: var(--color-bg-subtle); border-radius: 4px; overflow: hidden;
}
.xs-dist-bar > div { height: 100%; border-radius: 4px; }
.xs-dist-value {
  font-size: 12px; color: var(--color-text-muted); text-align: right;
  font-family: 'Barlow Condensed', sans-serif; font-weight: 700;
}

/* ── Add-to-list dropdown (series page hero) ─────────── */
.xs-add-to-list { position: relative; }
.xs-add-to-list > summary {
  list-style: none; cursor: pointer;
}
.xs-add-to-list > summary::-webkit-details-marker { display: none; }
.xs-add-list-menu {
  position: absolute; top: calc(100% + 6px); left: 0;
  z-index: 100;
  min-width: 200px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px; overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  display: flex; flex-direction: column;
}
.xs-add-list-menu button {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: transparent; border: none; cursor: pointer;
  font-size: 13px; color: var(--color-text);
  text-align: left;
  transition: background var(--motion);
}
.xs-add-list-menu button:hover { background: var(--color-surface-hover); }
.xs-add-icon { font-size: 14px; width: 16px; text-align: center; }
.xs-add-divider {
  border: none; height: 1px; background: var(--color-border); margin: 4px 0;
}
.xs-add-remove { color: var(--color-danger) !important; }

/* ============================================================
   WIKI — sub-tabs + 5 sub-panes + sticky info card
   ============================================================ */
.xs-wiki-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 24px;
  max-width: 1100px;
  margin: 0 auto;
}
.xs-wiki-main { min-width: 0; }

/* Wiki sub-tabs */
.xs-wiki-subtabs {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0;
}
.xs-wiki-subtab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px;
  background: transparent; border: none;
  border-bottom: 2px solid transparent;
  color: var(--color-text-muted);
  font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all var(--motion);
}
.xs-wiki-subtab:hover { color: var(--color-text); }
.xs-wiki-subtab.is-active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}
.xs-wiki-subtab i { font-size: 11px; }
.xs-wiki-subpane.is-hidden { display: none; }

/* Wiki info card (sticky aside) */
.xs-wiki-info-card {
  position: sticky; top: 80px;
  align-self: start;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px; overflow: hidden;
}
.xs-wiki-info-card .xs-wiki-info-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--color-primary);
}
.xs-wiki-info-list { display: flex; flex-direction: column; }
.xs-wiki-info-pair {
  padding: 10px 16px;
  display: flex; flex-direction: column; gap: 2px;
  border-bottom: 1px solid var(--color-border);
}
.xs-wiki-info-pair:last-child { border-bottom: none; }
.xs-wiki-info-pair dt {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--color-text-muted);
}
.xs-wiki-info-pair dd { font-size: 13px; color: var(--color-text); font-weight: 500; }

/* Wiki prose blocks */
.xs-wiki-prose-block {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 16px;
}
.xs-wiki-block-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 16px; font-weight: 800;
  color: var(--color-text); margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
  padding-bottom: 10px; border-bottom: 1px solid var(--color-border);
}
.xs-wiki-block-title i { color: var(--color-primary); font-size: 13px; }

/* ── Cultivation system ─────────────────────────────────────── */
.xs-wiki-cultivation { display: flex; flex-direction: column; gap: 16px; }
.xs-cult-track-tabs {
  display: flex; gap: 6px; flex-wrap: wrap;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 8px;
}
.xs-cult-track-tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 8px;
  background: var(--color-surface); border: 1px solid var(--color-border);
  font-size: 12px; font-weight: 600;
  color: var(--color-text-muted); cursor: pointer;
  transition: all var(--motion);
}
.xs-cult-track-tab.is-active {
  background: color-mix(in srgb, var(--color-primary) 14%, transparent);
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.xs-cult-primary-pill {
  font-size: 9px; padding: 1px 6px; border-radius: 8px;
  background: var(--color-primary); color: #fff;
}
.xs-cult-track-pane.is-hidden { display: none; }
.xs-cult-realm-header {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px; font-weight: 800; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--color-primary);
  margin: 16px 0 8px;
}
.xs-cult-stage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}
.xs-cult-stage-card {
  display: flex; align-items: stretch; gap: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--stage-color, var(--color-primary));
  border-radius: 8px; overflow: hidden;
}
.xs-cult-stage-level {
  display: grid; place-items: center;
  width: 48px;
  background: color-mix(in srgb, var(--stage-color, var(--color-primary)) 14%, transparent);
  color: var(--stage-color, var(--color-primary));
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 22px; font-weight: 800;
}
.xs-cult-stage-body { padding: 10px 12px; flex: 1; min-width: 0; }
.xs-cult-stage-name { font-size: 13px; font-weight: 700; color: var(--color-text); }
.xs-cult-stage-aliases {
  display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px;
}
.xs-cult-alias {
  font-size: 10px; padding: 1px 6px; border-radius: 4px;
  background: var(--color-bg-subtle); color: var(--color-text-muted);
}
.xs-cult-suffixes {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px; overflow: hidden;
}
.xs-cult-suffixes-summary {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--color-text);
}
.xs-cult-suffix-grid {
  padding: 12px 16px; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}
.xs-cult-suffix {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px; background: var(--color-bg-subtle);
  border-radius: 6px;
}
.xs-cult-suffix-name { font-size: 12px; color: var(--color-text); }
.xs-cult-suffix-boost {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800; color: var(--color-warning); font-size: 13px;
}

/* ── Characters ─────────────────────────────────────── */
.xs-wiki-characters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.xs-char-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px; overflow: hidden;
  padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
  transition: all var(--motion);
}
.xs-char-card:hover { border-color: #475569; transform: translateY(-2px); }
.xs-char-head { display: flex; align-items: center; gap: 12px; }
.xs-char-avatar {
  width: 52px; height: 52px; border-radius: 50%;
  background: color-mix(in srgb, var(--color-primary) 14%, transparent);
  border: 2px solid color-mix(in srgb, var(--color-primary) 35%, transparent);
  display: grid; place-items: center; font-size: 22px;
  flex-shrink: 0; overflow: hidden;
}
.xs-char-avatar img { width: 100%; height: 100%; object-fit: cover; }
.xs-char-head-meta { flex: 1; min-width: 0; }
.xs-char-name {
  font-size: 14px; font-weight: 700; color: var(--color-text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.xs-char-orig { font-size: 11px; color: var(--color-text-muted); }
.xs-char-status {
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  margin-top: 3px; display: inline-block;
}
.xs-char-rank-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 0; border-bottom: 1px solid var(--color-border);
}
.xs-char-rank-row:last-of-type { border-bottom: none; }
.xs-char-rank-label {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--color-text-muted);
}
.xs-char-rank-value { font-size: 12px; color: var(--color-text); font-weight: 600; }
.xs-char-desc {
  font-size: 12px; color: var(--color-text-muted); line-height: 1.5;
}
.xs-char-skills { display: flex; flex-wrap: wrap; gap: 4px; }
.xs-char-skill {
  font-size: 10px; padding: 2px 7px; border-radius: 8px;
  background: rgba(168,85,247,0.14); color: var(--color-primary);
}

/* ── World ─────────────────────────────────────── */
.xs-wiki-world { display: flex; flex-direction: column; gap: 14px; }
.xs-world-group {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px; overflow: hidden;
}
.xs-world-group-summary {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; cursor: pointer;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 14px; font-weight: 800;
  color: var(--color-text);
  letter-spacing: 0.04em; text-transform: uppercase;
  transition: background var(--motion);
}
.xs-world-group-summary:hover { background: var(--color-surface-hover); }
.xs-world-group-summary i:first-child { color: var(--color-primary); font-size: 16px; }
.xs-world-group-summary > span:first-of-type { flex: 1; }
.xs-world-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px; padding: 0 18px 18px;
}
.xs-world-entity {
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  border-radius: 10px; padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.xs-world-entity-head { display: flex; align-items: center; gap: 10px; }
.xs-world-entity-img {
  width: 40px; height: 40px; border-radius: 6px; object-fit: cover; flex-shrink: 0;
}
.xs-world-entity-name { font-size: 13px; font-weight: 700; color: var(--color-text); }
.xs-world-entity-rank {
  font-size: 10px; color: var(--color-warning); font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
}
.xs-world-entity-desc {
  font-size: 12px; color: var(--color-text-muted); line-height: 1.5;
}
.xs-world-entity-meta {
  display: flex; flex-direction: column; gap: 4px;
  padding-top: 8px; border-top: 1px solid var(--color-border);
}
.xs-world-entity-meta > div { display: flex; gap: 6px; align-items: baseline; font-size: 11px; }
.xs-world-entity-meta dt { color: var(--color-text-muted); font-weight: 600; min-width: 70px; }
.xs-world-entity-meta dd { color: var(--color-text); }

/* ── Timeline ─────────────────────────────────────── */
.xs-wiki-timeline {
  display: flex; flex-direction: column; gap: 0;
  position: relative;
  padding-left: 30px;
}
.xs-wiki-timeline::before {
  content: ''; position: absolute;
  left: 14px; top: 0; bottom: 0;
  width: 2px; background: var(--color-border);
}
.xs-tl-event {
  display: flex; gap: 14px;
  padding: 12px 0;
  position: relative;
}
.xs-tl-dot {
  position: absolute; left: -30px; top: 16px;
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  color: #fff; font-size: 11px;
  border: 3px solid var(--color-bg);
  flex-shrink: 0;
}
.xs-tl-event-major .xs-tl-dot { box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 30%, transparent); }
.xs-tl-event-critical .xs-tl-dot { box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-danger) 40%, transparent); }
.xs-tl-body {
  flex: 1; min-width: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px; padding: 12px 14px;
}
.xs-tl-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 6px;
}
.xs-tl-time {
  font-size: 13px; font-weight: 800;
  color: var(--color-text);
}
.xs-tl-cat {
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase;
}
.xs-tl-ep {
  font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 8px;
  background: var(--color-primary); color: #fff;
}
.xs-tl-desc {
  font-size: 13px; color: var(--color-text); line-height: 1.5;
}

/* ============================================================
   EPISODE PAGE — full rebuild styles
   ============================================================ */
.xs-ep-breadcrumb {
  max-width: 1440px; margin: 0 auto;
  display: flex; align-items: center; gap: 8px;
  padding: 14px 20px;
  font-size: 13px;
  border-bottom: 1px solid var(--color-border);
}
.xs-ep-breadcrumb a {
  color: var(--color-text-muted);
  display: inline-flex; align-items: center; gap: 4px;
  transition: color var(--motion);
}
.xs-ep-breadcrumb a:hover { color: var(--color-primary); }
.xs-ep-breadcrumb .sep { opacity: 0.5; }
.xs-ep-breadcrumb .cur { color: var(--color-text); font-weight: 600; }
.xs-ep-breadcrumb-nav { margin-left: auto; display: flex; gap: 6px; }
.xs-ep-nav-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 6px;
  font-size: 12px; font-weight: 600;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  transition: all var(--motion);
}
.xs-ep-nav-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-text);
}
.xs-ep-nav-btn.is-primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}
.xs-ep-nav-btn.is-primary:hover {
  background: var(--color-primary-hover);
  color: #fff;
}
.xs-ep-nav-btn.is-disabled {
  opacity: 0.4; cursor: default; pointer-events: none;
}

.xs-ep-layout {
  /* 3-col: wiki-mini (260) | player+info (1fr) | side (320). When the wiki has
     no data, the wiki column collapses to 0 since wiki-mini.php returns
     before rendering — the grid template still works because we use auto. */
  display: grid; grid-template-columns: 260px minmax(0, 1fr) 320px;
  gap: 24px; align-items: flex-start;
  max-width: 1440px; margin: 0 auto; padding: 24px 20px 40px;
}
.xs-ep-main { min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.xs-ep-wiki-side, .xs-ep-side {
  position: sticky; top: 90px;
  display: flex; flex-direction: column; gap: 16px;
}

.xs-ep-player-shell {
  background: var(--color-surface);
  padding: 14px;                         /* breathing room around iframe */
  border-radius: 16px; overflow: hidden;
  border: 1px solid var(--color-border);
}
.xs-ep-player-shell .xs-player {
  background: #000;
  border-radius: 12px;
  overflow: hidden;
}

/* Player tabs (BeerCSS-friendly) */
.xs-player { display: flex; flex-direction: column; }
.xs-player-tabs {
  display: flex; gap: 0; overflow-x: auto;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  scrollbar-width: none;
}
.xs-player-tabs::-webkit-scrollbar { display: none; }
.xs-player-tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  background: transparent; border: none;
  border-bottom: 2px solid transparent;
  color: var(--color-text-muted);
  font-size: 13px; font-weight: 600;
  white-space: nowrap; cursor: pointer;
  transition: all var(--motion);
}
.xs-player-tab:hover { color: var(--color-text); }
.xs-player-tab.is-active {
  color: var(--tab-color, var(--color-primary));
  border-bottom-color: var(--tab-color, var(--color-primary));
}
.xs-player-tab-icon {
  width: 16px; height: 16px; object-fit: contain;
}
.xs-player-frame { position: relative; aspect-ratio: 16/9; background: #000; }
.xs-player-pane {
  position: absolute; inset: 0;
  display: none;
}
.xs-player-pane.is-active { display: block; }
.xs-player-pane iframe {
  width: 100%; height: 100%; border: 0;
}
.xs-player-empty {
  padding: 80px 20px; text-align: center;
  color: var(--color-text-muted);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.xs-player-empty i { font-size: 32px; color: var(--color-warning); opacity: 0.7; }

/* Episode info card */
.xs-ep-info-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px; padding: 20px 24px;
}
.xs-ep-info-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.xs-ep-info-season { font-size: 12px; color: var(--color-text-muted); }
.xs-ep-info-stat {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--color-text-muted);
}
.xs-ep-info-stat i { font-size: 11px; }
.xs-ep-info-title {
  font-size: 24px; font-weight: 800;
  color: var(--color-text); margin-bottom: 14px;
  line-height: 1.2;
}

.xs-keywords {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 14px;
}
.xs-keyword {
  font-size: 11px; padding: 3px 9px; border-radius: 12px;
  background: rgba(168,85,247,0.12);
  color: var(--color-primary); font-weight: 500;
}

/* ── Episode quick actions: single consolidated row that replaces the
      old .xs-ep-actions + .xs-ep-watchlist card duplication.
      Compartir + 3 bucket buttons + inline progress input all live here. */
.xs-ep-quick-actions {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 16px 0 20px;
  padding: 12px;
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  align-items: center;
}
.xs-qa-btn {
  flex: 1 1 auto; min-width: 130px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  color: var(--color-text);
  font-size: 13px; font-weight: 700;
  cursor: pointer; text-decoration: none;
  transition: background var(--motion), border-color var(--motion),
              color var(--motion), transform 120ms;
}
.xs-qa-btn i { font-size: 12px; }
.xs-qa-btn:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  transform: translateY(-1px);
}
.xs-qa-btn.is-set {
  background: color-mix(in srgb, var(--color-primary) 18%, transparent);
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.xs-qa-btn.xs-qa-finish.is-done,
.xs-qa-btn.is-done {
  background: var(--color-success);
  border-color: var(--color-success);
  color: #fff;
  pointer-events: none;
}
.xs-qa-btn.xs-qa-share { flex: 0 0 auto; }
/* Inline progress input takes the full width of the container so
   the number field + save button don't get squished alongside the
   bucket buttons above. */
.xs-qa-progress {
  flex: 1 1 100%;
  padding: 10px 4px 2px;
  border-top: 1px dashed var(--color-border);
  margin-top: 4px;
}
.xs-qa-progress.is-hidden { display: none; }
.xs-qa-progress-label {
  display: block;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}
.xs-qa-progress-row { display: flex; gap: 6px; }
.xs-qa-progress-input {
  flex: 1; padding: 7px 10px;
  background: var(--color-surface); color: var(--color-text);
  border: 1px solid var(--color-border); border-radius: 6px;
  font-size: 13px; font-weight: 600; outline: none;
  transition: border-color var(--motion);
}
.xs-qa-progress-input:focus { border-color: var(--color-primary); }
.xs-qa-progress-save {
  padding: 7px 16px;
  background: var(--color-primary); color: #fff;
  border: none; border-radius: 6px;
  font-size: 12px; font-weight: 700;
  cursor: pointer;
  transition: background var(--motion);
}
.xs-qa-progress-save:hover { background: var(--color-primary-hover); }

/* Legacy aliases — kept as empty rules so any stray references
   in third-party/overlay code don't 404 in the stylesheet. The
   corresponding markup has been removed from episode.php. */
.xs-ep-actions { display: none; }
.xs-ep-watchlist,
.xs-mark-watched,
.xs-ep-watchlist-buttons,
.xs-ep-watchlist-divider,
.xs-ep-progress-inline { /* deprecated */ }

/* ── Episode comments section (3rd-party embed via site_scripts) ──── */
.xs-ep-comments {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 22px 24px;
  margin-top: 4px;
}
.xs-ep-comments-header {
  display: flex; align-items: baseline; gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}
.xs-ep-comments-header .xs-section-title { padding-left: 14px; font-size: 18px; }
.xs-ep-comments-sub {
  font-size: 12px; color: var(--color-text-muted);
  font-family: 'Barlow Condensed', sans-serif; letter-spacing: 0.04em;
}
.xs-ep-comments-body {
  min-height: 120px;
  font-size: 13px; color: var(--color-text);
}
.xs-ep-comments-body :where(iframe) {
  width: 100%; min-height: 320px;
  border: none; border-radius: 8px;
}
/* .xs-ep-action-btn removed — superseded by .xs-qa-btn in the
   consolidated .xs-ep-quick-actions container above. */

/* ── Toast notifications (global) ─────────────────────── */
.xs-toasts {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.xs-toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  font-size: 13px; font-weight: 600;
  color: var(--color-text);
  box-shadow: 0 12px 40px rgba(0,0,0,0.55);
  min-width: 220px; max-width: 360px;
  pointer-events: auto;
  opacity: 0; transform: translateX(40px);
  transition: opacity 250ms, transform 250ms;
}
.xs-toast.is-visible { opacity: 1; transform: translateX(0); }
.xs-toast i { font-size: 16px; flex-shrink: 0; }
.xs-toast-success { border-left: 4px solid var(--color-success); }
.xs-toast-success i { color: var(--color-success); }
.xs-toast-error   { border-left: 4px solid var(--color-danger); }
.xs-toast-error i { color: var(--color-danger); }
.xs-toast-info    { border-left: 4px solid var(--color-primary); }
.xs-toast-info i  { color: var(--color-primary); }

/* ── Quick add-to-list popover (series cards) ───────────────
      Wrapper is a small pill in the top-left that appears on card hover.
      Hovering the pill reveals a menu with the 3 buckets (En proceso /
      Por ver / Finalizado). Each menuitem is an HTMX-driven button.
      When any bucket is chosen, .is-added turns the pill green so the
      user sees immediate feedback without a page refresh. */
.xs-card-quick-add {
  position: absolute; top: 8px; left: 8px; z-index: 5;
  opacity: 0; transform: translateY(-4px);
  transition: opacity 180ms, transform 180ms;
}
.xs-card-quick-add-trigger {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  cursor: pointer;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.45);
  transition: background 180ms, border-color 180ms;
}
.xs-card-quick-add-trigger .xs-quick-add-icon { font-size: 12px; }
.xs-card-quick-add-trigger:hover,
.xs-card-quick-add:focus-within .xs-card-quick-add-trigger {
  background: var(--color-primary);
  border-color: var(--color-primary);
}
.xs-series-card:hover .xs-card-quick-add {
  opacity: 1;
  transform: translateY(0);
}
/* Popover menu — appears when the pill is hovered or any child has focus. */
.xs-card-quick-add-menu {
  position: absolute; top: calc(100% + 6px); left: 0;
  display: flex; flex-direction: column; gap: 2px;
  min-width: 150px; padding: 4px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.45);
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity 160ms, visibility 160ms, transform 160ms;
  z-index: 6;
}
.xs-card-quick-add:hover .xs-card-quick-add-menu,
.xs-card-quick-add:focus-within .xs-card-quick-add-menu {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.xs-qam-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border: none; border-radius: 6px;
  background: transparent; color: var(--color-text);
  font-family: var(--font-body);
  font-size: 12px; font-weight: 600; letter-spacing: 0;
  text-transform: none; text-align: left;
  cursor: pointer; width: 100%;
  transition: background 140ms, color 140ms;
}
.xs-qam-item:hover {
  background: color-mix(in srgb, var(--color-primary) 14%, transparent);
  color: var(--color-primary);
}
.xs-qam-ico { font-size: 13px; width: 18px; display: inline-block; text-align: center; }

/* Successful bucket pick: pill turns green & stays visible. */
.xs-card-quick-add.is-added {
  opacity: 1; transform: translateY(0);
}
.xs-card-quick-add.is-added .xs-card-quick-add-trigger {
  background: var(--color-success);
  border-color: var(--color-success);
}
.xs-card-quick-add.is-added .xs-quick-add-icon { color: #fff; }
/* On touch devices the hover trigger never fires — keep it visible always. */
@media (hover: none) {
  .xs-card-quick-add { opacity: 1; transform: translateY(0); }
}

/* Side cards (right column) */
.xs-side-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px; overflow: hidden;
}
.xs-side-header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--color-primary);
}
.xs-side-header i { font-size: 13px; }
.xs-side-header-toggle { cursor: pointer; transition: background var(--motion); }
.xs-side-header-toggle:hover { background: var(--color-surface-hover); }
.xs-side-header-toggle .xs-pill-count { margin-left: auto; }
.xs-side-header-toggle .xs-panel-chev { font-size: 11px; transition: transform var(--motion); }
details.xs-side-card[open] .xs-panel-chev { transform: rotate(180deg); }
details.xs-side-card:not([open]) .xs-side-header { border-bottom: none; }

/* Mini series banner card */
.xs-series-mini {
  display: block;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px; overflow: hidden;
  transition: all var(--motion);
}
.xs-series-mini:hover { border-color: var(--color-primary); transform: translateY(-2px); }
.xs-series-mini-banner {
  position: relative; aspect-ratio: 16/9;
  background: var(--color-bg-subtle);
}
.xs-series-mini-banner img {
  width: 100%; height: 100%; object-fit: cover;
}
.xs-series-mini-shade {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 60%);
}
.xs-series-mini-title {
  position: absolute; bottom: 10px; left: 12px; right: 12px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 14px; font-weight: 800; color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.7);
  letter-spacing: 0.02em;
}
.xs-series-mini-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; gap: 8px;
  font-size: 11px; color: var(--color-text-muted);
}
.xs-series-mini-foot .meta i { margin-right: 4px; }
.xs-series-mini-foot .link {
  color: var(--color-primary); font-weight: 700;
  font-size: 11px; letter-spacing: 0.04em;
}

/* Watch-list buttons (episode side) — REMOVED. The watch-list controls
   now live in the horizontal .xs-ep-quick-actions row next to Compartir
   inside the episode info card (not in the sidebar). */

/* Compact team list (right sidebar) */
.xs-team-compact {
  list-style: none; display: flex; flex-direction: column;
}
.xs-team-compact li {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
  transition: background var(--motion);
}
.xs-team-compact li:last-child { border-bottom: none; }
.xs-team-compact li:hover { background: var(--color-surface-hover); }
.xs-team-compact .av {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: color-mix(in srgb, var(--color-primary) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-primary) 35%, transparent);
  display: grid; place-items: center; font-size: 14px;
}
.xs-team-compact .body { flex: 1; min-width: 0; padding: 0; }
.xs-team-compact .name {
  font-size: 12px; font-weight: 600; color: var(--color-text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.xs-team-compact .role {
  font-size: 10px; color: var(--color-primary); font-weight: 600;
  letter-spacing: 0.04em;
}
.xs-team-compact .lvl {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px; font-weight: 800; color: var(--color-warning);
  flex-shrink: 0;
}

/* Season pills + mini ep rows (inside seasons accordion) */
.xs-ep-seasons-body { padding: 14px; }
.xs-ep-season-pills {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px;
}
.xs-ep-season-pill {
  padding: 5px 14px; border-radius: 16px;
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  font-size: 12px; font-weight: 600;
  color: var(--color-text-muted); cursor: pointer;
  transition: all var(--motion);
}
.xs-ep-season-pill:hover { color: var(--color-text); }
.xs-ep-season-pill.is-active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}
.xs-ep-season-pane.is-hidden { display: none; }
.xs-ep-season-pane {
  display: flex; flex-direction: column; gap: 4px;
  max-height: 320px; overflow-y: auto;
}

.xs-ep-mini-row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px;
  background: var(--color-bg-subtle);
  border: 1px solid transparent;
  border-radius: 8px;
  transition: all var(--motion);
}
.xs-ep-mini-row:hover {
  background: var(--color-surface-hover);
  border-color: #475569;
}
.xs-ep-mini-row.is-current {
  background: color-mix(in srgb, var(--color-primary) 12%, transparent);
  border-color: var(--color-primary);
}
.xs-ep-mini-thumb {
  width: 80px; height: 45px; border-radius: 4px; overflow: hidden; flex-shrink: 0;
  background: var(--color-bg);
}
.xs-ep-mini-thumb img { width: 100%; height: 100%; object-fit: cover; }
.xs-ep-mini-ep {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 12px; font-weight: 800; letter-spacing: 0.04em;
  color: var(--color-primary); flex-shrink: 0;
}
.xs-ep-mini-row.is-current .xs-ep-mini-ep { color: #fff; }
.xs-ep-mini-title {
  flex: 1; font-size: 12px; color: var(--color-text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.xs-ep-mini-current {
  flex-shrink: 0; color: var(--color-primary); font-size: 11px;
  display: grid; place-items: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(168,85,247,0.2);
}

.xs-ep-recs { padding: 16px; }
.xs-dl-list .name { color: var(--color-primary); font-size: 12px; }

/* Wiki layout responsive collapse */
@media (max-width: 1100px) {
  .xs-wiki-layout { grid-template-columns: 1fr; }
  .xs-wiki-info-card { position: static; }
  .xs-ep-layout { grid-template-columns: 1fr; }
  .xs-ep-side, .xs-ep-wiki-side { position: static; width: 100%; }
  /* Catalog: collapse sidebar to top on tablets */
  .xs-catalog-body { grid-template-columns: 1fr; }
  .xs-catalog-sidebar { position: static; max-height: none; }
  .xs-catalog-sidebar { flex-direction: row; flex-wrap: wrap; gap: 12px; }
  .xs-catalog-sidebar .xs-filter-block { flex-basis: calc(50% - 6px); }
  .xs-catalog-sidebar .xs-active-filters { flex-basis: 100%; }
  .xs-catalog-sidebar .xs-filter-reset { flex-basis: 100%; }
}
@media (max-width: 860px) {
  .xs-profile-tabs { padding: 0 12px; overflow-x: auto; scrollbar-width: none; }
  .xs-profile-tabs::-webkit-scrollbar { display: none; }
  .xs-bucket-tab { font-size: 11px; padding: 5px 10px; }
  .xs-stats-grid { grid-template-columns: 1fr 1fr; }
  .xs-genre-bar-row { grid-template-columns: 100px 1fr 30px; }
  .xs-tooltip { width: 280px; }
}

/* ============================================================
   WIKI MINI — left column on episode pages with section selector
   ============================================================ */
.xs-ep-wiki-card {
  padding: 0;
  display: flex; flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px; overflow: hidden;
}

.xs-wiki-mini-select {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
}
.xs-wiki-mini-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 9px;
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-text-muted);
  font-size: 11px; font-weight: 600;
  cursor: pointer;
  transition: all var(--motion);
}
.xs-wiki-mini-chip i { font-size: 10px; opacity: 0.85; }
.xs-wiki-mini-chip:hover {
  color: var(--color-text);
  border-color: #475569;
}
.xs-wiki-mini-chip.is-active {
  background: color-mix(in srgb, var(--color-primary) 16%, transparent);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.xs-wiki-mini-body {
  padding: 14px;
  display: flex; flex-direction: column; gap: 12px;
}
.xs-wiki-mini-pane.is-hidden { display: none; }
.xs-wiki-mini-pane {
  display: flex; flex-direction: column; gap: 10px;
}

/* ── Personajes mini cards ─────────────────────────────────────── */
.xs-wiki-mini-char {
  display: flex; align-items: center; gap: 10px;
  padding: 8px;
  background: var(--color-bg-subtle);
  border-radius: 8px;
  border: 1px solid var(--color-border);
}
.xs-wiki-mini-char-av {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: color-mix(in srgb, var(--color-primary) 15%, transparent);
  border: 2px solid color-mix(in srgb, var(--color-primary) 35%, transparent);
  display: grid; place-items: center; font-size: 16px;
  overflow: hidden;
}
.xs-wiki-mini-char-av img { width: 100%; height: 100%; object-fit: cover; }
.xs-wiki-mini-char-body { min-width: 0; flex: 1; }
.xs-wiki-mini-char-name {
  font-size: 12px; font-weight: 700; color: var(--color-text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.xs-wiki-mini-char-rank {
  font-size: 10px; color: var(--color-primary);
  font-family: 'Barlow Condensed', sans-serif;
  letter-spacing: 0.04em; text-transform: uppercase;
  margin-top: 2px;
}

/* ── Cultivo mini list ─────────────────────────────────────────── */
.xs-wiki-mini-cult-track {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px; font-weight: 800;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--color-primary);
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--color-border);
}
.xs-wiki-mini-cult-list {
  list-style: none; display: flex; flex-direction: column; gap: 6px;
  padding: 0; margin: 0;
}
.xs-wiki-mini-cult-list li {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12px; color: var(--color-text);
}
.xs-wiki-mini-cult-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.xs-wiki-mini-cult-name {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.xs-wiki-mini-cult-chars {
  display: inline-flex; flex-shrink: 0;
}
.xs-wiki-mini-cult-char-av {
  width: 22px; height: 22px; border-radius: 50%; overflow: hidden;
  border: 2px solid var(--color-surface);
  background: color-mix(in srgb, var(--color-primary) 14%, transparent);
  display: grid; place-items: center;
  font-size: 10px; font-weight: 700;
  color: var(--color-text);
  margin-left: -7px;
  position: relative;
}
.xs-wiki-mini-cult-char-av:first-child { margin-left: 0; }
.xs-wiki-mini-cult-char-av img { width: 100%; height: 100%; object-fit: cover; }
.xs-wiki-mini-cult-extra {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px; font-weight: 800;
  color: var(--color-text-muted);
  margin-left: 4px;
  align-self: center;
}

/* ── Mundo mini ─────────────────────────────────────────────── */
.xs-wiki-mini-world {
  padding: 10px;
  background: var(--color-bg-subtle);
  border-radius: 8px;
  border: 1px solid var(--color-border);
}
.xs-wiki-mini-world-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.xs-wiki-mini-world-emoji { font-size: 16px; }
.xs-wiki-mini-world-name { font-size: 12px; font-weight: 700; color: var(--color-text); }
.xs-wiki-mini-world-desc { font-size: 11px; color: var(--color-text-muted); line-height: 1.4; margin: 0; }

/* ── Cronología mini ─────────────────────────────────────────── */
.xs-wiki-mini-tl {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
}
.xs-wiki-mini-tl:last-child { border-bottom: none; }
.xs-wiki-mini-tl-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  margin-top: 4px;
  box-shadow: 0 0 0 3px var(--color-bg-subtle);
}
.xs-wiki-mini-tl-time { font-size: 11px; font-weight: 800; color: var(--color-text); }
.xs-wiki-mini-tl-desc { font-size: 11px; color: var(--color-text-muted); line-height: 1.4; }

/* ── Trama prose ─────────────────────────────────────────────── */
.xs-wiki-mini-prose {
  font-size: 12px; line-height: 1.55; color: var(--color-text);
}
.xs-wiki-mini-prose p { margin: 0 0 8px; }
.xs-wiki-mini-prose p:last-child { margin-bottom: 0; }

/* ── CTA → full wiki ─────────────────────────────────────────── */
.xs-wiki-mini-cta {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px;
  border-top: 1px solid var(--color-border);
  background: color-mix(in srgb, var(--color-primary) 8%, transparent);
  color: var(--color-primary);
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  text-decoration: none;
  transition: background var(--motion);
}
.xs-wiki-mini-cta:hover {
  background: color-mix(in srgb, var(--color-primary) 18%, transparent);
}
