/* FamilyEnter — YouTube-style application styles */
:root {
  --bg: #0f0f0f;
  --bg-elevated: #181818;
  --surface: #212121;
  --surface-2: #272727;
  --surface-3: #303030;
  --text: #f1f1f1;
  --muted: #aaa;
  --muted-2: #717171;
  --border: #3a3a3a;
  --accent: #ff2d55;
  --accent-2: #ff5c7a;
  --accent-3: #7c3aed;
  --blue: #3ea6ff;
  --green: #22c55e;
  --topbar-h: 56px;
  --sidebar-w: 240px;
  --player-h: 0px;
  --music-bar-h: 86px;
  --radius: 12px;
  --shadow: 0 18px 48px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  padding-bottom: var(--player-h);
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
ul { list-style: none; margin: 0; padding: 0; }
/* YouTube-style scrolling: no bright scrollbar track or white gutter, and no
   rubber-band flash when you hit the top or bottom of the page. */
html { scrollbar-color: #4a4a4a transparent; scrollbar-width: thin; overscroll-behavior: none; }
body { overscroll-behavior: none; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #4a4a4a !important; border-radius: 10px; border: 2px solid transparent !important; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent !important; border: 0 !important; }
@media (max-width: 760px) {
  html, body, * { scrollbar-width: none !important; -ms-overflow-style: none !important; }
  *::-webkit-scrollbar { display: none !important; width: 0 !important; height: 0 !important; }
}
/* Side panels scroll without drawing the distracting vertical track line. */
.sidebar, .side-list, .queue-panel, .player-menu {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.sidebar::-webkit-scrollbar, .side-list::-webkit-scrollbar,
.queue-panel::-webkit-scrollbar, .player-menu::-webkit-scrollbar { display: none; }
/* Mobile-only shortcut group lives in the sidebar; hidden on desktop. */
.sidebar .mobile-tools { display: none; }
/* Sidebar links styled as buttons must match anchor links. */
button.sidebar-link { width: 100%; text-align: left; background: transparent; border: 0; color: inherit; cursor: pointer; }

/* ---------- Top bar ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--topbar-h); z-index: 90;
  display: flex; align-items: center; gap: 16px; padding: 0 20px;
  background: rgba(15, 15, 15, .96); backdrop-filter: blur(14px);
  border-bottom: 1px solid #242424;
}
.icon-btn {
  width: 40px; height: 40px; flex: 0 0 40px; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: transparent; color: var(--text); font-size: 17px;
  transition: background .18s, transform .18s;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(.92); }
.brand { display: flex; align-items: center; gap: 8px; font-size: 19px; font-weight: 800; letter-spacing: -.6px; white-space: nowrap; }
.brand-mark {
  width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px;
  background: linear-gradient(145deg, var(--accent), #ff7a3d); color: #fff; font-size: 14px;
  box-shadow: 0 4px 14px rgba(255, 45, 85, .35);
}
.brand span:last-child { color: var(--accent); }
.search-bar {
  flex: 1 1 640px; max-width: 720px; margin: 0 auto; display: flex; height: 40px;
  background: #121212; border: 1px solid #303030; border-radius: 22px; overflow: hidden;
  transition: border-color .2s, box-shadow .2s;
}
.search-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 45, 85, .12); }
.search-bar input { flex: 1; min-width: 0; padding: 0 18px; border: 0; outline: 0; background: transparent; color: var(--text); }
.search-bar input::placeholder { color: var(--muted-2); }
.search-submit { width: 64px; border: 0; border-left: 1px solid #303030; background: var(--surface-2); color: var(--text); font-size: 16px; }
.search-submit:hover { background: var(--surface-3); }
.top-actions { display: flex; align-items: center; gap: 6px; }
.pill {
  height: 36px; padding: 0 14px; display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--border); border-radius: 20px; background: var(--surface);
  color: var(--text); font-size: 13px; font-weight: 600; white-space: nowrap;
}
.pill:hover { background: var(--surface-2); }
.pill.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.pill.primary:hover { background: var(--accent-2); }
.boost-pill.on { background: rgba(255, 45, 85, .14); border-color: var(--accent); color: var(--accent-2); }
.boost-pill.on i { filter: drop-shadow(0 0 5px rgba(255, 45, 85, .55)); }
.install-pill, .download-pill { border-color: rgba(255,255,255,.28); color: var(--text); }
.install-pill.ready { border-color: var(--accent); color: var(--accent-2); background: rgba(255,45,85,.12); }
.download-pill { border-color: var(--border); }
.install-pill span, .download-pill span { display: inline; }
.download-options { display: grid; gap: 10px; margin-top: 14px; }
.download-option {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--surface-2); color: var(--text); text-decoration: none;
  width: 100%; text-align: left; cursor: pointer; font: inherit;
}
.download-option:hover, .download-option.recommended { border-color: var(--accent); }
.download-option > i { font-size: 24px; color: var(--accent-2); width: 30px; text-align: center; }
.download-option span { display: grid; gap: 3px; }
.download-option small { color: var(--muted); }
.pill.danger {
  color: #ff7188; border-color: rgba(255, 113, 136, .35); background: rgba(255, 113, 136, .08);
}
.pill.danger:hover { background: rgba(255, 113, 136, .16); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent-2); outline-offset: 2px;
}
.pill:hover, .chip:hover, .action-btn:hover { transform: translateY(-1px); }
.pill:active, .chip:active, .action-btn:active { transform: translateY(0) scale(.98); }

/* ---------- Revamp polish ---------- */
.chip.active {
  background: linear-gradient(135deg, var(--accent), #ff7a3d);
  border-color: transparent; color: #fff;
  box-shadow: 0 6px 18px rgba(255, 45, 85, .22);
}
.section-head h2::before {
  content: ''; display: inline-block; width: 4px; height: 19px; margin-right: 10px;
  border-radius: 4px; vertical-align: -3px; background: linear-gradient(180deg, var(--accent), var(--accent-3, #7c3aed));
}
.video-card .thumb, .music-card, .playlist-card, .channel-card {
  border: 1px solid rgba(255,255,255,.045);
}
.video-card:hover .thumb { border-color: rgba(255, 45, 85, .35); }
.skeleton, .shimmer {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: feShimmer 1.1s linear infinite;
}
@keyframes feShimmer { to { background-position: -200% 0; } }
.badge { position: absolute; top: 4px; right: 3px; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 9px; line-height: 15px; text-align: center; }
.icon-btn { position: relative; }
.avatar-btn {
  width: 36px; height: 36px; flex: 0 0 36px; border: 0; border-radius: 50%; margin-left: 4px;
  background: linear-gradient(145deg, #6d28d9, #2563eb); color: #fff; font-weight: 700; font-size: 13px;
  display: grid; place-items: center; overflow: hidden;
}
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed; top: var(--topbar-h); left: 0; bottom: 0; width: var(--sidebar-w); z-index: 80;
  overflow-y: auto; padding: 12px 12px 110px; background: var(--bg);
  scrollbar-width: thin; transition: transform .25s ease;
}
.sidebar-group { padding: 12px 0; border-bottom: 1px solid #272727; }
.sidebar-group:last-child { border-bottom: 0; }
.sidebar-title { padding: 0 12px 8px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .4px; }
.sidebar-link {
  display: flex; align-items: center; gap: 16px; height: 40px; padding: 0 12px;
  border-radius: 10px; color: var(--text); font-size: 14px; transition: background .18s;
}
.sidebar-link i { width: 20px; text-align: center; font-size: 16px; color: #d0d0d0; }
.sidebar-link:hover { background: var(--surface); }
.sidebar-link.active { background: var(--surface-2); font-weight: 600; }
.sidebar-link.active i { color: var(--accent); }
.sidebar-footer { padding: 18px 12px; color: var(--muted-2); font-size: 11px; line-height: 1.7; }
.scrim { display: none; position: fixed; inset: var(--topbar-h) 0 0; background: rgba(0,0,0,.6); z-index: 75; }
body.sidebar-open .scrim { display: block; }

/* ---------- Main ---------- */
/* The top bar is fixed, so every page must start below it. */
.main { margin-left: var(--sidebar-w); margin-top: var(--topbar-h); padding: 20px 28px 60px; min-height: calc(100vh - var(--topbar-h)); }
.chips { display: flex; gap: 10px; overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; padding: 4px 0 18px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  height: 34px; padding: 0 15px; border: 1px solid var(--border); border-radius: 18px;
  background: var(--surface); color: var(--text); font-size: 13px; font-weight: 500; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 7px;
}
.chip:hover { background: var(--surface-2); }
.chip.active { background: var(--text); color: #0f0f0f; border-color: var(--text); font-weight: 700; }
.section { margin-bottom: 38px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-head h2 { margin: 0; font-size: 21px; font-weight: 750; letter-spacing: -.3px; }
.section-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.link-btn { border: 0; background: transparent; color: var(--blue); font-size: 13px; font-weight: 600; }
.link-btn:hover { text-decoration: underline; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 30px;
  min-height: 240px; padding: 32px; margin-bottom: 28px; border-radius: 18px;
  background: radial-gradient(circle at 80% 20%, rgba(255, 45, 85, .28), transparent 45%),
              linear-gradient(120deg, #241226, #151a30 60%, #101010);
  border: 1px solid #362334;
}
.hero-copy { max-width: 560px; position: relative; z-index: 1; }
.hero-kicker { color: var(--accent-2); font-weight: 800; letter-spacing: 1.4px; font-size: 11px; text-transform: uppercase; }
.hero h1 { margin: 10px 0 8px; font-size: clamp(28px, 4vw, 46px); line-height: 1.05; letter-spacing: -1.5px; }
.hero p { margin: 0 0 20px; color: #d4d4d4; font-size: 15px; line-height: 1.55; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-art { position: absolute; right: 5%; top: 50%; transform: translateY(-50%); width: 260px; height: 260px; border-radius: 50%; background: conic-gradient(from 20deg, #ff2d55, #7c3aed, #3ea6ff, #ff2d55); filter: blur(2px); opacity: .6; }
.hero-art::after { content: '\f04b'; font-family: "Font Awesome 6 Free"; font-weight: 900; position: absolute; inset: 28px; display: grid; place-items: center; border-radius: 50%; background: #12121a; color: #fff; font-size: 64px; }

/* ---------- Cards & grids ---------- */
.grid { display: grid; gap: 22px 16px; }
.grid-videos { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-music { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.grid-channels { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.grid-playlists { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.yt-playlist { padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); cursor: pointer; transition: background .2s, border-color .2s; }
.yt-playlist:hover { background: var(--surface-2); border-color: var(--accent); }
.yt-playlist .playlist-cover { aspect-ratio: 16/9; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.yt-playlist .playlist-cover img { width: 100%; height: 100%; object-fit: cover; }
.yt-playlist h3 { margin: 10px 0 4px; font-size: 14px; line-height: 1.3; }
.yt-playlist p { margin: 0; color: var(--muted); font-size: 12px; }
.yt-playlist-videos { margin-top: 12px; }
.yt-playlist-videos .grid-videos { grid-template-columns: 1fr; gap: 10px; }
.yt-playlist-videos .video-meta { padding-top: 8px; }
.yt-playlist-videos .video-title { font-size: 13px; }
.yt-connect { display: flex; align-items: center; gap: 18px; padding: 20px; margin-bottom: 28px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.yt-connect h2 { margin: 0 0 6px; font-size: 19px; }
.yt-connect p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.yt-connect .yt-note { margin-top: 8px; color: var(--accent-2); }
.yt-connect-icon, .yt-avatar { width: 54px; height: 54px; flex: 0 0 54px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,45,85,.12); color: var(--accent); font-size: 26px; object-fit: cover; }
.yt-channel { padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); cursor: pointer; transition: background .2s, border-color .2s; }
.yt-channel:hover { background: var(--surface-2); border-color: var(--accent); }
.yt-channel-img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; margin-bottom: 10px; background: var(--surface-2); }
.yt-channel strong { display: block; font-size: 14px; line-height: 1.3; }
.yt-channel > span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.yt-channel-videos { margin-top: 12px; }
.yt-channel-videos .grid-videos { grid-template-columns: 1fr; gap: 10px; }
.yt-channel-videos .video-meta { padding-top: 8px; }
.yt-channel-videos .video-title { font-size: 13px; }
.yt-more { margin-top: 10px; width: 100%; padding: 7px; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--blue); font-size: 12px; font-weight: 600; cursor: pointer; }
.yt-more:hover { background: var(--surface-2); }
.video-card { min-width: 0; cursor: pointer; }
/* Off-screen cards skip layout and paint entirely. On a long home grid this
   keeps scrolling smooth on Quest/WebView without changing what is visible. */
.video-card, .music-card, .channel-card {
  content-visibility: auto;
  contain-intrinsic-size: auto 190px;
  contain: layout paint style;
}
.thumb { position: relative; aspect-ratio: 16/9; border-radius: 12px; overflow: hidden; background: var(--surface); }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.video-card:hover .thumb img { transform: scale(1.045); }
.thumb .duration { position: absolute; right: 8px; bottom: 8px; padding: 2px 6px; border-radius: 4px; background: rgba(0,0,0,.82); color: #fff; font-size: 12px; font-weight: 600; }
.thumb .play-hover { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.28); opacity: 0; transition: opacity .2s; }
.thumb .play-hover i { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: #fff; font-size: 18px; }
.video-card:hover .play-hover { opacity: 1; }
.video-meta { display: flex; gap: 10px; padding-top: 11px; }
.channel-avatar { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(145deg, #7c3aed, #3ea6ff); color: #fff; font-size: 13px; font-weight: 700; overflow: hidden; }
.channel-avatar img { width: 100%; height: 100%; object-fit: cover; }
.video-info { min-width: 0; }
.video-title { font-size: 14px; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.video-sub { margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.video-sub .verified { color: var(--muted); margin-left: 3px; }
.video-desc {
  margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.video-reason { color: var(--blue); font-size: 11px; font-weight: 600; }
.video-reason i { margin-right: 4px; }
.music-card { background: var(--surface); border: 1px solid transparent; border-radius: 14px; padding: 12px; cursor: pointer; transition: background .2s, border-color .2s, transform .2s; }
.music-card:hover { background: var(--surface-2); border-color: var(--border); transform: translateY(-3px); }
.music-art { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--surface-2); margin-bottom: 12px; }
.music-art img { width: 100%; height: 100%; object-fit: cover; }
.music-art .play-hover { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.45); opacity: 0; transition: opacity .2s; }
.music-art .play-hover i { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: #fff; }
.music-card:hover .play-hover, .music-card.playing .play-hover { opacity: 1; }
.music-card h3 { margin: 0 0 4px; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.music-card p { margin: 0; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.channel-card { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 20px 10px; background: var(--surface); border-radius: 14px; text-align: center; }
.channel-card .channel-avatar { width: 76px; height: 76px; flex-basis: 76px; font-size: 26px; }
.channel-card strong { font-size: 14px; }
.channel-card span { color: var(--muted); font-size: 12px; }

/* ---------- Watch page ---------- */
.watch-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; }
/* Grid items default to min-width:auto, so a nowrap child (channel row, side
   list) can force the whole column wider than the screen and clip the video. */
.watch-layout > div { min-width: 0; }
.player-frame-wrap, .player-frame, .local-player, #youtubePlayer { max-width: 100%; }
.player-frame { width: 100%; aspect-ratio: 16/9; border: 0; border-radius: 14px; background: #000; overflow: hidden; }
.local-player { width: 100%; aspect-ratio: 16/9; border-radius: 14px; background: #000; object-fit: contain; }
.watch-title { margin: 16px 0 12px; font-size: 20px; font-weight: 700; line-height: 1.35; }
.watch-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.action-btn {
  height: 36px; padding: 0 14px; display: inline-flex; align-items: center; gap: 8px;
  border: 0; border-radius: 20px; background: var(--surface-2); color: var(--text); font-size: 13px; font-weight: 600;
}
.action-btn:hover { background: var(--surface-3); }
.action-btn.active { background: var(--accent); color: #fff; }
.channel-row { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid #2c2c2c; border-bottom: 1px solid #2c2c2c; }
.channel-row .channel-avatar { width: 44px; height: 44px; flex-basis: 44px; font-size: 16px; }
.channel-row strong { display: block; font-size: 15px; }
.channel-row small { color: var(--muted); font-size: 12px; }
.description { margin-top: 14px; padding: 14px; border-radius: 12px; background: var(--surface); font-size: 13px; line-height: 1.6; cursor: pointer; }
.description.clamped { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.description b { display: block; margin-bottom: 4px; }
.comments { margin-top: 26px; }
.comments h3 { font-size: 17px; margin-bottom: 18px; }
.comment-form { display: flex; gap: 12px; margin-bottom: 22px; }
.comment-form input { flex: 1; height: 42px; padding: 0 14px; border: 1px solid var(--border); border-radius: 22px; background: var(--surface); color: var(--text); outline: none; }
.comment-form input:focus { border-color: var(--accent); }
.comment { display: flex; gap: 12px; margin-bottom: 20px; }
.comment-body strong { font-size: 13px; }
.comment-body small { color: var(--muted); margin-left: 8px; font-size: 11px; }
.comment-body p { margin: 5px 0 0; line-height: 1.5; font-size: 13px; }
.comment-head { display: flex; align-items: center; flex-wrap: wrap; }
.comment-actions { display: flex; gap: 14px; margin-top: 8px; flex-wrap: wrap; }
.comment-action {
  border: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600;
  padding: 3px 0; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.comment-action:hover, .comment-action.active { color: var(--accent-2); }
.comment-action.danger:hover { color: #ff7188; }
.comment-action i { font-size: 12px; }
.comment-edit-input {
  width: 100%; min-height: 72px; margin-top: 6px; padding: 10px 12px; resize: vertical;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text);
  outline: none; font: inherit;
}
.comment-edit-input:focus { border-color: var(--accent); }
.mod-check { color: var(--accent-2); margin-left: 4px; }
.side-list { display: flex; flex-direction: column; gap: 12px; }
.side-list .video-card { display: grid; grid-template-columns: 168px 1fr; gap: 10px; }
.side-list .video-meta { padding-top: 0; }

/* ---------- Search / list results ---------- */
.result-list { display: flex; flex-direction: column; gap: 18px; max-width: 980px; }
.result-item { display: grid; grid-template-columns: 360px 1fr; gap: 16px; cursor: pointer; }
.result-item .thumb { aspect-ratio: 16/9; }
.result-item h3 { margin: 0 0 8px; font-size: 17px; font-weight: 600; line-height: 1.35; }
.tabs { display: flex; gap: 8px; border-bottom: 1px solid #2c2c2c; margin-bottom: 20px; }
.tab { padding: 10px 14px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-weight: 600; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- Playlists & library ---------- */
.playlist-card { padding: 14px; background: var(--surface); border-radius: 14px; cursor: pointer; }
.playlist-cover { aspect-ratio: 16/9; border-radius: 10px; background: linear-gradient(145deg, #3b1d4f, #12284d); display: grid; place-items: center; font-size: 42px; color: #ffffffb0; margin-bottom: 12px; }
.playlist-card h3 { margin: 0 0 5px; font-size: 15px; }
.playlist-card p { margin: 0; color: var(--muted); font-size: 12px; }
.list-row { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border-radius: 10px; }
.list-row:hover { background: var(--surface); }
.list-row .thumb { width: 150px; flex: 0 0 150px; }
.list-row .row-info { flex: 1; min-width: 0; }
.list-row .row-actions { display: flex; gap: 6px; }
.item-index { width: 28px; color: var(--muted); text-align: center; }

/* ---------- Uploads ---------- */
.dropzone {
  display: grid; place-items: center; gap: 10px; min-height: 190px; padding: 28px;
  border: 2px dashed var(--border); border-radius: 16px; background: var(--surface);
  text-align: center; cursor: pointer; transition: border-color .2s, background .2s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: #2a1a22; }
.dropzone i { font-size: 34px; color: var(--accent); }
.dropzone strong { font-size: 16px; }
.dropzone span { color: var(--muted); font-size: 13px; }
.upload-form { display: flex; gap: 12px; margin-top: 16px; }
.upload-form input { flex: 1; height: 42px; padding: 0 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); outline: none; }

/* ---------- Modal, toast, states ---------- */
.modal-backdrop {
  /* Keep every dialog below the fixed search bar, including on Quest Browser. */
  position: fixed; inset: 0; z-index: 150; display: grid; place-items: center;
  padding: calc(var(--topbar-h) + 24px) 20px 24px;
  background: rgba(0,0,0,.72); backdrop-filter: blur(4px);
}
.modal {
  width: min(480px, 100%); max-height: calc(100vh - var(--topbar-h) - 48px); overflow-y: auto;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 18px;
  box-shadow: var(--shadow); padding: 24px;
}
.modal.wide { width: min(720px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h2 { margin: 0; font-size: 20px; }
.field { margin-bottom: 14px; }
.field label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
.field input, .field textarea, .field select {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px;
  background: #121212; color: var(--text); outline: none;
}
.field input:focus, .field textarea:focus { border-color: var(--accent); }
.modal-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.account-summary {
  display: flex; align-items: center; gap: 14px; margin-bottom: 18px;
  padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface);
}
.account-summary strong { display: block; font-size: 17px; line-height: 1.3; }
.account-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); justify-content: stretch; }
.account-actions .pill { width: 100%; justify-content: center; }
.account-actions .pill.primary { grid-column: 1 / -1; }
.account-actions .pill.danger {
  color: #ff7188; border-color: rgba(255, 113, 136, .35); background: rgba(255, 113, 136, .08);
}
.account-actions .pill.danger:hover { background: rgba(255, 113, 136, .16); }
@media (max-width: 520px) {
  .account-actions { grid-template-columns: 1fr; }
  .account-actions .pill.primary { grid-column: auto; }
}
.modal-note { margin-top: 16px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.divider-text { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--muted-2); font-size: 11px; }
.divider-text::before, .divider-text::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ---------- Developer tools ---------- */
.dev-panel { max-width: 100%; }
.dev-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.dev-stat {
  padding: 12px; border: 1px solid var(--border); border-radius: 12px;
  background: linear-gradient(145deg, rgba(255,45,85,.08), rgba(124,58,237,.07));
  display: grid; gap: 5px; min-width: 0;
}
.dev-stat span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; }
.dev-stat strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.dev-pre {
  max-height: 320px; overflow: auto; margin: 0; padding: 14px;
  border: 1px solid var(--border); border-radius: 12px; background: #0b0b0d;
  color: #b9f6d0; font: 11px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-wrap; word-break: break-word;
}
.dev-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.dev-actions .pill { height: 34px; font-size: 12px; }
@media (max-width: 620px) {
  .dev-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dev-pre { max-height: 220px; }
}
.toast-host { position: fixed; right: 20px; bottom: calc(var(--player-h) + 20px); z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  min-width: 260px; max-width: 380px; padding: 13px 16px; border-radius: 10px;
  background: #2c2c2c; border-left: 4px solid var(--accent); box-shadow: var(--shadow);
  font-size: 13px; animation: toast-in .22s ease;
}
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: #ef4444; }
@keyframes toast-in { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.empty { padding: 70px 20px; text-align: center; color: var(--muted); }
.empty i { display: block; margin-bottom: 16px; font-size: 46px; color: var(--surface-3); }
.empty h3 { margin: 0 0 8px; color: var(--text); font-size: 18px; }
.skeleton { border-radius: 12px; background: linear-gradient(90deg, #1d1d1d 25%, #292929 50%, #1d1d1d 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.skeleton-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 22px 16px; }
.skeleton-card .skeleton:first-child { aspect-ratio: 16/9; margin-bottom: 12px; }
.skeleton-card .skeleton { height: 14px; margin-bottom: 8px; }

/* ---------- Bottom player (only shown once music is actually selected) ---------- */
body.music-active { --player-h: var(--music-bar-h); }
.player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 120; height: var(--music-bar-h);
  display: none; grid-template-columns: minmax(180px, 1fr) minmax(320px, 2fr) minmax(180px, 1fr);
  align-items: center; gap: 18px; padding: 0 18px;
  background: #181818; border-top: 1px solid #2d2d2d;
}
body.music-active .player { display: grid; }
.player-track { display: flex; align-items: center; gap: 12px; min-width: 0; }
.player-track img { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; background: var(--surface-2); }
.player-track-info { min-width: 0; }
.player-track-info strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-track-info span { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-center { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.player-controls { display: flex; align-items: center; gap: 14px; }
.player-controls .icon-btn { width: 34px; height: 34px; flex-basis: 34px; font-size: 15px; }
.player-controls .play-main { width: 40px; height: 40px; flex-basis: 40px; background: var(--text); color: #0f0f0f; font-size: 16px; }
.player-controls .play-main:hover { background: #fff; }
.player-controls .icon-btn.on { color: var(--accent); }
.progress-wrap { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 620px; color: var(--muted); font-size: 11px; }
input[type="range"] { -webkit-appearance: none; appearance: none; height: 4px; border-radius: 4px; background: #4a4a4a; outline: none; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: #fff; }
input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: #fff; }
#seek { flex: 1; }
.player-right { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
#volume { width: 100px; }
.queue-panel {
  position: fixed; right: 14px; bottom: calc(var(--player-h) + 14px); z-index: 130; width: 340px; max-height: 420px;
  overflow-y: auto; padding: 14px; border-radius: 14px; background: var(--bg-elevated); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.queue-panel h3 { margin: 0 0 12px; font-size: 15px; }
.queue-row { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; cursor: pointer; }
.queue-row:hover { background: var(--surface); }
.queue-row.active { background: var(--surface-2); }
.queue-row img { width: 38px; height: 38px; border-radius: 6px; object-fit: cover; }
.queue-row div { min-width: 0; }
.queue-row strong, .queue-row span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.queue-row span { color: var(--muted); }

/* ---------- Light theme ---------- */
body.theme-light {
  --bg: #f5f5f5; --bg-elevated: #ffffff; --surface: #eaeaea; --surface-2: #dedede; --surface-3: #d2d2d2;
  --text: #161616; --muted: #5c5c5c; --muted-2: #8a8a8a; --border: #c9c9c9;
}
body.theme-light .topbar { background: rgba(255,255,255,.96); border-bottom-color: #ddd; }
body.theme-light .sidebar { background: #fafafa; }
body.theme-light .sidebar-group { border-bottom-color: #e0e0e0; }
body.theme-light .search-bar { background: #fff; border-color: #ccc; }
body.theme-light .search-submit { background: #eee; border-left-color: #ccc; }
body.theme-light .player { background: #fff; border-top-color: #ddd; }
body.theme-light .hero { background: radial-gradient(circle at 80% 20%, rgba(255,45,85,.14), transparent 45%), linear-gradient(120deg, #ffe9ee, #eef2ff 60%, #f5f5f5); border-color: #e6c8d0; }
body.theme-light .hero p { color: #444; }
body.theme-light .playlist-cover { color: #333; }
body.theme-light .channel-avatar { color: #fff; }
body.theme-light .description, body.theme-light .dropzone, body.theme-light .modal { background: #fff; }
body.theme-light .field input, body.theme-light .field textarea, body.theme-light .comment-form input { background: #fafafa; }
body.theme-light .skeleton { background: linear-gradient(90deg, #e4e4e4 25%, #efefef 50%, #e4e4e4 75%); background-size: 200% 100%; }
body.theme-light .toast { background: #fff; color: #161616; }

/* ---------- Autoplay countdown (starts only after video ends) ---------- */
.autoplay-overlay {
  position: absolute; right: 16px; bottom: 16px; z-index: 5; display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 12px; background: rgba(15,15,15,.92); color: #fff; box-shadow: var(--shadow);
  font-size: 13px; animation: rise .2s ease-out;
}
.autoplay-overlay strong { color: var(--accent-2); }
.player-frame-wrap { position: relative; overflow: hidden; border-radius: 12px; background: #000; }
#youtubePlayer { position: relative; z-index: 1; width: 100%; aspect-ratio: 16 / 9; border: 0; display: block; }
.player-poster { position: absolute; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; background: #000; transition: opacity .3s ease; }
.player-poster.hidden { opacity: 0; }
.player-poster img { width: 100%; height: 100%; object-fit: cover; opacity: .7; }
.player-poster::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.15), rgba(0,0,0,.65)); }
/* One shared status layer: startup and buffering update this same element. */
.player-status { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; color: #fff; font-size: 12px; font-weight: 600; text-shadow: 0 1px 5px rgba(0,0,0,.9); pointer-events: none; }
.player-status[hidden] { display: none; }
.player-status i { font-size: 27px; color: var(--accent-2); filter: drop-shadow(0 2px 6px rgba(0,0,0,.6)); }
.player-frame-wrap:fullscreen .player-poster, .main.mini-watch-host .player-poster { display: none; }
.player-frame-wrap:fullscreen .player-status, .main.mini-watch-host .player-status { display: none; }
.card-preview {
  position: absolute; right: 10px; bottom: 10px; z-index: 3; width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.24); background: rgba(0,0,0,.72); color: #fff; font-size: 11px;
  display: grid; place-items: center; opacity: 0; transition: opacity .18s, transform .18s; cursor: pointer;
}
.music-card:hover .card-preview, .card-preview:focus-visible { opacity: 1; }
.card-preview:hover { background: var(--accent); transform: scale(1.08); }

/* ---------- Compact player tools below the video; settings opens upward ---------- */
.player-tools { position: relative; display: flex; align-items: center; justify-content: flex-end; flex-wrap: nowrap; gap: 3px; height: 34px; margin: 3px 0 7px; }
.player-tool { position: relative; display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer; transition: background .15s, color .15s; }
.player-tool:hover, .player-tool.on { color: var(--text); background: var(--surface); }
.player-tool i { font-size: 13px; }
.player-tool.cc-tool, .player-tool.mode-tool { font-size: 10px; letter-spacing: .02em; }
.player-tool.mode-tool { min-width: 44px; width: auto; padding: 0 8px; border-radius: 14px; gap: 4px; }
.player-tool.mode-tool i { font-size: 11px; }
.player-tool.cinema-tool { color: #fff; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16); }
.player-tool.cinema-tool.on { color: #fff; background: var(--accent); border-color: var(--accent); }
.player-menu { position: absolute; bottom: calc(100% + 8px); right: 0; z-index: 95; width: 210px; max-height: min(52vh, 360px); overflow-y: auto; padding: 6px; border-radius: 12px; background: var(--bg-elevated); border: 1px solid var(--border); box-shadow: var(--shadow); color: var(--text); }
.player-menu-title { padding: 7px 9px 5px; font-size: 10px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted-2); }
.player-menu button { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 9px; border-radius: 8px; color: var(--text); font-size: 12px; background: transparent; border: 0; cursor: pointer; text-align: left; }
.player-menu button:hover { background: var(--surface); }
.player-menu button.active { color: var(--accent); }
.player-menu small { color: var(--muted); font-weight: 500; }
.player-menu .divider { height: 1px; background: var(--border); margin: 5px 3px; }

/* YouTube-style theater and full screen */
body.theater-mode .watch-layout { display: block; max-width: 1500px; margin: 0 auto; }
body.theater-mode .side-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; margin-top: 20px; }
body.theater-mode .player-frame { max-height: calc(100vh - 220px); }
.player-frame-wrap:fullscreen { width: 100vw; height: 100vh; display: grid; place-items: center; background: #000; }
.player-frame-wrap:fullscreen .player-frame,
.player-frame-wrap:fullscreen .local-player { width: 100vw; height: 100vh; max-height: none; aspect-ratio: auto; border-radius: 0; }
.player-fs-exit { display: none; position: absolute; top: 16px; right: 16px; z-index: 12; align-items: center; gap: 8px; padding: 9px 13px; border: 1px solid rgba(255,255,255,.24); border-radius: 10px; background: rgba(12,12,12,.88); color: #fff; font-size: 12px; font-weight: 700; cursor: pointer; }
.player-fs-exit:hover { background: var(--accent); border-color: var(--accent); }
.player-frame-wrap:fullscreen .player-fs-exit { display: inline-flex; }

/* ---------- Persistent mini player (no iframe remount) ---------- */
#miniPlayerHost:empty { display: none; }
.main.mini-watch-host {
  position: static !important;
  width: 0 !important;
  height: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: visible !important;
  pointer-events: none;
}
.main.mini-watch-host .watch-layout { display: block; width: 0; height: 0; }
.main.mini-watch-host .watch-layout > div:first-child > * { display: none !important; }
.main.mini-watch-host .watch-layout > div:first-child > .player-frame-wrap { display: block !important; }
.main.mini-watch-host .watch-layout > aside { display: none !important; }
.main.mini-watch-host .player-tools { display: none !important; }
.main.mini-watch-host .player-frame-wrap {
  position: fixed;
  right: 20px;
  bottom: 134px;
  z-index: 60;
  width: 340px;
  height: 191px;
  overflow: hidden;
  border-radius: 12px;
  background: #000;
  box-shadow: 0 18px 50px rgba(0,0,0,.55);
  pointer-events: auto;
  animation: miniIn .22s ease-out;
}
.main.mini-watch-host .player-frame-wrap .player-frame,
.main.mini-watch-host .player-frame-wrap .local-player {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  border-radius: 0;
}
.mini-bar {
  position: fixed;
  right: 20px;
  bottom: 96px;
  z-index: 61;
  width: 340px;
  height: 38px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 9px;
  border-radius: 0 0 12px 12px;
  background: #101010;
  border: 1px solid rgba(255,255,255,.16);
  border-top: 0;
  box-shadow: 0 18px 50px rgba(0,0,0,.55);
  color: #fff;
  animation: miniIn .22s ease-out;
  cursor: grab;
  touch-action: none;
}
.mini-bar.dragging { cursor: grabbing; }
.mini-grip { width: 14px; flex: 0 0 14px; color: #777; font-size: 12px; text-align: center; cursor: grab; }
.mini-copy { flex: 1; min-width: 0; }
.mini-copy strong, .mini-copy span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-copy strong { font-size: 12px; }
.mini-copy span { font-size: 10px; color: #aaa; }
.mini-bar button { width: 28px; height: 28px; flex: 0 0 28px; border-radius: 50%; border: 0; background: rgba(255,255,255,.1); color: #fff; cursor: pointer; display: grid; place-items: center; }
.mini-bar button:hover, .mini-bar button.on { background: var(--accent); }
@keyframes miniIn { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (max-width: 760px) {
  .main.mini-watch-host .player-frame-wrap { right: 10px; bottom: 126px; width: min(300px, calc(100vw - 20px)); height: auto; aspect-ratio: 16 / 9; }
  .mini-bar { right: 10px; bottom: 88px; width: min(300px, calc(100vw - 20px)); }
  .player-tools { flex-wrap: nowrap; justify-content: flex-end; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .watch-layout { grid-template-columns: 1fr; }
  .side-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
  .side-list .video-card { display: block; }
  .side-list .video-meta { padding-top: 10px; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow); }
  body.sidebar-open .sidebar { transform: none; }
  .main { margin-left: 0; padding: 18px 18px 60px; }
  .player { grid-template-columns: minmax(140px, 1fr) minmax(260px, 2fr); }
  .player-right { display: none; }
  .result-item { grid-template-columns: 280px 1fr; }
}
@media (max-width: 700px) {
  .topbar { gap: 8px; padding: 0 10px; }
  .brand { font-size: 0; gap: 0; }
  .brand-mark { font-size: 14px; }
  /* Only the essentials stay in the phone top bar: Cast, theme and account.
     Everything else moves into the slide-out menu so nothing is unreachable. */
  .top-actions .pill, .top-actions [data-action="voice-search"], .top-actions [data-action="open-bug-report"], .top-actions [data-action="open-notifications"] { display: none; }
  .sidebar .mobile-tools { display: block; }
  .search-bar { flex: 1 1 auto; min-width: 0; }
  .boost-pill { padding: 0 10px; }
  .boost-pill span { display: none; }
  .search-bar { height: 38px; }
  .search-submit { width: 48px; }
  .main { padding: 14px 12px 60px; }
  .hero { padding: 24px 20px; min-height: 200px; }
  .hero-art { display: none; }
  .watch-title { font-size: 17px; }
  .result-item { grid-template-columns: 1fr; }
  .result-item .thumb { width: 100%; }
  .grid-videos { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 18px 10px; }
  .video-title { font-size: 12px; }
  .video-sub, .video-meta .channel-avatar { display: none; }
  .grid-music { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
  .player { grid-template-columns: 1fr auto; gap: 8px; padding: 0 10px; }
  .player-track img { width: 44px; height: 44px; }
  .player-center { align-items: flex-end; }
  .player-controls { gap: 4px; }
  .player-controls [data-action="prev"], .player-controls [data-action="next"] { display: none; }
  .progress-wrap { width: 100%; }
  .progress-wrap .time { display: none; }
  .queue-panel { width: calc(100% - 28px); }
  .toast-host { left: 12px; right: 12px; bottom: calc(var(--player-h) + 12px); }
  .toast { max-width: none; }
}
.related-loading { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; padding: 8px 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ---- Chat & Calls ---- */
.chat-picker.hidden, .chat-record-bar.hidden, .call-stage.hidden,
.call-no-video.hidden, #callLocal.hidden { display: none !important; }
.muted { color: var(--muted); }

.chat-layout {
  display: grid;
  grid-template-columns: 316px minmax(0, 1fr);
  gap: 14px;
  width: 100%;
  max-width: 1240px;
  min-height: calc(100vh - var(--topbar-h) - 36px);
  margin: 0 auto;
}
.chat-sidebar, .chat-main {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  min-height: 0;
}
.chat-sidebar { display: flex; flex-direction: column; height: calc(100vh - var(--topbar-h) - 40px); overflow: hidden; }
.chat-side-head { display: grid; gap: 12px; padding: 16px; border-bottom: 1px solid var(--border); }
.chat-side-title { display: flex; align-items: center; gap: 10px; }
.chat-side-icon {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-size: 16px;
}
.chat-side-title h2 { margin: 0; font-size: 16px; letter-spacing: -.01em; }
.chat-side-title small { color: var(--muted); font-size: 11px; }
.chat-search {
  display: flex; align-items: center; gap: 8px; padding: 0 10px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px; color: var(--muted);
}
.chat-search:focus-within { border-color: var(--accent); }
.chat-search input { flex: 1; min-width: 0; padding: 9px 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 13px; }
.chat-side-scroll { flex: 1; overflow-y: auto; padding: 12px; scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
.chat-side-scroll::-webkit-scrollbar { width: 6px; }
.chat-side-scroll::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 6px; }
.chat-section-head {
  display: flex; justify-content: space-between; align-items: center;
  margin: 8px 4px; color: var(--muted); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .09em;
}
.chat-section-head small { color: var(--muted-2); font-size: 10px; }
.chat-empty { font-size: 12px; padding: 6px 4px; margin: 0; line-height: 1.5; }
.chat-avatar {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; background: var(--surface-2); color: var(--text);
  font-size: 14px; font-weight: 700;
}
.chat-avatar.small { width: 30px; height: 30px; font-size: 12px; }
.chat-conv {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px;
  border: 1px solid transparent; border-radius: 12px; background: transparent;
  color: var(--text); text-align: left; cursor: pointer; transition: background .15s, border-color .15s;
}
.chat-conv:hover { background: var(--surface); }
.chat-conv.active { background: var(--surface-2); border-color: rgba(255, 45, 85, .45); }
.chat-conv-copy { flex: 1; min-width: 0; display: grid; gap: 2px; }
.chat-conv-copy strong { font-size: 13px; font-weight: 600; }
.chat-conv-preview, .chat-conv-time { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 11px; }
.chat-conv-time { flex: 0 0 auto; align-self: flex-start; font-size: 10px; }
.chat-add-form, .chat-memory-form { display: grid; grid-template-columns: 1fr auto; gap: 6px; margin-bottom: 8px; }
.chat-add-form input, .chat-memory-form input {
  min-width: 0; padding: 9px 10px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg); color: var(--text); font-size: 12px; outline: none;
}
.chat-add-form input:focus, .chat-memory-form input:focus { border-color: var(--accent); }
.chat-add-form input:first-child, .chat-memory-form input { grid-column: 1 / -1; }
.chat-contact { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 10px; background: var(--bg); }
.chat-contact-copy { flex: 1; min-width: 0; display: grid; gap: 1px; }
.chat-contact-copy strong { font-size: 12px; }
.chat-contact-copy small { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.chat-icon-btn {
  flex: 0 0 auto; width: 34px; height: 34px; display: inline-grid; place-items: center;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  color: var(--text); font-size: 13px; cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.chat-icon-btn:hover { background: var(--surface-2); border-color: var(--muted-2); }
.chat-icon-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.chat-icon-btn.primary:hover { background: var(--accent-2); }
.chat-icon-btn.recording { background: #e53935; border-color: #e53935; color: #fff; animation: pulse 1.2s infinite; }
.chat-icon-btn.off { color: #e53935; border-color: rgba(229, 57, 53, .5); }
.chat-icon-btn.active { background: var(--blue); border-color: var(--blue); color: #fff; }
@keyframes pulse { 50% { opacity: .55; } }
.chat-text-btn { border: 0; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; }
.chat-text-btn:hover { color: var(--text); }
.chat-ringtone, .chat-memory { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
.chat-ringtone summary, .chat-memory summary { cursor: pointer; color: var(--muted); font-size: 12px; font-weight: 600; }
.chat-ringtone summary small, .chat-memory summary small { color: var(--muted-2); }
.ringtone-body { display: grid; gap: 7px; margin-top: 9px; }
.ringtone-body select, .ringtone-clip input {
  width: 100%; padding: 7px 8px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text); font-size: 12px; outline: none;
}
.ringtone-file { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; cursor: pointer; }
.ringtone-clip { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.ringtone-clip label { display: grid; gap: 3px; color: var(--muted); font-size: 11px; }
.ringtone-actions { display: flex; gap: 6px; }
.ringtone-body > small { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.chat-memory summary small { color: var(--muted-2); }
.chat-memory-list { display: grid; gap: 5px; margin-top: 8px; }
.chat-memory-list > div { display: grid; gap: 2px; padding: 7px 9px; background: var(--bg); border-radius: 9px; font-size: 12px; }
.chat-memory-list strong { color: var(--accent-2); }
.chat-memory-list span { color: var(--muted); overflow-wrap: anywhere; }

.chat-main { display: flex; flex-direction: column; height: calc(100vh - var(--topbar-h) - 40px); overflow: hidden; }
.chat-main-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border); flex: 0 0 auto;
}
.chat-head-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.chat-head-info h3 { margin: 0; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-presence { color: var(--muted); font-size: 11px; }
.chat-presence i { color: var(--green); margin-right: 4px; }
.chat-call-btns { display: flex; gap: 6px; }
.chat-messages {
  flex: 1; min-height: 0; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth;
}
.chat-msg { display: flex; }
.chat-msg.mine { justify-content: flex-end; }
.chat-msg-body {
  max-width: min(78%, 620px); padding: 9px 12px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border); overflow-wrap: anywhere;
}
.chat-msg.mine .chat-msg-body { background: var(--accent); border-color: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg:not(.mine) .chat-msg-body { border-bottom-left-radius: 4px; }
.chat-msg-body strong { display: block; font-size: 11px; opacity: .7; margin-bottom: 3px; }
.chat-msg-body p { margin: 0; font-size: 14px; line-height: 1.45; white-space: pre-wrap; }
.chat-msg-body small { display: block; font-size: 10px; opacity: .6; margin-top: 5px; }
.chat-sticker { font-size: 52px; line-height: 1.1; padding: 2px 0; }
.chat-msg-body p:has(+ .chat-sticker) { margin-bottom: 4px; }
.chat-image-link { display: block; margin: 6px 0; }
.chat-image { display: block; max-width: 100%; max-height: 320px; border-radius: 10px; object-fit: cover; }
.chat-voice { display: flex; align-items: center; gap: 8px; min-width: 240px; margin: 6px 0; }
.chat-voice > i { color: currentColor; opacity: .8; }
.chat-voice audio { flex: 1; min-width: 0; height: 34px; }
.chat-voice small { font-size: 10px; opacity: .7; }
.chat-file {
  display: flex; align-items: center; gap: 10px; margin: 6px 0; padding: 9px 10px;
  border: 1px solid var(--border); border-radius: 10px; background: rgba(0,0,0,.18);
  color: inherit; text-decoration: none; min-width: 230px;
}
.chat-file > span { flex: 1; min-width: 0; display: grid; gap: 2px; }
.chat-file strong { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-file small { font-size: 10px; opacity: .7; }
.chat-typing { padding: 0 18px 6px; color: var(--muted); font-size: 11px; display: flex; align-items: center; gap: 4px; }
.chat-typing[hidden] { display: none !important; }
.chat-typing span { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); animation: typing 1s infinite; }
.chat-typing span:nth-child(2) { animation-delay: .15s; }
.chat-typing span:nth-child(3) { animation-delay: .3s; margin-right: 6px; }
@keyframes typing { 50% { transform: translateY(-3px); opacity: .5; } }
/* Quest / touch devices have no hover, so keep play controls visible and avoid
   expensive blur/animation work on a slow WebView. */
@media (hover: none), (pointer: coarse) {
  .thumb .play-hover, .music-art .play-hover { opacity: .7; }
  .video-card:hover .thumb img { transform: none; }
  .music-card:hover { transform: none; }
  .topbar, .modal-backdrop { backdrop-filter: none !important; }
  .skeleton::after { animation: none !important; }
}
.chat-compose-wrap { position: relative; flex: 0 0 auto; border-top: 1px solid var(--border); }
.chat-compose { display: flex; align-items: center; gap: 6px; padding: 10px 12px; }
.chat-compose input {
  flex: 1; min-width: 0; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--bg); color: var(--text); font-size: 13px; outline: none;
}
.chat-compose input:focus { border-color: var(--accent); }
.chat-picker {
  position: absolute; bottom: calc(100% + 8px); left: 12px; z-index: 20; width: 290px;
  padding: 10px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); box-shadow: var(--shadow);
}
.chat-picker-title { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px; }
.chat-picker-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; max-height: 190px; overflow-y: auto; }
.chat-picker-grid button { border: 0; background: transparent; font-size: 20px; padding: 4px; cursor: pointer; border-radius: 6px; }
.chat-picker-grid button:hover { background: var(--surface-2); }
.chat-picker-grid.stickers { grid-template-columns: repeat(6, 1fr); }
.chat-picker-grid.stickers button { font-size: 30px; }
.chat-record-bar { display: flex; align-items: center; gap: 8px; padding: 12px; }
.chat-record-bar .dot { color: #e53935; animation: pulse 1.2s infinite; }
.chat-record-bar span { font-variant-numeric: tabular-nums; font-size: 13px; }
.chat-record-bar small { flex: 1; color: var(--muted); }

/* Calls: full-screen stage with a floating self-view and compact controls. */
.call-stage {
  position: fixed; inset: 0; z-index: 500; display: flex; flex-direction: column;
  gap: 12px; padding: 16px; background: rgba(7, 7, 9, .97);
}
.call-stage-head { display: flex; align-items: center; justify-content: space-between; }
.call-stage-head > div { display: flex; align-items: center; gap: 10px; }
.call-stage-head strong { font-size: 14px; }
.call-quality { font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 20px; padding: 3px 9px; }
.call-quality[data-level="poor"] { color: #ffb74d; border-color: rgba(255, 183, 77, .5); }
.call-quality[data-level="fair"] { color: var(--blue); border-color: rgba(62, 166, 255, .5); }
.call-quality[data-level="good"] { color: var(--green); border-color: rgba(34, 197, 94, .5); }
.call-timer { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.call-stage-body { flex: 1; min-height: 0; position: relative; display: grid; place-items: center; }
#callRemote { width: 100%; height: 100%; object-fit: contain; border-radius: 14px; background: #000; }
#callLocal {
  position: absolute; right: 16px; bottom: 16px; width: 220px; max-height: 34%;
  border-radius: 12px; border: 1px solid var(--border); background: #000; object-fit: cover;
  box-shadow: var(--shadow);
}
.call-no-video { position: absolute; display: grid; place-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.call-no-video i { font-size: 46px; color: var(--surface-3); }
.call-controls { display: flex; justify-content: center; gap: 10px; flex: 0 0 auto; padding-bottom: env(safe-area-inset-bottom); }
.call-ctrl {
  width: 76px; padding: 9px 6px; display: grid; gap: 4px; place-items: center;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
  color: var(--text); font-size: 11px; cursor: pointer;
}
.call-ctrl i { font-size: 17px; }
.call-ctrl:hover { background: var(--surface-2); }
.call-ctrl.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.call-ctrl.off { color: #e53935; border-color: rgba(229, 57, 53, .5); }
.call-ctrl.danger { background: #e53935; border-color: #e53935; color: #fff; }
.call-ctrl.accept { background: var(--green); border-color: var(--green); color: #fff; }
.call-answer-link { margin-left: 8px; padding: 3px 9px; min-height: 0; height: auto; border-color: var(--green); color: var(--green); }
.chat-presence { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.call-type-icon { font-size: 16px; color: var(--accent-2); }
.call-incoming {
  display: flex; align-items: center; gap: 12px; flex: 0 0 auto;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface); box-shadow: var(--shadow);
}
.call-incoming.hidden { display: none !important; }
.call-incoming-icon {
  width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center;
  border-radius: 50%; background: rgba(62, 166, 255, .16); color: var(--blue); font-size: 20px;
  animation: pulse 1.4s infinite;
}
.call-incoming-copy { flex: 1; display: grid; gap: 2px; }
.call-incoming-copy small { color: var(--muted); }
.chat-presence.call-ringing { color: var(--blue); animation: pulse 1.2s infinite; }
.chat-presence .connected { color: var(--green); }
.chat-conv.call-ringing { border-color: var(--blue); background: rgba(62, 166, 255, .1); }
.chat-email-form { display: flex; gap: 6px; margin: 8px 0 4px; }
.chat-email-form input { flex: 1; min-width: 0; height: 32px; padding: 0 10px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--text); font-size: 11px; outline: none; }
.chat-email-form input:focus { border-color: var(--accent); }
.notification-list { display: grid; gap: 8px; max-height: 52vh; overflow: auto; }
.notification-row.unread { border-left: 3px solid var(--accent); padding-left: 10px; }
.notification-row .muted { display: block; margin-top: 3px; }

@media (max-width: 900px) {
  .chat-layout { grid-template-columns: 1fr; }
  .chat-sidebar { height: auto; max-height: 300px; }
  .chat-main { height: calc(100vh - var(--topbar-h) - 360px); min-height: 420px; }
  .chat-picker { left: 8px; right: 8px; width: auto; }
  #callLocal { width: 140px; }
  .call-ctrl { width: 64px; }
}
@media (max-width: 560px) {
  .chat-compose { gap: 4px; padding: 8px; }
  .chat-compose .chat-icon-btn { width: 30px; height: 30px; }
  .chat-msg-body { max-width: 88%; }
  .call-stage { padding: 10px; }
  #callLocal { width: 110px; }
}

/* ---- Ads, verified badges and membership ---- */
.verified-check { color: var(--blue); font-size: 12px; vertical-align: middle; }
.verified-account #topAvatar { box-shadow: 0 0 0 2px var(--blue); }
.account-tier {
  display: inline-flex; align-items: center; gap: 5px; margin-left: 6px; padding: 2px 8px;
  border-radius: 999px; background: rgba(255, 193, 7, .14); color: #ffc857; font-size: 11px; font-weight: 700;
}

/* Full-frame in-player ad: same footprint as the video so it reads like a
   normal video ad instead of a separate card floating above the page. */
.video-ad {
  position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column;
  background: #000; color: #fff; overflow: hidden;
}
.video-ad-topbar, .video-ad-footer {
  flex: 0 0 auto; display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; z-index: 2;
}
.video-ad-topbar { justify-content: space-between; background: linear-gradient(180deg, rgba(0,0,0,.85), transparent); }
.video-ad-footer { flex-direction: column; align-items: stretch; gap: 8px; background: linear-gradient(0deg, rgba(0,0,0,.9), transparent); }
.video-ad-label {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 4px;
  background: rgba(255,255,255,.16); color: #fff;
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.video-ad-skip {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border: 1px solid rgba(255,255,255,.4);
  border-radius: 4px; background: rgba(0,0,0,.55); color: #fff; font-size: 12px; cursor: pointer;
}
.video-ad-skip:hover:not([hidden]) { background: rgba(255,255,255,.16); }
.video-ad-skip[hidden] { display: none; }
.video-ad-noskip { display: inline-flex; align-items: center; gap: 6px; color: rgba(255,255,255,.75); font-size: 12px; }
.video-ad-card {
  flex: 1 1 auto; min-height: 0; width: 100%; margin: 0 auto; padding: 8px 18px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  max-width: 900px; color: var(--text);
}
.video-ad-body { display: flex; align-items: center; gap: 16px; max-width: 520px; }
.video-ad-mark {
  width: 64px; height: 64px; flex: 0 0 64px; display: grid; place-items: center; border-radius: 14px;
  background: linear-gradient(145deg, #ff2d55, #7c3aed); color: #fff; font-weight: 800; font-size: 18px;
}
.video-ad-body strong { font-size: 17px; }
.video-ad-body p { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.video-ad-slot {
  position: relative; width: min(100%, 900px); min-height: 200px; margin: 0; padding: 0;
  border-radius: 12px; overflow: hidden; background: rgba(255,255,255,.05);
}
.video-ad-slot-standalone { background: transparent; }
.video-ad-fallback {
  position: absolute; inset: 0; display: grid; place-items: center; border-radius: 12px; overflow: hidden;
  background: radial-gradient(circle at 20% 15%, rgba(62,166,255,.3), transparent 55%),
              radial-gradient(circle at 85% 80%, rgba(255,45,85,.32), transparent 55%),
              linear-gradient(135deg, #101522, #1a0f2e);
  animation: videoAdPulse 6s ease-in-out infinite alternate;
}
.video-ad-scene { text-align: center; padding: 24px; max-width: 620px; }
.video-ad-brand {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px;
  background: rgba(255,255,255,.1); font-weight: 800; letter-spacing: .02em;
}
.video-ad-brand i { color: #ff2d55; }
.video-ad-headline { margin: 16px 0 8px; font-size: clamp(20px, 3.2vw, 34px); font-weight: 800; line-height: 1.15; }
.video-ad-scene p { margin: 0 auto; max-width: 480px; color: rgba(255,255,255,.72); font-size: 13px; line-height: 1.6; }
.video-ad-site { display: inline-block; margin-top: 14px; color: rgba(255,255,255,.45); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
@keyframes videoAdPulse { from { filter: brightness(.9); } to { filter: brightness(1.15); } }
.video-ad-progress { height: 4px; border-radius: 4px; background: rgba(255,255,255,.2); overflow: hidden; }
.video-ad-progress span { display: block; height: 100%; background: var(--accent); transition: width 1s linear; }

/* Remote-friendly controls for the direct MP4 player. They replace the
   browser's native 10-second buttons, which fired overlapping seeks on TV. */
.direct-controls {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-top: 0; border-radius: 0 0 12px 12px; min-height: 52px;
}
.direct-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 34px; flex: 0 0 auto; border: 0; border-radius: 8px;
  background: rgba(255,255,255,.07); color: var(--text); cursor: pointer;
}
.direct-btn:hover { background: rgba(255,255,255,.14); }
.direct-btn small { position: absolute; right: 3px; bottom: 1px; font-size: 8px; color: var(--muted); }
#directSeek { flex: 1 1 auto; min-width: 80px; accent-color: var(--accent); cursor: pointer; }
#directVolume { flex: 0 0 90px; width: 90px; accent-color: var(--accent); cursor: pointer; }
.direct-time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
body.tv-mode .direct-btn { width: 54px; height: 48px; }
body.tv-mode .direct-controls { min-height: 70px; gap: 14px; }
body.tv-mode .direct-time { font-size: 15px; }

.auth-remember { display: flex; align-items: center; gap: 8px; margin: 12px 0; font-size: 13px; color: var(--muted); cursor: pointer; }
.auth-remember input { accent-color: var(--accent); }
.auth-code-row { display: flex; gap: 8px; }
.auth-code-row input { flex: 1; min-width: 0; }
.auth-change-email, .auth-forgot {
  display: inline-block; margin-top: 6px; font-size: 12px; color: var(--accent-2);
}
.auth-forgot { margin: 10px 0 0; }

/* Bug report form */
.bug-field { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; font-size: 13px; color: var(--muted); }
.bug-field textarea, .bug-field select, .bug-field input[type="file"] {
  width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg); color: var(--text); font: inherit; resize: vertical;
}
.bug-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bug-check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--muted); margin: 8px 0; }
.bug-list { max-height: 55vh; overflow: auto; display: grid; gap: 10px; }
.bug-item { padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.bug-item p { margin: 6px 0; color: var(--text); white-space: pre-wrap; }
.bug-item small { color: var(--muted); }
.bug-item a { color: var(--accent-2); }
.bug-item details { margin-top: 8px; }
.bug-item summary { cursor: pointer; color: var(--accent-2); font-size: 12px; }
.bug-item pre { max-height: 220px; overflow: auto; padding: 10px; border-radius: 8px; background: rgba(0,0,0,.25); color: var(--muted); font-size: 11px; white-space: pre-wrap; word-break: break-word; }
.video-ad-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.video-ad-count { margin-right: auto; color: var(--muted); font-size: 12px; }

.premium-page { max-width: 940px; margin: 0 auto; }
.premium-hero {
  padding: 30px; border: 1px solid var(--border); border-radius: 18px;
  background: radial-gradient(circle at 15% 0%, rgba(255,45,85,.18), transparent 55%), var(--bg-elevated);
}
.premium-kicker { color: #ffc857; font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.premium-hero h1 { margin: 10px 0; font-size: 30px; }
.premium-hero p { max-width: 620px; color: var(--muted); line-height: 1.6; }
.premium-current { margin: 16px 0; font-size: 13px; }
.premium-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.premium-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 16px; }
.premium-card { padding: 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-elevated); }
.premium-card > i { color: var(--accent); font-size: 22px; }
.premium-card h3 { margin: 10px 0 6px; font-size: 15px; }
.premium-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.premium-note { margin-top: 18px; color: var(--muted); font-size: 12px; text-align: center; }

.member-grant { display: grid; grid-template-columns: 1fr 130px auto; gap: 8px; margin: 14px 0; }
.member-grant input, .member-grant select {
  width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--bg); color: var(--text); font-size: 13px; outline: none;
}
.member-list { display: grid; gap: 7px; max-height: 260px; overflow-y: auto; }
.member-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 11px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2);
}
.member-row span { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.member-row small { color: var(--muted); }
.member-row em { color: #ffc857; font-size: 11px; font-style: normal; font-weight: 700; }

@media (max-width: 560px) {
  .member-grant { grid-template-columns: 1fr; }
  .premium-hero { padding: 22px 18px; }
  .premium-hero h1 { font-size: 23px; }
}

/* ---- TV / big-screen remote mode ---- */
body.tv-mode {
  --topbar-h: 84px;
  --sidebar-w: 300px;
  font-size: 17px;
}
body.tv-mode .topbar { height: var(--topbar-h); padding: 0 28px; }
body.tv-mode .sidebar { width: var(--sidebar-w); }
body.tv-mode .main { padding: 28px 36px 110px; }
body.tv-mode .grid-videos { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 32px 22px; }
body.tv-mode .grid-music { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 26px 20px; }
body.tv-mode .video-title { font-size: 17px; }
body.tv-mode .video-sub { font-size: 13px; }
body.tv-mode .pill { height: 46px; padding: 0 22px; font-size: 15px; }
body.tv-mode .topbar, body.tv-mode .modal-backdrop { backdrop-filter: none !important; }
body.tv-mode .skeleton::after { animation: none !important; }
body.tv-mode .thumb img, body.tv-mode .music-card { transition: none !important; }
body.tv-mode button:focus-visible, body.tv-mode a:focus-visible,
body.tv-mode input:focus-visible, body.tv-mode select:focus-visible {
  outline: 4px solid var(--accent); outline-offset: 3px; border-radius: 10px;
  box-shadow: 0 0 0 9px rgba(255,45,85,.16);
}
body.tv-mode .video-card:focus-within .thumb,
body.tv-mode .music-card:focus-within .music-art { box-shadow: 0 0 0 3px var(--accent); }
body.tv-mode .video-ad-card { max-width: 900px; font-size: 18px; }
body.tv-mode .premium-grid { grid-template-columns: repeat(3, 1fr); }

.tv-login-card {
  max-width: 760px; margin: 42px auto; padding: 36px; border: 1px solid var(--border);
  border-radius: 20px; background: var(--bg-elevated); text-align: center;
}
.tv-login-kicker { color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.tv-login-card h1 { margin: 12px 0; font-size: 30px; }
.tv-login-card p { color: var(--muted); line-height: 1.6; }
.tv-login-card strong { color: var(--text); overflow-wrap: anywhere; }
.tv-code {
  margin: 24px 0 12px; font-size: 52px; font-weight: 800; letter-spacing: 10px;
  color: var(--accent-2); font-variant-numeric: tabular-nums;
}
.tv-code-input {
  width: min(320px, 90%); margin: 18px auto; padding: 14px; text-align: center;
  font-size: 36px; letter-spacing: 10px; border: 2px solid var(--border); border-radius: 14px;
  background: var(--bg); color: var(--text); outline: none;
}
.tv-login-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.tv-pair-status { min-height: 20px; font-size: 13px; }

/* Keep keyboard/TV focus rings even where older component rules set
   outline:none on inputs, sliders and dialog controls. */
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
button:focus-visible,
a:focus-visible,
[tabindex="0"]:focus-visible {
  outline: 2px solid var(--accent) !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 5px rgba(255, 45, 85, .16) !important;
}
body.tv-mode input:focus-visible,
body.tv-mode textarea:focus-visible,
body.tv-mode select:focus-visible,
body.tv-mode button:focus-visible,
body.tv-mode a:focus-visible,
body.tv-mode [tabindex="0"]:focus-visible {
  outline: 4px solid var(--accent) !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 9px rgba(255, 45, 85, .16) !important;
}

/* Owner-only Sky WiFi remote */
.owner-only { display: none !important; }
body.is-owner .owner-only { display: flex !important; }
.remote-page { max-width: 980px; margin: 0 auto; padding: 8px 0 40px; }
.remote-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.remote-head h1 { margin: 4px 0 6px; font-size: 30px; }
.remote-head p { margin: 0; max-width: 620px; }
.remote-link-state {
  padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 700;
  background: rgba(255, 255, 255, .06); border: 1px solid var(--border); color: var(--muted, #aaa);
}
.remote-link-state[data-kind="good"] { color: #4ade80; border-color: rgba(74, 222, 128, .35); }
.remote-link-state[data-kind="warn"] { color: #fbbf24; border-color: rgba(251, 191, 36, .35); }
.remote-link-state[data-kind="bad"] { color: #fb7185; border-color: rgba(251, 113, 133, .35); }
.remote-pair-card {
  display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 18px;
  margin: 22px 0 14px; padding: 18px; border: 1px solid var(--border);
  border-radius: 16px; background: linear-gradient(135deg, rgba(255, 45, 85, .12), transparent 60%), var(--panel, rgba(255,255,255,.03));
}
.remote-pair-copy h2 { margin: 0 0 6px; font-size: 17px; }
.remote-pair-copy p { margin: 0; font-size: 13px; color: var(--muted, #aaa); }
.remote-pair-code {
  min-width: 132px; text-align: center; font-size: 34px; font-weight: 800; letter-spacing: 8px;
  padding: 10px 14px; border-radius: 12px; border: 2px dashed rgba(255, 45, 85, .55);
  background: var(--bg, #0b0b10);
}
.remote-devices { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.remote-empty { font-size: 13px; color: var(--muted, #aaa); margin: 0; }
.remote-device {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--panel, rgba(255,255,255,.03)); color: var(--text); cursor: pointer;
}
.remote-device.on { border-color: var(--accent, #ff2d55); box-shadow: 0 0 0 2px rgba(255,45,85,.18); }
.remote-device span { display: flex; flex-direction: column; text-align: left; }
.remote-device small { color: var(--muted, #aaa); font-size: 11px; }
.remote-pad {
  border: 1px solid var(--border); border-radius: 22px; padding: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(0,0,0,.25)), var(--bg, #0b0b10);
  box-shadow: 0 18px 50px rgba(0,0,0,.28);
}
.remote-brand { text-align: center; font-weight: 800; letter-spacing: 1px; margin-bottom: 14px; }
.remote-brand span { color: var(--accent, #ff2d55); margin-left: 6px; font-size: 12px; }
.remote-row { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.remote-key {
  min-width: 62px; min-height: 48px; padding: 7px 10px; border-radius: 12px;
  border: 1px solid var(--border); background: rgba(255,255,255,.06); color: var(--text);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; cursor: pointer;
  font-size: 11px; transition: transform .08s ease, background .12s ease;
}
.remote-key i { font-size: 16px; }
.remote-key:active { transform: scale(.94); background: rgba(255,45,85,.22); }
.remote-row-top .remote-key { min-width: 72px; }
.remote-row-digits .remote-key { min-width: 54px; }
.remote-row-dpad { margin-top: 14px; }
.remote-dpad {
  display: grid; grid-template-columns: repeat(3, 58px); grid-template-rows: repeat(3, 52px); gap: 6px;
}
.remote-dpad-up { grid-column: 2; grid-row: 1; }
.remote-dpad-left { grid-column: 1; grid-row: 2; }
.remote-dpad-ok { grid-column: 2; grid-row: 2; border-color: var(--accent, #ff2d55); background: rgba(255,45,85,.16); }
.remote-dpad-right { grid-column: 3; grid-row: 2; }
.remote-dpad-down { grid-column: 2; grid-row: 3; }
.remote-last { text-align: center; margin-top: 12px; font-size: 12px; color: var(--muted, #aaa); }
@media (max-width: 640px) {
  .remote-pair-card { grid-template-columns: 1fr; text-align: center; }
  .remote-pair-copy p { text-align: left; }
  .remote-key { min-width: 52px; min-height: 44px; }
  .remote-row-digits .remote-key { min-width: 44px; }
}

/* ---------- Device mode ----------
   Classified in <head> from UA + touch + screen size, or overridden by the
   user with the floating button. These class rules are authoritative even when
   a browser's "desktop site" mode reports a wide viewport and ignores the
   width media queries above. */
.view-mode-toggle {
  position: fixed; right: 12px; top: calc(var(--topbar-h) + 12px); z-index: 150;
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.14); background: rgba(33,33,33,.92);
  color: var(--text); font-size: 14px; box-shadow: var(--shadow);
  -webkit-tap-highlight-color: transparent;
}
.view-mode-toggle:hover { background: var(--surface-3); border-color: var(--accent); }

/* Never set overflow-x:hidden on html/body here — it turns the document into a
   clipped scroll container and many mobile browsers then refuse to scroll at
   all. The watch-page overflow is fixed at its source instead. */
html.mobile-mode, html.mobile-mode body { max-width: 100%; }
html.mobile-mode .topbar { gap: 8px; padding: 0 10px; }
html.mobile-mode .brand { font-size: 0; gap: 0; }
html.mobile-mode .brand-mark { font-size: 14px; }
html.mobile-mode .top-actions .pill,
html.mobile-mode .top-actions [data-action="voice-search"],
html.mobile-mode .top-actions [data-action="open-bug-report"],
html.mobile-mode .top-actions [data-action="open-notifications"] { display: none; }
html.mobile-mode .sidebar .mobile-tools { display: block; }
html.mobile-mode .search-bar { flex: 1 1 auto; min-width: 0; height: 38px; }
html.mobile-mode .search-submit { width: 48px; }
html.mobile-mode .sidebar { transform: translateX(-100%); box-shadow: var(--shadow); }
html.mobile-mode body.sidebar-open .sidebar { transform: none; }
html.mobile-mode .main { margin-left: 0; padding: 14px 12px 60px; }
html.mobile-mode .watch-layout { grid-template-columns: 1fr; }
html.mobile-mode .side-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
html.mobile-mode .side-list .video-card { display: block; }
html.mobile-mode .side-list .video-meta { padding-top: 10px; }
html.mobile-mode .player-right { display: none; }
html.mobile-mode .result-item { grid-template-columns: 1fr; }
html.mobile-mode .result-item .thumb { width: 100%; }
html.mobile-mode .hero { padding: 24px 20px; min-height: 200px; }
html.mobile-mode .hero-art { display: none; }
html.mobile-mode .watch-title { font-size: 17px; }
html.mobile-mode .grid-videos { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 18px 10px; }
html.mobile-mode .video-title { font-size: 12px; }
html.mobile-mode .video-sub, html.mobile-mode .video-meta .channel-avatar { display: none; }
html.mobile-mode .grid-music { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
html.mobile-mode .player { grid-template-columns: 1fr auto; gap: 8px; padding: 0 10px; }
html.mobile-mode .player-track img { width: 44px; height: 44px; }
html.mobile-mode .player-center { align-items: flex-end; }
html.mobile-mode .player-controls { gap: 4px; }
html.mobile-mode .player-controls [data-action="prev"],
html.mobile-mode .player-controls [data-action="next"] { display: none; }
html.mobile-mode .progress-wrap { width: 100%; }
html.mobile-mode .progress-wrap .time { display: none; }
html.mobile-mode .queue-panel { width: calc(100% - 28px); }
html.mobile-mode .toast-host { left: 12px; right: 12px; bottom: calc(var(--player-h) + 12px); }
html.mobile-mode .toast { max-width: none; }
html.mobile-mode .main.mini-watch-host .player-frame-wrap { right: 10px; bottom: 126px; width: min(300px, calc(100vw - 20px)); height: auto; aspect-ratio: 16 / 9; }
/* Keep the video inside the screen: no nowrap child may force the watch grid
   wider than the viewport, otherwise the player is clipped off the right. */
html.mobile-mode .watch-layout > div { min-width: 0; }
html.mobile-mode .channel-row { flex-wrap: wrap; min-width: 0; }
html.mobile-mode .side-list { min-width: 0; }
html.mobile-mode .mini-bar { right: 10px; bottom: 88px; width: min(300px, calc(100vw - 20px)); }
html.mobile-mode .player-tools { flex-wrap: wrap; height: auto; justify-content: flex-start; }
html.mobile-mode .chat-layout { grid-template-columns: 1fr; }
html.mobile-mode .chat-sidebar { height: auto; max-height: 300px; }
html.mobile-mode .chat-main { height: calc(100vh - var(--topbar-h) - 360px); min-height: 420px; }
html.mobile-mode .chat-picker { left: 8px; right: 8px; width: auto; }
html.mobile-mode .chat-compose { gap: 4px; padding: 8px; }
html.mobile-mode .chat-compose .chat-icon-btn { width: 30px; height: 30px; }
html.mobile-mode .chat-msg-body { max-width: 88%; }
html.mobile-mode .remote-pair-card { grid-template-columns: 1fr; text-align: center; }
html.mobile-mode .remote-pair-copy p { text-align: left; }
html.mobile-mode .remote-key { min-width: 52px; min-height: 44px; }
html.mobile-mode .remote-row-digits .remote-key { min-width: 44px; }

/* Forced desktop layout stays desktop even on a narrow phone viewport. */
html.desktop-mode .topbar { gap: 16px; padding: 0 20px; }
html.desktop-mode .brand { font-size: 14px; gap: 8px; }
html.desktop-mode .top-actions .pill,
html.desktop-mode .top-actions [data-action="voice-search"],
html.desktop-mode .top-actions [data-action="open-bug-report"],
html.desktop-mode .top-actions [data-action="open-notifications"] { display: flex; }
html.desktop-mode .top-actions .icon-btn { display: grid; }
html.desktop-mode .sidebar .mobile-tools { display: none; }
html.desktop-mode .sidebar { transform: none; box-shadow: none; }
html.desktop-mode .main { margin-left: var(--sidebar-w); padding: 24px; }
html.desktop-mode .search-bar { flex: 1 1 640px; max-width: 720px; height: 40px; }
html.desktop-mode .search-submit { width: 64px; }


