/* Резервные emoji загружаются с сайта, когда в системных шрифтах нет символа. */
@font-face {
  font-family: 'OpenMoji Black';
  src: url('../emoji/OpenMoji-black-17.0.0.woff2') format('woff2');
  font-display: swap;
  /* Включаем символы emoji, модификаторы, флаги и последовательности с цифрами. */
  unicode-range:
    U+0023, U+002A, U+0030-0039, U+00A9, U+00AE, U+200D, U+203C, U+2049, U+20E3,
    U+2122, U+2139, U+2194-2199, U+21A9-21AA, U+2300-23FF, U+24C2, U+25A0-27BF,
    U+2934-2935, U+2B05-2B55, U+3030, U+303D, U+3297, U+3299, U+FE0F,
    U+1F000-1FAFF, U+E0020-E007F;
}

:root {
  --video-ui-fonts: system-ui, 'Segoe UI', Arial, 'Apple Color Emoji', 'Segoe UI Emoji',
    'Noto Color Emoji', 'Twemoji Mozilla', 'OpenMoji Black', sans-serif;
}

/* Pure CSS задаёт собственные шрифты сетки. Карточки и комментарии наследуют общий набор. */
#contents { font-family: var(--video-ui-fonts); }
#contents .pure-g, #contents [class*='pure-u'] { font-family: inherit; }

