/* 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; }

.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; }
}

/* 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, .short-stage iframe, .ev-preview iframe {
  opacity: 0; transition: opacity .25s ease;
}
.sp-ready iframe, .sp-ready video { opacity: 1; }
/* 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;
  /* vertical swipes must scroll the shorts feed, not be swallowed */
  touch-action: pan-y;
}
.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-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; }
.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; }

/* 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; }
