/* Catalogo de peliculas y series - mobile first */
:root {
  --bg: #080b10;
  --panel: #0d1117;
  --panel-2: #111827;
  --surface: rgba(15, 23, 42, .78);
  --surface-2: rgba(17, 24, 39, .84);
  --field: #0b1220;
  --field-text: #eef2ff;
  --line: #273142;
  --text: #eef2ff;
  --muted: #9ca3af;
  --accent: #7c3aed;
  --accent-2: #0ea5e9;
  --glow-a: rgba(14, 165, 233, .18);
  --glow-b: rgba(124, 58, 237, .16);
  --shadow: 0 18px 55px rgba(0, 0, 0, .42);
  --radius: 16px;
}

body.theme-jade {
  --bg: #07110f;
  --panel: #0b1714;
  --panel-2: #10231f;
  --line: #24443c;
  --accent: #10b981;
  --accent-2: #22d3ee;
  --glow-a: rgba(16, 185, 129, .17);
  --glow-b: rgba(34, 211, 238, .13);
}

body.theme-rose {
  --bg: #100811;
  --panel: #180d1b;
  --panel-2: #231225;
  --line: #462944;
  --accent: #d946ef;
  --accent-2: #fb7185;
  --glow-a: rgba(217, 70, 239, .16);
  --glow-b: rgba(251, 113, 133, .14);
}

body.theme-ember {
  --bg: #100c08;
  --panel: #171108;
  --panel-2: #231a0d;
  --line: #49351b;
  --accent: #f59e0b;
  --accent-2: #38bdf8;
  --glow-a: rgba(245, 158, 11, .16);
  --glow-b: rgba(56, 189, 248, .12);
}

body.theme-light {
  --bg: #f8fafc;
  --panel: #ffffff;
  --panel-2: #eef2ff;
  --surface: rgba(255, 255, 255, .86);
  --surface-2: rgba(241, 245, 249, .92);
  --field: #ffffff;
  --field-text: #0f172a;
  --line: #cbd5e1;
  --text: #0f172a;
  --muted: #475569;
  --accent: #2563eb;
  --accent-2: #14b8a6;
  --glow-a: rgba(37, 99, 235, .12);
  --glow-b: rgba(20, 184, 166, .10);
}

body.theme-graphite {
  --bg: #111827;
  --panel: #161f2e;
  --panel-2: #1f2937;
  --surface: rgba(22, 31, 46, .86);
  --surface-2: rgba(31, 41, 55, .92);
  --field: #111827;
  --field-text: #f8fafc;
  --line: #4b5563;
  --accent: #94a3b8;
  --accent-2: #f8fafc;
  --glow-a: rgba(148, 163, 184, .14);
  --glow-b: rgba(248, 250, 252, .08);
}

body.theme-contrast {
  --bg: #000;
  --panel: #050505;
  --panel-2: #111;
  --surface: #050505;
  --surface-2: #111;
  --field: #000;
  --field-text: #fff;
  --line: #facc15;
  --text: #fff;
  --muted: #fde68a;
  --accent: #facc15;
  --accent-2: #fff;
  --glow-a: rgba(250, 204, 21, .22);
  --glow-b: rgba(255, 255, 255, .10);
}

body.theme-ocean {
  --bg: #061826;
  --panel: #0a2233;
  --panel-2: #0f3147;
  --line: #155e75;
  --accent: #06b6d4;
  --accent-2: #3b82f6;
  --glow-a: rgba(6, 182, 212, .18);
  --glow-b: rgba(59, 130, 246, .15);
}

body.theme-sakura {
  --bg: #140914;
  --panel: #1f1020;
  --panel-2: #2b162b;
  --line: #6b315c;
  --accent: #f472b6;
  --accent-2: #fda4af;
  --glow-a: rgba(244, 114, 182, .18);
  --glow-b: rgba(253, 164, 175, .14);
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  background:
    radial-gradient(circle at 12% 0%, var(--glow-a), transparent 28%),
    radial-gradient(circle at 90% 8%, var(--glow-b), transparent 24%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Arial, sans-serif;
}

body {
  min-height: 100svh;
  padding-bottom: 104px;
}

body.auth-locked {
  padding-bottom: 0;
  overflow-x: hidden;
}

body.auth-checking #authGateLogin {
  display: none;
}

.auth-gate {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 22px;
}

.auth-gate[hidden] {
  display: none;
}

.auth-card {
  width: min(460px, 100%);
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 26px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(15, 23, 42, .92), rgba(8, 11, 16, .92));
  box-shadow: var(--shadow);
  text-align: center;
}

.auth-card h1 {
  margin: 0;
  font-size: clamp(34px, 8vw, 54px);
  line-height: 1;
}

.auth-card p {
  max-width: 34ch;
  margin: 0;
  color: #cbd5e1;
  line-height: 1.45;
}

.auth-card .primary {
  min-height: 48px;
  padding-inline: 18px;
}

.auth-mark {
  width: 58px;
  height: 58px;
  font-size: 28px;
}

button,
input,
select,
textarea { font: inherit; }

button {
  cursor: pointer;
  border: 0;
  -webkit-tap-highlight-color: transparent;
}

button,
.btn,
select,
.select-btn,
.card,
.source-box,
.info,
.tag {
  transition: transform .2s ease, border-color .2s ease, background .2s ease, box-shadow .2s ease, color .2s ease, opacity .2s ease;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.bi {
  line-height: 1;
}

.no-animations *,
.no-animations *::before,
.no-animations *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

.app {
  width: min(100%, 1240px);
  margin: 0 auto;
  padding: 12px;
}

.hero {
  position: relative;
  z-index: 30;
  margin: 0;
  padding: 12px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel) 96%, transparent), color-mix(in srgb, var(--panel) 88%, transparent));
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}

