:root {
  --ap-status-favorite: rgba(225, 45, 55, 0.96);
  --ap-status-hidden: rgba(105, 70, 190, 0.96);
  --ap-status-playback: rgba(245, 215, 85, 0.96);
  --ap-status-favorite-soft: rgba(225, 45, 55, 0.78);
  --ap-status-hidden-soft: rgba(105, 70, 190, 0.78);
  --ap-status-playback-soft: rgba(245, 215, 85, 0.78);
  --grid-icon-size: 64px;
  --grid-font-size: 14px;
  --grid-tile-min: 110px;

  --list-icon-size: 22px;
  --list-font-size: 14px;
  --list-row-gap: 2px;
}

.content-area {
  --content-scroll-gap: 20px;
  --content-scrollbar-compensation: 16px;
  height: 100%;
  width: calc(var(--catalog-content-width, var(--content-grid-width, var(--content-track-width, calc(100% - 245px)))) + var(--content-scroll-gap) + var(--content-scrollbar-compensation));
  max-width: calc(var(--catalog-content-width, var(--content-grid-width, var(--content-track-width, calc(100% - 245px)))) + var(--content-scroll-gap) + var(--content-scrollbar-compensation));
  min-height: 0;
  min-width: 0;
  padding-right: var(--content-scroll-gap);
  box-sizing: border-box;
  overflow: visible;
  justify-self: start;
  margin-left: var(--catalog-content-left, 0px);
  margin-top: var(--catalog-vertical-gap, 0px);
}

.media-scroll {
  height: calc(100% - 40px);
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  margin-top: -25px;
  padding-top: 36px;
  box-sizing: border-box;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.22) transparent;
}

body:has(.menu-btn.active[data-section="movie_ussr"]) .media-scroll,
body:has(.menu-btn.active[data-section="series_ussr"]) .media-scroll,
body:has(.menu-btn.active[data-section="movie_ru"]) .media-scroll,
body:has(.menu-btn.active[data-section="movie_russia"]) .media-scroll,
body:has(.menu-btn.active[data-section="series_ru"]) .media-scroll,
body:has(.menu-btn.active[data-section="series_russia"]) .media-scroll,
body:has(.menu-btn.active[data-section="movie_foreign"]) .media-scroll,
body:has(.menu-btn.active[data-section="series_foreign"]) .media-scroll {
  padding-top: 10px;
  margin-top: 8px;
}

body:has(.menu-btn.active[data-section="movie_ussr"]) .media-scroll,
body:has(.menu-btn.active[data-section="series_ussr"]) .media-scroll,
body:has(.menu-btn.active[data-section="movie_ru"]) .media-scroll,
body:has(.menu-btn.active[data-section="movie_russia"]) .media-scroll,
body:has(.menu-btn.active[data-section="series_ru"]) .media-scroll,
body:has(.menu-btn.active[data-section="series_russia"]) .media-scroll,
body:has(.menu-btn.active[data-section="movie_foreign"]) .media-scroll {
  height: auto;
  max-height: calc(100% - 27px);
  overflow-y: auto;
}

/* Фильмовые разделы при активной букве: естественная высота, без внутреннего скролла */
body:has(.menu-btn.active[data-section="movie_ussr"]):has(.alphabet-btn.active) .media-scroll,
body:has(.menu-btn.active[data-section="series_ussr"]):has(.alphabet-btn.active) .media-scroll,
body:has(.menu-btn.active[data-section="movie_russia"]):has(.alphabet-btn.active) .media-scroll,
body:has(.menu-btn.active[data-section="series_russia"]):has(.alphabet-btn.active) .media-scroll,
body:has(.menu-btn.active[data-section="movie_foreign"]):has(.alphabet-btn.active) .media-scroll {
  height: auto;
  max-height: none;
  overflow-x: visible;
  overflow-y: visible;
  scrollbar-gutter: auto;
}

body:has(.menu-btn.active[data-section="youtube"]) .media-scroll {
  padding-top: 5px;
}

.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 10020;
}

.image-viewer[hidden] {
  display: none;
}

.image-viewer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 10, 0.82);
  backdrop-filter: blur(4px);
}

.image-viewer__panel {
  position: absolute;
  top: 50%;
  left: 50%;
  display: flex;
  flex-direction: column;
  width: min(66vw, calc(100vw - 2rem));
  height: min(66vh, calc(100vh - 2rem));
  min-width: 280px;
  min-height: 220px;
  background: linear-gradient(180deg, rgba(16, 21, 27, 0.98), rgba(9, 13, 18, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.48);
  overflow: hidden;
  transform: translate(-50%, -50%);
}

.image-viewer.is-interacting,
.image-viewer.is-interacting * {
  user-select: none;
}

.image-viewer__panel.is-expanded {
  width: calc(100vw - 8px);
  height: calc(100vh - 8px);
}

.image-viewer:fullscreen,
.image-viewer.is-fullscreen {
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 0;
  background: #000;
}

.image-viewer:fullscreen .image-viewer__backdrop,
.image-viewer.is-fullscreen .image-viewer__backdrop {
  background: #000;
  backdrop-filter: none;
}

.image-viewer:fullscreen .image-viewer__panel,
.image-viewer.is-fullscreen .image-viewer__panel {
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  min-width: 0;
  min-height: 0;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: #000;
  transform: none;
}

.image-viewer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 52px;
  padding: 0 14px 0 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  cursor: move;
  touch-action: none;
}

.image-viewer:fullscreen .image-viewer__header,
.image-viewer.is-fullscreen .image-viewer__header {
  position: absolute;
  top: 12px;
  right: 12px;
  left: auto;
  z-index: 3;
  min-height: 0;
  padding: 0;
  border: none;
  background: transparent;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  transition: opacity 0.18s ease, transform 0.18s ease;
  cursor: default;
}

