:root {
  --bg: #0b0e14;
  --panel: #141a26;
  --panel-2: #1b2333;
  --line: #232c3f;
  --text: #e9edf6;
  --muted: #8c96ac;
  --accent: #4f8cff;
  --accent-2: #7c5cff;
  --gold: #ffd76a;
  --radius: 16px;
  --nav-h: 68px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(79, 140, 255, .12), transparent 60%),
    radial-gradient(700px 420px at 0% 100%, rgba(124, 92, 255, .09), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px calc(var(--nav-h) + 34px + env(safe-area-inset-bottom));
  min-height: 100vh;
}

/* ------------------------------------------------------- Topbar --------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 2px 14px;
  background: linear-gradient(180deg, rgba(11, 14, 20, .96) 55%, rgba(11, 14, 20, 0));
  backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-logo {
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  flex: none;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 22px rgba(79, 140, 255, .3);
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 15.5px; letter-spacing: .2px; }
.brand-text span {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 58vw;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  flex: none;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 12px;
  color: #b8c2d6;
  transition: .15s;
}
.icon-btn:hover { background: var(--panel-2); color: #fff; border-color: #33405c; }
.icon-btn:active { transform: scale(.95); }

/* ------------------------------------------------------- Vistas --------- */
.view { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin: 6px 0 14px;
}
.view-head h1 { margin: 0; font-size: 24px; letter-spacing: -.3px; }
.view-sub { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }

.search {
  width: 100%;
  padding: 12px 15px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: #0e1320;
  outline: none;
  font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 140, 255, .14); }
