/**
 * KVS modern dark shell — loads after all-responsive-*.css
 * Scoped to body.kvs-theme-modern (toggle by removing class in include_header_general.tpl)
 */

body.kvs-theme-modern {
  --kvs-bg-deep: #050508;
  --kvs-bg-elevated: #101018;
  --kvs-bg-card: #14141f;
  --kvs-bg-glass: rgba(22, 22, 34, 0.92);
  --kvs-border: rgba(255, 255, 255, 0.08);
  --kvs-border-strong: rgba(255, 255, 255, 0.14);
  --kvs-text: #f4f4f8;
  --kvs-text-muted: #9a9ab0;
  --kvs-accent: #7c6cf5;
  --kvs-accent-2: #4f8cff;
  --kvs-radius: 14px;
  --kvs-radius-sm: 10px;
  --kvs-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --kvs-sticky-z: 8000;
  color-scheme: dark;
}

html:has(> body.kvs-theme-modern) {
  background: var(--kvs-bg-deep);
}

html body.kvs-theme-modern {
  background: var(--kvs-bg-deep);
  color: var(--kvs-text);
}

body.kvs-theme-modern {
  color: var(--kvs-text);
  background: radial-gradient(120% 80% at 50% -20%, rgba(124, 108, 245, 0.12), transparent 50%),
    linear-gradient(180deg, #0a0a10 0%, var(--kvs-bg-deep) 45%, #030305 100%);
  background-attachment: fixed;
}

body.kvs-theme-modern a {
  color: var(--kvs-text);
}

body.kvs-theme-modern.no-touch a:hover {
  color: var(--kvs-accent-2);
}

/* Allow sticky header; keep horizontal scroll contained */
body.kvs-theme-modern {
  overflow-x: hidden;
}

body.kvs-theme-modern .container {
  overflow: visible;
  background: transparent;
  background-image: none;
}

/* Sticky top: logo + search + nav */
body.kvs-theme-modern .kvs-sticky-top {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: var(--kvs-sticky-z);
  background: linear-gradient(180deg, rgba(8, 8, 12, 0.97) 0%, rgba(8, 8, 12, 0.88) 85%, transparent 100%);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--kvs-border);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

body.kvs-theme-modern .top-links {
  background: #020203;
  border-bottom: 1px solid var(--kvs-border);
}

body.kvs-theme-modern .header {
  z-index: 2;
  background: transparent;
  padding: 14px 20px;
}

body.kvs-theme-modern .header + nav {
  border-color: var(--kvs-border);
  background: transparent;
}

body.kvs-theme-modern .header-inner {
  max-width: 1320px;
}

body.kvs-theme-modern .logo img {
  max-height: 40px;
  width: auto;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
}

/* Search */
body.kvs-theme-modern .search form {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  border: 1px solid var(--kvs-border);
  background: var(--kvs-bg-elevated);
  overflow: hidden;
}

body.kvs-theme-modern .search .search-text input {
  background: transparent;
  color: var(--kvs-text);
  border-radius: 999px;
  padding: 14px 60px 14px 20px;
  font-size: 14px;
}

body.kvs-theme-modern .search-text input::placeholder {
  color: var(--kvs-text-muted);
}

body.kvs-theme-modern .search .search-button {
  border-radius: 0 999px 999px 0;
  background: linear-gradient(135deg, var(--kvs-accent) 0%, var(--kvs-accent-2) 100%);
}

body.kvs-theme-modern.no-touch .search .search-button:hover {
  filter: brightness(1.08);
}

/* Primary navigation */
body.kvs-theme-modern .navigation {
  max-width: 1320px;
  padding-bottom: 4px;
}

body.kvs-theme-modern .navigation .primary a {
  color: var(--kvs-text-muted);
  border-radius: var(--kvs-radius-sm);
  transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

body.kvs-theme-modern .navigation .primary .selected a,
body.kvs-theme-modern .navigation .primary a:hover {
  color: var(--kvs-text);
}

body.kvs-theme-modern .navigation .primary .selected a {
  background: rgba(124, 108, 245, 0.18);
  box-shadow: inset 0 0 0 1px rgba(124, 108, 245, 0.35);
}

body.kvs-theme-modern .navigation .button .ico-bar {
  background: var(--kvs-text);
}

body.kvs-theme-modern .navigation .secondary a {
  color: var(--kvs-accent-2);
}

/* Mobile / tablet slide menu above page content */
@media screen and (max-width: 1152px) {
  body.kvs-theme-modern .navigation .primary {
    background: var(--kvs-bg-glass);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid var(--kvs-border-strong);
    border-radius: var(--kvs-radius);
    box-shadow: var(--kvs-shadow);
    z-index: calc(var(--kvs-sticky-z) + 50);
  }

  body.kvs-theme-modern .secondary {
    z-index: calc(var(--kvs-sticky-z) + 60);
  }
}

/* Main content */
body.kvs-theme-modern .content {
  max-width: 1580px;
  padding: 12px 10px 32px;
  position: relative;
  z-index: 0;
}

body.kvs-theme-modern .main-content {
  padding-bottom: 1.5rem;
}

body.kvs-theme-modern .headline {
  color: var(--kvs-text);
}

body.kvs-theme-modern .headline h1,
body.kvs-theme-modern .headline h2 {
  color: var(--kvs-text);
  font-weight: 600;
  letter-spacing: -0.02em;
}

body.kvs-theme-modern .headline .sort strong,
body.kvs-theme-modern .headline .sort a {
  color: var(--kvs-text-muted);
}

body.kvs-theme-modern .headline .more {
  background: var(--kvs-bg-elevated);
  border: 1px solid var(--kvs-border);
  border-radius: 999px;
  color: var(--kvs-text);
}

body.kvs-theme-modern.no-touch .headline .more:hover {
  border-color: var(--kvs-accent);
  color: var(--kvs-text);
}

/* Video & album cards */
body.kvs-theme-modern .list-videos .item,
body.kvs-theme-modern .list-albums .item,
body.kvs-theme-modern .list-models .item,
body.kvs-theme-modern .list-sponsors .item,
body.kvs-theme-modern .list-channels .item,
body.kvs-theme-modern .list-categories .item,
body.kvs-theme-modern .list-playlists .item {
  background: var(--kvs-bg-card);
  border: 1px solid var(--kvs-border);
  border-radius: var(--kvs-radius);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

body.kvs-theme-modern.no-touch .list-videos .item:hover,
body.kvs-theme-modern.no-touch .list-albums .item:hover {
  transform: translateY(-3px);
  border-color: rgba(124, 108, 245, 0.45);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}

body.kvs-theme-modern .list-videos .item .title {
  color: var(--kvs-text);
}

body.kvs-theme-modern .list-videos .wrap,
body.kvs-theme-modern .list-videos .added,
body.kvs-theme-modern .list-videos .views {
  color: var(--kvs-text-muted);
}

body.kvs-theme-modern .list-videos .duration {
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  border-radius: 6px;
  padding: 2px 8px;
}

/* --- List video cards: image-first (TikTok / Netflix style), non-shorts grids only --- */
body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .kvs-video-card-shell {
  position: relative;
  width: 100%;
}

body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .kvs-video-card-shell > a.kvs-video-card-link {
  display: block;
  width: 100%;
  text-decoration: none;
  color: inherit;
}

body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item .img.kvs-video-card {
  position: relative;
  width: 100%;
  padding-bottom: 0;
  aspect-ratio: 16 / 9;
  border-radius: 18px;
  overflow: hidden;
  background: #08080c;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item .kvs-card-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item .kvs-card-thumb {
  transition: opacity 0.35s ease;
  z-index: 3;
}

body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item .kvs-video-card.is-previewing .kvs-card-thumb {
  opacity: 0;
}

body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item .kvs-video-card.is-previewing .kvs-card-preview {
  opacity: 1;
  z-index: 4;
}

body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .kvs-card-preview-btn {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 18;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(28, 28, 32, 0.58);
  color: #fff;
  cursor: pointer;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  line-height: 0;
  box-sizing: border-box;
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  backdrop-filter: blur(10px) saturate(1.2);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.42);
}

body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .kvs-card-preview-btn__ico {
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .kvs-card-preview-btn__ico--stop {
  display: none;
}

body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .kvs-card-preview-btn.is-active .kvs-card-preview-btn__ico--tap {
  display: none;
}

body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .kvs-card-preview-btn.is-active .kvs-card-preview-btn__ico--stop {
  display: flex;
}

body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .kvs-card-preview-btn__ico svg {
  display: block;
}

body.kvs-theme-modern.no-touch .list-videos:not(.kvs-shorts-feed) .kvs-card-preview-btn:hover {
  background: rgba(18, 18, 22, 0.72);
  border-color: rgba(255, 255, 255, 0.32);
}

body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .kvs-card-preview-btn:active {
  transform: scale(0.94);
}

/* Desktop / fine pointer: hover drives preview; hide tap control (matches reference on phones). */
@media (hover: hover) and (pointer: fine) {
  body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .kvs-card-preview-btn {
    display: none !important;
  }
}

body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item .kvs-card-gradient {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background: linear-gradient(
    to top,
    rgba(8, 8, 12, 0.95) 0%,
    rgba(8, 8, 12, 0.45) 38%,
    rgba(8, 8, 12, 0.08) 62%,
    transparent 100%
  );
}

body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item .kvs-card-overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px 12px 12px;
  pointer-events: none;
}

body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item .kvs-card-badges-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  align-self: flex-end;
}

body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item .kvs-card-chip {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item .kvs-card-chip--rating.is-positive {
  color: #9ae6b4;
}

body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item .kvs-card-chip--rating.is-negative {
  color: #feb2b2;
}

body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item .kvs-card-bottom {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-top: auto;
  min-width: 0;
  width: 100%;
  padding-bottom: 10px;
}

body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item .kvs-card-duration {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 7;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  pointer-events: none;
}

body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item .kvs-card-title {
  display: none !important;
}

body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item .kvs-card-meta {
  font-size: 12px;
  color: rgba(180, 198, 230, 0.88);
  font-weight: 500;
}

body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item .kvs-video-card [data-fav-video-id] {
  pointer-events: auto;
  z-index: 10;
}

body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item .kvs-video-card .is-hd {
  z-index: 10;
}

body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item .kvs-video-card .line-private,
body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item .kvs-video-card .line-premium,
body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item .kvs-video-card .line-disabled,
body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item .kvs-video-card .line-error,
body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item .kvs-video-card .line-processing {
  z-index: 10;
}

body.kvs-theme-modern.page-index .list-videos:not(.kvs-shorts-feed) .item .img.kvs-video-card {
  border-radius: 18px;
}

body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item .kvs-video-card + .title,
body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item .kvs-video-card-shell > a > .title:not(.kvs-card-title),
body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item .kvs-video-card-shell > a > .wrap {
  display: none !important;
}

/* --- Mobile / tablet: single-column cinematic list (≤768px) --- */
@media screen and (max-width: 768px) {
  body.kvs-theme-modern.page-index .list-videos:not(.kvs-shorts-feed) .margin-fix,
  body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .margin-fix {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 18px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding-left: max(0px, env(safe-area-inset-left, 0px));
    padding-right: max(0px, env(safe-area-inset-right, 0px));
  }

  body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item,
  body.kvs-theme-modern.page-index .list-videos:not(.kvs-shorts-feed) .item,
  body.kvs-theme-modern.page-index .sidebar + .main-container .list-videos:not(.kvs-shorts-feed) .item {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    flex: none !important;
  }

  body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item .kvs-video-card-shell > a.kvs-video-card-link {
    max-width: 100%;
    overflow: hidden;
    border-radius: 20px;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
  }

  body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item .img.kvs-video-card {
    aspect-ratio: 16 / 10;
    border-radius: 20px;
    box-shadow: 0 18px 52px rgba(0, 0, 0, 0.58), 0 0 0 1px rgba(255, 255, 255, 0.04);
  }

  body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item .kvs-card-preview,
  body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item .kvs-card-thumb {
    object-fit: cover;
  }

  body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item .kvs-card-gradient {
    background: linear-gradient(to top, rgba(8, 8, 12, 0.42) 0%, rgba(8, 8, 12, 0.08) 48%, transparent 78%);
  }

  body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item .kvs-card-badges-top .kvs-card-chip {
    opacity: 1;
    transform: none;
  }

  body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item .kvs-card-bottom {
    transform: none;
    opacity: 1;
    pointer-events: none;
  }

  body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item .kvs-video-card.is-previewing .kvs-card-gradient {
    background: linear-gradient(
      to top,
      rgba(8, 8, 12, 0.96) 0%,
      rgba(8, 8, 12, 0.5) 40%,
      rgba(8, 8, 12, 0.1) 68%,
      transparent 100%
    );
  }

  body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .box {
    margin-bottom: 1.25rem;
  }
}

body.kvs-theme-modern .item .img {
  background: #0a0a12;
}

body.kvs-theme-modern .list-videos .rating {
  color: var(--kvs-accent-2);
}

/* Tag cloud → glossy pills */
body.kvs-theme-modern .list-tags .item a {
  background: linear-gradient(145deg, rgba(40, 40, 58, 0.95), rgba(20, 20, 32, 0.98));
  border: 1px solid var(--kvs-border-strong);
  border-radius: 999px;
  padding: 8px 14px;
  color: var(--kvs-text);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

body.kvs-theme-modern.no-touch .list-tags .item a:hover {
  border-color: rgba(124, 108, 245, 0.55);
  box-shadow: 0 6px 20px rgba(124, 108, 245, 0.2);
}

body.kvs-theme-modern .list-tags .item .title {
  color: var(--kvs-text-muted);
}

/* Sidebar */
body.kvs-theme-modern .sidebar {
  background: var(--kvs-bg-card);
  border: 1px solid var(--kvs-border);
  box-shadow: var(--kvs-shadow);
  color: var(--kvs-text);
}

@media screen and (min-width: 769px) {
  body.kvs-theme-modern .main-content > .sidebar {
    margin-right: 8px;
  }

  body.kvs-theme-modern .sidebar + .main-container {
    width: calc(100% - 258px);
  }
}

body.kvs-theme-modern .sidebar h2,
body.kvs-theme-modern .sidebar h1 {
  color: var(--kvs-text);
}

body.kvs-theme-modern .sidebar .list a {
  color: var(--kvs-text-muted);
}

body.kvs-theme-modern .sidebar .comments li {
  border-color: var(--kvs-border);
}

/* Generic boxes */
body.kvs-theme-modern .box {
  background: transparent;
}

body.kvs-theme-modern .empty-content {
  color: var(--kvs-text-muted);
}

/* Forms & buttons */
body.kvs-theme-modern input[type="text"],
body.kvs-theme-modern input[type="search"],
body.kvs-theme-modern input[type="password"],
body.kvs-theme-modern input[type="email"],
body.kvs-theme-modern textarea,
body.kvs-theme-modern select {
  background: var(--kvs-bg-elevated);
  border: 1px solid var(--kvs-border);
  color: var(--kvs-text);
  border-radius: var(--kvs-radius-sm);
}

body.kvs-theme-modern form .submit,
body.kvs-theme-modern .margin-fix .bottom .submit,
body.kvs-theme-modern .toggle-button {
  border-radius: var(--kvs-radius-sm);
  background: linear-gradient(135deg, #3a3a52 0%, #252532 100%);
  color: var(--kvs-text);
  border: 1px solid var(--kvs-border-strong);
  transition: filter 0.2s ease, border-color 0.2s ease;
}

body.kvs-theme-modern.no-touch form .submit:hover,
body.kvs-theme-modern.no-touch .margin-fix .bottom .submit:hover {
  filter: brightness(1.12);
  border-color: var(--kvs-accent);
  color: var(--kvs-text);
}

body.kvs-theme-modern .load-more a {
  background: var(--kvs-bg-elevated);
  color: var(--kvs-text);
  border: 1px solid var(--kvs-border);
}

body.kvs-theme-modern.no-touch .load-more a:hover {
  background: linear-gradient(135deg, var(--kvs-accent), var(--kvs-accent-2));
  color: #fff;
  border-color: transparent;
}

/* Video view page */
body.kvs-theme-modern .block-video {
  background: transparent;
}

body.kvs-theme-modern .block-video .headline h1 {
  color: var(--kvs-text);
}

body.kvs-theme-modern .video-info,
body.kvs-theme-modern .block-details,
body.kvs-theme-modern .info-holder {
  color: var(--kvs-text);
}

body.kvs-theme-modern .block-details .info {
  color: var(--kvs-text-muted);
}

body.kvs-theme-modern .tabs-menu ul {
  border-color: var(--kvs-border);
}

body.kvs-theme-modern .tabs-menu a {
  color: var(--kvs-text-muted);
  border-radius: var(--kvs-radius-sm);
}

body.kvs-theme-modern .tabs-menu a:hover,
body.kvs-theme-modern .tabs-menu .selected a {
  color: var(--kvs-text);
  background: rgba(124, 108, 245, 0.15);
}

body.kvs-theme-modern .related-videos {
  border-top: 1px solid var(--kvs-border);
  padding-top: 8px;
}

body.kvs-theme-modern .related-videos .list-sort span,
body.kvs-theme-modern .related-videos .list-sort a {
  color: var(--kvs-text-muted);
}

body.kvs-theme-modern .rating-container .voters {
  color: var(--kvs-text-muted);
}

body.kvs-theme-modern .rate-dislike:before,
body.kvs-theme-modern .rate-like:before {
  color: var(--kvs-text-muted);
}

body.kvs-theme-modern.no-touch .rate-like:hover::before {
  color: var(--kvs-accent-2);
}

body.kvs-theme-modern.no-touch .rate-dislike:hover::before {
  color: #ff6b6b;
}

body.kvs-theme-modern .rate-like.voted::before {
  color: var(--kvs-accent-2);
}

/* Comments */
body.kvs-theme-modern .comments,
body.kvs-theme-modern .list-comments {
  color: var(--kvs-text);
}

body.kvs-theme-modern .comment-text {
  color: var(--kvs-text-muted);
}

/* Ad spots: readable label + spacing (hooks unchanged) */
body.kvs-theme-modern .place {
  margin: 12px 0;
  padding: 12px 0;
  text-align: center;
}

body.kvs-theme-modern .place:not(:empty)::before {
  content: "Advertisement";
  display: block;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--kvs-text-muted);
  margin-bottom: 8px;
  opacity: 0.85;
}

/* Footer */
body.kvs-theme-modern .footer {
  background: #020203;
  border-top: 1px solid var(--kvs-border);
  color: var(--kvs-text-muted);
}

body.kvs-theme-modern .footer a {
  color: var(--kvs-text-muted);
}

body.kvs-theme-modern.no-touch .footer a:hover {
  color: var(--kvs-accent-2);
}

body.kvs-theme-modern .footer .copyright,
body.kvs-theme-modern .footer .txt {
  color: var(--kvs-text-muted);
}

body.kvs-theme-modern .footer-margin {
  background: transparent;
}

body.kvs-theme-modern .footer .kvs-footer-rta {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--kvs-border);
  text-align: center;
}

body.kvs-theme-modern .footer .kvs-footer-rta a {
  display: inline-block;
  opacity: 0.92;
  transition: opacity 0.2s ease;
}

body.kvs-theme-modern.no-touch .footer .kvs-footer-rta a:hover {
  opacity: 1;
}

body.kvs-theme-modern .footer .kvs-footer-rta img {
  display: block;
  height: 32px;
  width: auto;
  margin: 0 auto;
}

body.kvs-theme-modern.shorts-standalone .kvs-shorts-legal {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(62px + env(safe-area-inset-bottom, 0px));
  z-index: 9100;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 16px;
  padding: 6px 12px;
  font-size: 11px;
  background: rgba(8, 8, 12, 0.88);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  pointer-events: auto;
}

body.kvs-theme-modern.shorts-standalone .kvs-shorts-legal a {
  color: var(--kvs-text-muted);
  text-decoration: none;
}

body.kvs-theme-modern.shorts-standalone .kvs-shorts-legal a:hover {
  color: var(--kvs-text);
}

body.kvs-theme-modern.shorts-standalone .kvs-shorts-legal__rta img {
  display: block;
  height: 26px;
  width: auto;
}

/* Pagination */
body.kvs-theme-modern .pagination a,
body.kvs-theme-modern .pagination span {
  background: var(--kvs-bg-elevated);
  border: 1px solid var(--kvs-border);
  color: var(--kvs-text-muted);
  border-radius: 8px;
}

body.kvs-theme-modern .pagination .page-current {
  background: rgba(124, 108, 245, 0.25);
  color: var(--kvs-text);
  border-color: rgba(124, 108, 245, 0.5);
}

/* Autocomplete (search) */
body.kvs-theme-modern .autocomplete-suggestions {
  background: var(--kvs-bg-card);
  border-color: var(--kvs-border-strong);
  color: var(--kvs-text);
}

body.kvs-theme-modern .autocomplete-suggestion {
  color: var(--kvs-text);
}

body.kvs-theme-modern .autocomplete-selected {
  background: rgba(124, 108, 245, 0.2);
}

/* Fancybox / modals — keep readable on dark */
body.kvs-theme-modern .fancybox-skin {
  background: var(--kvs-bg-card) !important;
  color: var(--kvs-text) !important;
  border-radius: var(--kvs-radius) !important;
  border: 1px solid var(--kvs-border) !important;
}

body.kvs-theme-modern .fancybox-title {
  color: var(--kvs-text-muted) !important;
}

/* Generic text blocks */
body.kvs-theme-modern .text {
  color: var(--kvs-text-muted);
}

body.kvs-theme-modern .generic-error {
  color: #ff8a8a;
}

/* --- Video list grids (non-shorts): same column breakpoints; tighter gap + wider shell = larger thumbs --- */
@media screen and (min-width: 769px) {
  body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .margin-fix {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 0;
    box-sizing: border-box;
  }

  body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item {
    width: calc((100% - 12px) / 2);
    margin: 0;
    box-sizing: border-box;
  }

  @media screen and (min-width: 1280px) {
    body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item {
      width: calc((100% - 24px) / 3);
    }
  }

  @media screen and (min-width: 1680px) {
    body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item {
      width: calc((100% - 36px) / 4);
    }
  }
}

/* Related videos: 4-column grid so each row is 3 thumbs + 1 ad tile (same width as a thumb). */
@media screen and (min-width: 900px) {
  body.kvs-theme-modern .related-videos .list-videos:not(.kvs-shorts-feed) .margin-fix {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 0;
    box-sizing: border-box;
  }

  body.kvs-theme-modern .related-videos .list-videos:not(.kvs-shorts-feed) .margin-fix > .item {
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    min-width: 0;
  }
}

/* Related in-feed ad tiles: match video thumb cards (dark shell, no white tray around iframe). */
/* Outstreams / rich media expand outside the 16:9 slot — must NOT inherit .item overflow:hidden or nested clips. */
body.kvs-theme-modern .related-videos .list-videos:not(.kvs-shorts-feed) .item.kvs-related-list-ad {
  overflow: visible;
  border-radius: 18px;
  background: #08080c;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  isolation: auto;
  pointer-events: auto;
}

body.kvs-theme-modern.no-touch .related-videos .list-videos:not(.kvs-shorts-feed) .item.kvs-related-list-ad:hover {
  transform: none;
  border-color: var(--kvs-border);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

body.kvs-theme-modern .related-videos .list-videos:not(.kvs-shorts-feed) .item.kvs-related-list-ad .kvs-related-list-ad__inner {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
  overflow: visible;
  border-radius: 18px;
  background: #08080c;
  border: none;
  aspect-ratio: 16 / 9;
}

body.kvs-theme-modern .related-videos .list-videos:not(.kvs-shorts-feed) .item.kvs-related-list-ad .kvs-related-ad-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 6;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.18);
  pointer-events: none;
}

body.kvs-theme-modern .related-videos .list-videos:not(.kvs-shorts-feed) .item.kvs-related-list-ad .kvs-related-list-ad__body.place {
  margin: 0 !important;
  padding: 0 !important;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
  width: 100%;
  min-height: 0;
  min-width: 0;
  position: relative;
  z-index: 4;
  overflow: visible;
  border-radius: 18px;
  background: #08080c !important;
  text-align: center;
  pointer-events: auto;
}

body.kvs-theme-modern .related-videos .list-videos:not(.kvs-shorts-feed) .item.kvs-related-list-ad .kvs-related-list-ad__body.place:not(:empty)::before {
  content: none !important;
  display: none !important;
}

body.kvs-theme-modern .related-videos .list-videos:not(.kvs-shorts-feed) .item.kvs-related-list-ad .kvs-related-list-ad__body.place > * {
  flex: 1 1 auto;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  box-sizing: border-box;
  pointer-events: auto;
}

body.kvs-theme-modern .related-videos .list-videos:not(.kvs-shorts-feed) .item.kvs-related-list-ad iframe,
body.kvs-theme-modern .related-videos .list-videos:not(.kvs-shorts-feed) .item.kvs-related-list-ad .kvs-related-list-ad__body.place iframe {
  display: block;
  width: 100% !important;
  height: 100% !important;
  min-height: 140px;
  border: 0 !important;
  background: #000;
  border-radius: 14px;
  pointer-events: auto;
}

body.kvs-theme-modern .related-videos .list-videos:not(.kvs-shorts-feed) .item.kvs-related-list-ad img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  border-radius: 14px;
  background: #08080c;
}