/* Общие кнопки главной, шапки и профиля. */
.button-primary, .button-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid #bec2ff44;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.button-primary { color: white; background: linear-gradient(103deg, #ff6878, #e92268); border-color: #ff8aa075; box-shadow: 0 4px 18px #e83b6a55; }
.button-primary:hover { background: linear-gradient(103deg, #fa7987, #f13380); }
.button-secondary { background: #252945d9; }
.button-secondary:hover { background: #353963; }
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  gap: 8px;
  height: 40px;
  border: 1px solid #343652;
  border-radius: 12px;
  background: #22233a;
  color: #ede9fa;
  cursor: pointer;
}
.icon-button { width: 40px; padding: 0; }
.icon-button:hover { border-color: #9177c3; background: #2a2945; }

/* Цвета основных действий включаются классом на штатных кнопках Invidious. */
body[data-gg-page] #contents .video-button-primary.pure-button {
  border-color: var(--video-button-accent, #f877a290);
  background: var(--video-button-bg, linear-gradient(110deg, #ef5379, #ca357f));
  color: #fff;
}
.button-primary:disabled, .button-secondary:disabled { opacity: .55; }

/* Размер аватара задаёт блок, в котором отображается автор. */
.video-avatar, #contents .channel-profile img.video-avatar {
  display: block;
  flex: none;
  width: var(--video-avatar-size, 27px);
  height: var(--video-avatar-size, 27px);
  border-radius: var(--video-avatar-radius, 50%);
  object-fit: cover;
}

/* Плитки Nuxt и карточки Invidious используют одинаковую обложку и бейдж. */
.video-card-cover { position: relative; overflow: hidden; }
.video-card-cover > a, .video-card-cover img { display: block; width: 100%; height: 100%; }
.video-card-cover img { object-fit: cover; }
.gg-playback-meter { position: absolute; z-index: 2; inset: auto 0 0; display: block; height: 3px; background: #100d18a8; pointer-events: none; }
.gg-playback-meter > span { display: block; height: 100%; background: #ff648c; }
.video-card-cover:has(.gg-playback-meter) .watched-indicator { display: none; }
#contents .native-video-cover { width: 100%; aspect-ratio: var(--video-card-aspect, 16 / 9); overflow: hidden; }
.video-card-label, #contents .video-card-label {
  margin: 0;
  padding: var(--video-card-label-padding, 3px 5px);
  border-radius: var(--video-card-label-radius, 5px);
  background: var(--video-card-label-bg, #0f1021ed);
  color: #fff;
  font-size: var(--video-card-label-size, 11px);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

/* Активный эфир узнаётся по одной плашке на всех обложках. */
.video-card-label.is-live {
  --video-card-label-bg: #c8103b;
  --video-card-label-padding: 4px 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 750;
  text-transform: uppercase;
  white-space: nowrap;
}
.video-card-label.is-live::before {
  content: '';
  flex: none;
  width: 5px;
  height: 5px;
  margin-inline: 1px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 1px #ffffff87;
}
.video-card-label.is-live.video-label { inset: auto 6px 6px auto; }
#contents .thumbnail > .bottom-right-overlay:has(.video-card-label.is-live) {
  position: absolute;
  right: 6px;
  bottom: 6px;
}

/* Общий вид названия, автора и даты сохраняет структуру исходных строк. */
#contents .video-card-title p {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  min-height: var(--video-card-title-height, 2.62em);
  margin: 0;
  color: var(--video-ink);
  font-size: var(--video-card-title-size, 14px);
  font-weight: var(--video-card-title-weight, 680);
  line-height: 1.31;
}
#contents .video-card-byline .channel-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#contents .video-card-meta > div { flex: 0 0 auto; width: auto; margin: 0; }
#contents .video-card-meta .video-data { margin: 0; color: var(--video-muted); font-size: 11px; line-height: 1.35; text-align: start; }
#contents .video-card-meta:has(.video-data[hidden]):not(:has(.video-data:not([hidden]))) { display: none; }

/* Общие скругления и отступы для ссылок и кнопок перелистывания. */
.video-pagination .button-secondary, #contents .native-pagination a { border-radius: 8px; }
#contents .native-pagination { margin: 10px 0; padding: 0; }
#contents .native-pagination:not(:has(a[href], button)) { display: none; }
#contents .native-pagination a {
  padding: 7px 9px;
  border: 1px solid var(--video-stroke);
  background: var(--video-panel);
  font-size: 13px;
}
@media (max-width: 460px) {
  #contents .native-pagination a { padding-inline: 6px; font-size: 11px; }
}

/* Общий диалог сохранения для страницы ролика и Shorts. */
.gg-library-save {
  box-sizing: border-box;
  width: min(420px, calc(100% - 24px));
  max-height: calc(100% - 24px);
  padding: 20px;
  overflow: auto;
  border: 1px solid #444763;
  border-radius: 16px;
  color: #f5f3fb;
  background: #1b1d30;
  font: 400 14px/1.45 'GGGOLD Sidebar', Inter, system-ui, sans-serif;
}
.gg-library-save::backdrop { background: #090913b8; }
.gg-library-save-heading { display: flex; gap: 14px; align-items: center; justify-content: space-between; }
.gg-library-save-heading h2 { margin: 0; font-size: 20px; }
.gg-library-save-choices { display: grid; gap: 6px; margin: 14px 0; }
.gg-library-save-choice { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; background: #282b44; overflow-wrap: anywhere; }
.gg-library-save input[type="checkbox"] { width: 17px; height: 17px; margin: 0; flex: none; accent-color: #d9b5ff; }
.gg-library-save-form:not([hidden]), .gg-library-save-form label { display: grid; gap: 8px; }
.gg-library-save-form input { min-width: 0; padding: 9px; border: 1px solid #555574; border-radius: 8px; background: #141626; color: inherit; font: inherit; }
.gg-library-save button { color: inherit; border: 1px solid #444763; border-radius: 8px; padding: 7px 11px; background: #282b44; font: inherit; cursor: pointer; }
.gg-library-save button:hover { background: #363954; }
.gg-library-save button.video-button-primary { background: #923b73; border-color: #a6518a; }
.gg-library-save :focus-visible { outline: 2px solid #d9b5ff; outline-offset: 2px; }
.gg-library-save-loading { margin: 10px 0 0; }
.gw-actions button[aria-pressed="true"] { color: #ffd1e4; background: #513047; }

/* Алерт закреплён у края экрана и не занимает место под кнопками. */
.gg-notification {
  --notification-accent: #83c6ff;
  --notification-border: #406389;
  --notification-background: #182d44;
  position: fixed;
  z-index: 1000;
  inset: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) auto auto;
  box-sizing: border-box;
  width: max-content;
  max-width: min(360px, calc(100% - 32px));
  margin: 0;
  padding: 11px 15px;
  border: 1px solid var(--notification-border);
  border-inline-start: 4px solid var(--notification-accent);
  border-radius: 10px;
  background: var(--notification-background);
  color: #f5f3fb;
  box-shadow: 0 6px 24px #0908148c;
  font: 500 14px/1.45 'GGGOLD Sidebar', Inter, system-ui, sans-serif;
  overflow-wrap: anywhere;
  pointer-events: none;
}
.gg-notification[data-kind="success"] {
  --notification-accent: #6de3a5;
  --notification-border: #3f795a;
  --notification-background: #193a2b;
}
.gg-notification[data-kind="error"], .gg-notification[role="alert"] {
  --notification-accent: #ff8b94;
  --notification-border: #954a54;
  --notification-background: #461f29;
}
.gg-notification[data-kind="warning"] {
  --notification-accent: #ffd978;
  --notification-border: #826735;
  --notification-background: #403318;
}

/* Ленты используют компактные карточки и отступы сетки из общего оформления. */
[data-gg-page="feed"] #contents :is(.feed-menu, .gg-feed-filters) {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 7px;
  margin: 0 0 14px;
}
[data-gg-page="feed"] #contents :is(.feed-menu, .gg-feed-filters) > :is(a, b) {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 11px;
  border: 1px solid var(--video-stroke);
  border-radius: 8px;
  background: var(--video-panel);
  color: var(--video-ink);
  font: 650 13px/1.4 var(--video-ui-fonts);
  text-transform: none;
  white-space: nowrap;
}
[data-gg-page="feed"] #contents :is(.feed-menu, .gg-feed-filters) [aria-current],
[data-gg-page="feed"] #contents :is(.feed-menu, .gg-feed-filters) a:hover {
  border-color: var(--video-accent);
  background: var(--video-raised);
  color: var(--video-accent);
}
[data-gg-page="feed"] #contents > .gg-feed-filters + .h-box:has(> hr:only-child) { display: none; }
[data-gg-page="feed"] #contents > .gg-feed-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
  gap: 15px;
  margin-block: 14px 24px;
}
[data-gg-page="feed"] #contents .gg-feed-grid > div { min-width: 0; width: auto; }
[data-gg-page="feed"] #contents .gg-feed-grid > div > .h-box {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  box-sizing: border-box;
  margin: 0;
  padding: 9px;
  border: 1px solid var(--video-stroke);
  border-radius: 13px;
  background: var(--video-panel);
}
[data-gg-page="feed"] #contents .gg-feed-grid .video-card-cover { background: var(--video-raised); border-radius: 8px; }
[data-gg-page="feed"] #contents .gg-feed-grid .video-card-row { margin: 0; min-width: 0; }
[data-gg-page="feed"] #contents .gg-feed-grid .video-card-title:not(:has(a)),
[data-gg-page="feed"] #contents .gg-feed-grid .video-card-meta > div:not(:has(.video-data)) { display: none; }
[data-gg-page="feed"] #contents .gg-feed-grid .video-card-title a { display: block; }
[data-gg-page="feed"] #contents .gg-feed-grid .video-card-byline { display: flex; justify-content: space-between; align-items: center; flex-wrap: nowrap; }
[data-gg-page="feed"] #contents .gg-feed-grid .video-card-byline .flex-left { flex: 1; }
[data-gg-page="feed"] #contents .gg-feed-grid .channel-name { margin: 0; font-size: 12px; }
[data-gg-page="feed"] #contents .gg-feed-grid .icon-buttons { display: flex; gap: 4px; font-size: 13px; }
[data-gg-page="feed"] #contents .gg-feed-grid .video-card-meta { justify-content: flex-start; gap: 4px 8px; }
[data-gg-page="feed"] #contents .gg-feed-grid .video-card-meta .video-data { font-weight: 530; }
[data-gg-page="feed"] #contents .gg-feed-status { margin-block: 16px; color: var(--video-muted); }

@media (max-width: 1180px) {
  [data-gg-page="feed"] #contents > .gg-feed-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 650px) {
  [data-gg-page="feed"] #contents > .gg-feed-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
}
@media (max-width: 460px) {
  [data-gg-page="feed"] #contents > .gg-feed-grid { grid-template-columns: minmax(0, 1fr); }
}