.image-viewer__title {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  color: rgba(248, 249, 252, 0.94);
  font-family: "Segoe UI", "Trebuchet MS", Verdana, sans-serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-viewer:fullscreen .image-viewer__title,
.image-viewer.is-fullscreen .image-viewer__title {
  display: none;
}

.image-viewer__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.image-viewer:fullscreen .image-viewer__actions,
.image-viewer.is-fullscreen .image-viewer__actions {
  gap: 10px;
}

.image-viewer__button {
  width: 2.2rem;
  height: 2.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 0.55rem;
  background: transparent;
  box-shadow: none;
  color: rgba(235, 241, 247, 0.64);
  opacity: 0.68;
  cursor: pointer;
  touch-action: manipulation;
  transition: color 0.16s ease, opacity 0.16s ease, filter 0.16s ease, transform 0.16s ease;
}

.image-viewer__button:hover {
  background: transparent;
  color: rgba(255, 255, 255, 0.95);
  opacity: 1;
  filter: brightness(1.16);
}

.image-viewer:fullscreen .image-viewer__button,
.image-viewer.is-fullscreen .image-viewer__button {
  border: none;
  background: transparent;
  box-shadow: none;
}

.image-viewer:fullscreen .image-viewer__button:hover,
.image-viewer.is-fullscreen .image-viewer__button:hover {
  background: transparent;
}

.image-viewer__button:focus-visible {
  background: transparent;
  color: rgba(255, 255, 255, 0.95);
  opacity: 1;
  filter: brightness(1.16);
  outline: none;
  box-shadow: none;
}

.image-viewer__button:active {
  transform: translateY(1px);
}

.image-viewer__icon {
  width: 1.2rem;
  height: 1.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.image-viewer__icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.image-viewer__button--close .image-viewer__icon {
  width: 1.5rem;
  height: 1.5rem;
}

.image-viewer__body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: radial-gradient(circle at top, rgba(255, 255, 255, 0.04), transparent 42%), rgba(4, 7, 12, 0.9);
  cursor: zoom-in;
}

.image-viewer:fullscreen .image-viewer__body,
.image-viewer.is-fullscreen .image-viewer__body {
  width: 100vw;
  height: 100vh;
  padding: 0;
  margin: 0;
  background: #000;
}

.image-viewer.is-expanded.is-idle,
.image-viewer.is-fullscreen.is-idle,
.image-viewer:fullscreen.is-idle {
  cursor: none;
}

.image-viewer.is-expanded.is-idle .image-viewer__body,
.image-viewer.is-fullscreen.is-idle .image-viewer__body,
.image-viewer:fullscreen.is-idle .image-viewer__body,
.image-viewer.is-expanded.is-idle .image-viewer__image,
.image-viewer.is-fullscreen.is-idle .image-viewer__image,
.image-viewer:fullscreen.is-idle .image-viewer__image {
  cursor: none;
}

.image-viewer.is-expanded.is-idle .image-viewer__header,
.image-viewer.is-fullscreen.is-idle .image-viewer__header,
.image-viewer:fullscreen.is-idle .image-viewer__header {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-0.4rem);
}

.image-viewer__body.is-expanded {
  cursor: zoom-out;
}

.image-viewer__image {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.26);
  cursor: inherit;
}

.image-viewer__resize-handle {
  position: absolute;
  z-index: 4;
  background: transparent;
  touch-action: none;
}

.image-viewer__resize-handle--top {
  top: -4px;
  left: 12px;
  width: calc(100% - 24px);
  height: 10px;
  cursor: ns-resize;
}

.image-viewer__resize-handle--left {
  top: 12px;
  left: -4px;
  width: 12px;
  height: calc(100% - 24px);
  cursor: ew-resize;
}

.image-viewer__resize-handle--right {
  top: 12px;
  right: -4px;
  width: 12px;
  height: calc(100% - 24px);
  cursor: ew-resize;
}

.image-viewer__resize-handle--bottom {
  left: 12px;
  bottom: -4px;
  width: calc(100% - 24px);
  height: 12px;
  cursor: ns-resize;
}

.image-viewer__resize-handle--top-left {
  top: -4px;
  left: -4px;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
}

.image-viewer__resize-handle--top-right {
  top: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  cursor: nesw-resize;
}

.image-viewer__resize-handle--bottom-left {
  left: -4px;
  bottom: -4px;
  width: 16px;
  height: 16px;
  cursor: nesw-resize;
}

.image-viewer__resize-handle--bottom-right {
  right: -4px;
  bottom: -4px;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
}

.image-viewer:fullscreen .image-viewer__image,
.image-viewer.is-fullscreen .image-viewer__image {
  max-width: 100vw;
  max-height: 100vh;
  width: auto;
  height: auto;
  border-radius: 0;
  box-shadow: none;
  object-fit: contain;
}

.image-viewer:fullscreen .image-viewer__resize-handle,
.image-viewer.is-fullscreen .image-viewer__resize-handle,
.image-viewer.is-expanded .image-viewer__resize-handle {
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 720px) {
  .image-viewer__panel {
    width: calc(100vw - 1rem);
    height: calc(100vh - 1rem);
    min-width: 0;
    min-height: 0;
    border-radius: 14px;
  }

  .image-viewer__panel.is-expanded {
    width: calc(100vw - 8px);
    height: calc(100vh - 8px);
  }

  .image-viewer__header {
    padding: 0 10px 0 12px;
    gap: 10px;
  }

  .image-viewer__actions {
    gap: 6px;
  }

  .image-viewer__button {
    width: 2rem;
    height: 2rem;
  }

  .image-viewer__body {
    padding: 12px;
  }
}

body:has(.menu-btn.active[data-section="cartoons"]) .media-scroll {
  padding-top: calc(36px + 20px);
}

body:has(.menu-btn.active[data-section="series_ussr"]) .media-scroll {
  padding-bottom: 8px;
  max-height: calc(100% - 27px);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
}

body:has(.menu-btn.active[data-section="movie_ussr"]) .media-scroll {
  padding-bottom: 5px;
}

body:has(.menu-btn.active[data-section="series_foreign"]) .media-scroll {
  margin-top: 0;
  height: auto;
  flex: 1 1 auto;
  min-height: 0;
  padding-bottom: 12px;
}

body:has(.menu-btn.active[data-section="movie_foreign"]) .media-scroll {
  padding-bottom: 6px;
}

body:has(.menu-btn.active[data-section="movie_russia"]) .media-scroll {
  padding-bottom: 5px;
}

body:not(:has(.menu-btn.active)) .content-area {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body:not(:has(.menu-btn.active)) .media-scroll {
  height: auto;
  max-height: none;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  margin-top: 0;
  padding-top: 10px;
  scroll-padding-top: 0;
}

body:not(:has(.menu-btn.active)) .media-grid {
  margin-top: 0;
  padding-top: 0;
}

.media-scroll::-webkit-scrollbar {
  width: 7px;
}

.media-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.media-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  border: 1px solid transparent;
  background-clip: padding-box;
}

.media-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.45);
}

body:has(.menu-btn.active[data-section="recent"]) .media-scroll {
  overflow-y: hidden;
  scrollbar-width: none;
}

body:has(.menu-btn.active[data-section="recent"]) .media-scroll::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.foreign-series-submenu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  width: var(--catalog-content-width, var(--content-grid-width, var(--content-track-width, calc(100% - 245px))));
  max-width: var(--catalog-content-width, var(--content-grid-width, var(--content-track-width, calc(100% - 245px))));
  position: sticky;
  top: 0;
  z-index: 30;
  background: transparent;
  margin-bottom: 0;
  padding-top: 2px;
  padding-bottom: 0px;
  box-sizing: border-box;
}

.foreign-series-submenu::after {
  content: "";
  display: block;
  position: absolute;
  left: 0;
  right: 0;
  bottom: -8px;
  height: 8px;
  background: transparent;
  pointer-events: none;
}