@media screen and (max-width: 899px) {
  body.kvs-theme-modern .related-videos .list-videos:not(.kvs-shorts-feed) .item.kvs-related-list-ad .kvs-related-list-ad__inner {
    border-radius: 20px;
  }
}

/* Let outstream / rich ads escape clip from .content tab rules (overflow-x) on video pages. */
body.kvs-theme-modern.page-view_video .related-videos {
  position: relative;
  z-index: 2;
  overflow-x: visible !important;
  overflow-y: visible !important;
}

body.kvs-theme-modern.page-view_video .related-videos .list-videos,
body.kvs-theme-modern.page-view_video .related-videos .list-videos .margin-fix {
  overflow: visible !important;
}

body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item.kvs-related-list-ad {
  overflow: visible !important;
}

body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item.kvs-related-list-ad .kvs-related-list-ad__inner,
body.kvs-theme-modern .list-videos:not(.kvs-shorts-feed) .item.kvs-related-list-ad .kvs-related-list-ad__body.place {
  overflow: visible !important;
}

/* Slightly taller thumb feel on homepage (still 16:9); full card uses .kvs-video-card radius */
body.kvs-theme-modern.page-index .list-videos .img:not(.kvs-video-card) {
  border-radius: var(--kvs-radius-sm) var(--kvs-radius-sm) 0 0;
}

