/*!
 * L2G Player — оформление собственного видеоплеера Language2Go.
 * Все переменные объявлены внутри .l2g-player, внешних зависимостей нет.
 */

.l2g-player {
  --l2g-primary: #7c2d91;
  --l2g-accent: #a63cc4;
  --l2g-panel: rgba(22, 14, 28, .64);
  --l2g-panel-line: rgba(255, 255, 255, .12);
  --l2g-text: #ffffff;
  --l2g-text-soft: rgba(255, 255, 255, .72);
  --l2g-track: rgba(255, 255, 255, .26);
  --l2g-buffer: rgba(255, 255, 255, .46);
  --l2g-menu: rgba(26, 17, 33, .92);
  --l2g-radius: 12px;
  --l2g-shadow: 0 16px 40px rgba(18, 8, 26, .38);
  --l2g-backdrop:
    radial-gradient(62% 82% at 78% 16%, rgba(166, 60, 196, .5) 0%, rgba(166, 60, 196, 0) 70%),
    linear-gradient(135deg, #2b0f45 0%, #4a1a6b 52%, #1f2a5a 100%);

  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0;
  background: var(--l2g-backdrop);
  border-radius: var(--l2g-radius);
  overflow: hidden;
  isolation: isolate;
  color: var(--l2g-text);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  outline: none;
  aspect-ratio: 16 / 9;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.l2g-player:focus-visible { box-shadow: 0 0 0 3px var(--l2g-accent); }
.l2g-player.is-fullscreen { border-radius: 0; aspect-ratio: auto; width: 100%; height: 100%; }
.l2g-player * { box-sizing: border-box; }

@supports not (aspect-ratio: 16 / 9) {
  .l2g-player::before { content: ""; display: block; padding-top: 56.25%; }
}

.l2g-stage { position: absolute; inset: 0; display: block; background: transparent; }
/* затемнение под панелью — чтобы белые иконки читались на светлом кадре */
.l2g-stage::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 45%;
  z-index: 2;
  background: linear-gradient(to top, rgba(13, 9, 17, .7), rgba(13, 9, 17, 0));
  pointer-events: none;
  transition: opacity .2s ease;
}
.l2g-player.is-idle .l2g-stage::after { opacity: 0; }
.l2g-player video,
.l2g-stage > video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  background: transparent;
  object-fit: contain;
  border-radius: 0;
}

.l2g-player.is-playing .l2g-stage { cursor: pointer; }
.l2g-player.is-playing.is-idle { cursor: none; }

.l2g-icon { width: 20px; height: 20px; display: block; flex: 0 0 auto; pointer-events: none; }

/* ------------------------------------------------------------- верхняя плашка */

.l2g-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 3;
  display: none;
  padding: 14px 16px 34px;
  background: linear-gradient(to bottom, rgba(13, 9, 17, .68), rgba(13, 9, 17, 0));
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.l2g-player.has-title .l2g-top { display: block; }
.l2g-title {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .5);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------------------------------------------------- центральная кнопка */

.l2g-bigplay {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
  width: 76px;
  height: 76px;
  min-width: 76px;
  padding: 0 0 0 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--l2g-primary), var(--l2g-accent));
  color: #fff;
  box-shadow: var(--l2g-shadow);
  cursor: pointer;
  transition: transform .18s ease, opacity .18s ease;
}
.l2g-bigplay .l2g-icon { width: 34px; height: 34px; }
.l2g-bigplay:hover { transform: translate(-50%, -50%) scale(1.06); }
.l2g-bigplay:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.l2g-player.is-started .l2g-bigplay,
.l2g-player.is-playing .l2g-bigplay,
.l2g-player.is-empty .l2g-bigplay,
.l2g-player.has-error .l2g-bigplay { opacity: 0; pointer-events: none; transform: translate(-50%, -50%) scale(.85); }

/* ------------------------------------------------------- загрузка и заглушка */

.l2g-spin {
  display: block;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .22);
  border-top-color: var(--l2g-accent);
  animation: l2g-spin 900ms linear infinite;
}
@keyframes l2g-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .l2g-spin { animation-duration: 2.4s; } }

.l2g-buffering,
.l2g-empty {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  pointer-events: none;
}
.l2g-player.is-buffering .l2g-buffering { display: flex; }
.l2g-player.is-empty .l2g-empty { display: flex; background: rgba(13, 9, 17, .55); }
.l2g-player.is-empty.is-buffering .l2g-buffering { display: none; }
.l2g-empty p { margin: 0; font-size: 14px; color: var(--l2g-text-soft); }

/* ------------------------------------------------------------------- ошибка */