.foreign-series-submenu .submenu-item {
  display: block;
  padding: 0;
  margin: 0;
  font-family: "Segoe UI", "Trebuchet MS", Verdana, sans-serif;
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.3px;
  text-align: left;
  color: #595e64;
  background: none !important;
  border: none !important;
  border-radius: 0;
  box-shadow: none !important;
  text-shadow: none;
  cursor: pointer;
  transition: color 0.2s ease;
  appearance: none;
}

.foreign-series-submenu .submenu-item:hover {
  color: #ffffff;
}

.foreign-series-submenu .submenu-item:focus,
.foreign-series-submenu .submenu-item:active {
  outline: none !important;
  box-shadow: none !important;
  border: none !important;
}

.foreign-series-submenu .submenu-item.active {
  color: #ffffff;
  text-decoration: none;
}

body:has(.menu-btn.active[data-section="series_foreign"]) .content-area:has(.foreign-series-submenu:not([hidden])) .media-scroll .media-grid:not(.list-view) {
  padding-top: 0;
  margin-top: 0px;
  transform: none;
}

body:has(.menu-btn.active[data-section="series_foreign"]) .content-area:has(.foreign-series-submenu:not([hidden])) {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body.section-youtube-active .content-area {
  display: flex;
  flex-direction: column;
  min-height: 0;
  transform: translateY(-8px);
}

body.section-youtube-active .media-scroll {
  height: auto;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  margin-top: 0;
}

body.section-cartoons-active .content-area,
body.section-clips-active .content-area {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body.section-cartoons-active .media-scroll,
body.section-clips-active .media-scroll {
  height: auto;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

body:has(.menu-btn.active[data-section="series_foreign"]) .content-area:has(.foreign-series-submenu:not([hidden])):not(:has(.foreign-series-submenu .submenu-item.active)) .media-scroll {
  padding-top: 5px;
  margin-top: 0;
}

body:has(.menu-btn.active[data-section="series_foreign"]) .content-area:has(.foreign-series-submenu:not([hidden]) .submenu-item.active[data-category="latin"]) .media-scroll {
  padding-top: 0;
  margin-top: 0;
}

body:has(.menu-btn.active[data-section="series_foreign"]) .content-area:has(.foreign-series-submenu:not([hidden]) .submenu-item.active[data-category="turkish"]) .media-scroll {
  padding-top: 0;
  margin-top: 0;
}

body:has(.menu-btn.active[data-section="series_foreign"]) .content-area:has(.foreign-series-submenu:not([hidden]) .submenu-item.active[data-category="other"]) .media-scroll {
  padding-top: 0;
  margin-top: 0;
}

.youtube-hierarchy-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: var(--catalog-content-width, var(--content-grid-width, var(--content-track-width, calc(100% - 245px))));
  max-width: var(--catalog-content-width, var(--content-grid-width, var(--content-track-width, calc(100% - 245px))));
  margin-bottom: 12px;
  padding-top: 0;
  box-sizing: border-box;
}

.youtube-hierarchy-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}

.youtube-title-row {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
}

.youtube-title-row .youtube-title {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
}

.youtube-hierarchy-item {
  padding: 0;
  margin: 0;
  font-family: "Segoe UI", "Trebuchet MS", Verdana, sans-serif;
  font-size: 36px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.3px;
  text-align: left;
  color: #595e64;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  text-shadow: none;
  cursor: pointer;
  transition: color 0.2s ease;
  appearance: none;
}

.youtube-hierarchy-item:hover,
.youtube-hierarchy-item.active {
  color: #ffffff;
}

.youtube-hierarchy-item:focus,
.youtube-hierarchy-item:active {
  outline: none !important;
  box-shadow: none !important;
  border: none !important;
}

.youtube-breadcrumbs {
  width: 100%;
}

.youtube-title {
  padding: 0;
  margin: 0;
  font-family: "Segoe UI", "Trebuchet MS", Verdana, sans-serif;
  font-size: 36px;
  font-weight: 400;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.88);
  background: none;
  border: none;
}

.youtube-title.is-clickable {
  cursor: pointer;
}

.youtube-title.is-clickable:hover,
.youtube-title.is-clickable:focus {
  color: #ffffff;
  outline: none;
}

body:has(.menu-btn.active[data-section="clips"]) .clips-channel-title-panel .youtube-title[data-action="clips-root"] {
  margin-top: 14px;
}

body:has(.menu-btn.active[data-section="clips"]) .content-area:has(.clips-channel-title-panel:not([hidden])) .clips-channel-title-panel:not([hidden]) {
  position: sticky;
  top: 0;
  z-index: 35;
  background: transparent;
  padding-bottom: 20px;
}

body:has(.menu-btn.active[data-section="clips"]) .content-area:has(.clips-channel-title-panel:not([hidden])) .media-grid:not(.list-view) {
  margin-top: 0;
  padding-top: 8px;
}

body:has(.menu-btn.active[data-section="youtube"]) .youtube-hierarchy-panel:not(.clips-channel-title-panel) .youtube-breadcrumbs .youtube-title {
  margin-top: 10px;
}

body:has(.menu-btn.active[data-section="youtube"]) .youtube-hierarchy-panel:not(.clips-channel-title-panel) .youtube-title-row .youtube-title,
body:has(.menu-btn.active[data-section="youtube"]) .youtube-hierarchy-panel:not(.clips-channel-title-panel) .youtube-breadcrumbs .youtube-title {
  position: relative;
  left: -6px;
}

body.section-clips-active .clips-channel-title-panel .youtube-title-row .youtube-title,
body.section-clips-active .clips-channel-title-panel .youtube-breadcrumbs .youtube-title {
  position: relative;
  left: -6px;
}

.youtube-hierarchy-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}

.youtube-hierarchy-empty {
  font-family: "Segoe UI", "Trebuchet MS", Verdana, sans-serif;
  font-size: 18px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.62);
}

.books-nav-bar {
  width: var(--catalog-content-width, var(--content-grid-width, var(--content-track-width, calc(100% - 245px))));
  max-width: var(--catalog-content-width, var(--content-grid-width, var(--content-track-width, calc(100% - 245px))));
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 2px;
  margin-bottom: 6px;
  min-width: 0;
}

.books-nav-back {
  flex: 0 0 auto;
  padding: 0;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.84);
  font: inherit;
  font-size: 22px !important;
  line-height: 1.15;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.18s ease;
}

.books-nav-back:hover,
.books-nav-back:focus {
  color: #ffffff;
  outline: none;
}