/* --- Video page (view_video): actions, player chrome, related --- */
body.kvs-theme-modern.page-view_video .block-video .video-holder {
  position: relative;
}

body.kvs-theme-modern.page-view_video .kvs-player-slot {
  position: relative;
}

body.kvs-theme-modern.page-view_video .kvs-player-slot--empty {
  min-height: 72px;
  border-radius: var(--kvs-radius);
  border: 1px dashed var(--kvs-border-strong);
  background: rgba(0, 0, 0, 0.25);
}

body.kvs-theme-modern.page-view_video .kvs-player-chrome {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

body.kvs-theme-modern.page-view_video .kvs-player-chrome:empty {
  display: none;
}

/* KT player VAST skip — stay visible above mini-player chrome */
body.kvs-theme-modern.page-view_video .kt-player .fp-ui-skip-ad {
  z-index: 12000 !important;
  pointer-events: auto !important;
  visibility: visible !important;
  opacity: 1 !important;
  min-height: 40px;
  min-width: 88px;
  font-size: 13px;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.78) !important;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
}

body.kvs-theme-modern.page-view_video.kvs-miniplayer-active .kt-player .fp-ui-skip-ad {
  z-index: 12050 !important;
}

body.kvs-theme-modern.page-view_video .kt-player .fp-ui-skip-ad.time {
  cursor: pointer !important;
}

