/* ══════════════════════════════════════════════════════════════
   Library page — restyles the original classes; the page script
   still generates the same markup.
══════════════════════════════════════════════════════════════ */
html, body { min-height: 100%; }
body { font-size: 14px; overflow-x: hidden; }

/* ── Top bar ── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100; height: var(--topbar-h);
  display: flex; align-items: center; gap: 1.2rem; padding: 0 clamp(1rem, 3vw, 1.6rem);
  border-bottom: 1px solid transparent; transition: background 0.3s var(--ease), border-color 0.3s;
}
.topbar.scrolled { background: var(--glass-strong); border-color: var(--border); }
.top-links { display: flex; gap: 0.15rem; }
.top-links a { padding: 0.38rem 0.7rem; border-radius: 9px; font-size: 0.82rem; font-weight: 500; text-decoration: none; color: rgba(255, 255, 255, 0.62); transition: color 0.2s, background 0.2s; }
.top-links a:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }
.top-links a.active { color: #fff; background: rgba(229, 9, 20, 0.14); box-shadow: inset 0 0 0 1px rgba(229, 9, 20, 0.35); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }

.source-toggle { display: flex; padding: 3px; gap: 2px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border); }
.source-btn { display: inline-flex; align-items: center; gap: 0.35rem; border: none; background: none; cursor: pointer;
  padding: 0.32rem 0.7rem; border-radius: 8px; font-size: 0.75rem; font-weight: 600; color: var(--muted); transition: color 0.2s, background 0.25s; }
.source-btn:hover { color: #fff; }
.source-btn.active { background: var(--grad-red); color: #fff; }

/* ── Header ── */
.library-container { max-width: 1320px; margin: 0 auto; padding: calc(var(--topbar-h) + 0.5rem) clamp(1rem, 3vw, 2rem) 3rem; }
.library-header { position: relative; text-align: center; padding: clamp(2rem, 5vw, 3.4rem) 0 1.8rem; isolation: isolate; }
.lib-backdrop {
  position: absolute; z-index: -1; left: 50%; top: calc(-1 * var(--topbar-h) - 0.5rem); width: 100vw; height: calc(100% + var(--topbar-h) + 3rem);
  transform: translateX(-50%); background-size: cover; background-position: center 25%; opacity: 0; transition: opacity 1.2s var(--ease);
  -webkit-mask: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.55) 55%, transparent 100%); mask: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.55) 55%, transparent 100%);
}
.lib-backdrop.on { opacity: 0.26; }
.lib-backdrop::after { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 30%, transparent 0%, rgba(5, 5, 7, 0.8) 70%); }
.lib-kicker { justify-content: center; margin-bottom: 0.8rem; animation: fadeUp 0.7s var(--ease) both; }
.lib-kicker::before { display: none; }
.library-header h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(2.4rem, 5.5vw, 3.8rem); line-height: 0.9; letter-spacing: 0.015em; margin-bottom: 0.6rem; }
.library-header h1 span, .library-header h1 em { display: inline-block; animation: fadeUp 0.8s var(--ease) both; }
.library-header h1 em { font-style: normal; animation-delay: 0.06s; background: var(--grad-heat); -webkit-background-clip: text; background-clip: text; color: transparent; }
.library-header p { color: rgba(255, 255, 255, 0.6); font-size: 0.9rem; margin-bottom: 1.5rem; animation: fadeUp 0.8s var(--ease) 0.12s both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } }

.search-wrapper {
  position: relative; max-width: 560px; margin: 0 auto; display: flex; align-items: center; gap: 0.4rem; padding: 4px 4px 4px 0;
  border-radius: 999px; background: rgba(12, 12, 16, 0.92); border: 1px solid var(--border-hover);
  transition: border-color 0.3s, box-shadow 0.3s; animation: fadeUp 0.8s var(--ease) 0.18s both;
}
.search-wrapper:focus-within { border-color: rgba(229, 9, 20, 0.65); box-shadow: 0 0 0 4px rgba(229, 9, 20, 0.12); }
.search-ic { padding-left: 1.05rem; color: var(--muted); font-size: 0.85rem; transition: color 0.2s; }
.search-wrapper:focus-within .search-ic { color: var(--red-hot); }
.search-input { flex: 1; min-width: 0; background: none; border: none; outline: none; padding: 0.55rem 0.4rem 0.55rem 0.5rem; font-size: 0.9rem; color: var(--text); }
.search-input::placeholder { color: var(--muted2); }
.search-kbd { font: 600 0.66rem var(--font-ui); color: var(--muted); padding: 0.12rem 0.42rem; border-radius: 5px; border: 1px solid var(--border-hover); background: rgba(255, 255, 255, 0.04); }
.search-wrapper:focus-within .search-kbd { opacity: 0; }
.btn-search { height: 36px; padding: 0 1.2rem; border: none; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 0.84rem;
  background: var(--grad-red); color: #fff; transition: transform 0.25s var(--ease); }
.btn-search:hover { transform: translateY(-1px); }
.btn-search:active { transform: scale(0.96); }

/* ── Filters ── */
.filters-bar { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.6rem; animation: fadeUp 0.8s var(--ease) 0.24s both;
  padding: 0.4rem; border-radius: 14px; background: rgba(255, 255, 255, 0.02); border: 1px solid var(--border); }
.genre-pill i { font-size: 0.72rem; opacity: 0.85; }
.rating-star i { font-size: 0.85em; }
.type-toggle { display: flex; gap: 3px; padding: 3px; border-radius: 11px; background: rgba(255, 255, 255, 0.04); flex-shrink: 0; }
.type-toggle .genre-pill { border-color: transparent; background: transparent; }
.type-toggle .genre-pill.active { background: #fff; color: #0a0a0e; border-color: #fff; box-shadow: none; }
.genre-filters { display: flex; gap: 0.35rem; overflow-x: auto; padding: 2px; flex: 1; min-width: 0; scrollbar-width: none;
  -webkit-mask: linear-gradient(90deg, #000 92%, transparent); mask: linear-gradient(90deg, #000 92%, transparent); }
.genre-filters::-webkit-scrollbar { display: none; }
.genre-pill {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.36rem 0.8rem; border-radius: 999px; cursor: pointer; white-space: nowrap;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border); color: rgba(255, 255, 255, 0.7);
  font-size: 0.76rem; font-weight: 600; transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.genre-pill:hover { color: #fff; border-color: var(--border-hover); }
.genre-pill.active { background: var(--grad-red); border-color: transparent; color: #fff; }

/* ── Grid ── */
.grid-section-title { display: flex; align-items: baseline; gap: 0.75rem; margin-bottom: 1rem;
  font-family: var(--font-display); font-weight: 400; font-size: clamp(1.4rem, 2.6vw, 1.8rem); letter-spacing: 0.03em; line-height: 1; }
.grid-section-title::before { content: ''; align-self: center; width: 4px; height: 1.15rem; border-radius: 4px; background: var(--grad-heat); }
.grid-loader { font-family: var(--font-ui); font-size: 0.76rem; letter-spacing: 0; color: var(--muted); }
.grid-loader:not(:empty)::before { content: ''; display: inline-block; width: 10px; height: 10px; margin-right: 0.45rem; vertical-align: -1px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.15); border-top-color: var(--red-hot); animation: spinIt 0.7s linear infinite; }
@keyframes spinIt { to { transform: rotate(360deg); } }

.movies-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: clamp(0.75rem, 1.5vw, 1.1rem); margin-bottom: 2.5rem; }
.movies-grid.dim .movie-card { opacity: 0.45; }

/* ── Movie card ── */
.movie-card {
  position: relative; display: flex; flex-direction: column; cursor: pointer; border-radius: 12px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  animation: cardIn 0.55s var(--ease) both; animation-delay: calc(var(--i, 0) * 25ms);
  transition: transform 0.35s var(--ease), border-color 0.25s, opacity 0.25s;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(16px); } }
.movie-card:hover { transform: translateY(-6px); border-color: rgba(229, 9, 20, 0.55); z-index: 2; }
.movie-card.loading-streams { opacity: 0.6; pointer-events: none; }

.poster-wrap { position: relative; aspect-ratio: 2 / 3; width: 100%; overflow: hidden; background: linear-gradient(135deg, var(--surface2), var(--surface)); }
.poster-img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--ease); }
.movie-card:hover .poster-img { transform: scale(1.06); }

.format-badge { position: absolute; top: 8px; right: 8px; z-index: 2; font-size: 0.56rem; font-weight: 800; letter-spacing: 0.08em; padding: 2px 6px; border-radius: 5px; }
.format-badge.mp4 { background: rgba(15, 157, 88, 0.9); color: #fff; }
.format-badge.mkv { background: rgba(229, 9, 20, 0.9); color: #fff; }
.format-badge.webm { background: rgba(26, 115, 232, 0.9); color: #fff; }
.format-badge.loading { background: rgba(0, 0, 0, 0.65); border: 1px solid var(--border-hover); color: var(--muted); }
.format-badge.none { background: rgba(0, 0, 0, 0.65); border: 1px solid var(--border-hover); color: var(--muted2); }

.card-overlay-btn { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 0.9rem;
  background: linear-gradient(180deg, transparent 40%, rgba(0, 0, 0, 0.85)); opacity: 0; transition: opacity 0.3s var(--ease); }
.movie-card:hover .card-overlay-btn { opacity: 1; }
.play-badge { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.4rem 0.85rem; border-radius: 999px;
  background: var(--grad-red); color: #fff; font-size: 0.72rem; font-weight: 700; transform: translateY(10px); transition: transform 0.4s var(--ease-spring); }
.movie-card:hover .play-badge { transform: none; }

.movie-details { padding: 0.6rem 0.7rem 0.7rem; display: flex; flex-direction: column; gap: 0.25rem; flex: 1; }
.movie-title { font-size: 0.82rem; font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.movie-meta-row { display: flex; align-items: center; justify-content: space-between; margin-top: auto; font-size: 0.7rem; color: var(--muted); }
.movie-rating { display: inline-flex; align-items: center; gap: 0.25rem; padding: 1px 6px; border-radius: 5px; color: #fff; font-weight: 600;
  background: rgba(245, 197, 24, 0.1); border: 1px solid rgba(245, 197, 24, 0.22); }
.rating-star { color: var(--imdb-gold); }

/* Skeletons (added by the enhancement script while loading) */
.skeleton-card { border-radius: 12px; overflow: hidden; background: var(--surface); border: 1px solid var(--border); }
.skeleton-poster, .skeleton-line { background: linear-gradient(100deg, var(--surface2) 30%, #2a2a33 50%, var(--surface2) 70%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton-poster { aspect-ratio: 2 / 3; }
.skeleton-details { padding: 0.7rem; }
.skeleton-line { height: 9px; border-radius: 5px; margin-bottom: 0.45rem; }
.skeleton-line.short { width: 55%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.status-message { grid-column: 1 / -1; text-align: center; padding: 3rem 1rem; color: var(--muted); font-size: 0.9rem;
  border: 1px dashed var(--border-hover); border-radius: 14px; background: rgba(255, 255, 255, 0.02); }

.local-section { margin-bottom: 2.5rem; }
.local-add-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem; aspect-ratio: 2 / 3; padding: 1rem; text-align: center;
  border-radius: 12px; border: 1px dashed var(--border-hover); background: rgba(255, 255, 255, 0.02); color: var(--muted); cursor: pointer; transition: border-color 0.2s, color 0.2s; }
.local-add-btn:hover { border-color: var(--red); color: var(--text); }

/* ── Modals (stream + episode pickers) ── */
.stream-modal-overlay {
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 1rem;
  background: rgba(3, 3, 5, 0.82); opacity: 0; pointer-events: none; transition: opacity 0.3s var(--ease);
}
.stream-modal-overlay.open { opacity: 1; pointer-events: all; }
.stream-modal {
  position: relative; width: 100%; max-width: 500px; max-height: 82vh; overflow-y: auto; overscroll-behavior: contain;
  padding: 1.4rem 1.3rem 1.2rem; border-radius: 18px;
  background: linear-gradient(180deg, #1b1b23, #0f0f14); border: 1px solid var(--border-hover);
  box-shadow: 0 30px 80px -25px rgba(0, 0, 0, 0.95);
  transform: translateY(20px) scale(0.97); opacity: 0; transition: transform 0.4s var(--ease-spring), opacity 0.3s var(--ease);
}
.stream-modal-overlay.open .stream-modal { transform: none; opacity: 1; }
.modal-ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; margin-bottom: 0.75rem; font-size: 0.9rem; color: #fff; background: var(--grad-red); }
.stream-modal h3 { font-family: var(--font-display); font-weight: 400; font-size: 1.55rem; letter-spacing: 0.03em; line-height: 1; margin-bottom: 0.35rem; padding-right: 1rem; }
.stream-modal-sub { font-size: 0.8rem; color: var(--muted); margin-bottom: 1rem; }
.season-tabs { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
.stream-list { display: flex; flex-direction: column; gap: 0.45rem; }
.stream-item {
  display: flex; align-items: center; gap: 0.7rem; padding: 0.65rem 0.75rem; border-radius: 11px; cursor: pointer;
  background: rgba(255, 255, 255, 0.035); border: 1px solid var(--border);
  animation: rowIn 0.4s var(--ease) both; transition: border-color 0.2s, background 0.2s;
}
.stream-item:nth-child(2) { animation-delay: 0.03s; } .stream-item:nth-child(3) { animation-delay: 0.06s; }
.stream-item:nth-child(4) { animation-delay: 0.09s; } .stream-item:nth-child(n+5) { animation-delay: 0.12s; }
@keyframes rowIn { from { opacity: 0; transform: translateY(8px); } }
.stream-item:hover { border-color: rgba(229, 9, 20, 0.55); background: rgba(229, 9, 20, 0.07); }
.stream-item-warn { border-color: rgba(229, 9, 20, 0.22) !important; }
.stream-item-warn:hover { border-color: rgba(229, 9, 20, 0.55) !important; }
.stream-fmt { flex-shrink: 0; font-size: 0.58rem; font-weight: 800; letter-spacing: 0.07em; padding: 3px 6px; border-radius: 5px; }
.stream-fmt.mp4 { background: rgba(15, 157, 88, 0.18); color: #4ade80; border: 1px solid rgba(74, 222, 128, 0.3); }
.stream-fmt.mkv { background: rgba(229, 9, 20, 0.18); color: #ff7b7b; border: 1px solid rgba(255, 107, 107, 0.3); }
.stream-fmt.webm { background: rgba(26, 115, 232, 0.18); color: #7cc0ff; border: 1px solid rgba(100, 181, 246, 0.3); }
.stream-fmt.other { background: rgba(255, 255, 255, 0.05); color: var(--muted); border: 1px solid var(--border); }
.stream-info { flex: 1; min-width: 0; }
.stream-name { font-size: 0.8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stream-meta { font-size: 0.7rem; color: var(--muted); margin-top: 0.15rem; }
.stream-quality { flex-shrink: 0; font-size: 0.64rem; font-weight: 800; color: var(--imdb-gold); padding: 2px 6px; border-radius: 5px;
  background: rgba(245, 197, 24, 0.1); border: 1px solid rgba(245, 197, 24, 0.25); }
.stream-play-btn { flex-shrink: 0; border: none; cursor: pointer; padding: 0.4rem 0.8rem; border-radius: 999px; font-size: 0.72rem; font-weight: 700; white-space: nowrap;
  background: var(--grad-red); color: #fff; transition: transform 0.2s var(--ease); }
.stream-play-btn:hover { transform: scale(1.05); }
.stream-play-btn[data-loading="true"] { background: var(--surface3); }
.stream-modal-close { width: 100%; margin-top: 0.9rem; padding: 0.6rem 1rem; border-radius: 11px; cursor: pointer; font-size: 0.82rem; font-weight: 600;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border); color: var(--muted); transition: color 0.2s, border-color 0.2s; }
.stream-modal-close:hover { color: var(--text); border-color: var(--border-hover); }

/* ── Responsive ── */
@media (max-width: 860px) {
  .top-links { display: none; }
  .filters-bar { flex-direction: column; align-items: stretch; }
  .type-toggle { align-self: center; }
}
@media (max-width: 768px) {
  .library-container { padding-inline: 0.85rem; }
  .movies-grid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 0.7rem; }
  .movie-title { font-size: 0.78rem; }
  .source-btn span { display: none; }
  .search-kbd { display: none; }
  .btn-search { padding: 0 0.95rem; }
  .stream-modal-overlay { align-items: flex-end; padding: 0; }
  .stream-modal { max-width: none; max-height: 86vh; border-radius: 18px 18px 0 0; padding-bottom: calc(1.2rem + env(safe-area-inset-bottom)); transform: translateY(100%); }
  .stream-modal::before { content: ''; display: block; width: 38px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.18); margin: -0.4rem auto 0.9rem; }
}
@media (max-width: 420px) { .create-room { display: none; } }

/* ── Shelves (For You view) ── */
.shelf { margin-bottom: 1.8rem; }
.shelf-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.7rem; }
.shelf-head h3 { font-size: 0.98rem; font-weight: 700; letter-spacing: 0.01em; }
.shelf-more { border: none; background: none; cursor: pointer; font-size: 0.74rem; font-weight: 600; color: var(--muted); transition: color 0.2s; }
.shelf-more:hover { color: var(--red-hot); }
.shelf-more i { font-size: 0.6rem; margin-left: 0.2rem; }
.shelf-track { display: grid; grid-auto-flow: column; grid-auto-columns: 148px; gap: 0.85rem; overflow-x: auto; padding: 4px 2px 10px;
  scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.12) transparent; }
.shelf-track .movie-card { scroll-snap-align: start; }
.shelf-track .movie-card:hover { transform: translateY(-4px); }
.movie-card:focus-visible { outline: 2px solid var(--red-hot); outline-offset: 2px; }

/* ── Title details modal ── */
.detail-modal { max-width: 560px; }
.detail-x { position: absolute; top: 0.8rem; right: 0.8rem; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border); cursor: pointer;
  background: rgba(255, 255, 255, 0.05); color: var(--muted); display: grid; place-items: center; transition: color 0.2s, background 0.2s; }
.detail-x:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }
.detail-head { display: flex; gap: 1rem; align-items: flex-end; margin-bottom: 0.9rem; padding-right: 1.6rem; }
.detail-poster { width: 96px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 10px; flex-shrink: 0; background: var(--surface2); border: 1px solid var(--border); }
.detail-info { min-width: 0; }
.detail-type { font-size: 0.64rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--red-hot); }
.detail-modal h3 { margin: 0.2rem 0 0.5rem; font-size: 1.6rem; }
.detail-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.detail-chips span { font-size: 0.68rem; color: rgba(255, 255, 255, 0.75); padding: 2px 7px; border-radius: 6px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border); }
.detail-chips i { color: var(--imdb-gold); font-size: 0.6rem; }
.detail-desc { font-size: 0.82rem; line-height: 1.6; color: rgba(255, 255, 255, 0.72); margin-bottom: 1rem; }
.detail-loading { font-size: 0.78rem; color: var(--muted); margin-bottom: 1rem; }
.episode-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 0.35rem; max-height: 168px; overflow-y: auto; margin-bottom: 1rem; padding: 2px; }
.episode-btn { height: 34px; border-radius: 8px; cursor: pointer; font: 600 0.78rem var(--font-ui); color: rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border); transition: background 0.2s, border-color 0.2s, color 0.2s; }
.episode-btn:hover { border-color: var(--border-hover); color: #fff; }
.episode-btn.active { background: var(--grad-red); border-color: transparent; color: #fff; }
.detail-actions { display: flex; gap: 0.5rem; align-items: stretch; }
.detail-select { flex-shrink: 0; max-width: 40%; padding: 0 0.7rem; border-radius: 11px; font: 600 0.78rem var(--font-ui); color: var(--text);
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border-hover); }
.detail-select option { background: #16161c; }
.detail-watch { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; height: 44px; border: none; border-radius: 11px; cursor: pointer;
  font: 700 0.88rem var(--font-ui); color: #fff; background: var(--grad-red); box-shadow: 0 14px 30px -14px rgba(229, 9, 20, 0.9); transition: transform 0.25s var(--ease), opacity 0.2s; }
.detail-watch:hover { transform: translateY(-1px); }
.detail-watch:disabled { opacity: 0.45; cursor: default; transform: none; }

@media (max-width: 768px) {
  .shelf-track { grid-auto-columns: 118px; gap: 0.65rem; }
  .detail-poster { width: 78px; }
}

/* ── Continue Watching (this device's history) ───── */
.cw { margin: 0 0 1.6rem; }
.cw .shelf-head h3 { display: flex; align-items: center; gap: 0.5rem; }
.cw .shelf-head h3 i { color: var(--red-hot); font-size: 0.8rem; }
.cw-track { display: grid; grid-auto-flow: column; grid-auto-columns: 280px; gap: 0.85rem; overflow-x: auto; padding: 4px 2px 10px;
  scroll-snap-type: x mandatory; scrollbar-width: none; }
.cw-track::-webkit-scrollbar { display: none; }
.cw-card { position: relative; height: 158px; border-radius: 14px; overflow: hidden; cursor: pointer; scroll-snap-align: start;
  border: 1px solid rgba(255, 255, 255, 0.08); background: var(--surface);
  animation: cardIn 0.5s var(--ease) both; transition: transform 0.35s var(--ease), border-color 0.3s, opacity 0.2s; }
.cw-card:hover, .cw-card:focus-visible { transform: translateY(-4px); border-color: rgba(229, 9, 20, 0.55); outline: none; }
.cw-card.loading-streams { opacity: 0.6; pointer-events: none; }
.cw-bg { position: absolute; inset: 0; background-size: cover; background-position: center 22%; transform: scale(1.04); transition: transform 0.6s var(--ease); }
.cw-card:hover .cw-bg { transform: scale(1.1); }
.cw-card::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(5, 5, 7, 0.95) 0%, rgba(5, 5, 7, 0.75) 48%, rgba(5, 5, 7, 0.15) 100%), linear-gradient(0deg, rgba(5, 5, 7, 0.9), transparent 55%); }
.cw-in { position: absolute; inset: 0; z-index: 1; display: flex; gap: 12px; padding: 12px 12px 16px; }
.cw-poster { width: 76px; flex: none; aspect-ratio: 2 / 3; align-self: center; border-radius: 8px; object-fit: cover; box-shadow: 0 8px 20px -6px rgba(0, 0, 0, 0.8); }
.cw-txt { display: flex; flex-direction: column; min-width: 0; padding: 4px 22px 0 0; }
.cw-tag { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.08em; color: var(--red-hot); text-transform: uppercase; }
.cw-title { font-weight: 700; font-size: 0.92rem; line-height: 1.2; margin: 3px 0 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cw-sub { font-size: 0.7rem; color: var(--muted); }
.cw-resume { margin-top: auto; align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 6px 12px;
  font-size: 0.7rem; font-weight: 700; color: #fff; background: var(--grad-red); box-shadow: 0 6px 16px -6px rgba(229, 9, 20, 0.9); transition: transform 0.25s var(--ease); }
.cw-card:hover .cw-resume { transform: scale(1.05); }
.cw-x { position: absolute; z-index: 2; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  font-size: 0.65rem; color: #fff; background: rgba(0, 0, 0, 0.55); border: 1px solid rgba(255, 255, 255, 0.15); opacity: 0; transition: opacity 0.2s, background 0.2s; }
.cw-card:hover .cw-x, .cw-card:focus-within .cw-x { opacity: 1; }
.cw-x:hover { background: var(--red); }
.cw-bar { position: absolute; z-index: 1; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255, 255, 255, 0.12); }
.cw-bar span { display: block; height: 100%; background: linear-gradient(90deg, #ff5a1f, #e50914); box-shadow: 0 0 8px rgba(229, 9, 20, 0.8); }
/* Touch screens have no hover: the remove button is always there */
@media (hover: none) { .cw-x { opacity: 1; } }
@media (max-width: 640px) { .cw-track { grid-auto-columns: 250px; } .cw-card { height: 142px; } .cw-poster { width: 66px; } }

/* ── My List ─────────────────────────────────────── */
.my-list .shelf-head h3 { display: flex; align-items: center; gap: 0.5rem; }
.my-list .shelf-head h3 i { color: var(--red-hot); font-size: 0.8rem; }
.shelf-count { font-size: 0.74rem; font-weight: 600; color: var(--muted); }
.heart-btn { position: absolute; z-index: 3; top: 7px; left: 7px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  font-size: 0.74rem; color: #fff; background: rgba(0, 0, 0, 0.55); border: 1px solid rgba(255, 255, 255, 0.18); backdrop-filter: blur(6px);
  opacity: 0; transition: opacity 0.2s, background 0.2s, color 0.2s; }
.movie-card:hover .heart-btn, .movie-card:focus-within .heart-btn, .heart-btn.on { opacity: 1; }
.heart-btn:hover { background: rgba(0, 0, 0, 0.75); }
.heart-btn.on { color: var(--red-hot); background: rgba(255, 255, 255, 0.92); border-color: transparent; }
@media (hover: none) { .heart-btn { opacity: 1; } }
.detail-list { display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; height: 44px; padding: 0 1rem; border-radius: 11px; cursor: pointer;
  font-family: inherit; font-size: 0.85rem; font-weight: 700; color: #fff; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.16); transition: background 0.2s, border-color 0.2s; }
.detail-list:hover { background: rgba(255, 255, 255, 0.13); }
.detail-list.on { border-color: rgba(255, 45, 58, 0.5); }
.detail-list.on i { color: var(--red-hot); }
@media (max-width: 640px) { .detail-list span { display: none; } .detail-list { padding: 0 0.9rem; } }

/* ── Join a room from a pasted invite link (js/join.js) ── */
.join-line { display: flex; align-items: center; justify-content: center; gap: 0.45rem; margin: 0.8rem auto 0; padding: 0.3rem 0.6rem; border: 0; background: none; cursor: pointer;
  font: 500 0.84rem var(--font-ui); color: rgba(255, 255, 255, 0.62); animation: fadeUp 0.8s var(--ease) 0.24s both; }
.join-line > i { font-size: 0.75rem; color: var(--red-hot); }
.join-line b { display: inline-flex; align-items: center; gap: 0.4rem; color: #fff; font-weight: 700; padding-bottom: 1px; border-bottom: 1px solid rgba(229, 9, 20, 0.7); transition: border-color 0.2s; }
.join-line b i { font-size: 0.68rem; color: var(--red-hot); transition: transform 0.25s var(--ease); }
.join-line:hover b { border-color: var(--red-hot); }
.join-line:hover b i { transform: translateX(3px); }
.join-modal { max-width: 440px; }
.join-field { display: flex; gap: 0.45rem; align-items: center; padding: 4px 4px 4px 12px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border-hover); transition: border-color 0.2s; }
.join-field:focus-within { border-color: rgba(255, 255, 255, 0.32); }
.join-field.ok { border-color: rgba(61, 220, 132, 0.55); }
.join-field.bad { border-color: rgba(255, 90, 80, 0.7); }
/* 16px: smaller makes iPhones zoom the page in */
.join-field input { flex: 1; min-width: 0; height: 38px; background: none; border: 0; outline: 0; color: var(--text); font: 16px var(--font-ui); }
.join-paste { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border: 0; border-radius: 10px; cursor: pointer;
  font: 600 0.8rem var(--font-ui); color: #fff; background: rgba(255, 255, 255, 0.1); transition: background 0.2s; }
.join-paste:hover { background: rgba(255, 255, 255, 0.16); }
.join-paste[hidden], .join-msg[hidden] { display: none; }
.join-msg { display: flex; gap: 10px; align-items: center; margin-top: 0.8rem; padding: 10px 12px; border-radius: 12px; font-size: 0.82rem; line-height: 1.4; }
.join-msg.ok { background: rgba(61, 220, 132, 0.08); border: 1px solid rgba(61, 220, 132, 0.3); }
.join-msg.ok i { color: #3ddc84; }
.join-msg.bad { background: rgba(255, 90, 80, 0.08); border: 1px solid rgba(255, 90, 80, 0.3); }
.join-msg.bad i { color: #ff5a50; }
.join-msg b { color: #fff; }
.join-go { width: 100%; flex: none; margin-top: 0.8rem; height: 46px; border-radius: 999px; }
.join-tip { margin-top: 0.85rem; font-size: 0.74rem; color: var(--muted); text-align: center; }
/* Phones: a sheet from the bottom, within reach of a thumb */
@media (max-width: 640px) {
  .join-overlay { align-items: flex-end; padding: 0; }
  .join-modal { max-width: none; border-radius: 18px 18px 0 0; padding-bottom: calc(1.3rem + env(safe-area-inset-bottom)); transform: translateY(40px); }
}

/* ── In the Windows/Android apps the "+" becomes a labelled Create Room pill (the app adds .hx-create);
      kept compact so it doesn't compete with the logo and search ── */
html body a.create-room.hx-create { height: 30px !important; padding: 0 11px 0 9px !important; gap: 5px !important; border-radius: 999px !important;
  font-size: 11.5px !important; font-weight: 600 !important; box-shadow: 0 3px 10px -6px rgba(229, 9, 20, 0.7) !important; }
html body a.create-room.hx-create i { font-size: 10px; }
html body a.create-room.hx-create { width: auto !important; display: inline-flex !important; align-items: center; color: #fff !important;
  text-decoration: none; white-space: nowrap; background: linear-gradient(135deg, #ff2d3a 0%, #e50914 45%, #b20710 100%); border-color: transparent !important; }