.l2g-error {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px 20px 68px;
  text-align: center;
  background: rgba(13, 9, 17, .86);
}
.l2g-player.has-error .l2g-error { display: flex; }
.l2g-error .l2g-icon { width: 38px; height: 38px; color: #f0a58f; }
.l2g-error-text { margin: 0; max-width: 460px; font-size: 15px; color: #fff; }
.l2g-retry {
  min-height: 40px;
  padding: 10px 22px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(140deg, var(--l2g-primary), var(--l2g-accent));
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.l2g-retry:hover { filter: brightness(1.1); }
.l2g-retry:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

/* -------------------------------------------------------------------- панель */

.l2g-bar {
  position: absolute;
  left: 10px; right: 10px; bottom: 10px;
  z-index: 7;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px 8px;
  border-radius: var(--l2g-radius);
  border: 1px solid var(--l2g-panel-line);
  background: var(--l2g-panel);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  backdrop-filter: blur(14px) saturate(150%);
  box-shadow: var(--l2g-shadow);
  transition: opacity .2s ease, transform .2s ease;
}
.l2g-player.is-fullscreen .l2g-bar { left: 16px; right: 16px; bottom: 16px; }

.l2g-player.is-idle .l2g-bar,
.l2g-player.is-idle .l2g-top { opacity: 0; transform: translateY(8px); pointer-events: none; }
.l2g-player.is-idle .l2g-top { transform: translateY(-8px); }
.l2g-player.is-paused .l2g-bar,
.l2g-player.has-menu .l2g-bar { opacity: 1; transform: none; pointer-events: auto; }
.l2g-player.has-error .l2g-bar { opacity: .45; }

.l2g-row { display: flex; align-items: center; gap: 2px; min-width: 0; overflow: hidden; }
.l2g-spacer { flex: 1 1 auto; min-width: 0; }

/* ------------------------------------------------------------------- кнопки */

.l2g-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--l2g-text);
  font: inherit;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.l2g-btn:hover { background: rgba(255, 255, 255, .14); }
.l2g-btn:active { background: rgba(255, 255, 255, .2); }
.l2g-btn:focus-visible { outline: 2px solid var(--l2g-accent); outline-offset: -2px; background: rgba(255, 255, 255, .14); }
.l2g-btn[aria-expanded="true"] { background: rgba(255, 255, 255, .18); color: #fff; }

.l2g-rate { width: auto; min-width: 44px; padding: 0 10px; font-size: 13px; font-weight: 700; letter-spacing: .2px; }

.l2g-time {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--l2g-text);
  white-space: nowrap;
}
.l2g-time-sep, .l2g-dur { color: var(--l2g-text-soft); }

/* --------------------------------------------------------- полоса прогресса */

.l2g-seek { position: relative; padding: 0 4px; }
.l2g-seek-hit {
  position: relative;
  display: flex;
  align-items: center;
  height: 22px;
  cursor: pointer;
  touch-action: none;
}
.l2g-seek.is-disabled .l2g-seek-hit { cursor: default; }
.l2g-seek-track {
  position: relative;
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: var(--l2g-track);
  overflow: visible;
  transition: height .12s ease;
}
.l2g-seek-hit:hover .l2g-seek-track,
.l2g-player.is-dragging .l2g-seek-track { height: 7px; }
.l2g-seek-buffer,
.l2g-seek-fill {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  border-radius: 999px;
  width: 0;
}
.l2g-seek-buffer { background: var(--l2g-buffer); }
.l2g-seek-fill { background: linear-gradient(90deg, var(--l2g-primary), var(--l2g-accent)); }
.l2g-seek-knob {
  position: absolute;
  top: 50%; left: 0;
  width: 14px; height: 14px;
  margin-left: -7px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .45);
  transform: translateY(-50%) scale(0);
  transition: transform .12s ease;
}
.l2g-seek-hit:hover .l2g-seek-knob,
.l2g-seek:focus-within .l2g-seek-knob,
.l2g-player.is-dragging .l2g-seek-knob,
.l2g-player.is-touch .l2g-seek-knob { transform: translateY(-50%) scale(1); }
.l2g-seek.is-disabled .l2g-seek-knob { transform: translateY(-50%) scale(0); }
.l2g-seek:focus-visible { outline: none; }
.l2g-seek:focus-visible .l2g-seek-track { outline: 2px solid var(--l2g-accent); outline-offset: 4px; }

.l2g-seek-tip {
  position: absolute;
  bottom: 26px;
  left: 0;
  transform: translateX(-50%);
  padding: 4px 8px;
  border-radius: 8px;
  background: var(--l2g-menu);
  border: 1px solid var(--l2g-panel-line);
  color: #fff;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease;
}
.l2g-seek-hit:hover ~ .l2g-seek-tip,
.l2g-player.is-dragging .l2g-seek-tip { opacity: 1; }
.l2g-seek.is-disabled .l2g-seek-tip { display: none; }

/* --------------------------------------------------------------- громкость */

.l2g-volume { display: flex; align-items: center; flex: 0 0 auto; }
.l2g-vol {
  display: flex;
  align-items: center;
  height: 40px;
  width: 64px;
  padding: 0 8px 0 2px;
  cursor: pointer;
  touch-action: none;
  overflow: hidden;
  transition: width .18s ease, padding .18s ease, opacity .18s ease;
}
.l2g-vol-track { position: relative; width: 100%; height: 5px; border-radius: 999px; background: var(--l2g-track); }
.l2g-vol-fill { position: absolute; top: 0; left: 0; bottom: 0; width: 100%; border-radius: 999px; background: #fff; }
.l2g-vol-knob {
  position: absolute;
  top: 50%; left: 100%;
  width: 12px; height: 12px;
  margin-left: -6px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .45);
  transform: translateY(-50%);
}
.l2g-vol:focus-visible { outline: none; }
.l2g-vol:focus-visible .l2g-vol-track { outline: 2px solid var(--l2g-accent); outline-offset: 4px; }

@media (hover: hover) and (pointer: fine) {
  .l2g-vol { width: 0; padding: 0; opacity: 0; }
  .l2g-volume:hover .l2g-vol,
  .l2g-volume:focus-within .l2g-vol { width: 64px; padding: 0 8px 0 2px; opacity: 1; }
}

/* -------------------------------------------------------------------- меню */

.l2g-menu {
  position: absolute;
  bottom: 62px;
  left: 0;
  z-index: 9;
  min-width: 176px;
  max-width: calc(100% - 16px);
  max-height: 62%;
  overflow-y: auto;
  padding: 6px;
  border-radius: var(--l2g-radius);
  border: 1px solid var(--l2g-panel-line);
  background: var(--l2g-menu);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  backdrop-filter: blur(16px) saturate(150%);
  box-shadow: var(--l2g-shadow);
}
.l2g-player.is-fullscreen .l2g-menu { bottom: 74px; }
.l2g-menu-header {
  padding: 8px 10px 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--l2g-text-soft);
}
.l2g-menu-divider { height: 1px; margin: 6px 4px; background: var(--l2g-panel-line); }
.l2g-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--l2g-text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.l2g-menu-item:hover { background: rgba(255, 255, 255, .12); }
.l2g-menu-item:focus-visible { outline: 2px solid var(--l2g-accent); outline-offset: -2px; background: rgba(255, 255, 255, .12); }
.l2g-menu-mark { display: flex; align-items: center; justify-content: center; width: 18px; flex: 0 0 18px; color: var(--l2g-accent); }
.l2g-menu-mark .l2g-icon { width: 16px; height: 16px; }
.l2g-menu-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* --------------------------------------------------------------- minimal */