body.kvs-theme-modern.page-view_video .kt-player .fp-ui-skip-ad.time:after {
  display: block !important;
}

body.kvs-theme-modern.page-view_video .kvs-btn-miniplayer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--kvs-border-strong);
  background: linear-gradient(145deg, rgba(60, 60, 88, 0.9), rgba(30, 30, 44, 0.95));
  color: var(--kvs-text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

body.kvs-theme-modern.page-view_video .kvs-btn-miniplayer__ico {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 2px solid var(--kvs-accent-2);
  box-shadow: inset 0 0 0 2px var(--kvs-bg-deep);
  background: linear-gradient(135deg, var(--kvs-accent), var(--kvs-accent-2));
}

body.kvs-theme-modern.no-touch.page-view_video .kvs-btn-miniplayer:hover {
  border-color: var(--kvs-accent);
  box-shadow: 0 6px 20px rgba(124, 108, 245, 0.25);
}

body.kvs-theme-modern.page-view_video .info-holder {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

body.kvs-theme-modern.page-view_video .info-buttons {
  flex-wrap: wrap;
  gap: 10px;
}

/* Video view: mobile-safe actions, tabs (~390px), comments — no horizontal page scroll */
@media screen and (max-width: 768px) {
  body.kvs-theme-modern.page-view_video .main-container,
  body.kvs-theme-modern.page-view_video .content,
  body.kvs-theme-modern.page-view_video .block-video,
  body.kvs-theme-modern.page-view_video .video-holder,
  body.kvs-theme-modern.page-view_video .video-info,
  body.kvs-theme-modern.page-view_video .info-holder,
  body.kvs-theme-modern.page-view_video .info-buttons {
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
    min-width: 0;
  }

  body.kvs-theme-modern.page-view_video .block-video .sponsor,
  body.kvs-theme-modern.page-view_video .block-video .sponsor a {
    display: block;
    max-width: 100%;
    box-sizing: border-box;
  }

  body.kvs-theme-modern.page-view_video .block-video .sponsor img {
    max-width: 100%;
    height: auto;
    display: block;
  }

  body.kvs-theme-modern.page-view_video .info-buttons {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding-left: max(8px, env(safe-area-inset-left, 0px));
    padding-right: max(8px, env(safe-area-inset-right, 0px));
  }

  body.kvs-theme-modern.page-view_video .rating-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    min-width: 0;
  }

  body.kvs-theme-modern.page-view_video .rating-container .rating {
    flex: 1 1 140px;
    min-width: 0;
  }

  body.kvs-theme-modern.page-view_video .btn-favourites {
    align-self: flex-start;
  }

  body.kvs-theme-modern.page-view_video .tabs-menu {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 0;
    overflow-x: hidden;
  }

  body.kvs-theme-modern.page-view_video .tabs-menu ul {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 4px 0 8px;
    margin: 0;
    list-style: none;
    border-bottom: 1px solid var(--kvs-border);
  }

  body.kvs-theme-modern.page-view_video .tabs-menu li {
    flex: 0 1 calc(50% - 4px);
    max-width: calc(50% - 4px);
    margin: 0;
    min-width: 0;
    box-sizing: border-box;
  }

  body.kvs-theme-modern.page-view_video .tabs-menu a {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-radius: 12px;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.05);
  }

  body.kvs-theme-modern.page-view_video .tabs-menu .selected a {
    border-color: rgba(124, 108, 245, 0.45);
    background: rgba(124, 108, 245, 0.18);
  }

  body.kvs-theme-modern.page-view_video .tabs-menu li:only-child {
    flex: 1 1 100%;
    max-width: 100%;
  }

  body.kvs-theme-modern.page-view_video .kvs-btn-miniplayer {
    padding: 7px 12px;
    font-size: 11px;
    gap: 6px;
    border-radius: 999px;
  }

  body.kvs-theme-modern.page-view_video .kvs-btn-miniplayer__txt {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.kvs-theme-modern.page-view_video .tab-content {
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
    padding-bottom: 1.5rem;
  }

  body.kvs-theme-modern.page-view_video .block-details,
  body.kvs-theme-modern.page-view_video .block-share,
  body.kvs-theme-modern.page-view_video .block-flagging,
  body.kvs-theme-modern.page-view_video .block-screenshots,
  body.kvs-theme-modern.page-view_video .list-comments {
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
  }

  body.kvs-theme-modern.page-view_video .block-comments {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
  }

  body.kvs-theme-modern.page-view_video .block-comments .toggle-button {
    float: none;
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0 0 12px;
    padding: 12px 14px;
    font-size: 13px;
    box-sizing: border-box;
    white-space: normal;
    text-align: center;
  }

  body.kvs-theme-modern.page-view_video .block-comments form .textfield,
  body.kvs-theme-modern.page-view_video .block-comments form .textarea {
    max-width: 100%;
    box-sizing: border-box;
  }

  body.kvs-theme-modern.page-view_video .block-comments .bottom {
    max-width: 100%;
    overflow-x: hidden;
  }
}

body.kvs-theme-modern.page-view_video .block-details .info .item a {
  display: inline-block;
  margin: 4px 6px 0 0;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--kvs-border);
  font-size: 12px;
  color: var(--kvs-text-muted);
}

body.kvs-theme-modern.no-touch.page-view_video .block-details .info .item a:hover {
  color: var(--kvs-text);
  border-color: var(--kvs-accent);
}

body.kvs-theme-modern.page-view_video .related-videos {
  margin-top: 1.5rem;
}

body.kvs-theme-modern.page-view_video .related-videos .list-sort {
  margin-bottom: 12px;
}

/* --- KVS PJAX (AJAX navigation): transitions + progress (GPU-friendly) --- */
#kvs-pjax-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 12000;
  pointer-events: none;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--kvs-accent, #7c6cf5), var(--kvs-accent-2, #4f8cff));
  opacity: 0;
  transition: transform 0.35s ease-out, opacity 0.2s ease;
  will-change: transform;
}

#kvs-pjax-progress.kvs-pjax-progress--active {
  opacity: 1;
}