.books-nav-path {
  flex: 1 1 auto;
  margin-left: 10px;
  min-width: 0;
  display: flex;
  align-items: center;
  color: rgba(255, 255, 255, 0.68);
  font-size: 17px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.books-list {
  width: var(--catalog-content-width, var(--content-grid-width, var(--content-track-width, calc(100% - 245px))));
  max-width: var(--catalog-content-width, var(--content-grid-width, var(--content-track-width, calc(100% - 245px))));
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  margin-top: 10px;
}

.books-row {
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.2s;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.4;
}

.books-row:hover {
  background: rgba(255, 255, 255, 0.08);
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  column-gap: 12px;
  row-gap: 14px;
  padding-top: 10px;
  width: var(--catalog-content-width, var(--content-grid-width, var(--content-track-width, calc(100% - 245px))));
  max-width: var(--catalog-content-width, var(--content-grid-width, var(--content-track-width, calc(100% - 245px))));
  box-sizing: border-box;
  align-content: start;
  align-items: start;
  justify-content: start;
}

body:has(.menu-btn.active[data-section="movie_ussr"]) .media-grid:not(.list-view),
body:has(.menu-btn.active[data-section="series_ussr"]) .media-grid:not(.list-view),
body:has(.menu-btn.active[data-section="movie_ru"]) .media-grid:not(.list-view),
body:has(.menu-btn.active[data-section="movie_russia"]) .media-grid:not(.list-view),
body:has(.menu-btn.active[data-section="series_ru"]) .media-grid:not(.list-view),
body:has(.menu-btn.active[data-section="series_russia"]) .media-grid:not(.list-view),
body:has(.menu-btn.active[data-section="movie_foreign"]) .media-grid:not(.list-view) {
  padding-top: 0;
  margin-top: 0;
}

body:has(.menu-btn.active[data-section="cartoons"]) .media-grid:not(.list-view) {
  padding-top: 4px;
  margin-top: -25px;
}

body:has(.menu-btn.active[data-section="youtube"]) .content-area:has(.youtube-hierarchy-panel:not([hidden])):not(:has(.youtube-breadcrumbs .youtube-title)) .media-grid:not(.list-view) {
  margin-top: 0;
}

body:has(.menu-btn.active[data-section="clips"]) .content-area:has(.clips-channel-title-panel[hidden]) .media-grid:not(.list-view) {
  padding-top: 14px;
  margin-top: 0;
}

body:has(.menu-btn.active[data-section="movie_ussr"]) .media-grid:not(.list-view),
body:has(.menu-btn.active[data-section="series_ussr"]) .media-grid:not(.list-view),
body:has(.menu-btn.active[data-section="movie_ru"]) .media-grid:not(.list-view),
body:has(.menu-btn.active[data-section="movie_russia"]) .media-grid:not(.list-view),
body:has(.menu-btn.active[data-section="series_ru"]) .media-grid:not(.list-view),
body:has(.menu-btn.active[data-section="series_russia"]) .media-grid:not(.list-view),
body:has(.menu-btn.active[data-section="movie_foreign"]) .media-grid:not(.list-view),
body:has(.menu-btn.active[data-section="series_foreign"]) .media-grid:not(.list-view),
body:has(.menu-btn.active[data-section="youtube"]) .media-grid:not(.list-view),
body:has(.menu-btn.active[data-section="clips"]) .media-grid:not(.list-view),
body:has(.menu-btn.active[data-section="cartoons"]) .media-grid:not(.list-view) {
  padding-left: 5px;
  padding-right: 5px;
}

.media-card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #1b222b;
  border: 1px solid #2f3740;
  border-radius: 12px;
  overflow: hidden;
  transform-origin: center;
  will-change: transform;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.media-card:hover {
  transform: translateY(-2px) scale(1.015);
  z-index: 5;
  border-color: #45505d;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.5), 0 3px 8px rgba(0, 0, 0, 0.35);
}

.media-poster {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  display: block;
  overflow: hidden;
  border-bottom: 1px solid #2f3740;
}

.media-card-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.media-card-poster[src^="/file-icons/"] {
  box-sizing: border-box;
  padding: 20px;
  object-fit: contain;
  object-position: center;
}

.file-icon-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  opacity: 0.95;
}

.file-icon-mask {
  width: var(--grid-icon-size);
  height: var(--grid-icon-size);
  display: inline-block;
  background-color: #9ca3af;
  -webkit-mask-image: var(--icon-url);
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  mask-image: var(--icon-url);
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  box-shadow: 0 4px 12px rgba(0,0,0,0.35);
  flex: 0 0 auto;
}

.file-icon-img,
.file-icon-img.type-audio,
.file-icon-img.type-video,
.file-icon-img.type-image,
.file-icon-img.type-document,
.file-icon-img.type-archive,
.file-icon-img.type-app,
.file-icon-img.type-code,
.file-icon-img.type-file {
  filter: none !important;
}