input,
select,
textarea,
.form-control,
.control {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--field);
  color: var(--field-text);
  min-height: 44px;
  padding: 10px 12px;
  outline: none;
}

input::placeholder,
textarea::placeholder,
.form-control::placeholder,
.control::placeholder {
  color: color-mix(in srgb, var(--muted) 72%, transparent);
}

input:focus,
select:focus,
textarea:focus,
.form-control:focus,
.control:focus {
  border-color: color-mix(in srgb, var(--accent-2) 72%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 18%, transparent);
}

.form-check-input,
.switch-input,
.switch-track {
  appearance: none !important;
  -webkit-appearance: none !important;
  position: relative;
  flex: 0 0 auto;
  width: 48px !important;
  height: 28px !important;
  margin: 0 !important;
  padding: 0 !important;
  aspect-ratio: auto !important;
  border: 1px solid var(--border-strong, var(--line)) !important;
  border-radius: 999px !important;
  background-color: var(--input-bg, var(--surface-2)) !important;
  background-image: none !important;
  cursor: pointer;
  box-shadow: none !important;
  display: inline-block !important;
  min-width: 48px !important;
  max-width: 48px !important;
  min-height: 28px !important;
  max-height: 28px !important;
  transform: none !important;
  transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.form-check-input::before,
.switch-input::before,
.switch-thumb {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-soft, var(--text));
  box-shadow: 0 2px 8px rgba(0, 0, 0, .28);
  transition: transform .18s ease, background-color .18s ease;
}

.form-check-input:checked,
.switch-input:checked,
.switch.is-on .switch-track {
  background-color: var(--accent) !important;
  border-color: color-mix(in srgb, var(--accent) 72%, var(--accent-2)) !important;
}

.form-check-input:checked::before,
.switch-input:checked::before,
.switch.is-on .switch-thumb {
  transform: translateX(20px);
  background: #fff;
}

.form-check-input:disabled,
.switch-input:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.form-check-input:focus,
.switch-input:focus {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 18%, transparent) !important;
}

.form-check.form-switch {
  min-height: 0;
  padding: 0;
  display: flex;
  align-items: center;
}

.switch {
  display: inline-flex;
  align-items: center;
}

.profile-socials-panel {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
}

.profile-socials-panel summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text);
  font-weight: 800;
  list-style: none;
}

.profile-socials-panel summary::-webkit-details-marker {
  display: none;
}

.profile-socials-panel summary::after {
  content: "\F282";
  margin-left: auto;
  font-family: "bootstrap-icons";
  color: var(--muted);
  transition: transform .18s ease;
}

.profile-socials-panel[open] summary::after {
  transform: rotate(180deg);
}

.topbar,
.searchbox,
.filters {
  width: min(100%, 1240px);
  margin-inline: auto;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: 10px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-home {
  width: fit-content;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.brand-home:hover .brand-mark {
  transform: translateY(-1px) scale(1.04);
  border-color: rgba(147, 197, 253, .44);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(14, 165, 233, .24), rgba(124, 58, 237, .32));
  border: 1px solid rgba(147, 197, 253, .22);
  color: #dbeafe;
  box-shadow: 0 14px 30px rgba(0, 0, 0, .24);
  font-size: 21px;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.user-box {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  max-width: min(520px, 62vw);
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 16px;
  background: rgba(255, 255, 255, .035);
}

.user-status,
.save-status {
  color: #cbd5e1;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.save-status.ok { color: #86efac; }
.save-status.error { color: #fca5a5; }

.profile-card {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 14px;
  background: rgba(255,255,255,.04);
}

.profile-icon {
  flex: 0 0 auto;
  font-size: 38px;
  color: #93c5fd;
}

.profile-card strong,
.profile-card span {
  display: block;
  overflow-wrap: anywhere;
}

.profile-card span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.profile-data {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 12px 0;
}

.profile-data .info {
  margin: 0;
}

.profile-shell {
  width: min(760px, 100%);
  margin: 0 auto;
}

.profile-panel {
  text-align: center;
}

.profile-panel .settings-actions {
  max-width: 520px;
  margin-inline: auto;
}

.profile-card {
  justify-content: center;
  text-align: left;
}

.profile-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.profile-metric,
.profile-data-card {
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 14px;
  background: rgba(255,255,255,.045);
  padding: 11px;
}

.profile-metric {
  display: grid;
  place-items: center;
  gap: 4px;
}

.profile-metric .bi {
  color: #93c5fd;
  font-size: 18px;
}

.profile-metric strong {
  font-size: 18px;
  overflow-wrap: anywhere;
}

.profile-metric span,
.profile-data-card span {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.profile-data-card {
  text-align: left;
}

.profile-data-card b {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
  color: var(--text);
  font-size: 12px;
}

.profile-hero-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-2);
  text-align: left;
}

.profile-banner {
  min-height: 96px;
  background:
    radial-gradient(circle at 18% 20%, color-mix(in srgb, var(--accent-2) 34%, transparent), transparent 32%),
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 32%, var(--panel)), var(--panel-2));
}

.profile-hero-content {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: end;
  padding: 0 16px 16px;
  margin-top: -32px;
}

.profile-avatar {
  width: 86px;
  height: 86px;
  border: 4px solid var(--panel);
  border-radius: 24px;
  object-fit: cover;
  background: var(--surface-2);
}

.profile-hero-content h3 {
  margin: 34px 0 2px;
  font-size: clamp(1.25rem, 4vw, 2rem);
}

.profile-hero-content p {
  margin: 8px 0 0;
  color: var(--muted);
}

.profile-form-grid .wide {
  grid-column: 1 / -1;
}

.public-profile-editor h4 {
  margin: 4px 0 0;
  font-size: 1rem;
}

.profile-account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.api-chip-grid {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.api-chip {
  display: inline-grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 5px 7px;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 999px;
  background: rgba(255,255,255,.045);
  color: #d1d5db;
  font-size: 12px;
}

.api-chip.ok {
  border-color: rgba(34, 197, 94, .34);
  background: rgba(34, 197, 94, .10);
  color: #dcfce7;
}

.api-chip small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 10px;
}

h1 {
  font-size: clamp(24px, 5vw, 36px);
  margin: 0;
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: 0;
}

.sub {
  font-size: 13px;
  color: #cbd5e1;
  margin-top: 4px;
  line-height: 1.35;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .05);
  color: var(--text);
  border-radius: 999px;
  padding: 9px 11px;
  font-size: 12px;
  white-space: nowrap;
}