html.kvs-pjax-navigating {
  background: var(--kvs-bg-deep, #050508);
}

html.kvs-pjax-navigating body {
  background: var(--kvs-bg-deep, #050508);
}

body.kvs-theme-modern .content.kvs-pjax-leave {
  opacity: 0.88;
  transition: opacity 0.18s ease-out;
  will-change: opacity;
}

body.kvs-theme-modern .content.kvs-pjax-enter {
  opacity: 0;
  transition: opacity 0.22s ease-out;
  will-change: opacity;
}

body.kvs-theme-modern .content.kvs-pjax-enter.kvs-pjax-enter-ready {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  #kvs-pjax-progress,
  body.kvs-theme-modern .content.kvs-pjax-leave,
  body.kvs-theme-modern .content.kvs-pjax-enter {
    transition: none !important;
  }
}

/* Floating mini-player (footer injects dock; works with or without theme body) */
.kvs-miniplayer-dock {
  position: fixed;
  z-index: 8500;
  max-width: 100vw;
  box-sizing: border-box;
  transition: transform 0.28s ease, opacity 0.28s ease;
  transform: translateY(12px);
  opacity: 0;
  pointer-events: none;
}

.kvs-miniplayer-dock--visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.kvs-miniplayer-dock[hidden] {
  display: none !important;
}

.kvs-miniplayer-dock:not([hidden]).kvs-miniplayer-dock--visible {
  display: block !important;
}

@media screen and (min-width: 769px) {
  .kvs-miniplayer-dock.kvs-miniplayer-dock--visible {
    left: 16px;
    right: auto;
    bottom: 16px;
    width: min(320px, 32vw);
    border-radius: var(--kvs-radius, 14px);
    overflow: hidden;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(12, 12, 18, 0.96);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
  }
}

@media screen and (max-width: 768px) {
  .kvs-miniplayer-dock {
    /* Instant show avoids opacity/transform fighting body padding + resize reflows on tap. */
    transition: none;
  }
  .kvs-miniplayer-dock.kvs-miniplayer-dock--visible {
    left: 0;
    right: 0;
    bottom: calc(62px + env(safe-area-inset-bottom, 0px));
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 0;
    background: rgba(10, 10, 16, 0.98);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  body.kvs-miniplayer-active {
    padding-bottom: min(34vh, 230px);
  }

  body.kvs-miniplayer-active:has(#kvsAppBottomNav.kvs-app-bottom-nav) {
    padding-bottom: calc(62px + env(safe-area-inset-bottom, 0px) + min(30vh, 200px));
  }
}

.kvs-miniplayer-dock__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.35);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.kvs-miniplayer-dock__title {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.kvs-miniplayer-dock__controls {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.kvs-miniplayer-dock__btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kvs-miniplayer-dock__btn--close {
  font-size: 22px;
}

.kvs-miniplayer-dock__btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.kvs-miniplayer-dock__body {
  width: 100%;
  position: relative;
  background: #000;
}

.kvs-miniplayer-dock__body .kvs-player-transport,
.kvs-miniplayer-dock__body .player-holder {
  width: 100%;
}

/* Ensure the mini-player has a real height (otherwise it can look like a black box). */
@media screen and (min-width: 769px) {
  .kvs-miniplayer-dock__body {
    height: 180px;
  }
}

.kvs-player-auto-mini-placeholder {
  width: 100%;
  box-sizing: border-box;
  flex-shrink: 0;
  pointer-events: none;
}

/* --- Mini player (CSS-pinned fallback): only when NOT using DOM-moved transport. */
body.kvs-miniplayer-active:not(.kvs-miniplayer-dom-moved) .kvs-player-transport {
  position: fixed !important;
  z-index: 8510;
  background: #000;
  overflow: hidden;
  border-radius: inherit;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  transform: none !important;
}

body.kvs-miniplayer-active:not(.kvs-miniplayer-dom-moved) .kvs-player-transport .player-holder,
body.kvs-miniplayer-active:not(.kvs-miniplayer-dom-moved) .kvs-player-transport .player-wrap {
  height: 100% !important;
}

body.kvs-miniplayer-active:not(.kvs-miniplayer-dom-moved) .kvs-player-transport .player-wrap {
  padding-bottom: 0 !important;
  position: relative !important;
  width: 100% !important;
  display: block !important;
}

body.kvs-miniplayer-active:not(.kvs-miniplayer-dom-moved) .kvs-player-transport #kt_player {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  display: block !important;
  overflow: hidden !important;
  transform: translateZ(0);
}

@media screen and (min-width: 769px) {
  body.kvs-miniplayer-active:not(.kvs-miniplayer-dom-moved) .kvs-player-transport #kt_player {
    will-change: transform;
  }
}

body.kvs-miniplayer-active:not(.kvs-miniplayer-dom-moved) .kvs-player-transport #kt_player > *,
body.kvs-miniplayer-active:not(.kvs-miniplayer-dom-moved) .kvs-player-transport #kt_player iframe,
body.kvs-miniplayer-active:not(.kvs-miniplayer-dom-moved) .kvs-player-transport #kt_player object,
body.kvs-miniplayer-active:not(.kvs-miniplayer-dom-moved) .kvs-player-transport #kt_player embed,
body.kvs-miniplayer-active:not(.kvs-miniplayer-dom-moved) .kvs-player-transport #kt_player video {
  width: 100% !important;
  height: 100% !important;
  display: block !important;
  max-width: none !important;
  max-height: none !important;
}

body.kvs-miniplayer-active:not(.kvs-miniplayer-dom-moved) .kvs-player-transport #kt_player > div {
  position: absolute !important;
  inset: 0 !important;
  overflow: hidden !important;
  transform: translateZ(0);
}

@media screen and (min-width: 769px) {
  body.kvs-miniplayer-active:not(.kvs-miniplayer-dom-moved) .kvs-player-transport {
    left: 16px !important;
    right: auto !important;
    bottom: 16px !important;
    top: auto !important;
    width: min(320px, 32vw) !important;
    height: 180px !important;
  }
}

@media screen and (max-width: 768px) {
  body.kvs-miniplayer-active:not(.kvs-miniplayer-dom-moved) .kvs-player-transport {
    left: 0 !important;
    right: 0 !important;
    bottom: calc(62px + env(safe-area-inset-bottom, 0px)) !important;
    top: auto !important;
    width: 100% !important;
    height: min(34vh, 230px) !important;
    border-radius: 16px 16px 0 0 !important;
    padding-bottom: env(safe-area-inset-bottom, 0) !important;
  }
}

/* --- DOM-moved mini: transport lives inside dock; 16:9 video surface. */
body.kvs-miniplayer-dom-moved .kvs-miniplayer-dock__body .kvs-player-transport {
  position: relative !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  bottom: auto !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
  z-index: 1;
  background: #000;
  overflow: hidden;
  border-radius: inherit;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  transform: none !important;
}

body.kvs-miniplayer-dom-moved .kvs-miniplayer-dock__body .kvs-player-transport .player-holder,
body.kvs-miniplayer-dom-moved .kvs-miniplayer-dock__body .kvs-player-transport .player-wrap {
  height: 100% !important;
}

body.kvs-miniplayer-dom-moved .kvs-miniplayer-dock__body .kvs-player-transport .player-wrap {
  padding-bottom: 0 !important;
  position: relative !important;
  width: 100% !important;
  display: block !important;
}

body.kvs-miniplayer-dom-moved .kvs-miniplayer-dock__body .kvs-player-transport #kt_player {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  display: block !important;
  overflow: hidden !important;
  transform: translateZ(0);
}

body.kvs-miniplayer-dom-moved .kvs-miniplayer-dock__body .kvs-player-transport #kt_player > *,
body.kvs-miniplayer-dom-moved .kvs-miniplayer-dock__body .kvs-player-transport #kt_player iframe,
body.kvs-miniplayer-dom-moved .kvs-miniplayer-dock__body .kvs-player-transport #kt_player object,
body.kvs-miniplayer-dom-moved .kvs-miniplayer-dock__body .kvs-player-transport #kt_player embed,
body.kvs-miniplayer-dom-moved .kvs-miniplayer-dock__body .kvs-player-transport #kt_player video {
  width: 100% !important;
  height: 100% !important;
  display: block !important;
  max-width: none !important;
  max-height: none !important;
}

body.kvs-miniplayer-dom-moved .kvs-miniplayer-dock__body .kvs-player-transport #kt_player > div {
  position: absolute !important;
  inset: 0 !important;
  overflow: hidden !important;
  transform: translateZ(0);
}

@media screen and (min-width: 769px) {
  body.kvs-miniplayer-dom-moved .kvs-miniplayer-dock.kvs-miniplayer-dock--visible {
    left: 16px !important;
    right: auto !important;
    bottom: 20px !important;
    top: auto !important;
    width: min(400px, 38vw) !important;
    max-width: 420px;
    border-radius: var(--kvs-radius, 14px);
    overflow: hidden;
    box-shadow: 0 20px 56px rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(12, 12, 18, 0.96);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
  }

  body.kvs-miniplayer-dom-moved .kvs-miniplayer-dock__body {
    height: auto !important;
    aspect-ratio: 16 / 9;
    max-height: min(56vh, 480px);
  }
}

@media screen and (max-width: 768px) {
  body.kvs-miniplayer-dom-moved .kvs-miniplayer-dock.kvs-miniplayer-dock--visible {
    left: 12px !important;
    right: 12px !important;
    width: calc(100vw - 24px) !important;
    bottom: 84px !important;
    top: auto !important;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(10, 10, 16, 0.98);
  }

  body.kvs-miniplayer-dom-moved .kvs-miniplayer-dock__body {
    height: auto !important;
    aspect-ratio: 16 / 9;
    max-height: 42vh;
  }

  body.kvs-miniplayer-dom-moved.kvs-miniplayer-active {
    padding-bottom: 0;
  }

  body.kvs-miniplayer-dom-moved.kvs-miniplayer-active:has(#kvsAppBottomNav.kvs-app-bottom-nav) {
    padding-bottom: calc(62px + env(safe-area-inset-bottom, 0px));
  }
}

@media screen and (max-width: 768px) {
  body:not(.kvs-miniplayer-dom-moved) .kvs-miniplayer-dock__body {
    height: min(34vh, 230px);
  }
}

/*
 * Mobile video page only: corner PiP (bottom-left) so a right-side slider / controls
 * stay visible. Mini player JS only runs on body.page-view_video — Shorts unchanged.
 */
