body {
  margin: 0;
  padding: 0;
  background: #333;
  display: flex;
  justify-content: center;
  font-family: Arial, Helvetica, sans-serif;
  overflow-x: hidden;
}

.fade-in-wrapper {
  animation: fadeInPage 0.35s ease-out forwards;
  opacity: 0;
  width: 100%;
  max-width: 480px;
  background: #fff;
  min-height: 100vh;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
}

@keyframes fadeInPage {
  to {
    opacity: 1;
  }
}

/* clone mode */
html.clone-mode,
.clone-mode body {
  background-color: #000 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  width: 100% !important;
  height: 100% !important;
}

.clone-mode .fade-in-wrapper {
  display: block !important;
  max-width: 100% !important;
  width: 100% !important;
  height: 100% !important;
  background-color: #000 !important;
  box-shadow: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.clone-mode .vp-mishura {
  display: none !important;
}

.clone-mode .pl-video-container {
  position: fixed !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100dvh !important;
  max-width: none !important;
  aspect-ratio: auto !important;
  background: #000 !important;
  z-index: 9999 !important;
}

.clone-mode .pl-frame {
  object-fit: contain !important;
  width: 100% !important;
  height: 100% !important;
}

.clone-mode .pl-bottom-controls {
  bottom: 0 !important;
  padding-bottom: env(safe-area-inset-bottom, 0) !important;
}

.clone-mode .pl-player-time {
  bottom: calc(50px + env(safe-area-inset-bottom, 0px)) !important;
}

.clone-mode .pl-clone-back-btn {
  display: flex !important;
  top: calc(env(safe-area-inset-top, 0px) + 25px) !important;
}

/* fonts */
@font-face {
  font-family: "ui-icons-v2";
  src:
    url("../favicon/ui-icons-v2.woff2") format("woff2"),
    url("../favicon/ui-icons-v2.woff") format("woff"),
    url("../favicon/ui-icons-v2.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: "iconfont";
  src:
    url("../favicon/iconfont.woff2") format("woff2"),
    url("../favicon/iconfont.woff") format("woff"),
    url("../favicon/iconfont.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}
/* icon fonts */
.icon-f,
.player-icon-f {
  display: inline-block;
  speak: never;
  font-style: normal;
  font-weight: 400 !important;
  font-variant: normal;
  text-transform: none;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.icon-f {
  font-family: "iconfont" !important;
}

.player-icon-f {
  font-family: "ui-icons-v2" !important;
}

.icf-bars:before {
  content: "\e90b";
}

.icf-search:before {
  content: "\e96e";
}

.icf-comments-o:before {
  content: "\e924";
}

.icf-user-o:before {
  content: "\e98d";
}

.icf-cog-o:before {
  content: "\e91d";
}

.pif-chromecast:before {
  content: "\e902";
}

.pif-pause:before {
  content: "\e910";
}

.pif-camera:before {
  content: "\e913";
}

.pif-download:before {
  content: "\e904";
}

.pif-settings:before {
  content: "\e919";
}

.pif-full-screen:before {
  content: "\e906";
}

.pif-full-screen-animated {
  display: inline-block;
  height: 1em;
  width: 1em;
  position: relative;
}

.pif-full-screen-animated span {
  height: 0.5em;
  overflow: hidden;
  position: absolute;
  transition: transform 0.1s ease-in-out;
  width: 0.5em;
}

.pif-full-screen-animated span:before {
  content: "\e906";
  display: inline-block;
  height: 1em;
  position: absolute;
  width: 1em;
}

.pif-full-screen-animated span:nth-child(1),
.pif-full-screen-animated span:nth-child(1):before {
  left: 0;
  top: 0;
}

.pif-full-screen-animated span:nth-child(2),
.pif-full-screen-animated span:nth-child(2):before {
  right: 0;
  top: 0;
}

.pif-full-screen-animated span:nth-child(3),
.pif-full-screen-animated span:nth-child(3):before {
  bottom: 0;
  left: 0;
}

.pif-full-screen-animated span:nth-child(4),
.pif-full-screen-animated span:nth-child(4):before {
  bottom: 0;
  right: 0;
}

/* header */
.vp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  border-bottom: 1px solid #ddd;
  background: #fff;
}

.vp-header-left,
.vp-header-center,
.vp-header-right {
  display: flex;
  align-items: center;
  gap: 15px;
  flex: 1;
}

.vp-header-center {
  justify-content: center;
}

.vp-header-right {
  justify-content: flex-end;
}

.vp-logo {
  height: 34px;
  cursor: pointer;
}

.vp-header .icon-f {
  font-size: 20px;
  color: #111;
  cursor: pointer;
  display: none;
}

/* custom svg header icons */
.vp-hicon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  cursor: pointer;
}

.vp-hicon svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: #111;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
}

/* top settings icon = same as player icon */
.vp-hicon-player .player-icon-f {
  font-size: 26px;   /* было ~16 → стало как в плеере */
  line-height: 1;
  display: block;
}

/* title block */
.vp-title-section {
  padding: 12px 15px;
}

.vp-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 10px 0;
  line-height: 1.3;
  color: #111;
}

.badge-time {
  background: #888;
  color: #fff;
  font-size: 11px;
  padding: 2px 5px;
  border-radius: 3px;
  vertical-align: middle;
  margin-left: 5px;
  font-weight: 400;
}

.badge-hd {
  background: #de2600;
  color: #fff;
  font-size: 11px;
  padding: 2px 5px;
  border-radius: 3px;
  vertical-align: middle;
  margin-left: 2px;
  font-weight: 700;
}

.vp-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
  align-items: center;
}

