/* YouTube Clone - styles */
:root {
  --bg: #f9f9f9;
  --surface: #ffffff;
  --text: #0f0f0f;
  --text2: #606060;
  --text3: #909090;
  --border: #e5e5e5;
  --hover: #f2f2f2;
  --red: #ff0000;
  --black: #0f0f0f;
  --blue: #065fd4;
  --header-h: 56px;
  --sidebar-w: 240px;
  --mini-sidebar-w: 72px;
  --radius: 12px;
  --chip-h: 32px;
}
* { box-sizing: border-box; }
html, body { margin:0; padding:0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
img { max-width: 100%; display: block; }

/* Header */
.header {
  position: fixed; top:0; left:0; right:0; height: var(--header-h);
  background: var(--surface);
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
  z-index: 100;
  border-bottom: 1px solid var(--border);
}
.header .left { display:flex; align-items:center; gap: 16px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text);
}
.icon-btn:hover { background: var(--hover); }
.logo { display:flex; align-items:center; gap:6px; font-weight: 500; font-size: 20px; letter-spacing: -0.5px; }
.logo .play { color: var(--red); font-size: 26px; }
.logo .country { font-size: 10px; color: var(--text2); vertical-align: super; margin-left: 2px; }
.logo .logo-img, .logo-img { height: 32px; width: auto; max-width: 200px; object-fit: contain; display: block; }