.searchbox {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.searchbox input {
  width: 100%;
  min-width: 0;
  background: #0b1220;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 14px;
  padding: 13px 14px;
  outline: none;
  font-size: 16px;
}

.primary {
  background: linear-gradient(135deg, var(--accent), #2563eb);
  color: #fff;
  border-radius: 14px;
  padding: 0 16px;
  font-weight: 700;
  min-height: 48px;
}

.filters {
  display: flex;
  gap: 8px;
  overflow: auto;
  padding: 10px 0 2px;
  scrollbar-width: none;
}

.filters::-webkit-scrollbar { display: none; }

select {
  background: #0b1220;
  border: 1px solid var(--line);
  color: var(--text);
  color-scheme: dark;
  border-radius: 999px;
  padding: 9px 11px;
  font-size: 13px;
  outline: none;
  min-width: max-content;
}

select:hover {
  border-color: rgba(147, 197, 253, .48);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, .08);
}

select:focus {
  border-color: rgba(14, 165, 233, .8);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, .14);
}

select.has-value {
  border-color: rgba(14, 165, 233, .8);
  background: linear-gradient(135deg, rgba(14, 165, 233, .18), rgba(124, 58, 237, .14));
  color: #f8fafc;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, .10);
}

select option {
  background: #0f172a;
  color: #f8fafc;
}

select option:checked {
  background: #2563eb;
  color: #fff;
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 10px 0 14px;
}

.toolbar .left,
.toolbar .right {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.toolbar .right { justify-content: flex-start; }

.ghost {
  background: rgba(255, 255, 255, .05);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 11px;
  font-size: 13px;
  min-height: 38px;
}

.ghost:hover,
.smallbtn:hover,
.linkbtn:hover,
.primary:hover,
.select-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(147, 197, 253, .52);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .22);
}

.ghost:active,
.smallbtn:active,
.linkbtn:active,
.primary:active,
.select-btn:active {
  transform: translateY(0) scale(.97);
}

.ghost.active {
  border-color: rgba(124, 58, 237, .85);
  background: rgba(124, 58, 237, .18);
}

.select-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  max-width: 100%;
  background: rgba(255, 255, 255, .05);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 9px;
  font-size: 13px;
}

.select-btn.has-value {
  border-color: rgba(14, 165, 233, .82);
  background: linear-gradient(135deg, rgba(14, 165, 233, .18), rgba(124, 58, 237, .14));
  box-shadow: 0 0 0 3px rgba(14, 165, 233, .10);
}

.select-btn select {
  min-width: 0;
  max-width: 132px;
  padding: 0 18px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  color-scheme: dark;
}

.select-btn select:focus {
  box-shadow: none;
}

.select-btn select option {
  background: #0f172a;
  color: #f8fafc;
}

.select-btn select option:checked {
  background: #2563eb;
  color: #fff;
}

.select-btn .bi {
  color: #cbd5e1;
}

.stats {
  font-size: 12px;
  color: var(--muted);
}

.query-hints {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  margin: -2px 0 12px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 12px;
  background: rgba(255, 255, 255, .04);
  color: #cbd5e1;
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.infinite-status {
  grid-column: 1 / -1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  margin: 18px auto 4px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 999px;
  background: rgba(255, 255, 255, .05);
  color: #cbd5e1;
  font-size: 13px;
}

.infinite-status[hidden] {
  display: none;
}

.infinite-status .bi {
  color: #93c5fd;
}

.infinite-status .bi-arrow-repeat,
.loading-icon .bi {
  animation: spin 1s linear infinite;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(144px, 1fr));
  gap: 12px;
}

.grid.list {
  display: flex;
  flex-direction: column;
}

.card {
  position: relative;
  background: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .025));
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .20);
  min-width: 0;
}

.card:hover {
  transform: translateY(-4px);
  border-color: rgba(147, 197, 253, .28);
  box-shadow: 0 18px 42px rgba(0, 0, 0, .32);
}

.adult-blur .poster,
.adult-blur .cover-fallback,
.poster--blurred-adult {
  filter: blur(14px) saturate(.75);
  transform: scale(1.04);
}

.episode-thumb--blurred {
  filter: blur(18px);
  transform: scale(1.12);
}

.adult-blur-badge {
  position: absolute;
  inset: auto 10px 10px 10px;
  z-index: 4;
  display: inline-flex;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .62);
  color: #fff;
  font-weight: 800;
}

.catalog-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.catalog-pagination-shell {
  margin: 18px auto 8px;
  color: var(--muted);
}

.catalog-pagination-shell[hidden] {
  display: none;
}

.catalog-page-select {
  width: auto;
  min-height: 38px;
  padding-block: 7px;
}

.card:active {
  transform: translateY(-1px) scale(.99);
}

.card:hover .poster {
  transform: scale(1.035);
}

.poster-wrap {
  position: relative;
  width: 100%;
  padding: 0;
  text-align: inherit;
  color: inherit;
  background: var(--panel-2);
  aspect-ratio: 2 / 3;
  overflow: hidden;
}

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

.poster {
  transition: transform .32s ease, filter .32s ease;
}