.tag-model {
  display: flex;
  align-items: center;
  background: #111;
  color: #fff;
  font-size: 13px;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.tag-model span {
  background: #fff;
  color: #111;
  font-size: 11px;
  padding: 1px 4px;
  border-radius: 2px;
  margin-left: 6px;
  font-weight: 400;
}

.tag-model.red {
  background: #de2600 !important;
}

.tag-model.red span {
  color: #de2600 !important;
}

.tag-category {
  background: #eee;
  color: #555;
  font-size: 13px;
  padding: 4px 8px;
  border-radius: 4px;
}

.tag-icon {
  font-size: 14px;
  color: #888;
  padding: 0 4px;
}

/* player */
.pl-video-container {
  width: 100%;
  aspect-ratio: 16 / 9;
  position: relative;
  overflow: hidden;
  background: #000;
  display: flex;
  cursor: pointer;
}

.pl-frame {
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.25s ease-out, filter 0.5s ease;
  z-index: 1;
}

.pl-frame.loading-state {
  opacity: 1;
  filter: blur(12px) brightness(0.55);
}

.pl-frame.is-ready {
  opacity: 1;
  filter: blur(0) brightness(1);
}

.pl-clone-back-btn {
  display: none;
  position: absolute;
  top: 15px;
  left: 15px;
  z-index: 50;
  width: 32px;
  height: 32px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.8));
}

.pl-clone-back-btn svg {
  width: 28px;
  height: 28px;
}

.pl-chromecast {
  position: absolute;
  top: 12px;
  right: 15px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  text-shadow: 1px 1px 3px #000;
}

.pl-chromecast .player-icon-f {
  font-size: 26px;
  margin-bottom: 2px;
}

.pl-player-time {
  position: absolute;
  bottom: 50px;
  left: 15px;
  z-index: 20;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-shadow: 1px 1px 2px #000;
  letter-spacing: 0.5px;
  pointer-events: none;
}

.pl-play-btn {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.pl-play-btn.ready {
  opacity: 1;
  pointer-events: auto;
}

.pl-play-btn svg {
  width: 90px;
  height: 90px;
  fill: #fff !important;
  stroke: #fff !important;
  stroke-width: 8px;
  stroke-linejoin: round;
  opacity: 0.95;
  filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.6));
}

.pl-bottom-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 50px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  box-sizing: border-box;
  background: linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.85) 0,
    rgba(0, 0, 0, 0.4) 50%,
    transparent 100%
  );
  z-index: 5;
  pointer-events: none;
}