.file-icon-mask.type-audio { background-color: #22c55e; }
.file-icon-mask.type-video { background-color: #38bdf8; }
.file-icon-mask.type-image { background-color: #f59e0b; }
.file-icon-mask.type-document { background-color: #3b82f6; }
.file-icon-mask.type-archive { background-color: #f97316; }
.file-icon-mask.type-app { background-color: #ef4444; }
.file-icon-mask.type-code { background-color: #a855f7; }
.file-icon-mask.type-file { background-color: #9ca3af; }

.media-card-file-icon {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-card-file-icon::before {
  content: '';
  width: 42px;
  height: 42px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

.file-other::before {
  background-image: url('/icons/file.svg');
}

.file-archive::before {
  background-image: url('/icons/archive.svg');
}

.file-document::before {
  background-image: url('/icons/document.svg');
}

.media-poster::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(0, 0, 0, 0);
  transition: background 0.22s ease;
  pointer-events: none;
}

.media-card:hover .media-poster::after {
  background: rgba(0, 0, 0, 0.18);
}

.media-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 7px 8px 8px;
  min-height: 0;
}

.card-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.media-title {
  margin: 0;
  color: rgba(255, 255, 255, 0.6);
  font-size: 14px;
  font-weight: 300;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  width: 100%;
}

.media-card:hover .media-title {
  color: #ffffff;
}

.media-card.is-status-playback .media-title,
.media-card.is-status-playback:hover .media-title,
.media-card.is-status-playback .icon-title {
  color: var(--ap-status-playback);
}

.media-card.is-status-playback .media-year,
.media-card.is-status-playback .card-year {
  color: var(--ap-status-playback);
}

.media-card.is-status-favorite .media-title,
.media-card.is-status-favorite:hover .media-title,
.media-card.is-status-favorite .icon-title {
  color: var(--ap-status-favorite);
}

.media-card.is-status-favorite .media-year,
.media-card.is-status-favorite .card-year {
  color: var(--ap-status-favorite);
}

.media-card.is-status-hidden .media-title,
.media-card.is-status-hidden:hover .media-title,
.media-card.is-status-hidden .icon-title {
  color: var(--ap-status-hidden);
}

.media-card.is-status-hidden .media-year,
.media-card.is-status-hidden .card-year {
  color: var(--ap-status-hidden);
}

.media-year {
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.2;
}

.card-year {
  display: block;
  min-height: 14px;
  margin: 4px auto 0;
  padding: 0;
  font-size: 12px;
  line-height: 1.2;
  text-align: center;
  background: none !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  color: rgba(255, 255, 255, 0.55);
}

.icon-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0px;
  cursor: pointer;
  padding: 12px;
}

.media-card.icon-tile {
  background: transparent;
  border: 0;
  border-radius: 10px;
  box-shadow: none;
  overflow: visible;
  justify-content: flex-start;
}

.media-card.icon-tile:hover {
  transform: none;
  border-color: transparent;
  box-shadow: none;
}

.media-card.file-open-scope,
.icon-tile.file-open-scope {
  cursor: default;
}

.file-open-scope .file-open-hitarea {
  cursor: pointer;
}

.file-open-hitarea--title {
  cursor: pointer;
}

.icon-img {
  width: 100px;
  height: 100px;
  object-fit: contain;
}

.icon-img[src^="/file-icons/"] {
  box-sizing: border-box;
  padding: 10px;
  object-position: center;
}

.icon-title {
  margin-top: 6px;
  font-size: 14px;
  text-align: center;
  color: var(--btn-text);
  line-height: 1.25;
  white-space: normal;
  width: 100%;
  word-break: normal;
  overflow-wrap: break-word;
  overflow: visible;
  max-height: none;
  height: auto;
  text-overflow: clip;
}

.file-date-prefix {
  display: inline-block;
  margin-right: 20px;
  white-space: nowrap;
  color: inherit;
}

.file-title-main {
  white-space: normal;
  color: inherit;
}

.empty-state-wrapper {
  grid-column: 1 / -1;
  width: 100%;
  max-width: 520px;
  margin: 8px 0 0;
  display: flex;
  justify-content: center;
  justify-self: start;
}

.media-empty {
  width: 100%;
  margin: 0;
  padding: 0;
  border-radius: 0;
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 27px;
  font-weight: 400;
  letter-spacing: 0;
  background: transparent;
  box-shadow: none;
  text-shadow: none;
}

.media-grid.media-grid--clips {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  column-gap: 12px;
  row-gap: 14px;
  padding-top: 18px;
}

/* YouTube has both --clips and --has-icons; icon grid must win (specificity 0,3,0 > 0,2,0) */
.media-grid.media-grid--has-icons.media-grid--clips {
  grid-template-columns: repeat(auto-fill, minmax(var(--grid-tile-min), 1fr));
}

.media-grid.media-grid--clips .media-card {
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
  overflow: visible;
}

.media-grid.media-grid--clips .media-poster {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid #2f3740;
  border-radius: 12px;
  border-bottom: 1px solid #2f3740;
}

.media-grid.media-grid--clips .media-card-poster {
  position: absolute;
  border-radius: 12px;
}

.media-grid.media-grid--clips .media-meta {
  padding: 8px 2px 0;
}

.media-grid.media-grid--clips .card-footer {
  align-items: center;
}

.media-grid.media-grid--clips .media-title {
  font-size: 16px;
  white-space: normal;
  text-align: center;
}

.media-grid.media-grid--clips .card-year {
  display: none;
}

.media-card.media-card--horizontal {
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
  overflow: visible;
}

.media-card.media-card--horizontal .media-poster {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid #2f3740;
  border-radius: 12px;
  border-bottom: 1px solid #2f3740;
}

.media-card.media-card--horizontal .media-card-poster {
  position: absolute;
  border-radius: 12px;
}

.media-card.media-card--horizontal .media-meta {
  padding: 8px 2px 0;
}

.media-card.media-card--horizontal .card-footer {
  align-items: center;
}

.media-card.media-card--horizontal .media-title {
  font-size: 16px;
  white-space: normal;
  text-align: center;
}

.media-card.media-card--horizontal .card-year {
  display: none;
}

.video-preview-empty {
  width: 100%;
  height: 100%;
  background: #1a2028;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-preview-empty::after {
  content: '';
  display: block;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.12);
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E");
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}

.photo-preview-empty {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1b2430, #222e3d);
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-preview-empty::after {
  content: '';
  display: block;
  width: 34px;
  height: 34px;
  background: rgba(255, 255, 255, 0.22);
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 19h14a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1H5a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1zm1-2 3.5-4.5 2.5 3 3.5-4.5L18 17H6zm3-7.5a1.5 1.5 0 1 1 0-.001z'/%3E%3C/svg%3E");
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 19h14a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1H5a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1zm1-2 3.5-4.5 2.5 3 3.5-4.5L18 17H6zm3-7.5a1.5 1.5 0 1 1 0-.001z'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}

@media (max-width: 900px) {
  .media-grid {
    column-gap: 10px;
    row-gap: 12px;
    padding-top: 8px;
  }

  .media-card {
    border-radius: 10px;
  }

  .media-meta {
    padding: 6px 7px 7px;
  }

  .media-title {
    font-size: 13px;
  }

  .media-grid.media-grid--clips {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }

  .media-grid.media-grid--clips .media-title {
    font-size: 14px;
  }
}

/* ===== View toolbar ===== */
.view-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0 2px;
  margin-top: 12px;
  margin-bottom: 4px;
  width: var(--catalog-content-width, var(--content-grid-width, var(--content-track-width, calc(100% - 245px))));
  max-width: var(--catalog-content-width, var(--content-grid-width, var(--content-track-width, calc(100% - 245px))));
  box-sizing: border-box;
}

.view-toolbar.is-hidden {
  display: none;
}

.view-mode-btn {
  flex: 0 0 auto;
  padding: 3px 7px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.view-mode-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
}

.view-mode-btn.is-active {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.42);
}

.view-sort-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  width: 68px;
  min-width: 68px;
  height: 28px;
  font-size: 15px;
  line-height: 1.1;
}

.view-sort-btn--date {
  width: 68px;
  min-width: 68px;
  letter-spacing: 0.04em;
  padding-left: 12px;
  padding-right: 6px;
}

.view-size-slider {
  flex: 1 1 auto;
  max-width: 180px;
  accent-color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
}

/* ===== Icon sections: auto-fill grid ===== */
.media-grid--has-icons {
  grid-template-columns: repeat(auto-fill, minmax(var(--grid-tile-min), 1fr));
}

.media-grid:not(.list-view) .icon-tile {
  min-width: var(--grid-tile-min);
  min-height: calc(var(--grid-icon-size) + var(--grid-font-size) + 20px);
}

.media-grid:not(.list-view) .icon-title {
  font-size: var(--grid-font-size);
}

.media-grid--has-icons:not(.list-view) .icon-img {
  width: var(--grid-icon-size);
  height: var(--grid-icon-size);
}

/* ===== List view ===== */
.media-grid.list-view {
  display: flex;
  flex-direction: column;
  row-gap: var(--list-row-gap);
}

.media-grid.list-view .icon-tile {
  flex-direction: row;
  align-items: center;
  gap: calc(var(--list-icon-size) * 0.35);
  padding: 2px 10px;
  margin: 0;
  width: 100%;
  min-height: calc(var(--list-icon-size) + 4px);
  box-sizing: border-box;
  border-radius: 4px;
  background: transparent;
}

.media-grid.list-view .file-icon-mask {
  width: var(--list-icon-size);
  height: var(--list-icon-size);
}

.media-grid.list-view .icon-tile .icon-img {
  width: var(--list-icon-size);
  height: var(--list-icon-size);
  flex: 0 0 auto;
}

.media-grid.list-view .icon-title {
  margin: 0;
  font-size: var(--list-font-size);
  text-align: left;
  flex: 1 1 auto;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: transparent;
}

/* media-card items inside icon-grid list-view (global search: movies, video files) */
.media-grid--has-icons.list-view .media-card:not(.icon-tile) {
  flex-direction: row;
  align-items: center;
  width: 100%;
  height: calc(var(--list-icon-size) + 4px);
  border-radius: 4px;
  overflow: hidden;
  background: transparent;
}

.media-grid--has-icons.list-view .media-card:not(.icon-tile) .media-poster {
  width: calc((var(--list-icon-size) + 4px) * 2 / 3);
  height: calc(var(--list-icon-size) + 4px);
  aspect-ratio: unset;
  flex: 0 0 auto;
  border-radius: 0;
}

.media-grid--has-icons.list-view .media-card:not(.icon-tile) .media-card-poster {
  border-radius: 0;
}

.media-grid--has-icons.list-view .media-card:not(.icon-tile) .media-meta {
  flex: 1 1 auto;
  padding: 2px 10px;
  overflow: hidden;
  justify-content: center;
}

.media-grid--has-icons.list-view .media-card:not(.icon-tile) .media-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  font-size: var(--list-font-size);
  background: transparent;
}

.media-grid--has-icons.list-view .media-card:not(.icon-tile) .card-year {
  font-size: var(--list-font-size);
  text-align: left;
}

body:is(
  :has(.menu-btn.active[data-section="photo"]),
  :has(.menu-btn.active[data-section="video"]),
  :has(.menu-btn.active[data-section="news"]),
  :has(.menu-btn.active[data-section="books"]),
  :has(.menu-btn.active[data-section="music"]),
  :has(.menu-btn.active[data-section="clips"]),
  :has(.menu-btn.active[data-section="youtube"])
) :is(
  .media-title,
  .icon-title,
  .media-grid.media-grid--clips .media-title,
  .media-card.media-card--horizontal .media-title,
  .media-grid:not(.list-view) .icon-title,
  .media-grid.list-view .icon-title,
  .media-grid--has-icons.list-view .media-card:not(.icon-tile) .media-title
) {
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  font-weight: 300;
  color: rgba(245, 248, 255, 0.88);
  letter-spacing: 0.03em;
  text-shadow:
    0 1px 1px rgba(0, 0, 0, 0.65),
    0 0 6px rgba(255, 255, 255, 0.08);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
}

body:is(
  :has(.menu-btn.active[data-section="photo"]),
  :has(.menu-btn.active[data-section="video"]),
  :has(.menu-btn.active[data-section="news"]),
  :has(.menu-btn.active[data-section="books"]),
  :has(.menu-btn.active[data-section="music"]),
  :has(.menu-btn.active[data-section="clips"]),
  :has(.menu-btn.active[data-section="youtube"])
) .media-card:hover :is(.media-title, .icon-title) {
  color: rgba(255, 255, 255, 0.96);
}

body:is(
  :has(.menu-btn.active[data-section="photo"]),
  :has(.menu-btn.active[data-section="video"]),
  :has(.menu-btn.active[data-section="news"]),
  :has(.menu-btn.active[data-section="books"]),
  :has(.menu-btn.active[data-section="music"]),
  :has(.menu-btn.active[data-section="clips"]),
  :has(.menu-btn.active[data-section="youtube"])
) .media-card.is-status-playback :is(.media-title, .icon-title),
body:is(
  :has(.menu-btn.active[data-section="photo"]),
  :has(.menu-btn.active[data-section="video"]),
  :has(.menu-btn.active[data-section="news"]),
  :has(.menu-btn.active[data-section="books"]),
  :has(.menu-btn.active[data-section="music"]),
  :has(.menu-btn.active[data-section="clips"]),
  :has(.menu-btn.active[data-section="youtube"])
) .media-card.is-status-playback:hover :is(.media-title, .icon-title) {
  color: var(--ap-status-playback);
}

body:is(
  :has(.menu-btn.active[data-section="photo"]),
  :has(.menu-btn.active[data-section="video"]),
  :has(.menu-btn.active[data-section="news"]),
  :has(.menu-btn.active[data-section="books"]),
  :has(.menu-btn.active[data-section="music"]),
  :has(.menu-btn.active[data-section="clips"]),
  :has(.menu-btn.active[data-section="youtube"])
) .media-card.is-status-favorite :is(.media-title, .icon-title),
body:is(
  :has(.menu-btn.active[data-section="photo"]),
  :has(.menu-btn.active[data-section="video"]),
  :has(.menu-btn.active[data-section="news"]),
  :has(.menu-btn.active[data-section="books"]),
  :has(.menu-btn.active[data-section="music"]),
  :has(.menu-btn.active[data-section="clips"]),
  :has(.menu-btn.active[data-section="youtube"])
) .media-card.is-status-favorite:hover :is(.media-title, .icon-title) {
  color: var(--ap-status-favorite);
}

body:is(
  :has(.menu-btn.active[data-section="photo"]),
  :has(.menu-btn.active[data-section="video"]),
  :has(.menu-btn.active[data-section="news"]),
  :has(.menu-btn.active[data-section="books"]),
  :has(.menu-btn.active[data-section="music"]),
  :has(.menu-btn.active[data-section="clips"]),
  :has(.menu-btn.active[data-section="youtube"])
) .media-card.is-status-hidden :is(.media-title, .icon-title),
body:is(
  :has(.menu-btn.active[data-section="photo"]),
  :has(.menu-btn.active[data-section="video"]),
  :has(.menu-btn.active[data-section="news"]),
  :has(.menu-btn.active[data-section="books"]),
  :has(.menu-btn.active[data-section="music"]),
  :has(.menu-btn.active[data-section="clips"]),
  :has(.menu-btn.active[data-section="youtube"])
) .media-card.is-status-hidden:hover :is(.media-title, .icon-title) {
  color: var(--ap-status-hidden);
}

body:is(
  :has(.menu-btn.active[data-section="movie_ussr"]),
  :has(.menu-btn.active[data-section="series_ussr"]),
  :has(.menu-btn.active[data-section="movie_russia"]),
  :has(.menu-btn.active[data-section="series_russia"]),
  :has(.menu-btn.active[data-section="movie_foreign"]),
  :has(.menu-btn.active[data-section="series_foreign"]),
  :has(.menu-btn.active[data-section="cartoons"])
) :is(
  .media-title,
  .media-card.media-card--horizontal .media-title,
  .media-grid--has-icons.list-view .media-card:not(.icon-tile) .media-title
) {
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  font-weight: 300;
  color: rgba(250, 252, 255, 0.92);
  letter-spacing: 0.035em;
  text-shadow:
    0 1px 0 rgba(0, 0, 0, 0.75),
    0 0 7px rgba(255, 255, 255, 0.10);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
}

body:is(
  :has(.menu-btn.active[data-section="movie_ussr"]),
  :has(.menu-btn.active[data-section="series_ussr"]),
  :has(.menu-btn.active[data-section="movie_russia"]),
  :has(.menu-btn.active[data-section="series_russia"]),
  :has(.menu-btn.active[data-section="movie_foreign"]),
  :has(.menu-btn.active[data-section="series_foreign"]),
  :has(.menu-btn.active[data-section="cartoons"])
) .media-card:hover .media-title {
  color: rgba(255, 255, 255, 0.98);
}

body:is(
  :has(.menu-btn.active[data-section="movie_ussr"]),
  :has(.menu-btn.active[data-section="series_ussr"]),
  :has(.menu-btn.active[data-section="movie_russia"]),
  :has(.menu-btn.active[data-section="series_russia"]),
  :has(.menu-btn.active[data-section="movie_foreign"]),
  :has(.menu-btn.active[data-section="series_foreign"]),
  :has(.menu-btn.active[data-section="cartoons"])
) .media-card:is(.is-status-playback, .is-status-playback:hover) .media-title {
  color: var(--ap-status-playback);
}

body:is(
  :has(.menu-btn.active[data-section="movie_ussr"]),
  :has(.menu-btn.active[data-section="series_ussr"]),
  :has(.menu-btn.active[data-section="movie_russia"]),
  :has(.menu-btn.active[data-section="series_russia"]),
  :has(.menu-btn.active[data-section="movie_foreign"]),
  :has(.menu-btn.active[data-section="series_foreign"]),
  :has(.menu-btn.active[data-section="cartoons"])
) .media-card:is(.is-status-favorite, .is-status-favorite:hover) .media-title {
  color: var(--ap-status-favorite);
}

body:is(
  :has(.menu-btn.active[data-section="movie_ussr"]),
  :has(.menu-btn.active[data-section="series_ussr"]),
  :has(.menu-btn.active[data-section="movie_russia"]),
  :has(.menu-btn.active[data-section="series_russia"]),
  :has(.menu-btn.active[data-section="movie_foreign"]),
  :has(.menu-btn.active[data-section="series_foreign"]),
  :has(.menu-btn.active[data-section="cartoons"])
) .media-card:is(.is-status-hidden, .is-status-hidden:hover) .media-title {
  color: var(--ap-status-hidden);
}

body:has(#media-grid.media-grid--has-icons.list-view) .toolbar,
body:has(#media-grid.media-grid--has-icons.list-view) .alphabet-wrapper,
body:has(#media-grid.media-grid--has-icons.list-view) .view-toolbar,
body:has(#media-grid.media-grid--has-icons.list-view) .content-area :is(.books-nav-bar, .music-nav-bar, .news-nav-bar, .video-nav-bar, .photo-nav-bar) {
  position: relative;
  z-index: 40;
  background: transparent;
}

body:has(#media-grid.media-grid--has-icons.list-view) .media-scroll {
  margin-top: 0;
  padding-top: 0;
  scroll-padding-top: 12px;
}

body:has(#media-grid.media-grid--has-icons.list-view) #media-grid.media-grid--has-icons.list-view {
  padding-top: 12px;
}

/* === ALIGN YOUTUBE & CLIPS: ONE GEOMETRY === */

/* 1) Единая вертикальная схема для обоих разделов */
body.section-youtube-active .content-area,
body.section-clips-active .content-area {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* 2) Изолированная scroll-зона для Music / Books / Clips */
body:has(.menu-btn.active[data-section="music"]) .content-area,
body:has(.menu-btn.active[data-section="books"]) .content-area,
body:has(.menu-btn.active[data-section="clips"]) .content-area {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

body:has(.menu-btn.active[data-section="music"]) .media-scroll {
  height: calc(100vh - 130px);
  max-height: calc(100vh - 355px);
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 36px;
  box-sizing: border-box;
}

body:has(.menu-btn.active[data-section="music"]):has(#media-grid:not(.list-view)) .media-scroll {
  max-height: calc(100vh - 330px);
}

body:has(.menu-btn.active[data-section="books"]) .media-scroll,
body.section-clips-active .media-scroll,
body:has(.menu-btn.active[data-section="clips"]) .media-scroll {
  height: calc(100vh - 130px);
  max-height: 100%;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

body.section-clips-active .media-scroll,
body:has(.menu-btn.active[data-section="clips"]) .media-scroll {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

body.section-youtube-active .content-area:has(.youtube-breadcrumbs .youtube-title) .media-scroll {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* 3) Единый отступ заголовков (чтобы стояли на одном уровне) */
body.section-youtube-active .youtube-title,
body.section-clips-active .clips-channel-title-panel .youtube-title {
  margin-top: 14px;   /* одинаково для обоих */
}

/* 4) Единый зазор между заголовком и карточками */
body.section-youtube-active .media-grid:not(.list-view),
body.section-clips-active .media-grid:not(.list-view) {
  padding-top: 8px;   /* одинаково для обоих */
  margin-top: 0;
}

.overlay-root.hidden {
  display: none;
}

.overlay-root {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
}

.overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

.overlay-window {
  position: absolute;
  width: 800px;
  min-width: 640px;
  min-height: 420px;
  height: 520px;
  top: 100px;
  left: 100px;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
  pointer-events: auto;
}

.overlay-header {
  flex: 0 0 40px;
  height: 40px;
  background: #131313;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 10px;
  cursor: move;
  user-select: none;
}

.overlay-title {
  flex: 1 1 auto;
  min-width: 0;
  display: block;
  color: rgba(255, 255, 255, 0.92);
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.overlay-controls {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.overlay-controls button {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
}

.overlay-body {
  flex: 1;
  min-height: 0;
  background: #000;
  overflow: hidden;
}

.overlay-body video,
.overlay-body .plyr {
  width: 100%;
  height: 100%;
}

#overlay-window:fullscreen .overlay-body video,
#overlay-window:fullscreen .overlay-body .plyr video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: none !important;
}

.overlay-body .plyr__controls {
  gap: 6px;
  flex-wrap: wrap;
}

.overlay-body .plyr__volume input[type="range"] {
  --overlay-volume-fill: 100%;
  --overlay-volume-active: rgba(218, 245, 255, 0.92);
  --overlay-volume-rest: rgba(23, 23, 23, 0.18);
}

.overlay-body .plyr__volume input[type="range"]::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--overlay-volume-active) 0,
    var(--overlay-volume-active) var(--overlay-volume-fill),
    var(--overlay-volume-rest) var(--overlay-volume-fill),
    var(--overlay-volume-rest) 100%
  ) !important;
}

.overlay-body .plyr__volume input[type="range"]::-moz-range-track {
  height: 5px;
  border-radius: 999px;
  background: var(--overlay-volume-rest) !important;
}

.overlay-body .plyr__volume input[type="range"]::-moz-range-progress {
  height: 5px;
  border-radius: 999px;
  background: var(--overlay-volume-active) !important;
}

.overlay-body .plyr__volume input[type="range"]::-webkit-slider-thumb,
.overlay-body .plyr__volume input[type="range"]::-moz-range-thumb {
  box-shadow: 0 0 0 2px rgba(10, 14, 20, 0.5);
}

.overlay-queue-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}

.overlay-queue-btn {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.86);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  position: relative;
}

.overlay-queue-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.overlay-queue-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.overlay-queue-btn:active {
  background: rgba(255, 255, 255, 0.26);
}

.overlay-queue-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.overlay-queue-btn.is-active,
.overlay-queue-btn[data-mode="one"],
.overlay-queue-btn[data-mode="all"] {
  background: rgba(0, 169, 255, 0.28);
  color: #8fd9ff;
}

.overlay-queue-repeat-one {
  position: absolute;
  right: 4px;
  bottom: 3px;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  color: #ffffff;
  opacity: 0;
}

.overlay-queue-btn[data-mode="one"] .overlay-queue-repeat-one {
  opacity: 1;
}

@media (max-width: 760px) {
  .overlay-body .plyr__controls {
    justify-content: center;
  }

  .overlay-queue-controls {
    margin-left: 2px;
  }
}

.overlay-resizer {
  width: 16px;
  height: 16px;
  position: absolute;
  right: 0;
  bottom: 0;
  cursor: se-resize;
}

/* 5) Убираем различия sticky-блоков (чтобы не было «прыжков») */
body.section-clips-active .clips-channel-title-panel {
  padding-bottom: 12px; /* подгони под YouTube */
}

body.section-clips-active .content-area:has(.clips-channel-title-panel:not([hidden])) {
  padding-top: 38px;
}

body.section-youtube-active .youtube-hierarchy-panel {
  margin-bottom: 12px;  /* симметрия с clips */
  padding-bottom: 20px;
}

#music-player-root {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 24px);
  max-width: 1360px;
  padding: 0 6px;
  z-index: 100;
}

.mp-player {
  background: rgba(16, 21, 29, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.58), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  padding: 16px 20px;
  min-height: 76px;
  display: grid;
  grid-template-columns: 1fr auto 2fr auto;
  gap: 16px;
  align-items: center;
}

.mp-left {
  color: #d7deea;
  font-size: 15px;
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.mp-center {
  display: flex;
  gap: 12px;
}

.mp-btn {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 20px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.mp-progress {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mp-bar {
  flex: 1;
  height: 5px;
  background: transparent !important;
  border-radius: 999px;
  overflow: hidden;
}

.mp-fill {
  width: 20%;
  height: 100%;
  background: #fff;
}

.mp-time {
  font-size: 12px;
  color: #b0bac8;
  margin-left: 2px;
  white-space: nowrap;
}

.mp-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mp-right > span {
  display: inline-flex;
  align-items: center;
  line-height: 1;
  color: #d0d9e8;
}

.mp-volume {
  width: 96px;
  height: 5px;
  background: transparent !important;
  border-bottom: 1px solid #444;
  border-radius: 0;
}



input[type="range"] {
  background: transparent !important;
}

input[type="range"]::-webkit-slider-runnable-track {
  background: transparent !important;
}

input[type="range"]::-moz-range-track {
  background: transparent !important;
}

body:has(.menu-btn.active[data-section="music"]) #media-grid .media-card.is-status-favorite > .icon-title,
body:has(.menu-btn.active[data-section="music"]) #media-grid .media-card.is-status-favorite .media-title,
body:has(.menu-btn.active[data-section="music"]) #media-grid .media-card.is-status-favorite .track-title,
body:has(.menu-btn.active[data-section="music"]) #media-grid .media-card.is-status-favorite .track-artist,
body:has(.menu-btn.active[data-section="music"]) #media-grid .media-card.is-status-favorite .artist,
body:has(.menu-btn.active[data-section="music"]) #media-grid .media-card.is-status-favorite .media-artist {
  color: var(--ap-status-favorite) !important;
  text-shadow:
    0 1px 1px rgba(0, 0, 0, 0.75),
    0 0 7px var(--ap-status-favorite-soft) !important;
}

body:has(.menu-btn.active[data-section="music"]) #media-grid .media-card.is-status-hidden > .icon-title,
body:has(.menu-btn.active[data-section="music"]) #media-grid .media-card.is-status-hidden .media-title,
body:has(.menu-btn.active[data-section="music"]) #media-grid .media-card.is-status-hidden .track-title,
body:has(.menu-btn.active[data-section="music"]) #media-grid .media-card.is-status-hidden .track-artist,
body:has(.menu-btn.active[data-section="music"]) #media-grid .media-card.is-status-hidden .artist,
body:has(.menu-btn.active[data-section="music"]) #media-grid .media-card.is-status-hidden .media-artist {
  color: var(--ap-status-hidden) !important;
  text-shadow:
    0 1px 1px rgba(0, 0, 0, 0.75),
    0 0 7px var(--ap-status-hidden-soft) !important;
}

body:has(.menu-btn.active[data-section="music"]) #media-grid .media-card.is-status-playback > .icon-title,
body:has(.menu-btn.active[data-section="music"]) #media-grid .media-card.is-status-playback .media-title,
body:has(.menu-btn.active[data-section="music"]) #media-grid .media-card.is-status-playback .track-title,
body:has(.menu-btn.active[data-section="music"]) #media-grid .media-card.is-status-playback .track-artist,
body:has(.menu-btn.active[data-section="music"]) #media-grid .media-card.is-status-playback .artist,
body:has(.menu-btn.active[data-section="music"]) #media-grid .media-card.is-status-playback .media-artist {
  color: var(--ap-status-playback) !important;
  text-shadow:
    0 1px 1px rgba(0, 0, 0, 0.75),
    0 0 7px var(--ap-status-playback-soft) !important;
}

@keyframes media-current-track-title-pulse {
  0%,
  100% {
    opacity: 0.48;
    text-shadow: none;
    filter: brightness(0.92);
  }

  50% {
    opacity: 1;
    text-shadow: none;
    filter: brightness(1.18);
  }
}

body:has(.menu-btn.active[data-section="music"]) #media-grid .media-card.is-currently-playing-media :is(.icon-title, .media-title),
body:has(.menu-btn.active[data-section="music"]) #media-grid .media-card.is-currently-playing-media :is(.icon-title, .media-title) .file-open-hitarea {
  -webkit-text-fill-color: currentColor;
  animation: media-current-track-title-pulse 1.65s ease-in-out infinite;
  will-change: opacity, filter;
}