.cover-fallback {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px;
  color: #fff;
  text-align: left;
  background:
    linear-gradient(160deg, rgba(8, 11, 16, .08), rgba(8, 11, 16, .76)),
    linear-gradient(135deg, #0f766e, #312e81 52%, #7c2d12);
}

.cover-fallback.korea { background: linear-gradient(145deg, #831843, #312e81 56%, #0f172a); }
.cover-fallback.asia { background: linear-gradient(145deg, #0f766e, #1e3a8a 56%, #111827); }
.cover-fallback.west { background: linear-gradient(145deg, #334155, #7c2d12 56%, #111827); }
.cover-fallback.other { background: linear-gradient(145deg, #374151, #4338ca 56%, #111827); }

.cover-fallback span {
  color: rgba(255, 255, 255, .78);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.cover-fallback strong {
  font-size: clamp(18px, 8vw, 28px);
  line-height: 1.02;
  overflow-wrap: anywhere;
}

.badges {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  justify-content: space-between;
}

.badge {
  background: rgba(0, 0, 0, .68);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, .14);
  color: #fff;
  border-radius: 999px;
  padding: 5px 7px;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge.green { background: rgba(34, 197, 94, .78); }
.badge.purple { background: rgba(124, 58, 237, .78); }
.badge.orange { background: rgba(245, 158, 11, .82); }

.content { padding: 10px; }

.title {
  background: transparent;
  color: var(--text);
  text-align: left;
  width: 100%;
  padding: 0;
  font-weight: 800;
  font-size: 14px;
  line-height: 1.2;
  margin: 0 0 5px;
  overflow-wrap: anywhere;
}

.meta {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

.source-box {
  margin: 12px 0;
  padding: 10px;
  border: 1px solid rgba(14, 165, 233, .22);
  border-radius: 12px;
  background: rgba(14, 165, 233, .08);
  color: #dbeafe;
}

.source-box:hover {
  border-color: rgba(147, 197, 253, .42);
  background: rgba(14, 165, 233, .12);
  transform: translateY(-1px);
}

.source-box.compact {
  margin: 8px 0 0;
  padding: 8px;
}

.source-box-title {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #f8fafc;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.source-box-title span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-box-row {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 5px;
  color: #bfdbfe;
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.source-box-row .bi {
  flex: 0 0 auto;
  margin-top: 1px;
  color: #93c5fd;
}

.source-box.compact .source-box-row {
  overflow: hidden;
}

.source-box.compact .source-box-row span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.genres {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.tag {
  font-size: 11px;
  color: #cbd5e1;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .08);
  padding: 4px 7px;
  border-radius: 999px;
}

.tag:hover {
  color: #fff;
  border-color: rgba(147, 197, 253, .35);
  background: rgba(14, 165, 233, .14);
  transform: translateY(-1px);
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 10px;
}

.smallbtn {
  background: #111827;
  color: #e5e7eb;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  font-size: 12px;
  min-width: 0;
}

.smallbtn.ok {
  background: rgba(34, 197, 94, .16);
  border-color: rgba(34, 197, 94, .38);
}

.smallbtn.save {
  background: rgba(124, 58, 237, .16);
  border-color: rgba(124, 58, 237, .38);
}

.smallbtn.danger {
  background: rgba(239, 68, 68, .14);
  border-color: rgba(248, 113, 113, .38);
  color: #fecaca;
}

.grid.list .card {
  display: grid;
  grid-template-columns: 86px 1fr;
}

.grid.list .poster-wrap {
  min-height: 129px;
}

.empty {
  grid-column: 1 / -1;
  border: 1px dashed var(--line);
  border-radius: 16px;
  padding: 22px;
  text-align: center;
  color: var(--muted);
  background: rgba(255, 255, 255, .03);
}

.loading-state {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 180px;
}

.loading-state strong {
  color: #f8fafc;
  font-size: 16px;
}

.loading-state span:not(.loading-icon) {
  color: var(--muted);
  font-size: 13px;
}

.loading-icon {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  border: 1px solid rgba(147, 197, 253, .35);
  background: rgba(14, 165, 233, .12);
  color: #93c5fd;
  font-size: 24px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.bottom-nav {
  position: fixed;
  z-index: 50;
  left: 50%;
  right: auto;
  bottom: max(12px, env(safe-area-inset-bottom));
  width: min(calc(100% - 20px), 520px);
  transform: translateX(-50%);
  background: rgba(8, 11, 16, .9);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 18px;
  box-shadow: 0 18px 55px rgba(0, 0, 0, .46);
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.navbtn {
  position: relative;
  background: transparent;
  color: var(--muted);
  padding: 8px 4px;
  border-radius: 13px;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: center;
  min-width: 0;
  overflow: hidden;
  transition: color .22s ease, background .22s ease, transform .22s ease;
}

.navbtn::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(124, 58, 237, .34), rgba(14, 165, 233, .22));
  opacity: 0;
  transform: scale(.82);
  transition: opacity .22s ease, transform .22s ease;
  z-index: -1;
}

.navbtn:hover {
  color: #fff;
  transform: translateY(-2px);
}

.navbtn:active {
  transform: translateY(0) scale(.96);
}

.navbtn span:last-child {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.navbtn.active {
  background: rgba(124, 58, 237, .12);
  color: #fff;
  transform: translateY(-2px);
}

.navbtn.active::before {
  opacity: 1;
  transform: scale(1);
}

.ico {
  font-size: 18px;
  line-height: 1;
  transition: transform .22s ease;
}

.navbtn.active .ico {
  transform: translateY(-1px) scale(1.08);
}

.navbtn:hover .ico {
  transform: translateY(-1px) rotate(-4deg);
}

.tab-animate {
  animation: tabFade .24s ease both;
}

@keyframes tabFade {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

dialog {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  max-width: none;
}

dialog::backdrop {
  background: rgba(0, 0, 0, .72);
  backdrop-filter: blur(6px);
}

.detail-modal {
  width: min(940px, calc(100vw - 18px));
  max-height: min(88svh, 860px);
  overflow: auto;
  background: linear-gradient(180deg, #0f172a, #080b10);
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: var(--shadow);
  border-radius: 18px;
}

.detail-modal-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(15, 23, 42, .92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.x {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  color: white;
  font-size: 19px;
  padding: 0;
}

.detail-modal-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  padding: 14px;
}

.modal-poster-shell {
  display: block;
  width: min(180px, 48vw);
}

.modal-poster {
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 14px;
  object-fit: cover;
  background: #111827;
  overflow: hidden;
}

.modal-title {
  font-size: 24px;
  line-height: 1.08;
  margin: 0 0 7px;
  overflow-wrap: anywhere;
}

.synopsis {
  color: #d1d5db;
  font-size: 14px;
  line-height: 1.55;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 12px 0;
}

.info {
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 12px;
  padding: 9px;
}

.info:hover {
  border-color: rgba(147, 197, 253, .28);
  background: rgba(255, 255, 255, .065);
  transform: translateY(-2px);
}

.info b {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}

.info b .bi {
  color: #93c5fd;
}

.info span { font-size: 13px; }

.modal-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.linkbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  background: rgba(255, 255, 255, .05);
  color: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
}

.media-detail-page,
.episode-page {
  display: grid;
  gap: 14px;
}

.media-detail-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.media-poster-shell {
  width: min(220px, 62vw);
}

.media-page-poster {
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 16px;
  object-fit: cover;
  background: #111827;
  overflow: hidden;
}

.media-page-title,
.episode-head h2 {
  margin: 6px 0 0;
  font-size: clamp(26px, 6vw, 44px);
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.episode-number-line {
  display: inline-flex;
  align-items: center;
  margin-top: 6px;
  font-weight: 800;
  color: #bfdbfe;
}

.episode-title-line {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.episodes-section {
  border-top: 1px solid rgba(255, 255, 255, .08);
  padding-top: 14px;
}

.episodes-section h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 18px;
}

.episodes-toolbar {
  display: flex;
  justify-content: flex-end;
  margin: -2px 0 12px;
}

.episode-view-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(148, 163, 184, .22);
  border-radius: 12px;
  background: rgba(15, 23, 42, .78);
}

.episode-view-toggle .btn {
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 9px;
  color: var(--muted);
}

.episode-view-toggle .btn.active {
  color: #fff;
  background: rgba(59, 130, 246, .24);
  border-color: rgba(147, 197, 253, .36);
}

.episodes-grid,
.server-buttons {
  display: grid;
  gap: 10px;
}

.episodes-grid {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.server-buttons {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.server-group {
  display: grid;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.server-group:first-child { border-top: 0; }

.server-group h4 {
  margin: 0;
  font-size: .9rem;
  color: var(--muted);
}

.third-party-notice {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel-2) 78%, transparent);
  color: var(--muted);
  font-size: .88rem;
}

.terms-dialog {
  width: min(560px, calc(100vw - 24px));
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0;
  background: var(--panel);
  color: var(--text);
}

.terms-dialog::backdrop { background: rgba(0, 0, 0, .68); }

.terms-card {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 20px;
}

.terms-card [data-close-terms] {
  position: absolute;
  right: 10px;
  top: 10px;
}

.episodes-grid.episodes-list {
  grid-template-columns: 1fr;
}

.episodes-more {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
  padding: 14px 0 6px;
}

.episodes-more .btn {
  min-width: min(260px, 100%);
}

.episodes-more small,
.episodes-more.done {
  color: var(--muted);
  font-size: 13px;
}

.episodes-more.done {
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 12px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, .04);
}

.player-toolbar {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin: 4px 0 10px;
}

.player-toolbar .btn.active {
  border-color: rgba(250, 204, 21, .7);
  color: #fef3c7;
  background: rgba(250, 204, 21, .16);
}

.episode-page.player-size-stage .player-container {
  width: min(100%, 1180px);
  margin-inline: auto;
}

.episode-page.player-size-small .player-container {
  width: min(720px, 100%);
  margin-inline: auto;
}

body.lights-off #playerContainer iframe {
  box-shadow: 0 24px 80px rgba(0, 0, 0, .65);
}

body.dev-mode::after {
  content: "DEV";
  position: fixed;
  z-index: 200;
  right: 12px;
  bottom: 76px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f59e0b;
  color: #111827;
  font: 800 12px/1 system-ui, sans-serif;
  letter-spacing: 0;
}

.loading-icon.compact {
  width: 18px;
  height: 18px;
  font-size: 14px;
}

.server-buttons .active {
  border-color: rgba(34, 197, 94, .7);
  background: linear-gradient(135deg, rgba(34, 197, 94, .28), rgba(14, 165, 233, .16));
  color: #dcfce7;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, .12);
}

.server-buttons .active .bi {
  color: #86efac;
}

.episode-card {
  position: relative;
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 74px;
  padding: 8px;
  border: 1px solid rgba(147, 197, 253, .24);
  border-radius: 12px;
  background: rgba(255, 255, 255, .05);
  color: #fff;
  text-align: left;
  overflow: hidden;
}

.episodes-tile-grid .episode-card {
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  align-items: start;
  min-height: 178px;
  padding: 10px;
}

.episodes-tile-grid .episode-card .episode-thumb,
.episodes-tile-grid .episode-card .episode-thumb-fallback {
  grid-column: 1 / -1;
  width: 100%;
  border-radius: 10px;
}

.episodes-tile-grid .episode-card .episode-card-info {
  padding-top: 2px;
}

.episode-card:focus-visible,
.episode-card:focus,
.episode-view-toggle .btn:focus-visible,
.episode-nav .btn:focus-visible,
.servers-container .btn:focus-visible {
  outline: 3px solid rgba(96, 165, 250, .95);
  outline-offset: 3px;
  box-shadow: 0 0 0 7px rgba(37, 99, 235, .24);
}

.episodes-grid.episodes-list .episode-card {
  grid-template-columns: 140px minmax(0, 1fr) auto;
  min-height: 96px;
}

.episodes-grid.episodes-list .episode-thumb,
.episodes-grid.episodes-list .episode-thumb-fallback {
  width: 140px;
}

.episode-thumb,
.episode-thumb-fallback {
  width: 82px;
  aspect-ratio: 16 / 9;
  border-radius: 9px;
  background: #111827;
  object-fit: cover;
  display: block;
}

.episode-thumb-fallback {
  display: grid;
  align-content: end;
  gap: 2px;
  padding: 7px;
  background:
    linear-gradient(160deg, rgba(8, 11, 16, .08), rgba(8, 11, 16, .78)),
    linear-gradient(135deg, #7c2d12, #312e81 58%, #0f766e);
}

.episode-thumb-fallback.generated-cover {
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, .22), transparent 30%),
    linear-gradient(160deg, rgba(8, 11, 16, .08), rgba(8, 11, 16, .82)),
    linear-gradient(135deg, var(--ep-a), var(--ep-b) 58%, var(--ep-c));
}

.episode-thumb-fallback strong {
  font-size: 20px;
  line-height: 1;
}

.episode-thumb-fallback small {
  color: rgba(255, 255, 255, .78);
  font-size: 9px;
  line-height: 1.1;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.episode-card-info {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.episode-card-info span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.episode-card-info small {
  color: var(--muted);
  font-size: 11px;
}

.episode-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
}

.episode-check-btn {
  border-color: rgba(34, 197, 94, .35);
  background: rgba(34, 197, 94, .12);
}

.episode-check-btn.is-watched,
.smallbtn.is-watched {
  border-color: rgba(34, 197, 94, .64);
  background: rgba(34, 197, 94, .22);
  color: #dcfce7;
}

.player-container {
  min-height: 220px;
  aspect-ratio: 16 / 9;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 16px;
  background: #020617;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.player-container:empty::before {
  content: "Selecciona un servidor";
  color: var(--muted);
  font-size: 13px;
}

.player-container iframe {
  width: 100%;
  height: 100%;
  min-height: 100%;
  border: 0;
  display: block;
}

.servers-container {
  display: grid;
  gap: 10px;
}

.episode-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.episode-nav .btn {
  min-height: 42px;
}

.episode-nav .btn:disabled {
  cursor: not-allowed;
  opacity: .45;
  transform: none;
  box-shadow: none;
}

.drawer {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: none;
}

.drawer.show { display: block; }

.drawer-bg {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .55);
}

.drawer-panel {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: min(440px, 92vw);
  background: #0b1220;
  border-left: 1px solid rgba(255, 255, 255, .1);
  box-shadow: var(--shadow);
  padding: 16px;
  overflow: auto;
}

.drawer h2 { margin: 0 0 12px; }

.field { margin: 12px 0; }

.field label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  background: #080b10;
  border: 1px solid var(--line);
  color: #fff;
  border-radius: 13px;
  padding: 12px;
  outline: none;
}

.notice {
  font-size: 12px;
  line-height: 1.45;
  color: #cbd5e1;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 12px;
  padding: 10px;
  margin: 10px 0;
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, .08);
  background: rgba(255, 255, 255, .04);
  border-radius: 12px;
  margin: 8px 0;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 14px;
  background: rgba(255, 255, 255, .04);
}

.history-poster {
  width: 76px;
  aspect-ratio: 2 / 3;
  padding: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #111827;
}

.history-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: flex;
}

.history-row strong,
.history-row span,
.history-row small {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.history-row span {
  color: #cbd5e1;
  font-size: 13px;
}

.history-row small {
  color: var(--muted);
  font-size: 11px;
  margin-top: 3px;
}

.history-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.library-tabs-hidden {
  display: none !important;
}

.list-picker-modal {
  width: min(520px, calc(100vw - 18px));
}

.list-picker-body {
  padding: 14px;
}

.list-picker-body p {
  margin: 0 0 10px;
  color: var(--muted);
}

#listPickerOptions {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.list-choice {
  justify-content: flex-start;
  width: 100%;
  min-height: 44px;
}

.settings-shell {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.settings-panel {
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 16px;
  background: rgba(255, 255, 255, .04);
  padding: 14px;
}

.settings-panel h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.panel-copy {
  margin: -4px 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.setting-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid rgba(255, 255, 255, .08);
}

.setting-row:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.setting-row strong {
  display: block;
  font-size: 14px;
}

.setting-row span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.settings-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 12px;
}

.mini-segment {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(148, 163, 184, .22);
  border-radius: 12px;
  background: rgba(15, 23, 42, .78);
}

.mini-segment .btn {
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 9px;
  color: var(--muted);
}

.mini-segment .btn.active {
  color: #fff;
  background: rgba(59, 130, 246, .24);
  border-color: rgba(147, 197, 253, .36);
}

.theme-row {
  align-items: start;
}

.theme-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  width: min(520px, 100%);
}

.theme-option {
  justify-content: flex-start;
  gap: 10px;
  min-height: 58px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  text-align: left;
}

.theme-option.active {
  border-color: color-mix(in srgb, var(--accent-2) 58%, var(--line));
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 20%, var(--surface-2)), color-mix(in srgb, var(--accent-2) 16%, var(--surface-2)));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 14%, transparent);
}

.theme-swatches {
  display: inline-flex;
  flex: 0 0 auto;
  overflow: hidden;
  width: 44px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 999px;
}

.theme-swatches i {
  display: block;
  flex: 1 1 0;
}

.hero,
.bottom-nav,
.settings-panel,
.drawer-panel,
.auth-card,
.detail-modal,
.card,
.list-row,
.managed-list-item,
.history-row {
  border-color: color-mix(in srgb, var(--accent) 22%, rgba(255, 255, 255, .10));
}

.primary,
.navbtn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.brand-mark {
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent-2) 32%, transparent), color-mix(in srgb, var(--accent) 42%, transparent));
}

.theme-option strong,
.theme-option small {
  display: block;
}

.theme-option small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.sources-panel {
  grid-column: 1 / -1;
}

.source-settings-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}

.source-search {
  margin: 4px 0 12px;
  min-height: 42px;
  background: rgba(15, 23, 42, .84);
  color: var(--text);
  border: 1px solid rgba(148, 163, 184, .24);
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}

.source-search::placeholder {
  color: #64748b;
}

.source-search:focus {
  background: rgba(15, 23, 42, .96);
  color: #fff;
  border-color: rgba(96, 165, 250, .65);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .2);
}

.source-group-title {
  margin: 10px 0 8px;
  font-size: 14px;
  color: #dbeafe;
}

.source-disabled-details {
  margin-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, .08);
  padding-top: 10px;
}