@media screen and (max-width: 768px) {
  body.page-view_video .kvs-miniplayer-dock.kvs-miniplayer-dock--visible {
    left: max(10px, env(safe-area-inset-left, 0px));
    right: auto;
    width: min(268px, calc(100vw - 76px));
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    border-radius: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
    padding-bottom: 0;
    overflow: hidden;
  }

  body.page-view_video:has(#kvsAppBottomNav.kvs-app-bottom-nav) .kvs-miniplayer-dock.kvs-miniplayer-dock--visible {
    bottom: calc(62px + env(safe-area-inset-bottom, 0px) + 10px);
  }

  body.page-view_video.kvs-miniplayer-active {
    padding-bottom: 0;
  }

  body.page-view_video.kvs-miniplayer-active:has(#kvsAppBottomNav.kvs-app-bottom-nav) {
    padding-bottom: calc(62px + env(safe-area-inset-bottom, 0px));
  }

  body.page-view_video:not(.kvs-miniplayer-dom-moved) .kvs-miniplayer-dock__body {
    height: auto;
    aspect-ratio: 16 / 9;
    max-height: min(44vw, 200px);
  }

  body.page-view_video.kvs-miniplayer-active:not(.kvs-miniplayer-dom-moved) .kvs-player-transport {
    left: max(10px, env(safe-area-inset-left, 0px)) !important;
    right: auto !important;
    width: min(268px, calc(100vw - 76px)) !important;
    height: min(44vw, 200px) !important;
    bottom: calc(62px + env(safe-area-inset-bottom, 0px) + 10px) !important;
    border-radius: 14px !important;
    padding-bottom: 0 !important;
  }

  body.page-view_video:has(#kvsAppBottomNav.kvs-app-bottom-nav).kvs-miniplayer-active:not(.kvs-miniplayer-dom-moved) .kvs-player-transport {
    bottom: calc(62px + env(safe-area-inset-bottom, 0px) + 10px) !important;
  }

  body.page-view_video.kvs-miniplayer-dom-moved .kvs-miniplayer-dock.kvs-miniplayer-dock--visible {
    left: max(10px, env(safe-area-inset-left, 0px)) !important;
    right: auto !important;
    width: min(268px, calc(100vw - 76px)) !important;
    bottom: calc(62px + env(safe-area-inset-bottom, 0px) + 10px) !important;
    border-radius: 14px;
  }

  body.page-view_video.kvs-miniplayer-dom-moved .kvs-miniplayer-dock__body {
    max-height: min(44vw, 200px);
  }

  /* Optional: add data-kvs-above-mini on any fixed right control to force it above the PiP */
  body.page-view_video.kvs-miniplayer-active [data-kvs-above-mini] {
    z-index: 9000 !important;
    pointer-events: auto !important;
  }
}

/* --- Mobile bottom app navigation --- */
.kvs-app-bottom-nav {
  display: none;
}