.l2g-mode-minimal .l2g-bar { padding: 4px 6px 6px; }

/* ------------------------------------------------------------ узкий экран */

@media (max-width: 560px) {
  .l2g-bar { left: 6px; right: 6px; bottom: 6px; }
  .l2g-time { padding: 0 4px; font-size: 12px; }
  .l2g-rate { min-width: 40px; padding: 0 6px; }
  .l2g-vol { width: 48px; }
  .l2g-bigplay { width: 64px; height: 64px; min-width: 64px; }
  .l2g-bigplay .l2g-icon { width: 28px; height: 28px; }
  .l2g-title { font-size: 13px; }
}

/* на узком экране в режиме full убираем то, что дублируется в меню-шестерёнке:
   громкость (на телефоне есть аппаратные кнопки), «картинка в картинке» и скорость */
@media (max-width: 480px) {
  .l2g-mode-full .l2g-volume,
  .l2g-mode-full .l2g-pip { display: none; }
}
@media (max-width: 420px) {
  .l2g-mode-full .l2g-rate { display: none; }
  /* совсем узко: оставляем только текущее время, длительность видна по полосе */
  .l2g-mode-full .l2g-time-sep,
  .l2g-mode-full .l2g-dur { display: none; }
  .l2g-mode-full .l2g-row { gap: 0; }
  .l2g-mode-full .l2g-bar { padding: 6px 4px 6px; }
}

/* ----------------------------------------------------------- тёмная тема */

[data-theme="dark"] .l2g-player {
  --l2g-primary: #9a49b2;
  --l2g-accent: #c58ad6;
  --l2g-panel: rgba(16, 10, 21, .66);
  --l2g-panel-line: rgba(255, 255, 255, .1);
  --l2g-menu: rgba(18, 12, 24, .94);
  --l2g-shadow: 0 18px 48px rgba(0, 0, 0, .45);
  background: #0a070d;
}
[data-theme="dark"] .l2g-stage,
[data-theme="dark"] .l2g-player video { background: #0a070d; }

/* --------------------------------------------------------- печать/контраст */

@media print { .l2g-bar, .l2g-top, .l2g-bigplay { display: none !important; } }