.source-disabled-details summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 10px;
}

.source-setting {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 14px;
  background: rgba(255, 255, 255, .04);
}

.source-setting.is-disabled {
  opacity: .58;
  background: rgba(255, 255, 255, .025);
}

.source-setting-main {
  display: flex;
  gap: 10px;
  min-width: 0;
}

.source-setting-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(14, 165, 233, .12);
  color: #93c5fd;
}

.source-setting strong {
  display: block;
  font-size: 14px;
}

.source-setting p {
  margin: 3px 0 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.source-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.source-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(147, 197, 253, .12);
  color: #bfdbfe;
  font-size: 10px;
}

.source-pill.free {
  background: rgba(34, 197, 94, .12);
  color: #bbf7d0;
}

.source-pill.adult {
  background: rgba(244, 63, 94, .14);
  color: #fecdd3;
}

.source-toggle {
  display: grid;
  justify-items: center;
  gap: 4px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.secret-field {
  position: relative;
}

.secret-field input {
  padding-right: 46px;
}

.secret-toggle {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 10px;
}

.icon-actions {
  grid-template-columns: repeat(3, 42px);
  justify-content: start;
}

.icon-only {
  width: 40px;
  min-width: 40px;
  height: 38px;
  padding: 0;
}

.library-list-grid,
.managed-list,
.history-list {
  display: grid;
  gap: 10px;
}

.library-list-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  margin-bottom: 12px;
}