.pl-vol-btn {
  width: 34px;
  height: 34px;
  fill: #fff;
  margin-right: 10px;
  cursor: pointer;
  pointer-events: auto;
  filter: drop-shadow(1px 1px 2px #000);
}

.pl-progress-track {
  flex-grow: 1;
  height: 3px;
  background: rgba(255, 255, 255, 0.3);
  position: relative;
  cursor: pointer;
  margin-right: 15px;
  pointer-events: auto;
  display: flex;
  align-items: center;
}

.pl-buffer-preload {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: rgba(255, 255, 255, 0.6);
  width: 0;
  animation: fakeBufferAnim 12s ease-out forwards;
  z-index: 1;
}

@keyframes fakeBufferAnim {
  0% {
    width: 15%;
  }
  20% {
    width: 45%;
  }
  60% {
    width: 75%;
  }
  100% {
    width: 95%;
  }
}

.pl-progress-filled {
  width: 15%;
  height: 100%;
  background: #de2600;
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
}

.pl-progress-filled.active {
  animation: moveProgressLine 30s linear forwards;
}

.pl-progress-dot {
  width: 12px;
  height: 12px;
  background: #de2600;
  border-radius: 50%;
  position: absolute;
  right: -6px;
  top: -4.5px;
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
  z-index: 3;
}

@keyframes moveProgressLine {
  from {
    width: 15%;
  }
  to {
    width: 35%;
  }
}

.player-icon-f {
  color: #fff;
  text-shadow:
    0.03em 0.03em 0.1em #000,
    0 0 0.5em rgba(0, 0, 0, 0.5),
    0 0 1em rgba(0, 0, 0, 0.5);
}

.buttons-bar {
  display: flex;
  align-items: center;
  pointer-events: auto;
}

.buttons-bar > * {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
}

.buttons-bar > .is-disabled {
  opacity: 0.3;
  cursor: default;
}

.autoplay-btn {
  background: none;
  position: relative;
  cursor: pointer;
}

.autoplay-btn .autoplay-bar-bt {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.autoplay-btn .toggle-background-bar {
  height: 0.625em;
  width: 1.5em;
  border-radius: 0.5em;
  background: rgba(255, 255, 255, 0.3);
}

.autoplay-btn .toggle-circle {
  height: 0.8333em;
  width: 0.8333em;
  background: rgba(51, 51, 51, 0.9);
  box-shadow: 0 0 3px #000;
  border-radius: 50%;
  position: absolute;
  left: calc(50% - 0.8333em / 2);
  top: 50%;
  transform: translateY(-50%) translateX(-50%);
}

.autoplay-btn .toggle-circle .player-icon-f {
  color: rgba(255, 255, 255, 0.9);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.5em;
  text-shadow: none;
}

.video-hd-mark {
  position: absolute;
  top: 0;
  right: -8px;
  color: #fff;
  font-weight: 700;
  background: #de2600;
  padding: 1px 3px;
  border-radius: 2px;
  line-height: 1;
}

.pl-loader {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  z-index: 5;
}

.pl-loader::after {
  content: "";
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* actions */
.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 10px 15px 15px;
  border-bottom: 1px solid #ddd;
  text-align: center;
}

.action-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  position: relative;
}

.action-item .icon {
  width: 20px;
  height: 20px;
  fill: #555;
}

.action-item .value {
  font-size: 14px;
  font-weight: 700;
  color: #000;
}

.action-item .label {
  font-size: 11px;
  color: #555;
  font-weight: 700;
}

.comment-bubble {
  position: relative;
}

.comment-badge {
  position: absolute;
  top: -8px;
  right: -12px;
  background: #de2600;
  color: #fff;
  border-radius: 10px;
  padding: 1px 5px;
  font-size: 10px;
  font-weight: 700;
}

.like-bar {
  width: 100%;
  height: 3px;
  background: #ccc;
  margin-top: 2px;
}

.like-fill {
  height: 100%;
  background: #111;
  width: 96%;
}

/* tabs */
.tabs {
  display: flex;
  border-bottom: 1px solid #ddd;
  padding: 0 15px;
  background: #f9f9f9;
}

.tab {
  padding: 12px 10px;
  font-size: 13px;
  color: #777;
  cursor: pointer;
}

.tab.active {
  color: #000;
  font-weight: 700;
  border-bottom: 2px solid #000;
}

/* related */
.related-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px 10px;
  padding: 15px;
  background: #f4f4f4;
}