.search::placeholder { color: #5f6a80; }

/* ------------------------------------------------------- Home ---------- */
.hero {
  position: relative;
  overflow: hidden;
  margin-top: 6px;
  padding: 30px 28px;
  border-radius: 22px;
  border: 1px solid rgba(79, 140, 255, .22);
  background: linear-gradient(120deg, #16203a 0%, #141a2b 55%, #1a1430 100%);
}
.hero-glow {
  position: absolute;
  width: 420px; height: 420px;
  right: -120px; top: -180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 92, 255, .35), transparent 65%);
  pointer-events: none;
}
.hero-content { position: relative; max-width: 560px; }
.eyebrow {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #7ea3ff;
}
.hero h1 { margin: 0; font-size: 32px; letter-spacing: -.6px; }
.hero-sub { margin: 8px 0 0; font-size: 14px; line-height: 1.55; color: #b5c0d6; }

.hero-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .09);
  font-size: 12.5px;
  color: #d3dbeb;
}
.stat-pill b { color: #fff; }

#hero-cta { margin-top: 20px; }

.block { margin-top: 30px; }
.block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.block-head h2 { margin: 0; font-size: 17px; letter-spacing: -.2px; }
.link {
  border: 0;
  background: none;
  color: #7ea3ff;
  font-size: 12.5px;
  padding: 4px;
}
.link:hover { text-decoration: underline; }

.hscroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.hscroll::-webkit-scrollbar { display: none; }
.hscroll .poster-card { flex: 0 0 128px; scroll-snap-align: start; }

/* tarjetas de "seguir viendo" / favoritos */
.recent-card {
  flex: 0 0 152px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  scroll-snap-align: start;
}
.recent-card .thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: linear-gradient(150deg, #182032, #0c1018);
  display: grid;
  place-items: center;
  overflow: hidden;
  transition: transform .16s, border-color .16s;
}
.recent-card:hover .thumb { transform: translateY(-2px); border-color: #35415e; }
.recent-card .thumb img {
  max-width: 78%;
  max-height: 76%;
  object-fit: contain;
}
.rc-initials {
  font-size: 20px;
  font-weight: 800;
  color: rgba(255, 255, 255, .5);
  letter-spacing: .5px;
}
.rc-name {
  font-size: 12.5px;
  font-weight: 550;
  line-height: 1.3;
  color: #dbe2ef;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rc-sub {
  margin-top: -3px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.playing { overflow: hidden; }

.quick-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.quick-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  text-align: left;
  transition: transform .15s, border-color .15s;
}
.quick-card:hover { transform: translateY(-2px); border-color: #3a4766; }
.quick-card.live { background: linear-gradient(135deg, rgba(79, 140, 255, .2), rgba(20, 26, 38, .6)); }
.quick-card.movies { background: linear-gradient(135deg, rgba(255, 122, 89, .18), rgba(20, 26, 38, .6)); }
.quick-card.series { background: linear-gradient(135deg, rgba(124, 92, 255, .2), rgba(20, 26, 38, .6)); }
.quick-icon { font-size: 23px; flex: none; }
.quick-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.quick-info strong { font-size: 14.5px; }
.quick-info small { margin-top: 2px; font-size: 11.5px; color: var(--muted); }
.quick-arrow { font-size: 22px; color: #5c6884; flex: none; }

/* ------------------------------------------------------- Chips ---------- */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 14px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #0e1320;
  color: #a3aec3;
  font-size: 12.5px;
  white-space: nowrap;
  transition: .15s;
}
.chip:hover { color: #fff; border-color: #3a4766; }
.chip.active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.fav-switch {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: #0e1320;
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.fav-switch input { accent-color: var(--gold); width: 15px; height: 15px; cursor: pointer; }
.fav-switch:has(input:checked) { color: var(--gold); border-color: rgba(255, 215, 106, .4); background: rgba(255, 215, 106, .07); }

/* casillas personalizadas */
.switch input,
.fav-switch input {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  width: 18px;
  height: 18px;
  flex: none;
  border-radius: 6px;
  border: 1.5px solid #38445e;
  background: #0b0f17;
  display: inline-grid;
  place-content: center;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.switch input::before,
.fav-switch input::before {
  content: "";
  width: 10px;
  height: 10px;
  transform: scale(0);
  transition: transform .12s ease;
  background: #fff;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}
.switch input:checked,
.fav-switch input:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.fav-switch input:checked { background: var(--gold); border-color: var(--gold); }
.fav-switch input:checked::before { background: #1a1400; }
.switch input:checked::before,
.fav-switch input:checked::before { transform: scale(1); }

/* ------------------------------------------------------- Canales ------- */
.channel-list { display: flex; flex-direction: column; gap: 2px; }

.channel {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 13px;
  background: none;
  text-align: left;
  transition: background .12s, border-color .12s;
  content-visibility: auto;
  contain-intrinsic-size: 62px;
}
.channel:hover { background: #151c2a; border-color: var(--line); }
.channel:active { background: #192233; }

.ch-logo {
  width: 46px; height: 46px;
  flex: none;
  object-fit: contain;
  padding: 4px;
  border-radius: 11px;
  background: #0a0e16;
  border: 1px solid #1c2434;
}
.ch-logo.fallback {
  display: grid;
  place-items: center;
  color: #4d5a74;
  font-weight: 700;
  font-size: 15px;
  padding: 0;
}
.ch-text { flex: 1; min-width: 0; }
.ch-name {
  display: block;
  font-size: 14px;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ch-group {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.star {
  flex: none;
  width: 38px; height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  background: none;
  border-radius: 10px;
  color: #3b465a;
  font-size: 18px;
  line-height: 1;
  transition: .15s;
}
.star:hover { background: rgba(255, 255, 255, .05); }
.star.on { color: var(--gold); }

/* ------------------------------------------------------- Pósters ------- */
.poster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 16px 14px;
  padding-bottom: 10px;
}
.poster-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  min-width: 0;
}
.poster {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(150deg, #1c2436, #121722);
  border: 1px solid var(--line);
  transition: transform .16s, box-shadow .16s;
}
.poster img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.poster-card:hover .poster { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(0, 0, 0, .45); }
.poster .fallback-poster {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  text-align: center;
}
.fallback-poster .fp-icon { font-size: 26px; opacity: .55; }
.fallback-poster .fp-initials {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: .5px;
  color: rgba(255, 255, 255, .5);
}
.poster .badge {
  position: absolute;
  left: 8px; top: 8px;
  max-width: calc(100% - 16px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .65);
  backdrop-filter: blur(4px);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .02em;
}
.poster .ep-count {
  position: absolute;
  right: 8px; bottom: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .7);
  font-size: 10.5px;
  color: #dfe6f4;
}
.poster-title {
  font-size: 12.5px;
  line-height: 1.35;
  font-weight: 550;
  color: #dbe2ef;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.poster-sub { margin-top: -4px; font-size: 11px; color: var(--muted); }

.empty {
  grid-column: 1 / -1;
  padding: 50px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
}
.empty .big { display: block; font-size: 34px; margin-bottom: 10px; opacity: .6; }

.load-more {
  grid-column: 1 / -1;
  margin: 10px auto 0;
  padding: 11px 26px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: #b3bdd1;
  font-size: 13px;
}
.load-more:hover { background: var(--panel-2); color: #fff; }

/* ------------------------------------------------------- Bottom nav ---- */
.bottomnav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: rgba(13, 17, 25, .92);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  max-width: 130px;
  padding: 6px 4px 4px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: #6f7b93;
  font-size: 10.5px;
  font-weight: 550;
  transition: color .15s;
}
.nav-item svg { width: 22px; height: 22px; }
.nav-item:hover { color: #b8c2d6; }
.nav-item.active { color: #fff; }
.nav-item.active svg { filter: drop-shadow(0 0 10px rgba(79, 140, 255, .55)); }
.nav-item.active::after {
  content: "";
  position: absolute;
  margin-top: -2px;
}

/* ------------------------------------------------------- Reproductor --- */
.player-view {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  background: #05070b;
  animation: fade .2s ease;
}
.player-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px calc(14px + env(safe-area-inset-top)) 16px;
  background: linear-gradient(180deg, #0b0f17, #05070b);
}
.player-title { flex: 1; min-width: 0; text-align: center; }
.player-title h2 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-title p {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.star-btn { font-size: 19px; color: #3d4659; }
.star-btn.on { color: var(--gold); border-color: rgba(255, 215, 106, .35); }

.player-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}
.player-stage video {
  width: 100%;
  height: 100%;
  max-height: 100%;
  background: #000;
  object-fit: contain;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(600px 340px at 50% 45%, rgba(18, 24, 37, .8), rgba(0, 0, 0, .9));
  z-index: 2;
  transition: opacity .2s;
}
.overlay.hidden { display: none; }
.overlay-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 20px 26px;
  max-width: 640px;
  text-align: center;
}
.overlay p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: #c9d2e3;
  white-space: pre-wrap;
}
.overlay.error p { color: #ffb3ba; }

.spinner {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .12);
  border-top-color: var(--accent);
  animation: spin .9s linear infinite;
}
.spinner.hidden { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.player-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px calc(18px + env(safe-area-inset-bottom));
  background: #05070b;
}
.player-actions { display: flex; gap: 8px; }
.switch {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  user-select: none;
}
.switch input { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }

/* ------------------------------------------------------- Botones ------- */
.btn {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 10px 17px;
  border-radius: 11px;
  font-size: 13.5px;
  font-weight: 550;
  transition: .15s;
}
.btn:hover:not(:disabled) { background: var(--panel-2); border-color: #33405c; }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: 0;
  box-shadow: 0 10px 26px rgba(79, 140, 255, .32);
}
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { color: #ff7b88; border-color: rgba(255, 92, 108, .3); }

/* ------------------------------------------------------- Login --------- */
.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(700px 420px at 70% -5%, rgba(79, 140, 255, .16), transparent 60%),
    radial-gradient(600px 380px at 10% 105%, rgba(124, 92, 255, .12), transparent 60%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 380px;
  text-align: center;
  animation: fade .3s ease;
}
.auth-logo {
  display: inline-grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 19px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 14px 36px rgba(79, 140, 255, .35);
}
.auth-card h1 { margin: 18px 0 6px; font-size: 25px; letter-spacing: -.4px; }
.auth-desc { margin: 0 0 22px; font-size: 13.5px; color: var(--muted); line-height: 1.5; }

.auth-checking {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  color: var(--muted);
  font-size: 12.5px;
}
.spinner.small { width: 20px; height: 20px; border-width: 2.5px; }

#login-form input {
  width: 100%;
  padding: 13px 15px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: #0d121d;
  outline: none;
  font-size: 15px;
  text-align: center;
  letter-spacing: .05em;
  transition: border-color .15s, box-shadow .15s;
}
#login-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 140, 255, .16);
}
#login-form input + input { margin-top: 10px; }
.auth-submit { width: 100%; margin-top: 12px; padding: 12px; }
.auth-error { margin-top: 12px; }

/* ------------------------------------------------------- Config -------- */
.screen {
  position: fixed;
  inset: 0;
  z-index: 55;
  overflow-y: auto;
  background:
    radial-gradient(800px 400px at 80% -10%, rgba(79, 140, 255, .09), transparent 60%),
    var(--bg);
  animation: fade .2s ease;
}
.screen-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 18px;
  background: rgba(11, 14, 20, .9);
  backdrop-filter: blur(12px);
}
.screen-head h1 { flex: 1; margin: 0; font-size: 18px; text-align: center; letter-spacing: -.2px; }
.screen-spacer { width: 40px; flex: none; }
.screen-body { max-width: 720px; margin: 0 auto; padding: 6px 18px 50px; }

.config-card {
  margin-bottom: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: linear-gradient(180deg, #151b28, #10151f);
}
.config-card h2 { margin: 0 0 6px; font-size: 16px; }
.config-desc { margin: 0 0 8px; font-size: 12.5px; line-height: 1.55; color: var(--muted); }
.config-card label {
  display: block;
  margin: 13px 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: #a9b3c7;
}
.config-card input {
  width: 100%;
  padding: 11px 13px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: #0b0f17;
  outline: none;
  font-size: 13.5px;
  transition: border-color .15s, box-shadow .15s;
}
.config-card input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 140, 255, .14);
}
.block-btn { width: 100%; margin-top: 15px; }

.form-error,
.form-ok {
  margin-top: 13px;
  padding: 10px 13px;
  border-radius: 11px;
  font-size: 12.5px;
  line-height: 1.5;
  white-space: pre-wrap;
}
.form-error {
  background: rgba(255, 92, 108, .1);
  border: 1px solid rgba(255, 92, 108, .3);
  color: #ffb3ba;
}
.form-ok {
  background: rgba(74, 222, 128, .09);
  border: 1px solid rgba(74, 222, 128, .28);
  color: #9ae6b4;
}

/* ------------------------------------------------------- Modales ------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(4, 7, 12, .8);
  backdrop-filter: blur(7px);
  animation: fade .18s ease;
}
.modal {
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  background: linear-gradient(180deg, #161c29, #101520);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .65);
}
.modal h2 { margin: 0 0 6px; font-size: 19px; }
.modal-sub { margin: 0 0 18px; font-size: 13px; color: var(--muted); line-height: 1.5; }

.tabs {
  display: flex;
  gap: 5px;
  padding: 4px;
  margin-bottom: 16px;
  background: #0b0f17;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.tab {
  flex: 1;
  padding: 9px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--muted);
  font-size: 13px;
}
.tab.active { background: var(--panel-2); color: #fff; }

.tab-panel label {
  display: block;
  margin: 13px 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: #a9b3c7;
}
.tab-panel input,
.tab-panel textarea {
  width: 100%;
  padding: 11px 13px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: #0b0f17;
  outline: none;
  font-size: 13px;
  resize: vertical;
  transition: border-color .15s, box-shadow .15s;
}
.tab-panel input:focus,
.tab-panel textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 140, 255, .14);
}
.tab-panel textarea { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 12px; line-height: 1.5; }

.modal-error {
  margin-top: 14px;
  padding: 10px 13px;
  border-radius: 11px;
  background: rgba(255, 92, 108, .1);
  border: 1px solid rgba(255, 92, 108, .3);
  color: #ffb3ba;
  font-size: 12.5px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.direct {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  font-size: 12px;
  color: var(--muted);
}
.direct-row { display: flex; gap: 8px; margin-top: 8px; }
.direct-row input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0b0f17;
  outline: none;
  font-size: 12.5px;
}
.direct-row .btn { padding: 8px 14px; }

/* ------------------------------------------------------- Serie sheet --- */
.sheet { max-width: 620px; }
.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}
.sheet-title { display: flex; gap: 14px; align-items: center; min-width: 0; }
.sheet-poster {
  width: 64px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0b0f17;
  flex: none;
}
.sheet-title h2 { margin: 0; font-size: 18px; line-height: 1.3; }
.sheet-title p { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }

.episode-list { display: flex; flex-direction: column; gap: 4px; }
.episode {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 10px 11px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: none;
  text-align: left;
  transition: .13s;
}
.episode:hover { background: #1a2231; border-color: var(--line); }
.ep-badge {
  display: grid;
  place-items: center;
  width: 46px;
  height: 32px;
  flex: none;
  border-radius: 8px;
  background: #101623;
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 700;
  color: #90a0bd;
  letter-spacing: .02em;
}
.ep-text { flex: 1; min-width: 0; }
.ep-text strong {
  display: block;
  font-size: 13.5px;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ep-text small { display: block; margin-top: 2px; font-size: 11px; color: var(--muted); }
.ep-play { color: #7ea3ff; font-size: 16px; flex: none; }

/* ------------------------------------------------------- Responsive ---- */
@media (max-width: 760px) {
  .shell { padding-left: 14px; padding-right: 14px; }
  .hero { padding: 24px 20px; border-radius: 18px; }
  .hero h1 { font-size: 26px; }
  .quick-cards { grid-template-columns: 1fr; gap: 9px; }
  .quick-card { padding: 14px 16px; }
  .poster-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 14px 10px; }
  .view-head h1 { font-size: 21px; }
  .player-title { text-align: left; }
  .player-bottom { justify-content: space-between; }
}

@media (min-width: 900px) {
  .player-stage video { max-width: 1280px; }
}