.list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(148, 163, 184, .14);
  border-radius: 12px;
  background: rgba(15, 23, 42, .46);
}

.list-row.active {
  border-color: rgba(124, 58, 237, .62);
  background: linear-gradient(135deg, rgba(124, 58, 237, .18), rgba(14, 165, 233, .08));
}

.list-row-main {
  justify-content: flex-start;
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 4px 6px;
  color: var(--text);
  text-align: left;
}

.list-row-main strong,
.list-row-main span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-row-main span {
  color: var(--muted);
  font-size: 12px;
}

.list-detail-head,
.managed-list-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 14px;
  background: rgba(255, 255, 255, .04);
}

.managed-list-item {
  grid-template-columns: 74px minmax(0, 1fr) auto;
}

.managed-grid {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.managed-grid .managed-list-item,
.managed-big .managed-list-item {
  grid-template-columns: 1fr;
  align-items: stretch;
}

.managed-grid .history-poster,
.managed-big .history-poster {
  width: 100%;
  aspect-ratio: 16 / 10;
}

.managed-big {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.managed-big .history-poster {
  aspect-ratio: 3 / 4;
}

.library-view-toggle {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: -2px 0 12px;
}

.library-view-toggle[hidden] {
  display: none;
}

.library-view-toggle .active {
  border-color: rgba(147, 197, 253, .48);
  background: rgba(59, 130, 246, .2);
  color: #fff;
}

.community-empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 28px;
  border: 1px dashed rgba(148, 163, 184, .28);
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
}

.community-empty .bi {
  font-size: 28px;
  color: var(--accent-2);
}

.list-detail-head {
  margin: 2px 0 10px;
  padding: 0 2px 8px;
  border: 0;
  border-bottom: 1px solid rgba(148, 163, 184, .16);
  border-radius: 0;
  background: transparent;
}

.list-detail-head strong {
  display: block;
  font-size: 15px;
}

.list-detail-head span {
  color: var(--muted);
  font-size: 12px;
}

.managed-list-item strong,
.managed-list-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.managed-list-item span {
  color: var(--muted);
  font-size: 12px;
}

.adult-enabled .hero {
  border-bottom-color: rgba(244, 63, 94, .28);
}

.toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: 104px;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  background: #111827;
  border: 1px solid rgba(255, 255, 255, .14);
  color: #fff;
  border-radius: 999px;
  padding: 10px 14px;
  box-shadow: var(--shadow);
  font-size: 13px;
  transition: .2s;
  max-width: calc(100vw - 24px);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.install-toast {
  position: fixed;
  z-index: 110;
  left: 50%;
  bottom: 150px;
  width: min(420px, calc(100vw - 24px));
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 14px;
  background: rgba(15, 23, 42, .94);
  color: #f8fafc;
  box-shadow: var(--shadow);
  font-size: 13px;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(16px);
  transition: .22s;
}

.install-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.install-toast .bi {
  color: #93c5fd;
  font-size: 18px;
}

@media (min-width: 520px) {
  .searchbox { grid-template-columns: 1fr auto; }
  .primary { min-width: 116px; }
  .toolbar {
    grid-template-columns: 1fr auto;
    align-items: center;
  }
  .toolbar .right { justify-content: flex-end; }
  .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .info.wide { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .topbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .top-actions {
    justify-content: space-between;
    flex-wrap: wrap;
  }
  .user-box {
    flex: 1 1 100%;
    max-width: none;
  }
  .user-status {
    flex: 1 1 auto;
  }
  .profile-metrics {
    grid-template-columns: 1fr;
  }
  .source-settings-list {
    grid-template-columns: 1fr;
  }
  .source-setting {
    grid-template-columns: 1fr;
  }
  .source-toggle {
    justify-items: start;
  }
  .history-row {
    grid-template-columns: 58px minmax(0, 1fr);
  }
  .list-detail-head,
  .managed-list-item {
    grid-template-columns: 1fr;
  }
  .managed-list-item {
    grid-template-columns: 64px minmax(0, 1fr);
  }
  .managed-list-item .history-poster {
    width: 64px;
    min-height: 78px;
  }
  .managed-list-item .history-actions {
    grid-column: 1 / -1;
  }
  .managed-grid .managed-list-item,
  .managed-big .managed-list-item {
    grid-template-columns: 1fr;
  }
  .managed-grid .history-poster,
  .managed-big .history-poster {
    width: 100%;
    min-height: 0;
  }
  .history-poster {
    width: 58px;
  }
  .history-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }
  .history-actions .smallbtn {
    flex: 1 1 120px;
  }
  .episode-nav {
    grid-template-columns: 1fr;
  }
  .episodes-toolbar {
    justify-content: stretch;
  }
  .episode-view-toggle {
    width: 100%;
  }
  .episode-view-toggle .btn {
    flex: 1 1 0;
  }
  .episodes-grid.episodes-list .episode-card,
  .episode-card {
    grid-template-columns: 96px minmax(0, 1fr) auto;
  }
  .episodes-grid.episodes-list .episode-thumb,
  .episodes-grid.episodes-list .episode-thumb-fallback,
  .episode-thumb,
  .episode-thumb-fallback {
    width: 96px;
  }
}

@media (min-width: 700px) {
  .app,
  .hero { padding-inline: 18px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); }
  .episodes-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .media-detail-layout {
    grid-template-columns: 240px minmax(0, 1fr);
    align-items: start;
  }
  .media-poster-shell { width: 240px; }
  .detail-modal-body {
    grid-template-columns: 190px 1fr;
    padding: 18px;
    gap: 18px;
  }
  .modal-poster-shell { width: 190px; }
  .modal-title { font-size: 30px; }
  .settings-shell { grid-template-columns: minmax(0, 1fr) minmax(320px, .85fr); }
  .settings-actions { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 980px) {
  body { padding-bottom: 112px; }
  .hero { padding-block: 16px; }
  .bottom-nav {
    bottom: 18px;
    width: auto;
    min-width: 520px;
    max-width: calc(100vw - 36px);
    grid-template-columns: repeat(4, auto);
    justify-content: center;
  }
  .navbtn {
    flex-direction: row;
    font-size: 13px;
    padding: 11px 16px;
  }
  .toast { bottom: 112px; }
  .install-toast { bottom: 132px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
  .episodes-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .grid.list .card { grid-template-columns: 110px 1fr; }
  .grid.list .poster-wrap { min-height: 165px; }
}

@media (min-width: 1280px) and (pointer: coarse), (min-width: 1280px) and (hover: none) {
  .episode-card,
  .episode-view-toggle .btn,
  .episode-nav .btn,
  .servers-container .btn {
    min-height: 58px;
  }
  .episodes-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
  }
}

.public-profile-editor,
.community-panel,
.public-profile-page,
.public-list-page {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 18px;
  padding: clamp(16px, 3vw, 24px);
  box-shadow: var(--shadow);
}

.public-profile-head,
.community-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.public-list-head {
  display: grid;
  grid-template-columns: minmax(180px, 280px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.public-profile-head span,
.community-toolbar span,
.community-card p,
.public-list-head p,
.community-owner,
.public-list-head a {
  color: var(--muted);
}

.profile-form-grid,
.community-publish {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.profile-form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: .88rem;
}

.public-profile-editor {
  display: grid;
  gap: 16px;
}

.profile-form-grid .control,
.community-publish .control,
.community-search .control {
  width: 100%;
  background: var(--field);
  color: var(--field-text);
}

.community-search {
  min-width: min(320px, 100%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding-inline: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
}

.community-search .control {
  border: 0;
  background: transparent;
  padding-inline: 0;
}

.community-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.community-card {
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  min-height: 310px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-2);
}

.community-cover,
.public-list-hero {
  min-height: 138px;
  display: flex;
  flex-direction: column;
  justify-content: end;
  gap: 6px;
  padding: 18px;
  color: #fff;
  text-decoration: none;
  text-shadow: 0 2px 14px rgba(0, 0, 0, .42);
}

.community-cover strong,
.public-list-hero strong {
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  line-height: 1;
}

.community-card-body {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px;
}

.community-title {
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
}

.community-owner,
.public-list-head a,
.community-card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.community-card-meta,
.community-actions,
.profile-actions,
.public-list-actions,
.public-socials {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.community-card-meta span {
  font-size: .88rem;
}

.public-profile-hero {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 18px;
  align-items: center;
  margin-bottom: 22px;
}

.public-profile-hero img,
.avatar-fallback {
  width: 96px;
  height: 96px;
  border-radius: 24px;
  object-fit: cover;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 2rem;
}

.public-profile-hero h2 {
  margin: 0;
}

.public-profile-hero p {
  color: var(--muted);
  margin: 8px 0 12px;
}

@media (max-width: 720px) {
  .public-profile-head,
  .community-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .public-list-head {
    grid-template-columns: 1fr;
  }

  .public-profile-hero {
    grid-template-columns: 1fr;
  }

  .profile-hero-content {
    grid-template-columns: 1fr;
  }
}

.grid.big-image .card .poster-wrap {
  min-height: min(72vh, 520px);
}

.community-editor-modal {
  width: min(720px, calc(100vw - 24px));
}

.community-editor-body {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.community-edit-items {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
}

.community-edit-item {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}