.related-item {
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.thumb-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #ccc;
  overflow: hidden;
  margin-bottom: 6px;
}

.thumb-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-badge-hd {
  position: absolute;
  top: 5px;
  right: 5px;
  font-size: 10px;
  padding: 2px 4px;
  background: #de2600;
  color: #fff;
  font-weight: 700;
  border-radius: 2px;
}

.thumb-badge-time {
  position: absolute;
  bottom: 5px;
  right: 5px;
  font-size: 11px;
  padding: 2px 4px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border-radius: 2px;
}

.thumb-title {
  font-size: 13px;
  color: #111;
  line-height: 1.3;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.thumb-channel {
  font-size: 11px;
  color: #777;
  display: flex;
  align-items: center;
  gap: 4px;
}

.thumb-channel span {
  text-decoration: underline;
}

/* modal */
.pl-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  font-family: sans-serif;
}

.pl-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
}

.pl-modal-content {
  position: relative;
  z-index: 100000;
  width: 85%;
  max-width: 300px;
  background: #1c1c1c;
  border: 1px solid #333;
  border-radius: 14px;
  padding: 24px;
  text-align: center;
  color: #fff;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

.pl-modal-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 10px;
}

.pl-modal-desc {
  font-size: 14px;
  color: #aaa;
  margin-bottom: 20px;
  line-height: 1.4;
}

.pl-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pl-btn {
  border: none;
  outline: none;
  padding: 12px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}

.pl-btn-primary {
  background: #de2600;
  color: #fff;
}

.pl-btn-secondary {
  background: #333;
  color: #ccc;
}

@keyframes playPulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.5));
  }
  100% {
    transform: scale(1);
  }
}

.clone-mode .pl-play-btn.ready svg {
  animation: playPulse 1.5s infinite ease-in-out;
}

.hidden-cam-effect {
  filter: grayscale(100%) contrast(125%) brightness(85%) !important;
}

/* dark mode */
@media (prefers-color-scheme: dark) {
  .fade-in-wrapper {
    background: #181818;
  }

  .vp-header {
    background: #181818;
    border-bottom-color: #333;
  }

  .vp-logo {
    filter: invert(1) hue-rotate(180deg);
  }

  .vp-title {
    color: #eee;
  }

  .tag-category {
    background: #333;
    color: #bbb;
  }

  .action-bar {
    border-bottom-color: #333;
  }

  .action-item .value {
    color: #eee;
  }

  .action-item .label {
    color: #aaa;
  }

  .action-item .icon {
    fill: #aaa;
  }

  .like-bar {
    background: #444;
  }

  .like-fill {
    background: #eee;
  }

  .tabs {
    background: #181818;
    border-bottom-color: #333;
  }

  .tab {
    color: #aaa;
  }

  .tab.active {
    color: #eee;
    border-bottom-color: #eee;
  }

  .related-grid {
    background: #111;
  }

  .thumb-title {
    color: #eee;
  }

  .thumb-wrapper {
    background: #222;
  }

  .vp-hicon svg {
    stroke: #eee;
  }

  .vp-hicon-player .player-icon-f {
    color: #eee;
  }
}

/* rtl fixes */
html[dir="rtl"] body,
html[dir="rtl"] .fade-in-wrapper {
  direction: ltr !important;
}

html[dir="rtl"] .pl-video-container,
html[dir="rtl"] .vp-header,
html[dir="rtl"] .pl-bottom-controls,
html[dir="rtl"] .action-bar,
html[dir="rtl"] .tabs,
html[dir="rtl"] .related-grid {
  direction: ltr !important;
}

html[dir="rtl"] .vp-title-section,
html[dir="rtl"] .vp-title,
html[dir="rtl"] .vp-tags-row,
html[dir="rtl"] .tag-model,
html[dir="rtl"] .tag-category,
html[dir="rtl"] .thumb-title,
html[dir="rtl"] .thumb-channel,
html[dir="rtl"] .pl-modal-content,
html[dir="rtl"] #m-title,
html[dir="rtl"] #m-desc,
html[dir="rtl"] #m-stay,
html[dir="rtl"] #m-leave {
  direction: rtl !important;
  text-align: right !important;
}