.search-bar { flex: 1; max-width: 640px; display: flex; align-items: center; margin-left: 40px; }
.search-input-wrap {
  flex:1; display:flex; align-items:center;
  border: 1px solid var(--border); border-right: 0;
  border-radius: 40px 0 0 40px;
  padding: 0 16px; height: 40px; background: var(--surface);
}
.search-input-wrap input { border:0; outline:0; width:100%; font-size:16px; background:transparent; }
.search-btn {
  width: 64px; height: 40px; border: 1px solid var(--border);
  border-radius: 0 40px 40px 0; background: var(--hover);
  display:flex; align-items:center; justify-content:center;
}
.search-btn:hover { background: #e5e5e5; }
.mic-btn { width:40px; height:40px; border-radius:50%; background: var(--hover); display:flex; align-items:center; justify-content:center; margin-left: 8px; }
.mic-btn:hover { background:#e5e5e5; }

.header .right { display:flex; align-items:center; gap: 4px; margin-left: auto; }
.create-btn {
  display:flex; align-items:center; gap:6px; padding: 0 12px; height:36px;
  border-radius: 18px; background: var(--hover); font-weight:500;
}
.create-btn:hover { background:#e5e5e5; }
/* Create dropdown */
.create-wrap { position: relative; }
.create-menu {
  position: absolute; top: 44px; right: 0; z-index: 120;
  min-width: 300px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,.18); padding: 6px;
}
.create-menu[hidden] { display: none !important; }
.create-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 10px; border-radius: 8px; color: var(--text);
}
.create-item:hover { background: var(--hover); }
.create-item .create-ico { font-size: 22px; width: 28px; text-align: center; flex: 0 0 auto; }
.create-item b { display: block; font-size: 14px; font-weight: 500; }
.create-item small { display: block; font-size: 12px; color: var(--text2); margin-top: 1px; }
.signin-btn {
  display:flex; align-items:center; gap:6px; padding: 0 12px; height:36px;
  border-radius: 18px; border: 1px solid var(--blue); color: var(--blue); font-weight:500;
}
.signin-btn:hover { background: #def1ff; }
.user-menu { display:flex; align-items:center; gap:8px; }
.user-avatar { width:32px; height:32px; border-radius:50%; object-fit:cover; }

/* Layout */
.app { display:flex; margin-top: var(--header-h); min-height: calc(100vh - var(--header-h)); }
.sidebar {
  width: var(--sidebar-w); background: var(--surface);
  position: fixed; top: var(--header-h); left:0; bottom:0;
  overflow-y: auto; padding: 12px 0;
  border-right: 1px solid transparent;
}
.sidebar.mini { width: var(--mini-sidebar-w); }
.sidebar .section { padding: 8px 0; border-bottom: 1px solid var(--border); }
.sidebar .section:last-child { border-bottom: 0; }
.sidebar .section-title { padding: 8px 24px 4px; font-size: 14px; font-weight: 500; color: var(--text); }
.nav-item {
  display:flex; align-items:center; gap: 24px;
  padding: 0 24px; height: 40px; border-radius: 10px; margin: 0 12px;
  color: var(--text); font-size: 14px;
}
.nav-item:hover { background: var(--hover); }
.nav-item.active { background: var(--hover); font-weight:500; }
.nav-item .ico { width:24px; height:24px; display:flex; align-items:center; justify-content:center; font-size:20px; }
.sidebar.mini .nav-item { flex-direction: column; gap: 4px; padding: 0; height: 72px; justify-content:center; font-size: 10px; margin:0; border-radius:0; }
.sidebar.mini .nav-item .ico { font-size: 22px; }
.sidebar.mini .section-title { display:none; }

.main {
  margin-left: var(--sidebar-w);
  flex: 1; padding: 24px 24px 48px;
  max-width: 100%;
}
.main.mini-margin { margin-left: var(--mini-sidebar-w); }
.container { max-width: 1400px; margin: 0 auto; }

/* Chips */
.chips-bar {
  display:flex; align-items:center; gap:12px; overflow-x:auto; padding-bottom: 16px;
  scrollbar-width: none;
}
.chips-bar::-webkit-scrollbar { display:none; }
.chip {
  height: var(--chip-h); padding: 0 12px; border-radius: 8px;
  background: var(--hover); color: var(--text); font-size: 14px; font-weight:500;
  white-space: nowrap; flex-shrink: 0; border: 1px solid var(--border);
}
.chip:hover { background: #e5e5e5; }
.chip.active { background: var(--black); color: #fff; border-color: var(--black); }

/* Video grid */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px 16px;
}
.video-card { cursor: pointer; }
.thumb-wrap {
  position: relative; width:100%; aspect-ratio: 16/9;
  border-radius: var(--radius); overflow: hidden; background: #000;
}
.thumb-wrap img { width:100%; height:100%; object-fit:cover; }
.thumb-wrap .duration {
  position:absolute; bottom:6px; right:6px; background: rgba(0,0,0,0.8);
  color:#fff; font-size:12px; font-weight:500; padding: 2px 6px; border-radius:4px;
}
.card-meta { display:flex; gap:12px; margin-top: 12px; }
.card-avatar { width:36px; height:36px; border-radius:50%; flex-shrink:0; object-fit:cover; }
.card-info { flex:1; min-width:0; }
.card-title { font-size: 14px; font-weight: 500; line-height: 1.3; margin:0; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.card-channel { font-size: 12px; color: var(--text2); margin-top:4px; display:flex; align-items:center; gap:4px; }
.card-channel .verified { color: var(--text2); font-size: 12px; }
.card-meta-line { font-size: 12px; color: var(--text2); margin-top:2px; }
.card-menu { color: var(--text2); font-size:18px; padding: 0 4px; align-self:flex-start; }

/* ===== Shorts shelves on the home page ================================ */
.shorts-shelf {
  grid-column: 1 / -1;
  margin: 4px 0 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.shelf-head { display:flex; align-items:center; gap:8px; margin-bottom:14px; }
.shelf-logo { display:flex; width:24px; height:24px; }
.shelf-logo svg { width:24px; height:24px; fill:#ff0033; }
.shelf-head h2 { font-size:19px; font-weight:600; margin:0; letter-spacing:-.2px; }
.shelf-more { margin-left:auto; font-size:13px; font-weight:500; color:var(--text2); padding:4px 8px; border-radius:14px; }
.shelf-more:hover { background:var(--hover); color:var(--text); }
.shelf-wrap { position:relative; }
.shelf-track {
  display:flex; gap:12px; overflow-x:auto;
  scroll-snap-type:x proximity; scroll-behavior:smooth;
  padding:2px; margin:-2px;
  scrollbar-width:none; -ms-overflow-style:none;
}
.shelf-track::-webkit-scrollbar { display:none; }
.short-card {
  flex:0 0 auto; width: clamp(142px, 15vw, 178px);
  scroll-snap-align:start; color:var(--text); text-decoration:none;
}
.short-card-thumb {
  position:relative; width:100%; aspect-ratio:9/16; border-radius:12px;
  overflow:hidden; background:#000; box-shadow:0 1px 4px rgba(0,0,0,.12);
}
.short-card-thumb img { width:100%; height:100%; object-fit:cover; display:block; }
.short-card-thumb::after {
  content:""; position:absolute; left:0; right:0; bottom:0; height:34%;
  background:linear-gradient(to top, rgba(0,0,0,.5), rgba(0,0,0,0));
  pointer-events:none;
}
.short-card-badge {
  position:absolute; left:8px; bottom:8px; z-index:2;
  display:inline-flex; align-items:center; gap:4px;
  background:rgba(0,0,0,.62); color:#fff; font-size:11px; font-weight:600;
  padding:3px 7px 3px 5px; border-radius:11px; line-height:1;
}
.short-card-badge svg { width:13px; height:13px; fill:#ff0033; }
.short-card-title {
  font-size:13px; font-weight:500; line-height:1.3; margin-top:8px;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
}
.short-card-meta { font-size:11.5px; color:var(--text2); margin-top:3px; }
.shelf-nav {
  position:absolute; top:calc(50% - 24px); z-index:3;
  width:40px; height:40px; border-radius:50%; border:none;
  background:var(--surface); color:var(--text);
  box-shadow:0 2px 10px rgba(0,0,0,.22);
  display:flex; align-items:center; justify-content:center;
  font-size:24px; line-height:1; cursor:pointer;
  opacity:0; transition:opacity .15s ease;
}
.shelf-wrap:hover .shelf-nav, .shelf-nav:focus-visible { opacity:1; }
.shelf-nav.prev { left:-10px; }
.shelf-nav.next { right:-10px; }
.shelf-nav.off { opacity:0 !important; pointer-events:none; }
@media (max-width: 768px) {
  .shelf-nav { display:none; }
  .short-card { width:132px; }
  .shorts-shelf { padding-top:12px; }
}

/* ===== Anime hub ===================================================== */
.anime-hub { padding-bottom: 30px; }
.anime-hero {
  position: relative; overflow: hidden; color: #fff;
  border-radius: 16px; padding: 34px 30px 30px;
  margin: 6px 0 18px;
  background:
    radial-gradient(120% 160% at 12% 0%, rgba(255,0,80,.40) 0%, rgba(255,0,80,0) 55%),
    radial-gradient(120% 160% at 92% 10%, rgba(88,60,255,.40) 0%, rgba(88,60,255,0) 60%),
    linear-gradient(135deg, #14101f 0%, #0b0b11 100%);
  border: 1px solid rgba(255,255,255,.08);
}
.anime-hero-badge {
  display:inline-block; font-size:10.5px; font-weight:800; letter-spacing:.14em;
  padding:5px 9px; border-radius:20px; background:rgba(255,255,255,.12);
}
.anime-hero h1 { font-size: 30px; line-height:1.1; margin:14px 0 10px; letter-spacing:-.6px; color:#fff; }
.anime-hero p { max-width: 700px; color: rgba(255,255,255,.76); font-size: 14px; line-height:1.6; margin:0; }
.anime-hero-stats { display:flex; flex-wrap:wrap; gap: 20px; margin-top:18px; font-size:12.5px; color:rgba(255,255,255,.66); }
.anime-hero-stats b { color:#fff; font-size:16px; margin-right:4px; }
.anime-toolbar { display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin-bottom:16px; }
.anime-toolbar .anime-chips { flex: 1 1 auto; padding: 0; }
.anime-search { flex: 0 0 260px; max-width: 100%; }
.anime-search input {
  width:100%; height: 36px; border:1px solid var(--border); border-radius: 18px;
  padding: 0 14px; background: var(--surface); color: var(--text); font-size: 13.5px; outline:none;
}
.anime-search input:focus { border-color: var(--text2); }
.anime-rows { display:flex; flex-direction: column; gap: 26px; }
.anime-row-head { display:flex; align-items:center; gap:10px; margin-bottom: 10px; }
.anime-avatar {
  width: 34px; height:34px; border-radius:50%; display:inline-flex; align-items:center; justify-content:center;
  background: linear-gradient(135deg,#ff2d55,#7a2bff); font-size:16px; flex:0 0 auto;
}
.anime-avatar-lg { width: 52px; height: 52px; font-size: 24px; }
.anime-row-titles { display:flex; align-items:center; gap:8px; min-width:0; }
.anime-row-titles h2 {
  font-size: 18px; font-weight:600; letter-spacing:-.3px; margin:0;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.anime-tag {
  font-size: 10.5px; font-weight:700; letter-spacing:.06em; text-transform: uppercase;
  color: var(--text2); border:1px solid var(--border); border-radius: 20px; padding: 3px 8px; white-space: nowrap;
}
.anime-row-link { margin-left:auto; font-size: 12.5px; font-weight:600; color: var(--text2); padding: 5px 10px; border-radius: 16px; }
.anime-row-link:hover { background: var(--hover); color: var(--text); }
.anime-track {
  display:flex; gap: 14px; overflow-x:auto;
  scroll-snap-type: x proximity; scroll-behavior: smooth;
  padding: 2px; margin: -2px;
  scrollbar-width:none; -ms-overflow-style:none;
}
.anime-track::-webkit-scrollbar { display:none; }
.anime-card { flex: 0 0 auto; width: clamp(212px, 22vw, 288px); scroll-snap-align: start; color: var(--text); text-decoration:none; }
.anime-thumb { position: relative; width:100%; aspect-ratio: 16/9; border-radius: 12px; overflow:hidden; background: #000; }
.anime-thumb img { width:100%; height:100%; object-fit: cover; display:block; }
.anime-badge {
  position:absolute; right:7px; bottom:7px; background: rgba(0,0,0,.82); color:#fff;
  font-size: 11px; font-weight:700; padding: 2px 5px; border-radius: 4px; line-height:1.35;
}
.anime-badge-live { background:#f00; left:7px; right:auto; letter-spacing:.04em; }
.anime-card-title {
  font-size: 13.5px; font-weight: 500; line-height: 1.35; margin: 8px 0 0;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
}
.anime-card-meta {
  font-size: 11.5px; color: var(--text2); margin-top: 4px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.anime-card:hover .anime-thumb { box-shadow: 0 4px 16px rgba(0,0,0,.25); }
.anime-fail, .anime-empty { font-size: 12.5px; color: var(--text2); padding: 18px 4px; }
.anime-skeleton .anime-thumb {
  background: linear-gradient(100deg, var(--hover) 20%, rgba(127,127,127,.14) 40%, var(--hover) 60%);
  background-size: 220% 100%; animation: anime-shimmer 1.3s infinite linear;
}
.anime-skel-line { height: 11px; border-radius: 5px; background: var(--hover); margin-top: 9px; }
.anime-skel-line.short { width: 55%; }
@keyframes anime-shimmer { from { background-position: 120% 0; } to { background-position: -60% 0; } }
/* Channel page inside the hub */
.anime-back { display:inline-block; font-size:13px; color: var(--text2); margin: 4px 0 14px; }
.anime-back:hover { color: var(--text); }
.anime-chan-head { display:flex; align-items:center; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.anime-chan-info h1 { font-size: 24px; margin:0 0 4px; letter-spacing:-.4px; }
.anime-chan-sub { font-size: 13px; color: var(--text2); display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.anime-ext {
  margin-left:auto; font-size:12.5px; font-weight:600; border:1px solid var(--border);
  border-radius:20px; padding: 7px 14px; color: var(--text); text-decoration:none;
}
.anime-ext:hover { background: var(--hover); }
.anime-grid { margin-bottom: 10px; }
.anime-grid .anime-card { width: 100%; }
.anime-more-wrap { text-align:center; padding: 10px 0 6px; }
.anime-more {
  border:1px solid var(--border); background: var(--surface); color: var(--text);
  font-size:13.5px; font-weight:600; border-radius: 20px; padding: 10px 22px; cursor:pointer;
}
.anime-more:hover { background: var(--hover); }
.anime-note { font-size: 12px; color: var(--text2); line-height: 1.6; max-width: 760px; margin: 26px 0 0; }
@media (max-width: 768px) {
  .anime-hero { border-radius: 0; margin: 0 -12px 14px; padding: 24px 16px; }
  .anime-hero h1 { font-size: 24px; }
  .anime-rows { gap: 20px; }
  .anime-card { width: 205px; }
  .anime-search { flex: 1 1 100%; }
  .anime-row-titles h2 { font-size: 16px; }
  .anime-ext { margin-left: 0; }
}

/* Watch page */
.watch-container { display: grid; grid-template-columns: 1fr 400px; gap: 24px; }
@media (max-width: 1200px) { .watch-container { grid-template-columns: 1fr; } }
.player-wrap { position:relative; width:100%; aspect-ratio: 16/9; background:#000; border-radius: var(--radius); overflow:hidden; }
.player-wrap iframe, .player-wrap video { width:100%; height:100%; border:0; }
/* The YouTube iframe stays invisible until the official IFrame API is ready.
   While it loads YouTube shows its own branding (title + "Watch on YouTube"
   button) - that must never be visible or clickable on our site. */
.player-wrap iframe, .ev-preview iframe {
  opacity: 0; transition: opacity .25s ease;
}
.sp-ready iframe, .sp-ready video { opacity: 1; }
/* Shorts stage iframes are ALWAYS visible - the shorts feed renders
   YouTube cards dynamically (no SP wiring needed), and the guard strips
   below already hide any YouTube branding, so the opacity-0 rule would
   only leave a black box. */
.short-stage iframe { opacity: 1 !important; }
/* Guard strips over the YouTube player.
   YouTube always renders its own title overlay and the "Watch on YouTube"
   logo button (both are links to youtube.com) - `controls=0` only removes the
   control bar. These strips cover them and swallow every click, so nobody can
   leave our site from inside a video. */
.yt-guard { position: absolute; left: 0; right: 0; z-index: 2; pointer-events: auto; }
.yt-guard-top {
  top: 0; height: 64px;
  background: linear-gradient(to bottom, #000 0, #000 72%, rgba(0,0,0,0) 100%);
}
.yt-guard-bottom {
  bottom: 0; height: 78px;
  background: linear-gradient(to top, #000 0, #000 70%, rgba(0,0,0,0) 100%);
}
/* ---- Site's own video player controls ------------------------------
   YouTube embeds are loaded with the official parameter controls=0 so the
   YouTube control bar (and its "Watch on YouTube" / "More videos" UI) never
   renders. Playback is driven through the official YouTube IFrame Player
   API (enablejsapi=1) by the bar below; uploaded <video> files use the
   same bar with native media events. Nothing inside the iframe is hidden
   with CSS. */
.sp-surface {
  position: absolute; inset: 0; z-index: 5; cursor: pointer;
  /* taps must not be swallowed, and double taps must not zoom the page;
     vertical scrolling still works for shorts-style feeds */
  touch-action: manipulation;
}
.player-wrap .sp-ctrls, .ev-preview .sp-ctrls, .short-stage .sp-ctrls {
  position:absolute; left:0; right:0; bottom:0; z-index:6;
  padding:24px 12px 6px;
  background:linear-gradient(to top, rgba(0,0,0,.82), rgba(0,0,0,0));
  opacity:1; transition:opacity .2s ease;
}
.sp-idle .sp-ctrls { opacity:0; pointer-events:none; }
.sp-seek { position:relative; height:14px; display:flex; align-items:center; cursor:pointer; }
.sp-seek-track { position:relative; width:100%; height:4px; background:rgba(255,255,255,.3);
  border-radius:2px; transition:height .1s ease; }
.sp-seek:hover .sp-seek-track, .sp-seek.dragging .sp-seek-track { height:6px; }
.sp-seek-fill { position:absolute; left:0; top:0; bottom:0; width:0%; background:var(--red);
  border-radius:2px; }
.sp-seek-knob { position:absolute; top:50%; left:0%; width:13px; height:13px; margin-left:-6.5px;
  border-radius:50%; background:var(--red); transform:translateY(-50%) scale(0);
  transition:transform .1s ease; }
.sp-seek:hover .sp-seek-knob, .sp-seek.dragging .sp-seek-knob { transform:translateY(-50%) scale(1); }
.sp-row { display:flex; align-items:center; gap:4px; margin-top:2px; color:#fff; }
.sp-btn { width:38px; height:38px; flex:0 0 auto; display:flex; align-items:center;
  justify-content:center; border-radius:50%; color:#fff; }
.sp-btn:hover { background:rgba(255,255,255,.16); }
.sp-btn svg { width:22px; height:22px; fill:#fff; pointer-events:none; }
.sp-time { font-size:12.5px; color:#fff; margin:0 8px; white-space:nowrap;
  font-variant-numeric:tabular-nums; user-select:none; }
.sp-right { margin-left:auto; display:flex; align-items:center; gap:2px; }
.sp-vol { width:72px; height:4px; margin:0 8px 0 2px; accent-color:#fff; cursor:pointer; }
.sp-skip-indicator {
  position: absolute; top: 50%; z-index: 6; width: 84px; height: 84px;
  margin-top: -42px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(0,0,0,.6); color: #fff; pointer-events: none;
  animation: sp-skip-anim .72s ease forwards;
}
.sp-skip-left { left: 12%; }
.sp-skip-right { right: 12%; }
.sp-skip-indicator span { font-size: 26px; line-height: 1; }
.sp-skip-indicator b { font-size: 12.5px; font-weight: 600; margin-top: 3px; letter-spacing: .02em; }
@keyframes sp-skip-anim {
  0% { opacity: 0; transform: scale(.55); }
  25% { opacity: 1; transform: scale(1.08); }
  60% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(.9); }
}

.sp-compact .sp-ctrls { padding:0; background:none; top:auto; bottom:0; pointer-events:none; }
.sp-compact .sp-row { display:none; }
.sp-compact .sp-seek { pointer-events:auto; height:4px; padding:0; }
.sp-compact .sp-seek-track { height:3px; border-radius:0; background:rgba(255,255,255,.35); }
.sp-compact .sp-seek-fill { border-radius:0; background: var(--red); }
.sp-compact .sp-seek-knob { display:none; }
.sp-compact.sp-idle .sp-ctrls { opacity:1; pointer-events:none; }
/* Big centered play/pause affordance (site-styled, sits above our surface) */
.sp-bigplay { position:absolute; left:50%; top:50%; width:72px; height:72px; margin:-36px 0 0 -36px;
  border-radius:50%; background:rgba(0,0,0,.55); display:flex; align-items:center; justify-content:center;
  z-index:6; cursor:pointer; transition:opacity .15s ease, transform .15s ease; pointer-events:auto; }
.sp-bigplay:hover { background:rgba(0,0,0,.72); transform:scale(1.05); }
.sp-bigplay svg { width:34px; height:34px; fill:#fff; margin-left:3px; }
.sp-playing .sp-bigplay { opacity:0; pointer-events:none; }
/* Overlays inside shorts must stay clickable above the tap surface */
.short-actions, .short-info { z-index:7; }
.short-stage .sp-bigplay { width:60px; height:60px; margin:-30px 0 0 -30px; }
.short-stage .sp-bigplay svg { width:26px; height:26px; }
/* ---- Rotating fullscreen (phones) -----------------------------------
   On a phone the fullscreen button must rotate the player to landscape,
   exactly like YouTube. iPhones have no element fullscreen at all and
   Android often ignores the orientation lock, so the player itself leaves
   the layout, fills the screen and turns 90deg while the viewport is
   still portrait. When the browser does lock landscape the media query
   simply stops matching and the player stays upright. */
.player-wrap.sp-fs, .ev-preview.sp-fs {
  position: fixed; inset: 0; z-index: 2147483000;
  width: 100vw; height: 100vh;
  max-width: none; max-height: none; aspect-ratio: auto;
  border-radius: 0; background: #000;
}
@supports (height: 100dvh) {
  .player-wrap.sp-fs, .ev-preview.sp-fs { width: 100dvw; height: 100dvh; }
}
@media (orientation: portrait) {
  .player-wrap.sp-fs, .ev-preview.sp-fs {
    left: 0; top: 0; right: auto; bottom: auto;
    width: 100vh; height: 100vw;
    transform-origin: top left;
    transform: translateX(100vw) rotate(90deg);
  }
}
@supports (height: 100dvh) {
  @media (orientation: portrait) {
    .player-wrap.sp-fs, .ev-preview.sp-fs {
      width: 100dvh; height: 100dvw;
      transform: translateX(100dvw) rotate(90deg);
    }
  }
}
html.sp-fs-open, body.sp-fs-open { overflow: hidden; overscroll-behavior: none; }
.video-title { font-size: 18px; font-weight: 600; margin: 12px 0 8px; line-height: 1.3; }
.channel-row { display:flex; align-items:center; gap:12px; padding: 8px 0; flex-wrap: wrap; }
.channel-avatar-lg { width:48px; height:48px; border-radius:50%; object-fit:cover; }
.channel-info { flex:1; min-width:0; }
.channel-name { font-size: 16px; font-weight: 500; display:flex; align-items:center; gap:4px; }
.channel-subs { font-size: 12px; color: var(--text2); }
.subscribe-btn {
  background: var(--black); color:#fff; padding: 0 16px; height:36px; border-radius:18px; font-weight:500;
}
.subscribe-btn:hover { background: #272727; }
.subscribe-btn.subscribed { background: var(--hover); color: var(--text); }
.actions-row { display:flex; align-items:center; gap:8px; margin-left:auto; flex-wrap:wrap; }
.action-pill {
  display:flex; align-items:center; gap:6px; height:36px; padding: 0 12px;
  background: var(--hover); border-radius: 18px; font-weight:500; font-size:14px;
}
.action-pill:hover { background: #e5e5e5; }
.action-pill .count { font-weight:500; }
.action-pill.liked { background: #e5e5e5; }

.description-box {
  background: var(--hover); border-radius: 12px; padding: 12px 16px; margin-top: 12px;
  font-size: 14px; line-height: 1.5;
}
.description-box .meta { color: var(--text2); font-size: 13px; margin-bottom: 8px; }
.description-box .body { white-space: pre-wrap; }
.description-box.collapsed .body { max-height: 80px; overflow: hidden; }

.comments-section { margin-top: 24px; }
.comments-header { font-size: 16px; font-weight: 500; margin-bottom: 16px; }
.comment-form { display:flex; gap:12px; margin-bottom: 24px; }
.comment-input {
  flex:1; border:0; border-bottom: 1px solid var(--border); padding: 8px 0;
  background: transparent; font-size:14px; outline:0;
}
.comment-input:focus { border-bottom-color: var(--text); }
.comment-btn { background: var(--blue); color:#fff; padding: 0 16px; height:36px; border-radius:18px; font-weight:500; }
.comment { display:flex; gap:12px; margin-bottom: 16px; }
.comment-avatar { width:40px; height:40px; border-radius:50%; object-fit:cover; flex-shrink:0; }
.comment-body { flex:1; }
.comment-author { font-size: 13px; font-weight:500; }
.comment-time { font-size: 12px; color: var(--text2); margin-left: 6px; }
.comment-text { font-size: 14px; margin-top:4px; white-space: pre-wrap; }
.comment-actions { display:flex; gap:8px; margin-top:6px; }
.comment-action { font-size: 13px; color: var(--text2); display:flex; align-items:center; gap:4px; padding:4px 8px; border-radius:14px; }
.comment-action:hover { background: var(--hover); color: var(--text); }

/* ---- Comment replies ---- */
.comment-thread { margin-bottom: 8px; }
.comment-form-main { flex: 1; min-width: 0; }
.reply-banner {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text2); padding: 6px 0 2px;
}
.reply-banner[hidden] { display: none !important; }
.reply-banner b { color: var(--text); font-weight: 500; }
.reply-cancel {
  width: 24px; height: 24px; border-radius: 50%;
  font-size: 18px; line-height: 1; color: var(--text2);
  display: flex; align-items: center; justify-content: center;
}
.reply-cancel:hover { background: var(--hover); color: var(--text); }
.comment-replies {
  margin-left: 52px; padding-left: 14px;
  border-left: 2px solid var(--border);
}
.comment-replies[hidden] { display: none !important; }
.comment-replies .comment-replies { margin-left: 0; padding-left: 14px; border-left: none; }
.comment-reply .comment-avatar-sm { width: 32px; height: 32px; }
.comment-reply .comment-text { font-size: 13.5px; }
.comment-reply-to { font-size: 12px; color: var(--text2); margin-left: 6px; }
/* the button that shows / hides a reply thread */
.reply-toggle { color: var(--text2); font-weight: 500; }
.reply-toggle:hover { color: var(--text); }
.reply-toggle .reply-toggle-chev {
  display: inline-block; transition: transform .15s ease; font-size: 11px; margin-right: 2px;
}
.reply-toggle.open { color: var(--text); }
.reply-toggle.open .reply-toggle-chev { transform: rotate(-180deg); }
.reply-toggle .reply-toggle-n { font-weight: 600; }
/* comment like / dislike */
.cr-btn { min-width: 34px; }
.cr-btn.liked { color: var(--text); font-weight: 600; }
.cr-btn.liked:hover { color: var(--text); }
.cr-btn span { font-variant-numeric: tabular-nums; }

/* Sidebar recommended */
.recommended { display:flex; flex-direction:column; gap: 8px; }
.rec-card { display:flex; gap:8px; cursor:pointer; }
.rec-thumb { width: 168px; aspect-ratio:16/9; border-radius:8px; overflow:hidden; background:#000; flex-shrink:0; position:relative; }
.rec-thumb img { width:100%; height:100%; object-fit:cover; }
.rec-thumb .dur { position:absolute; bottom:4px; right:4px; background:rgba(0,0,0,.8); color:#fff; font-size:11px; padding:1px 4px; border-radius:3px; }
.rec-info { flex:1; min-width:0; }
.rec-title { font-size: 14px; font-weight:500; line-height:1.3; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.rec-meta { font-size: 12px; color: var(--text2); margin-top:4px; }

/* Sidebar related videos (fetched from YouTube per video) */
.recommended[hidden] { display: none !important; }
.yt-rel { display: flex; flex-direction: column; gap: 8px; }
.yt-rel-head { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 14px; font-weight: 600; }
.yt-rel-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #ff0033; flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(255, 0, 51, .14);
  animation: yt-rel-pulse 1.8s ease-in-out infinite;
}
@keyframes yt-rel-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.yt-rel-list { display: flex; flex-direction: column; gap: 8px; }
.yt-rel-card .dur.dur-live { background: #cc0000; font-weight: 600; }
.yt-rel-skel { display: flex; gap: 8px; }
.yt-rel-skel-thumb {
  width: 168px; aspect-ratio: 16/9; border-radius: 8px; flex-shrink: 0;
  background: linear-gradient(100deg, var(--hover) 20%, var(--border) 40%, var(--hover) 60%);
  background-size: 220% 100%; animation: anime-shimmer 1.3s infinite linear;
}
.yt-rel-skel-lines { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; padding-top: 2px; }
.yt-rel-skel-lines i {
  display: block; height: 10px; border-radius: 6px;
  background: linear-gradient(100deg, var(--hover) 20%, var(--border) 40%, var(--hover) 60%);
  background-size: 220% 100%; animation: anime-shimmer 1.3s infinite linear;
}
.yt-rel-skel-lines i:nth-child(2) { width: 68%; }
.yt-rel-skel-lines i:nth-child(3) { width: 42%; }

/* Forms / auth */
.auth-container { max-width: 400px; margin: 60px auto; background: var(--surface); padding: 32px; border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,.05); }
.auth-container h1 { font-size: 24px; margin: 0 0 8px; }
.auth-container .sub { color: var(--text2); margin-bottom: 24px; }
.form-group { margin-bottom: 16px; }
.form-group label { display:block; font-size: 13px; color: var(--text2); margin-bottom: 4px; }
.form-control {
  width:100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; outline:0; background: var(--surface);
}
.form-control:focus { border-color: var(--blue); }
.btn-primary { background: var(--blue); color:#fff; padding: 10px 20px; border-radius: 20px; font-weight:500; width:100%; }
.btn-primary:hover { background: #0550b8; }
.btn-danger { background: #cc0000; color:#fff; padding: 8px 16px; border-radius: 4px; font-weight:500; }
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #fdecea; color: #b00020; }
.alert-success { background: #e6f4ea; color: #1e7e34; }

/* Admin */
.admin-layout { display:flex; min-height:100vh; }
.admin-sidebar { width: 240px; background: var(--black); color:#fff; padding: 16px 0; position:fixed; top:0; bottom:0; left:0; }
.admin-sidebar .brand { padding: 8px 20px 20px; font-size: 18px; font-weight:600; color:#fff; }
.admin-sidebar a { display:block; padding: 10px 20px; color: #aaa; font-size: 14px; }
.admin-sidebar a:hover, .admin-sidebar a.active { background: #272727; color:#fff; }
.admin-main { margin-left: 240px; flex:1; padding: 24px; background: var(--bg); }
.admin-card { background: var(--surface); border-radius: 8px; padding: 20px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.admin-table { width:100%; border-collapse: collapse; background: var(--surface); border-radius: 8px; overflow:hidden; }
.admin-table th, .admin-table td { padding: 12px 16px; text-align:left; border-bottom: 1px solid var(--border); font-size: 14px; }
.admin-table th { background: var(--hover); font-weight:600; }
.admin-table tr:hover td { background: #fafafa; }
.stats-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap:16px; margin-bottom: 24px; }
.stat-card { background: var(--surface); padding: 20px; border-radius: 8px; }
.stat-card .num { font-size: 28px; font-weight: 600; }
.stat-card .lbl { color: var(--text2); font-size: 13px; margin-top: 4px; }

/* Misc */
.empty-state { text-align:center; padding: 60px 20px; color: var(--text2); }
.empty-state .ico { font-size: 64px; margin-bottom: 16px; }
.pagination { display:flex; gap:8px; justify-content:center; margin-top:24px; }
.pagination a { padding: 8px 14px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); }
.pagination a.active { background: var(--black); color:#fff; border-color: var(--black); }
footer { padding: 24px; text-align:center; color: var(--text3); font-size: 12px; }
.verified-badge { color: var(--blue); font-size: 14px; }

/* YouTube Studio */
.studio-layout { display:flex; min-height:100vh; background:#f9f9f9; }
.studio-topbar { position:fixed; top:0; left:0; right:0; height:56px; background:#fff; border-bottom:1px solid var(--border); display:flex; align-items:center; padding:0 16px; gap:12px; z-index:100; }
.studio-topbar .brand { font-weight:500; font-size:18px; display:flex; align-items:center; gap:8px; }
.studio-topbar .brand .play { color:var(--red); }
.studio-topbar .right { margin-left:auto; display:flex; align-items:center; gap:8px; }
.studio-sidebar { width:220px; background:#fff; position:fixed; top:56px; left:0; bottom:0; padding:8px 0; border-right:1px solid var(--border); overflow-y:auto; }
.studio-sidebar a { display:flex; align-items:center; gap:12px; padding:10px 20px; color:var(--text); font-size:14px; }
.studio-sidebar a:hover { background:var(--hover); }
.studio-sidebar a.active { background:var(--hover); font-weight:500; border-left:3px solid var(--blue); }
.studio-sidebar .section { padding:8px 20px 4px; font-size:11px; color:var(--text3); text-transform:uppercase; font-weight:600; }
.studio-main { margin-left:220px; margin-top:56px; padding:24px; flex:1; }
.studio-card { background:#fff; border-radius:8px; padding:20px; margin-bottom:16px; box-shadow:0 1px 2px rgba(0,0,0,.05); }
.studio-table { width:100%; border-collapse:collapse; background:#fff; }
.studio-table th, .studio-table td { padding:12px 16px; text-align:left; border-bottom:1px solid var(--border); font-size:14px; }
.studio-table th { background:var(--hover); font-weight:600; }
.studio-table img.thumb { width:120px; aspect-ratio:16/9; object-fit:cover; border-radius:4px; }
.visibility-pill { display:inline-block; padding:2px 8px; border-radius:12px; font-size:12px; font-weight:500; }
.visibility-pill.public { background:#e6f4ea; color:#1e7e34; }
.visibility-pill.unlisted { background:#fef7e0; color:#b06000; }
.visibility-pill.private { background:#fdecea; color:#b00020; }
@media (max-width:768px){ .studio-sidebar{display:none;} .studio-main{margin-left:0;} }

/* responsive */
/* Shorts player */
.shorts-page {
  background: #000; color: #fff;
  min-height: calc(100vh - var(--header-h));
  margin: -24px -24px 0;
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.shorts-stage {
  position: relative; width: 360px; max-width: 90vw;
  aspect-ratio: 9/16; max-height: calc(100vh - var(--header-h) - 40px);
  background: #000; border-radius: 12px; overflow: hidden;
}
.shorts-video-wrap { width:100%; height:100%; }
.shorts-video-wrap iframe, .shorts-video-wrap video { width:100%; height:100%; border:0; }
.shorts-actions {
  position: absolute; right: -72px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 16px; align-items: center;
}
.shorts-action {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: #fff; font-size: 12px; cursor: pointer;
}
.shorts-action .icon {
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(255,255,255,0.1); display:flex; align-items:center; justify-content:center;
  font-size: 22px; transition: background .2s;
}
.shorts-action .icon:hover { background: rgba(255,255,255,0.2); }
.shorts-action .count { font-size: 12px; font-weight: 500; }
.shorts-info {
  position: absolute; left: 12px; bottom: 12px; right: 80px;
  color: #fff;
}
.shorts-channel { display:flex; align-items:center; gap: 8px; margin-bottom: 8px; }
.shorts-channel img { width: 36px; height: 36px; border-radius: 50%; }
.shorts-channel .name { font-weight: 600; font-size: 14px; }
.shorts-subscribe {
  background: #fff; color: #000; padding: 6px 12px; border-radius: 18px;
  font-weight: 600; font-size: 13px; margin-left: 8px;
}
.shorts-subscribe.subscribed { background: rgba(255,255,255,0.2); color: #fff; }
.shorts-title { font-size: 14px; line-height: 1.4; margin-bottom: 6px; }
.shorts-music { font-size: 13px; opacity: 0.9; display:flex; align-items:center; gap:6px; }
.shorts-nav {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 12px;
}
.shorts-nav a { color: #fff; font-size: 24px; opacity: 0.8; text-align: center; }
.shorts-nav a:hover { opacity: 1; }
.shorts-comments-drawer {
  position: absolute; bottom: 0; left: 0; right: 0; height: 50%;
  background: #212121; border-radius: 12px 12px 0 0; padding: 12px;
  overflow-y: auto; display: none;
}
.shorts-comments-drawer.open { display: block; }
@media (max-width: 768px) {
  .shorts-actions { right: 8px; }
  .shorts-nav { display: none; }
  .shorts-page { margin: 0; }
}
@media (max-width: 768px) {
  .sidebar { display:none; }
  .main { margin-left: 0; padding: 16px; }
  .search-bar { margin-left: 8px; }
  .search-input-wrap { display:none; }
  .search-btn { display:none; }
}

/* ===== Upload pages ===================================================== */
.upload-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 24px;
}
.upload-drop {
  position: relative; border: 2px dashed var(--border); border-radius: 12px;
  padding: 28px 16px; text-align: center; background: var(--bg); margin-bottom: 20px;
}
.upload-drop:hover { border-color: var(--blue); }
.upload-drop-ico { font-size: 34px; }
.upload-drop b { display: block; margin: 8px 0 4px; font-size: 15px; }
.upload-drop span { display: block; color: var(--text2); font-size: 13px; }
.upload-drop input[type=file] { margin-top: 14px; font-size: 13px; }
.upload-file-info {
  margin-top: 12px; display: inline-block; background: var(--hover);
  border-radius: 16px; padding: 6px 14px; font-size: 13px;
}
.vis-options { display: flex; gap: 12px; flex-wrap: wrap; }
.vis-option {
  display: flex; gap: 8px; align-items: flex-start; cursor: pointer;
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; min-width: 190px;
}
.vis-option:hover { background: var(--hover); }
.vis-option b { display: block; font-size: 14px; font-weight: 500; }
.vis-option small { display: block; color: var(--text2); font-size: 12px; }
.yt-preview {
  display: flex; gap: 14px; align-items: center; background: var(--bg);
  border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin: 4px 0 16px;
}
.yt-preview img { width: 120px; height: 68px; object-fit: cover; border-radius: 6px; flex: 0 0 auto; }
.yt-preview b { display: block; font-size: 14px; margin-bottom: 3px; }
.yt-preview small { display: block; color: var(--text2); font-size: 12px; }

/* ===== Monetization ===================================================== */
.mon-status {
  display: flex; gap: 16px; align-items: flex-start;
  border-radius: 14px; padding: 20px; margin-bottom: 20px;
  background: var(--surface); border: 1px solid var(--border);
}
.mon-status.ok { border-left: 5px solid #16a34a; }
.mon-status.warn { border-left: 5px solid #f59e0b; }
.mon-status-ico { font-size: 34px; }
.mon-status h2 { font-size: 17px; }
.mon-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.mon-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px;
}
.mon-card h4 { margin: 0 0 6px; font-size: 13px; color: var(--text2); font-weight: 500; }
.mon-num { font-size: 26px; font-weight: 700; line-height: 1.2; }
.mon-sub { font-size: 12.5px; color: var(--text2); margin-top: 2px; }
.mon-bar { height: 6px; border-radius: 3px; background: var(--hover); margin-top: 10px; overflow: hidden; }
.mon-bar span { display: block; height: 100%; background: var(--red); border-radius: 3px; }

/* Create dropdown (menu) is styled near .create-btn */
/* ===== Ads (Adsterra) ================================================= */
.ad-slot { margin: 16px 0; width: 100%; overflow: hidden; }
.ad-slot:empty { display: none; }
.ad-slot-wide {
  grid-column: 1 / -1; width: 100%; margin: 8px 0 16px; overflow: hidden;
}
.ad-slot-wide .ad-slot { margin: 0; }
/* header/footer banners sit outside the grids, one on every public page */
.ad-slot-header { margin: 0 0 20px; }
.ad-slot-footer { margin: 24px 0 0; }
/* native banners that are placed between videos in a feed */
.ad-slot-feed { margin: 8px 0 16px; }
@media (max-width: 600px) {
  .ad-slot-header { margin-bottom: 14px; }
  .ad-slot-footer { margin-top: 18px; }
}

/* ===== Download modal (resolution picker) ============================== */
.dl-modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.dl-modal[hidden] { display: none; }
.dl-modal-card {
  background: var(--surface); border-radius: var(--radius);
  width: 100%; max-width: 420px; overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
  animation: dl-pop .16s ease-out;
}
@keyframes dl-pop { from { transform: translateY(8px) scale(.98); opacity:0; } to { transform:none; opacity:1; } }
.dl-modal-head {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 16px 16px 10px;
}
.dl-modal-title { font-size: 16px; font-weight: 600; }
.dl-modal-sub { font-size: 12.5px; color: var(--text2); margin-top: 2px; }
.dl-head-actions {
  margin-left: auto; display: flex; align-items: center; gap: 2px; flex: 0 0 auto;
}
.dl-modal-close,
.dl-modal-min {
  width: 32px; height: 32px; border-radius: 50%;
  line-height: 1; color: var(--text); flex: 0 0 auto;
}
.dl-modal-close { font-size: 24px; }
.dl-modal-min { font-size: 22px; padding-bottom: 4px; }
.dl-modal-close:hover, .dl-modal-min:hover { background: var(--hover); }
.dl-modal-body { padding: 0 8px 8px; max-height: 55vh; overflow-y: auto; }
.dl-list { display: flex; flex-direction: column; }
.dl-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 12px; border-radius: 8px; text-align: left; width: 100%;
}
.dl-item:hover { background: var(--hover); }
.dl-item-q { font-weight: 500; font-size: 14px; flex: 0 0 auto; }
.dl-item-meta { font-size: 12.5px; color: var(--text2); flex: 1; min-width: 0; }
.dl-item-go { font-size: 18px; color: var(--text2); flex: 0 0 auto; }
.dl-loading, .dl-empty {
  display: flex; align-items: center; gap: 10px;
  padding: 22px 16px; color: var(--text2); font-size: 13.5px;
}
.dl-empty { justify-content: center; text-align: center; }
.dl-spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--text2);
  display: inline-block; animation: dl-spin .7s linear infinite;
}
@keyframes dl-spin { to { transform: rotate(360deg); } }
.dl-modal-foot { padding: 10px 16px 16px; }
.dl-progress {
  height: 4px; border-radius: 2px; background: var(--border); overflow: hidden;
}
.dl-progress-bar { height: 100%; width: 0%; background: var(--red); transition: width .2s ease; }
.dl-status { font-size: 12.5px; color: var(--text2); margin-top: 8px; min-height: 16px; }

/* Minimized download card: floats under the header, next to the logo */
.dl-mini {
  position: fixed; top: calc(var(--header-h) + 10px); left: 12px;
  z-index: 210;
  display: flex; align-items: center; gap: 4px;
  width: 296px; max-width: calc(100vw - 24px);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 8px 8px 8px 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,.22);
  animation: dl-mini-in .18s ease-out;
}
.dl-mini[hidden] { display: none; }
@keyframes dl-mini-in { from { transform: translateY(-6px); opacity:0; } to { transform:none; opacity:1; } }
.dl-mini-main {
  display: flex; align-items: center; gap: 10px;
  flex: 1; min-width: 0; text-align: left;
  padding: 2px; border-radius: 8px; color: var(--text);
}
.dl-mini-main:hover { background: var(--hover); }
.dl-mini-logo {
  width: 34px; height: 24px; border-radius: 6px; flex: 0 0 auto;
  background: var(--red); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 11px;
}
.dl-mini-info { flex: 1; min-width: 0; }
.dl-mini-title {
  display: block; font-size: 12.5px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dl-mini-bar {
  display: block; height: 3px; border-radius: 2px;
  background: var(--border); margin-top: 5px; overflow: hidden;
}
.dl-mini-fill {
  display: block; height: 100%; width: 0%; background: var(--red);
  transition: width .2s ease;
}
.dl-mini-pct {
  font-size: 12px; font-weight: 600; color: var(--text);
  min-width: 34px; text-align: right; flex: 0 0 auto;
}
.dl-mini-close {
  width: 26px; height: 26px; border-radius: 50%; flex: 0 0 auto;
  font-size: 17px; line-height: 1; color: var(--text2);
}
.dl-mini-close:hover { background: var(--hover); color: var(--text); }
@media (max-width: 560px) {
  .dl-mini { left: 8px; top: calc(var(--header-h) + 8px); width: 268px; }
}
@media (max-width: 560px) {
  .dl-modal { align-items: flex-end; padding: 0; }
  .dl-modal-card { max-width: none; border-radius: 14px 14px 0 0; }
  .dl-modal-body { max-height: 60vh; }
}
/* Keep every action pill (like / share / save / download) reachable on phones */
@media (max-width: 700px) {
  .channel-row { flex-wrap: wrap; }
  .actions-row { margin-left: 0; width: 100%; }
  .action-pill { height: 32px; padding: 0 10px; font-size: 13px; }
}

/* ===== YouTube results on the search page ==============================
   The section sits below the site's own results and fills itself in the
   background (api/yt_search.php + loadYouTubeResults in app.js), so a
   query like "hindi song" still shows playable videos. */
.yt-section {
  margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border);
}
.yt-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px;
}
.yt-badge {
  background: var(--red, #ff0000); color: #fff; font-size: 11px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; padding: 3px 8px; border-radius: 4px;
}
.yt-head h3 { margin: 0; font-size: 15px; font-weight: 500; color: var(--text2); }
#ytGrid:empty { display: none; }

/* ===== Sign-in message (toast) =========================================
   Shown when a guest uses an action that needs an account (like, comment,
   save, subscribe, upload). The page stays where it is - only a small
   message with the Sign in link appears. */
.site-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
  background: rgba(15,15,15,.94); color: #fff; padding: 11px 18px; border-radius: 22px;
  font-size: 13.5px; opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 500; max-width: 90vw; text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
.site-toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.site-toast a { color: #8ab4f8; font-weight: 600; margin-left: 8px; white-space: nowrap; }

/* Sign-in note above the comment box for guests */
.signin-note {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px;
  font-size: 13.5px; color: var(--text2);
}
.signin-note-btn {
  background: var(--blue); color: #fff; text-decoration: none;
  padding: 6px 16px; border-radius: 16px; font-size: 13px; font-weight: 500;
}
.signin-note-btn:hover { opacity: .9; }

.dl-open-link { color: var(--blue, #065fd4); font-size: 13px; text-decoration: none; display: inline-block; margin-top: 10px; }
.dl-open-link:hover { text-decoration: underline; }

/* ===== Mobile-first responsive YouTube-like design =====================
   Below / near 768px the layout collapses to the real YouTube phone UI:
   no sidebar, fixed bottom nav, full-width video feed, slim search bar
   full-width video feed, slim search bar always pinned to the top. Desktop
   keeps the classic sidebar/topbar intact. */

/* Fixed bottom navigation bar for phones */
.bottom-nav {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
  height: 56px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -1px 8px rgba(0,0,0,.06);
  grid-template-columns: repeat(7, 1fr);
  align-items: stretch;
  font-family: inherit;
}
.bottom-nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; height: 56px; padding: 4px 0; position: relative;
  color: var(--text); text-decoration: none;
}
.bottom-nav-item:active { background: var(--hover); }
.bottom-nav-ico { font-size: 22px; line-height: 1; }
.bottom-nav-label { font-size: 10.5px; font-weight: 500; letter-spacing: .01em; }
.bottom-nav-item.active .bottom-nav-ico,
.bottom-nav-item.active .bottom-nav-label { color: var(--text); }
.bottom-nav-item.active .bottom-nav-label { font-weight: 600; }

.bottom-nav-create { align-items: center; }
.bottom-nav-create-circle {
  width: 44px; height: 44px; border-radius: 50%; background: #ff0000; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 22px; line-height: 1;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.bottom-nav-create:active .bottom-nav-create-circle { background: #b91010; }

@media (max-width: 768px) {
  :root { --header-h: 52px; }
  .bottom-nav { display: grid; }

  /* Compact top bar: logo left, search bar flex fills, sign-in right */
  .header { padding: 0 6px; gap: 6px; height: var(--header-h); }
  .header .left { gap: 0; flex: 0 0 auto; }
  .icon-btn { width: 36px; height: 36px; }
  .logo { font-size: 18px; gap: 3px; }
  .logo .play { font-size: 21px; }
  .logo .country { font-size: 9px; }
  .header .right { gap: 2px; margin-left: 0; flex: 0 0 auto; }

  /* Search bar is ALWAYS visible on mobile - slim and flex to fill */
  .search-bar { flex: 1 1 auto; max-width: none; margin: 0; min-width: 0; height: 38px; }
  .search-input-wrap { display: flex !important; height: 36px; border-radius: 18px 0 0 18px; padding: 0 12px; border-right: 0; }
  .search-input-wrap input { font-size: 14px; }
  .search-btn { display: flex !important; width: 44px; height: 36px; border-radius: 0 18px 18px 0; }
  .mic-btn { display: none !important; }

  /* Create button hidden (it lives in the bottom nav center button) */
  .create-wrap, .create-btn { display: none !important; }

  /* Sign-in pill hidden on phones (mobile layout shows only logo + search bar) */
  .signin-btn { display: none !important; }

  /* Sidebar hidden on mobile */
  .sidebar { display: none !important; }
  .app { margin-top: var(--header-h); min-height: calc(100vh - var(--header-h)); padding-bottom: 72px; }
  .main { margin-left: 0 !important; padding: 12px 8px 24px; }
  .container { padding: 0 4px; }
  .chips-bar { gap: 8px; padding: 8px 4px 12px; overflow-x: auto; scrollbar-width: none; }
  .chips-bar::-webkit-scrollbar { display: none; }
  .chip { height: 28px; padding: 0 12px; font-size: 12.5px; }

  /* Video grid full-width */
  .video-grid { grid-template-columns: 1fr !important; gap: 14px !important; }
  .video-card { border-radius: 0; }
  .thumb-wrap { border-radius: 0; }
  .card-meta { padding: 0 4px; margin-top: 10px; }
}

@media (max-width: 420px) {
  .bottom-nav-label { font-size: 9px; }
  .bottom-nav-ico { font-size: 19px; }
  .header { padding: 0 4px; gap: 4px; }
  .logo { font-size: 15px; gap: 2px; }
  .logo .play { font-size: 19px; }
  .logo .country { display: none; }
}

/* Desktop: bottom-nav is hidden but search bar is visible (already from desktop base styles) */
@media (min-width: 769px) {
  .bottom-nav { display: none !important; }
}

/* Hide the hamburger on phones - the bottom nav / profile avatar serves as the
   entry to Settings, Studio, Help, etc. like in the real YouTube mobile UI. */
@media (max-width: 768px) {
  #menuToggle { display: none !important; }
}

/* Endless YouTube Shorts feed (appended after the local shorts) */
.yt-shorts-marker {
  display: flex; align-items: center; gap: 8px; padding: 16px 0 4px;
  border-top: 1px solid var(--border); margin-top: 24px; width: 100%;
}
.yt-shorts-marker h2 { font-size: 18px; margin: 0; font-weight: 600; }
.yt-badge {
  background: #ff0000; color: #fff; font-size: 11px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; padding: 3px 8px; border-radius: 4px;
}

/* Live now strip on the Shorts page */
.yt-live-strip { margin: 0 0 6px; }
.yt-live-badge {
  background: #f00; color: #fff; font-size: 11px; font-weight: 800;
  letter-spacing: .08em; text-transform: uppercase; padding: 3px 8px;
  border-radius: 4px; display: inline-flex; align-items: center; gap: 6px;
}
.yt-live-badge::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff;
  animation: ytLivePulse 1.4s ease-in-out infinite;
}
@keyframes ytLivePulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.yt-live-row {
  display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 12px;
  scrollbar-width: thin; scroll-snap-type: x proximity;
}
.yt-live-row::-webkit-scrollbar { height: 6px; }
.yt-live-row::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.yt-live-card {
  flex: 0 0 172px; scroll-snap-align: start; text-decoration: none;
  border-radius: 12px; overflow: hidden; border: 1px solid var(--border);
  background: var(--surface); display: flex; flex-direction: column;
  transition: transform .15s ease, box-shadow .15s ease;
}
.yt-live-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.28); }
.yt-live-thumb { position: relative; display: block; aspect-ratio: 16/9; background: #000; }
.yt-live-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.yt-live-chip {
  position: absolute; left: 6px; bottom: 6px; background: #f00; color: #fff;
  font-size: 10px; font-weight: 800; letter-spacing: .08em; padding: 2px 7px; border-radius: 3px;
}
.yt-live-title {
  font-size: 12px; line-height: 1.35; color: var(--text); padding: 8px 8px 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 32px;
}
.yt-live-meta { font-size: 11px; color: #f00; font-weight: 600; padding: 0 8px 8px; }

/* Sidebar sign-in teaser (logged-out visitors) */
.side-teaser { border-top: 1px solid var(--border); padding: 18px 14px 14px; }
.side-teaser p { font-size: 13.5px; color: var(--text2); margin: 0 0 12px; line-height: 1.45; }
.side-teaser-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 18px;
  border: 1px solid var(--border); border-radius: 18px; color: var(--blue);
  font-weight: 500; font-size: 13.5px; text-decoration: none; transition: background .15s ease;
}
.side-teaser-btn:hover { background: #def1ff; }
@media (max-width: 768px) { .side-teaser { display: none; } }

/* Mobile background playback: tiny toast shown when the network drops/returns */
.offline-toast {
  position: fixed; left: 50%; bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 12px); z-index: 9999;
  background: rgba(15,15,15,.92); color:#fff;
  border-radius: 22px; padding: 10px 18px;
  font-size: 13px; font-weight: 500; max-width: 88vw;
  box-shadow: 0 4px 18px rgba(0,0,0,.35); opacity: 0;
  transition: opacity .3s ease, transform .3s ease; pointer-events: none;
  text-align: center;
}
.offline-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Mobile safeguard: nothing in the page may push the layout wider than the
   device screen - no horizontal scrollbar, no clipped modals/cards */
@media (max-width: 768px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  .app, .main, .container, .watch-container, .watch-main, .watch-side { max-width: 100%; min-width: 0; }
  img, video, iframe, table, pre { max-width: 100%; }
  .admin-card, .studio-card { overflow-x: auto; }
  .admin-table, .studio-table { min-width: 560px; }
}

/* Library quick menu (floating pill above the Library button) */
.bottom-nav-item[hidden] { display: none !important; }
.lib-quick {
  position: fixed; z-index: 90;
  display: flex; gap: 2px; align-items: stretch;
  padding: 6px 8px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 -8px 30px rgba(0,0,0,.32);
  max-width: calc(100vw - 16px); white-space: nowrap;
  overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none;
}
.lib-quick::-webkit-scrollbar { display: none; }
.lib-quick-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; min-width: 54px; padding: 6px 12px; border-radius: 12px;
  color: var(--text); font-size: 11px; font-weight: 500;
}
.lib-quick-item:hover, .lib-quick-item:active { background: var(--hover); }
.lib-quick-ico { font-size: 22px; line-height: 1; }

/* Sidebar buttons that trigger inline popovers (Task trigger, desktop) */
button.nav-item { cursor: pointer; }
button.nav-item.active, button.nav-item:focus-visible { outline: none; background: var(--hover); font-weight: 500; }
@media (max-width: 768px) {
  button.nav-item { display: none !important; }  /* phones have the bottom-nav Library popover instead */
}