@media screen and (max-width: 900px) {
  .kvs-app-bottom-nav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 7000;
    justify-content: space-around;
    align-items: center;
    gap: 2px;
    min-height: calc(58px + env(safe-area-inset-bottom, 0px));
    padding: 10px 4px calc(8px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
    overflow: visible;
    background: rgba(8, 8, 12, 0.94);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.35);
  }

  body:has(.kvs-app-bottom-nav) {
    padding-bottom: calc(62px + env(safe-area-inset-bottom, 0px));
  }

  /* Keep Shorts/Home nav visible when mini-player is on (mini sits above the bar). */
  body.kvs-miniplayer-active .kvs-app-bottom-nav {
    transform: none;
    opacity: 1;
    pointer-events: auto;
    z-index: 9200;
  }

  .kvs-app-nav__item {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 4px;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 10px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    line-height: 1.15;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.2s ease, background 0.2s ease;
  }

  .kvs-app-nav__item:active {
    background: rgba(255, 255, 255, 0.06);
  }

  .kvs-app-nav__item--active {
    color: #fff;
    background: rgba(124, 108, 245, 0.2);
    box-shadow: inset 0 0 0 1px rgba(124, 108, 245, 0.35);
  }

  .kvs-app-nav__ico {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
  }

  .kvs-app-nav__ico svg {
    display: block;
  }

  .kvs-app-nav__label {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 2px;
  }

  /* Featured Shorts CTA (mobile bottom nav only) */
  .kvs-app-nav__item--shorts-cta {
    position: relative;
    z-index: 2;
    flex: 0 0 auto;
    align-self: center;
    min-width: 76px;
    max-width: 30vw;
    padding: 7px 12px 8px;
    margin: 0 2px;
    transform: translateY(-5px);
    border-radius: 18px;
    color: #fff !important;
    background: linear-gradient(135deg, #6d5dfc 0%, #4a6fff 45%, #2f80ff 100%);
    box-shadow:
      0 0 22px rgba(90, 130, 255, 0.42),
      0 6px 18px rgba(0, 0, 0, 0.35);
    border: none;
    transition:
      transform 0.2s ease,
      box-shadow 0.2s ease,
      filter 0.2s ease;
  }

  .kvs-app-nav__item--shorts-cta::before {
    content: "HOT";
    position: absolute;
    top: -11px;
    right: 6px;
    z-index: 3;
    padding: 2px 6px;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.04em;
    line-height: 1.2;
    color: #fff;
    background: linear-gradient(180deg, #ff4a8f 0%, #ff2d75 100%);
    box-shadow: 0 2px 8px rgba(255, 45, 117, 0.45);
    pointer-events: none;
  }

  .kvs-app-nav__item--shorts-cta .kvs-app-nav__ico {
    width: 28px;
    height: 28px;
    animation: kvsShortsNavPulse 2.2s ease-in-out infinite;
  }

  .kvs-app-nav__item--shorts-cta .kvs-app-nav__ico svg {
    width: 23px;
    height: 23px;
  }

  .kvs-app-nav__item--shorts-cta .kvs-app-nav__label {
    font-weight: 700;
    color: rgba(255, 255, 255, 0.96);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  }

  .kvs-app-nav__item--shorts-cta:active {
    transform: translateY(-4px) scale(0.98);
    filter: brightness(1.05);
    box-shadow:
      0 0 28px rgba(100, 140, 255, 0.55),
      0 4px 14px rgba(0, 0, 0, 0.35);
  }

  .kvs-app-nav__item--shorts-cta.kvs-app-nav__item--active {
    color: #fff !important;
    background: linear-gradient(135deg, #7a6dff 0%, #5288ff 40%, #3d9fff 100%);
    box-shadow:
      0 0 28px rgba(120, 150, 255, 0.55),
      0 0 0 1px rgba(255, 255, 255, 0.35) inset,
      0 6px 20px rgba(0, 0, 0, 0.38);
  }

  .kvs-app-nav__item--shorts-cta.kvs-app-nav__item--active::before {
    box-shadow: 0 2px 10px rgba(255, 60, 130, 0.55);
  }

  @keyframes kvsShortsNavPulse {
    0%,
    100% {
      transform: scale(1);
    }
    50% {
      transform: scale(1.08);
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .kvs-app-nav__item--shorts-cta .kvs-app-nav__ico {
      animation: none;
    }
  }
}

/* Infinite scroll: loading hint on KVS "Load more" */
body.kvs-theme-modern .load-more a[data-kvs-infinite-busy="1"] {
  opacity: 0.5;
  pointer-events: none;
}

/* --- Shorts / Reels: external page id "shorts" + body.kvs-shorts-context from shorts.tpl --- */
body.page-shorts .kvs-shorts-shell,
body.kvs-shorts-context .kvs-shorts-shell {
  max-width: none;
  padding: 0;
  margin: 0;
}

body.page-shorts .kvs-shorts-main,
body.kvs-shorts-context .kvs-shorts-main {
  margin: 0;
  padding: 0;
  width: 100%;
}

body.page-shorts .kvs-shorts-box,
body.kvs-shorts-context .kvs-shorts-box {
  margin: 0;
  padding: 0;
  border: 0;
  background: #000;
  box-shadow: none;
}

body.page-shorts .kvs-shorts-box .list-videos,
body.kvs-shorts-context .kvs-shorts-box .list-videos {
  margin: 0;
  padding: 0;
}

html:has(body.page-shorts),
html:has(body.kvs-shorts-context) {
  scroll-snap-type: y mandatory;
}

body.page-shorts .kvs-shorts-feed .margin-fix,
body.kvs-shorts-context .kvs-shorts-feed .margin-fix {
  overflow: visible;
}

body.page-shorts .kvs-shorts-slide,
body.kvs-shorts-context .kvs-shorts-slide {
  position: relative;
  min-height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  background: #000;
  color: #fff;
}

body.page-shorts .kvs-shorts-slide__inner,
body.kvs-shorts-context .kvs-shorts-slide__inner {
  position: relative;
  min-height: inherit;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
}

body.page-shorts .kvs-shorts-slide__media,
body.kvs-shorts-context .kvs-shorts-slide__media {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #000;
}

body.page-shorts .kvs-shorts-slide__media video.shorts-video,
body.kvs-shorts-context .kvs-shorts-slide__media video.shorts-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #000;
}

body.page-shorts .kvs-shorts-tap,
body.kvs-shorts-context .kvs-shorts-tap {
  position: absolute;
  inset: 0 76px 0 0;
  z-index: 1;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

body.page-shorts .kvs-shorts-mute,
body.kvs-shorts-context .kvs-shorts-mute {
  position: absolute;
  right: 12px;
  bottom: 120px;
  z-index: 4;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
}

body.page-shorts .kvs-shorts-slide__bottom,
body.kvs-shorts-context .kvs-shorts-slide__bottom {
  position: relative;
  z-index: 2;
  padding: 12px 88px 12px 16px;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.75) 40%, rgba(0, 0, 0, 0.92) 100%);
}

body.page-shorts .kvs-shorts-title,
body.kvs-shorts-context .kvs-shorts-title {
  display: block;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  color: #fff;
  text-decoration: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

body.page-shorts .kvs-shorts-meta,
body.kvs-shorts-context .kvs-shorts-meta {
  margin-top: 6px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

body.page-shorts .kvs-shorts-slide__actions,
body.kvs-shorts-context .kvs-shorts-slide__actions {
  position: absolute;
  right: 10px;
  bottom: calc(100px + env(safe-area-inset-bottom, 0px));
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

body.page-shorts .kvs-shorts-slide__actions .kvs-shorts-act,
body.kvs-shorts-context .kvs-shorts-slide__actions .kvs-shorts-act,
body.page-shorts .kvs-shorts-slide__actions .rate-like,
body.kvs-shorts-context .kvs-shorts-slide__actions .rate-like,
body.page-shorts .kvs-shorts-slide__actions .kvs-shorts-open,
body.kvs-shorts-context .kvs-shorts-slide__actions .kvs-shorts-open {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  line-height: 1.1;
  -webkit-tap-highlight-color: transparent;
}

body.page-shorts .kvs-shorts-slide__actions button.kvs-shorts-share,
body.kvs-shorts-context .kvs-shorts-slide__actions button.kvs-shorts-share {
  font: inherit;
  cursor: pointer;
}

body.page-shorts .kvs-shorts-slide__actions .ico-fav-0,
body.kvs-shorts-context .kvs-shorts-slide__actions .ico-fav-0,
body.page-shorts .kvs-shorts-slide__actions .ico-fav-1,
body.kvs-shorts-context .kvs-shorts-slide__actions .ico-fav-1 {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.45);
  box-sizing: border-box;
}

body.page-shorts .kvs-shorts-thumb-fallback,
body.kvs-shorts-context .kvs-shorts-thumb-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #fff;
  background: #111;
}

body.page-shorts .kvs-shorts-thumb-fallback img,
body.kvs-shorts-context .kvs-shorts-thumb-fallback img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.85;
}

body.page-shorts .kvs-shorts-thumb-fallback__hint,
body.kvs-shorts-context .kvs-shorts-thumb-fallback__hint {
  position: absolute;
  bottom: 140px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(124, 108, 245, 0.9);
  font-size: 13px;
  font-weight: 600;
}

body.page-shorts .kvs-shorts-slide--ad .kvs-shorts-slide__inner--ad,
body.kvs-shorts-context .kvs-shorts-slide--ad .kvs-shorts-slide__inner--ad {
  min-height: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px calc(80px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
  background: linear-gradient(160deg, #12121a, #050508);
}

body.page-shorts .kvs-shorts-ad-label,
body.kvs-shorts-context .kvs-shorts-ad-label {
  display: inline-block;
  margin-bottom: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

body.page-shorts .kvs-shorts-ad-place,
body.kvs-shorts-context .kvs-shorts-ad-place {
  width: 100%;
  max-width: 420px;
  text-align: center;
}

body.page-shorts .kvs-shorts-load-more,
body.kvs-shorts-context .kvs-shorts-load-more {
  padding: 12px 16px calc(72px + env(safe-area-inset-bottom, 0px));
  text-align: center;
  background: #000;
}

body.page-shorts .kvs-shorts-load-more a,
body.kvs-shorts-context .kvs-shorts-load-more a {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

body.page-shorts .kvs-shorts-global-mute,
body.kvs-shorts-context .kvs-shorts-global-mute {
  position: fixed;
  right: 12px;
  bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  z-index: 7500;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(8, 8, 12, 0.92);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

/* TikTok-style: hide top chrome on phone; bottom app nav stays */
@media screen and (max-width: 900px) {
  body.page-shorts .top-links,
  body.kvs-shorts-context .top-links,
  body.page-shorts .kvs-sticky-top,
  body.kvs-shorts-context .kvs-sticky-top {
    display: none !important;
  }

  body.page-shorts .container,
  body.kvs-shorts-context .container {
    padding-left: 0;
    padding-right: 0;
  }
}

@media screen and (min-width: 901px) {
  body.page-shorts .kvs-shorts-feed .margin-fix,
  body.kvs-shorts-context .kvs-shorts-feed .margin-fix {
    max-width: 480px;
    margin: 0 auto;
  }

  body.page-shorts .kvs-shorts-slide,
  body.kvs-shorts-context .kvs-shorts-slide {
    min-height: calc(100vh - 80px);
  }
}

@media screen and (max-width: 900px) {
  body.page-shorts .kvs-shorts-global-mute,
  body.kvs-shorts-context .kvs-shorts-global-mute {
    bottom: calc(58px + 62px + env(safe-area-inset-bottom, 0px));
  }

  body.page-shorts .kvs-app-bottom-nav .kvs-app-nav__label,
  body.kvs-shorts-context .kvs-app-bottom-nav .kvs-app-nav__label {
    font-size: 9px;
  }

  body.page-shorts .kvs-app-bottom-nav .kvs-app-nav__ico,
  body.kvs-shorts-context .kvs-app-bottom-nav .kvs-app-nav__ico {
    width: 22px;
    height: 22px;
  }

  body.page-shorts .kvs-app-bottom-nav .kvs-app-nav__item--shorts-cta .kvs-app-nav__label,
  body.kvs-shorts-context .kvs-app-bottom-nav .kvs-app-nav__item--shorts-cta .kvs-app-nav__label {
    font-size: 10px;
  }

  body.page-shorts .kvs-app-bottom-nav .kvs-app-nav__item--shorts-cta .kvs-app-nav__ico,
  body.kvs-shorts-context .kvs-app-bottom-nav .kvs-app-nav__item--shorts-cta .kvs-app-nav__ico {
    width: 28px;
    height: 28px;
  }

  body.page-shorts .kvs-app-bottom-nav .kvs-app-nav__item--shorts-cta .kvs-app-nav__ico svg,
  body.kvs-shorts-context .kvs-app-bottom-nav .kvs-app-nav__item--shorts-cta .kvs-app-nav__ico svg {
    width: 23px;
    height: 23px;
  }
}

/* --- Standalone /shorts.php (body.shorts-standalone): full-viewport TikTok-style feed --- */
html:has(> body.shorts-standalone),
html:has(> body.shorts-standalone) body {
  margin: 0;
  background: #000;
  overflow: hidden;
  height: 100%;
}

body.shorts-standalone.kvs-theme-modern {
  background: #000 !important;
  background-image: none !important;
  overflow: hidden;
  min-height: 100vh;
  height: 100vh;
}

body.shorts-standalone .shorts-page {
  position: fixed;
  inset: 0;
  background: #000;
  overflow: hidden;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Block root under .shorts-page: fill viewport and pass height into the feed */
body.shorts-standalone .shorts-page > div {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.shorts-standalone .kvs-shorts-box {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

/* Legacy .shorts-feed path: no second scrollport (scroll lives on #*_items only) */
body.shorts-standalone .shorts-feed.list-videos {
  display: block !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  flex: 1 1 auto;
  min-height: 0;
  height: auto !important;
  overflow: visible !important;
}

/* Outer feed: flex passthrough only — do NOT stack 100vh + scroll-snap here and on .margin-fix */
body.shorts-standalone .kvs-shorts-feed {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  height: auto !important;
  overflow: visible !important;
}

/* Single vertical scroll + snap (fixes “two videos” from nested 100vh snap) */
body.shorts-standalone .kvs-shorts-feed .margin-fix[id$="_items"] {
  flex: 1 1 auto;
  min-height: 0;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  height: 100%;
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: y mandatory;
  overscroll-behavior-y: contain;
}

body.shorts-standalone .shorts-feed.list-videos > .item,
body.shorts-standalone .shorts-feed > .item,
body.shorts-standalone .kvs-shorts-feed .margin-fix[id$="_items"] > .item {
  display: block !important;
  float: none !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  background: #000 !important;
  vertical-align: top;
  cursor: default;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

body.shorts-standalone .shorts-feed .load-more,
body.shorts-standalone .shorts-feed .kvs-shorts-load-more,
body.shorts-standalone .shorts-page .load-more.kvs-shorts-load-more {
  scroll-snap-align: none;
  min-height: auto;
  padding: 16px 12px 96px;
  text-align: center;
  background: #000;
}

body.shorts-standalone .shorts-slide,
body.shorts-standalone .kvs-shorts-slide {
  position: relative;
  height: 100dvh;
  min-height: 100dvh;
  max-height: 100dvh;
  box-sizing: border-box;
  background: #000;
  overflow: hidden;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

body.shorts-standalone .shorts-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #000;
}

body.shorts-standalone .shorts-tap,
body.shorts-standalone .shorts-tap.kvs-shorts-tap {
  position: absolute;
  inset: 0;
  z-index: 3;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

body.shorts-standalone .shorts-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent 45%, rgba(0, 0, 0, 0.25));
  pointer-events: none;
  z-index: 2;
}

body.shorts-standalone .shorts-info {
  position: absolute;
  left: 14px;
  right: 90px;
  bottom: 88px;
  z-index: 5;
  color: #fff;
  text-align: left;
  pointer-events: none;
}

body.shorts-standalone .shorts-info a {
  pointer-events: auto;
}

body.shorts-standalone .shorts-title {
  display: block;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  color: #fff;
  text-decoration: none;
  margin-bottom: 6px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

body.shorts-standalone .shorts-meta {
  font-size: 12px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

body.shorts-standalone .shorts-meta span {
  margin-right: 8px;
}

body.shorts-standalone .shorts-actions {
  position: absolute;
  right: 12px;
  bottom: 150px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  pointer-events: auto;
}

body.shorts-standalone .shorts-actions a,
body.shorts-standalone .shorts-actions button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
}

body.shorts-standalone .shorts-actions .rate-like {
  font-size: 20px;
}

body.shorts-standalone .shorts-actions .ico-fav-0,
body.shorts-standalone .shorts-actions .ico-fav-1 {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.35);
  background-position: center;
  background-repeat: no-repeat;
}

body.shorts-standalone .shorts-mute,
body.shorts-standalone .shorts-mute.kvs-shorts-mute {
  position: absolute;
  right: 12px;
  top: max(18px, env(safe-area-inset-top, 0px));
  z-index: 7;
  margin: 0;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

body.shorts-standalone .shorts-thumb-link {
  position: absolute;
  inset: 0;
  display: block;
  z-index: 1;
}

body.shorts-standalone .shorts-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

body.shorts-standalone .shorts-slide--empty .shorts-empty-msg {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: #ccc;
  z-index: 4;
  margin: 0;
}

body.shorts-standalone .shorts-ad-inner,
body.shorts-standalone .kvs-shorts-slide--ad .kvs-shorts-slide__inner--ad {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px calc(88px + env(safe-area-inset-bottom, 0px));
  z-index: 4;
  box-sizing: border-box;
}

body.shorts-standalone .shorts-ad-label,
body.shorts-standalone .kvs-shorts-ad-label {
  position: absolute;
  top: max(56px, env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 8;
  margin: 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.55);
}

/* Shorts: closeable scroll ad + right-side prev/next */
body.shorts-standalone .kvs-shorts-ad-close,
body.page-shorts .kvs-shorts-ad-close,
body.kvs-shorts-context .kvs-shorts-ad-close {
  position: absolute;
  top: max(14px, env(safe-area-inset-top, 0px));
  right: 14px;
  z-index: 12;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

body.shorts-standalone .kvs-shorts-slide--ad.kvs-shorts-ad--snoozed,
body.page-shorts .kvs-shorts-slide--ad.kvs-shorts-ad--snoozed,
body.kvs-shorts-context .kvs-shorts-slide--ad.kvs-shorts-ad--snoozed {
  display: none !important;
  height: 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
  scroll-snap-align: none !important;
  pointer-events: none !important;
}

body.shorts-standalone .kvs-shorts-nav,
body.page-shorts .kvs-shorts-nav,
body.kvs-shorts-context .kvs-shorts-nav {
  position: fixed;
  right: max(10px, env(safe-area-inset-right, 0px));
  top: 50%;
  transform: translateY(-50%);
  z-index: 10040;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  pointer-events: none;
}

body.shorts-standalone .kvs-shorts-nav__btn,
body.page-shorts .kvs-shorts-nav__btn,
body.kvs-shorts-context .kvs-shorts-nav__btn {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

body.shorts-standalone .kvs-shorts-nav__btn:active,
body.page-shorts .kvs-shorts-nav__btn:active,
body.kvs-shorts-context .kvs-shorts-nav__btn:active {
  transform: scale(0.94);
  background: rgba(124, 108, 245, 0.55);
}

/* Off-screen parking only — do NOT use visibility:hidden (breaks ExoClick native render) */
body.shorts-standalone .kvs-shorts-ad-seed,
body.page-shorts .kvs-shorts-ad-seed {
  position: fixed !important;
  left: -120vw !important;
  top: 0 !important;
  width: min(100vw, 420px) !important;
  height: 100dvh !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: none !important;
  z-index: -1 !important;
  overflow: hidden !important;
}

body.shorts-standalone .kvs-shorts-slide--ad.kvs-shorts-ad--shown,
body.shorts-standalone .kvs-shorts-slide--ad:not(#kvsShortsAdSeed .kvs-shorts-slide--ad) {
  visibility: visible !important;
  opacity: 1 !important;
}

body.shorts-standalone .kvs-shorts-slide--ad .kvs-shorts-ad-place,
body.shorts-standalone .kvs-shorts-slide--ad .shorts-ad-place {
  position: relative;
  z-index: 6;
  visibility: visible !important;
  opacity: 1 !important;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 420px;
  min-height: 250px;
  margin: 0 auto;
  flex: 0 0 auto;
}

/* VAST outstream (Fluid Player) — vertical in-feed slot */
body.shorts-standalone .kvs-shorts-vast-wrap,
body.page-shorts .kvs-shorts-vast-wrap,
body.kvs-shorts-context .kvs-shorts-vast-wrap {
  position: relative;
  width: min(100%, 420px);
  max-width: 100%;
  margin: 0 auto;
  aspect-ratio: 9 / 16;
  max-height: min(72dvh, 640px);
  min-height: 280px;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

body.shorts-standalone .kvs-shorts-vast-video,
body.page-shorts .kvs-shorts-vast-video,
body.kvs-shorts-context .kvs-shorts-vast-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

body.shorts-standalone .kvs-shorts-slide--ad.kvs-shorts-vast--error .kvs-shorts-vast-wrap::before,
body.page-shorts .kvs-shorts-slide--ad.kvs-shorts-vast--error .kvs-shorts-vast-wrap::before {
  content: 'Ad unavailable';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.55);
  font-size: 14px;
  z-index: 2;
  pointer-events: none;
}

body.shorts-standalone .kvs-shorts-slide--ad.kvs-shorts-vast--loading .kvs-shorts-vast-wrap::after,
body.page-shorts .kvs-shorts-slide--ad.kvs-shorts-vast--loading .kvs-shorts-vast-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

body.shorts-standalone .kvs-shorts-ad-frame-wrap,
body.page-shorts .kvs-shorts-ad-frame-wrap,
body.kvs-shorts-context .kvs-shorts-ad-frame-wrap {
  display: block;
  width: min(100%, 420px);
  margin: 0 auto;
  padding: 0;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  line-height: 0;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

body.shorts-standalone .kvs-shorts-ad-iframe,
body.page-shorts .kvs-shorts-ad-iframe,
body.kvs-shorts-context .kvs-shorts-ad-iframe {
  display: block;
  width: 100%;
  min-width: 300px;
  height: 250px;
  max-height: min(70dvh, 520px);
  border: 0;
  margin: 0;
  background: #fff;
}

/* Native spot_shorts output below iframe — hide empty placeholder noise */
body.shorts-standalone .kvs-shorts-slide--ad .kvs-shorts-ad-place .shorts-ad-wrap:empty,
body.shorts-standalone .kvs-shorts-slide--ad .kvs-shorts-ad-place > .place:empty {
  display: none !important;
}

body.shorts-standalone .kvs-shorts-slide--ad .kvs-shorts-ad-place ins,
body.shorts-standalone .kvs-shorts-slide--ad .shorts-ad-place ins,
body.shorts-standalone .kvs-shorts-slide--ad [id^="exo-native-widget"],
body.shorts-standalone .kvs-shorts-slide--ad .shorts-ad-wrap {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  margin: 0 auto;
}

body.shorts-standalone .kvs-shorts-slide--ad [id^="exo-native-widget"],
body.shorts-standalone .kvs-shorts-slide--ad .kvs-shorts-ad-place > div[data-uid] {
  min-width: 300px;
  min-height: 250px;
  max-width: 100%;
}

body.shorts-standalone .kvs-shorts-legal,
body.page-shorts .kvs-shorts-legal {
  display: none !important;
}

body.shorts-standalone .kvs-shorts-slide--ad .kvs-shorts-ad-place iframe,
body.shorts-standalone .kvs-shorts-slide--ad .kvs-shorts-ad-place img,
body.shorts-standalone .kvs-shorts-slide--ad .shorts-ad-place iframe,
body.shorts-standalone .kvs-shorts-slide--ad .shorts-ad-place img {
  max-width: 100%;
  max-height: min(72dvh, 560px);
  margin: 0 auto;
  display: block;
}

/* Shorts page: bottom nav is hidden by default above 900px — always show on standalone Shorts (incl. DevTools “mobile” with wide CSS width). */
body.shorts-standalone .kvs-app-bottom-nav.kvs-app-bottom-nav--shorts-overlay {
  display: flex !important;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10050;
  justify-content: space-around;
  align-items: center;
  gap: 2px;
  min-height: calc(58px + env(safe-area-inset-bottom, 0px));
  padding: 10px 4px calc(8px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
  overflow: visible;
  background: rgba(8, 8, 12, 0.94);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.35);
}

/* --- Mobile: prevent horizontal page drift (esp. video view + wide comment button) --- */
@media screen and (max-width: 768px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
  }
}
