/* lgreko.world player: fixed bottom dock, queue popover, now-playing sheet, floating video.
   Relies on: --accent (fallback below; site.css may override), --player-h (set by player.js),
   optional --font-text / --font-display from site.css. All classes are prefixed .lgp- */

:where(:root) {
  --accent: #ff5b2e;
  --player-h: 0px;
}

html.lgp-lock { overflow: hidden; }

.lgp {
  --lgp-solid: #0b0b0c;
  --lgp-bg: rgba(11, 11, 12, 0.82);
  --lgp-panel: #131315;
  --lgp-fg: #f3f1ec;
  --lgp-muted: #a3a19c;
  --lgp-dim: rgba(243, 241, 236, 0.16);
  --lgp-line: rgba(243, 241, 236, 0.09);
  --lgp-hover: rgba(243, 241, 236, 0.07);
  --lgp-acc: var(--accent, #ff5b2e);
  --lgp-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --lgp-safe-b: env(safe-area-inset-bottom, 0px);
  --lgp-safe-t: env(safe-area-inset-top, 0px);
  color: var(--lgp-fg);
  font-family: var(--font-text, inherit);
  -webkit-tap-highlight-color: transparent;
}
.lgp *, .lgp *::before, .lgp *::after { box-sizing: border-box; }

/* ---------- buttons ---------- */
.lgp-btn {
  appearance: none;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--lgp-muted);
  cursor: pointer;
  position: relative;
  transition: color 0.15s, background-color 0.15s, transform 0.15s var(--lgp-ease);
}
.lgp-btn svg { width: 20px; height: 20px; display: block; }
.lgp-btn:hover { color: var(--lgp-fg); }
.lgp-btn:active { transform: scale(0.92); }
.lgp button:focus-visible,
.lgp-range:focus-visible {
  outline: 2px solid var(--lgp-acc);
  outline-offset: 2px;
}
.lgp-mode[aria-pressed="true"],
.lgp-mode[aria-expanded="true"] { color: var(--lgp-acc); }
.lgp-mode[aria-pressed="true"]::after,
.lgp-mode[aria-expanded="true"]::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: currentColor;
}
.lgp-play {
  width: 40px;
  height: 40px;
  background: var(--lgp-fg);
  color: var(--lgp-solid);
}
.lgp-play svg { width: 18px; height: 18px; }
.lgp-play:hover { color: var(--lgp-solid); transform: scale(1.05); }
.lgp-play:active { transform: scale(0.95); }
.lgp-play--plain { background: transparent; color: var(--lgp-fg); }
.lgp-play--plain:hover { color: var(--lgp-fg); }
.lgp-play--plain svg { width: 22px; height: 22px; }
/* Autoplay was blocked: make "tap to play" obvious. */
.lgp.is-blocked .lgp-play { box-shadow: 0 0 0 3px var(--lgp-acc); }
.lgp.is-blocked .lgp-play--plain { color: var(--lgp-acc); box-shadow: none; }

/* ---------- ranges (seek + volume) ---------- */
.lgp-range {
  --lgp-pct: 0%;
  --lgp-fill: var(--lgp-fg);
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 18px;
  margin: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 4px;
  touch-action: none;
}
.lgp-range:hover, .lgp-range:focus-visible { --lgp-fill: var(--lgp-acc); }
.lgp-range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(to right, var(--lgp-fill) var(--lgp-pct), var(--lgp-dim) var(--lgp-pct));
}
.lgp-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -4px;
  border: 0;
  border-radius: 50%;
  background: var(--lgp-fg);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.15s;
}
.lgp-range::-moz-range-track { height: 4px; border-radius: 4px; background: var(--lgp-dim); }
.lgp-range::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--lgp-fill); }
.lgp-range::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 0;
  border-radius: 50%;
  background: var(--lgp-fg);
  opacity: 0;
  transition: opacity 0.15s;
}
.lgp-range:hover::-webkit-slider-thumb, .lgp-range:focus-visible::-webkit-slider-thumb, .lgp-range:active::-webkit-slider-thumb { opacity: 1; }
.lgp-range:hover::-moz-range-thumb, .lgp-range:focus-visible::-moz-range-thumb, .lgp-range:active::-moz-range-thumb { opacity: 1; }
@media (hover: none) {
  .lgp-range::-webkit-slider-thumb { opacity: 1; }
  .lgp-range::-moz-range-thumb { opacity: 1; }
}

/* ---------- dock ---------- */
.lgp-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  padding: 10px 20px calc(10px + var(--lgp-safe-b));
  background: var(--lgp-bg);
  -webkit-backdrop-filter: saturate(150%) blur(20px);
  backdrop-filter: saturate(150%) blur(20px);
  border-top: 1px solid var(--lgp-line);
  transform: translateY(calc(100% + 12px));
  visibility: hidden;
  transition: transform 0.55s var(--lgp-ease), visibility 0s linear 0.55s;
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .lgp-bar { background: var(--lgp-solid); }
}
.lgp.is-ready .lgp-bar {
  transform: none;
  visibility: visible;
  transition: transform 0.55s var(--lgp-ease), visibility 0s;
}

.lgp-meta {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 4px;
  margin: -4px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.lgp-meta:hover .lgp-title { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--lgp-dim); }
.lgp-art {
  position: relative;
  flex: none;
  width: 52px;
  height: 52px;
  overflow: hidden;
  border-radius: 6px;
  background: #1a1a1d;
  box-shadow: 0 0 0 1px var(--lgp-line) inset;
}
.lgp-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* i.ytimg hqdefault is 4:3 with letterbox bars around a 16:9 picture: zoom to hide them. */
.lgp-art.is-yt img, .lgp-sheet__bg.is-yt img { transform: scale(1.34); }
.lgp-meta__text { display: grid; gap: 3px; min-width: 0; }
.lgp-title, .lgp-sub {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  margin: 0;
}
.lgp-title { font-size: 14px; font-weight: 600; line-height: 1.3; color: var(--lgp-fg); }
.lgp-sub { font-size: 12px; line-height: 1.3; color: var(--lgp-muted); }

.lgp-center { display: grid; gap: 4px; justify-items: center; min-width: 0; }
.lgp-transport { display: flex; align-items: center; justify-content: center; gap: 10px; }

.lgp-seek {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 620px;
}
.lgp-time {
  font-size: 11px;
  line-height: 1;
  color: var(--lgp-muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.lgp-time--cur { text-align: right; }

.lgp-right { display: flex; align-items: center; justify-content: flex-end; gap: 4px; min-width: 0; }
.lgp-vol { display: flex; align-items: center; gap: 4px; }
.lgp-vol__range { width: 96px; }

.lgp-compact { display: none; align-items: center; gap: 2px; }
.lgp-bar__progress { display: none; }

/* ---------- queue popover (desktop) ---------- */
.lgp-queue {
  position: fixed;
  z-index: 65;
  right: 16px;
  bottom: calc(var(--player-h) + 12px);
  width: min(380px, calc(100vw - 32px));
  max-height: min(62vh, 560px);
  display: flex;
  flex-direction: column;
  background: var(--lgp-panel);
  border: 1px solid var(--lgp-line);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px);
  transition: opacity 0.2s, transform 0.3s var(--lgp-ease), visibility 0s linear 0.3s;
}
.lgp.is-queue .lgp-queue {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 0.2s, transform 0.3s var(--lgp-ease), visibility 0s;
}
.lgp-queue__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 10px 10px 18px;
  border-bottom: 1px solid var(--lgp-line);
}
.lgp-queue__ctx { display: grid; gap: 2px; min-width: 0; }
.lgp-ctx { font-size: 14px; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.lgp-eyebrow {
  margin: 0;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--lgp-muted);
}
.lgp-queue .lgp-list { overflow-y: auto; overscroll-behavior: contain; padding: 6px; }
.lgp-queue .lgp-list, .lgp-sheet__inner { scrollbar-width: thin; scrollbar-color: rgba(243, 241, 236, 0.18) transparent; }

.lgp-list { list-style: none; margin: 0; padding: 0; }
.lgp-qi {
  appearance: none;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px 8px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--lgp-fg);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.lgp-qi:hover { background: var(--lgp-hover); }
.lgp-qi__n, .lgp-qi__eq { grid-column: 1; grid-row: 1; justify-self: center; }
.lgp-qi__n { font-size: 12px; color: var(--lgp-muted); font-variant-numeric: tabular-nums; }
.lgp-qi__t { grid-column: 2; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.lgp-qi__d { grid-column: 3; font-size: 12px; color: var(--lgp-muted); font-variant-numeric: tabular-nums; }
.lgp-qi.is-current .lgp-qi__t { color: var(--lgp-acc); font-weight: 600; }
.lgp-qi.is-current .lgp-qi__n { color: var(--lgp-acc); }
.lgp-qi.is-bad { opacity: 0.4; }
.lgp-qi.is-bad .lgp-qi__t { text-decoration: line-through; }

.lgp-qi__eq { display: none; align-items: flex-end; gap: 2px; height: 12px; }
.lgp-qi__eq i { display: block; width: 3px; height: 100%; border-radius: 1px; background: var(--lgp-acc); transform-origin: bottom; animation: lgp-eq 0.9s ease-in-out infinite; }
.lgp-qi__eq i:nth-child(2) { animation-delay: -0.3s; }
.lgp-qi__eq i:nth-child(3) { animation-delay: -0.6s; }
.lgp-qi.is-live .lgp-qi__eq { display: flex; }
.lgp-qi.is-live .lgp-qi__n { visibility: hidden; }
@keyframes lgp-eq {
  0%, 100% { transform: scaleY(0.3); }
  50% { transform: scaleY(1); }
}

/* ---------- now-playing sheet ---------- */
.lgp-sheet {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: var(--lgp-solid);
  overflow: hidden;
  visibility: hidden;
  transform: translateY(100%);
  transition: transform 0.45s var(--lgp-ease), visibility 0s linear 0.45s;
}
.lgp.is-sheet .lgp-sheet {
  visibility: visible;
  transform: none;
  transition: transform 0.45s var(--lgp-ease), visibility 0s;
}
.lgp-sheet__bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.lgp-sheet__bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(60px) saturate(1.3);
  opacity: 0.32;
}
.lgp-sheet__bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(11, 11, 12, 0.2), var(--lgp-solid) 75%);
}
.lgp-sheet__inner {
  position: relative;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  max-width: 480px;
  margin: 0 auto;
  padding: calc(8px + var(--lgp-safe-t)) 16px calc(32px + var(--lgp-safe-b));
}
.lgp-sheet__head {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}
.lgp-sheet__head .lgp-btn { width: 44px; height: 44px; }
.lgp-sheet__head .lgp-btn svg { width: 24px; height: 24px; }
.lgp-sheet__ctx { display: grid; gap: 2px; text-align: center; min-width: 0; }
.lgp-sheet__ctx .lgp-ctx { font-size: 13px; }
.lgp-sheet .lgp-sheet__art {
  width: min(100%, 52vh);
  height: auto;
  aspect-ratio: 1 / 1;
  margin: 0 auto 24px;
  border-radius: 12px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.55), 0 0 0 1px var(--lgp-line) inset;
}
.lgp-sheet__meta { display: grid; gap: 4px; margin-bottom: 18px; }
.lgp-sheet__meta .lgp-title {
  font-family: var(--font-display, inherit);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.lgp-sheet__meta .lgp-sub { font-size: 15px; }
.lgp-sheet__inner .lgp-seek { max-width: none; grid-template-columns: 1fr 1fr; row-gap: 6px; }
.lgp-sheet__inner .lgp-seek__range { grid-column: 1 / -1; grid-row: 1; height: 24px; }
.lgp-sheet__inner .lgp-time--cur { grid-row: 2; text-align: left; }
.lgp-sheet__inner .lgp-time--dur { grid-row: 2; text-align: right; }
.lgp-transport--lg { justify-content: space-between; margin: 14px 0 8px; gap: 4px; }
.lgp-transport--lg .lgp-btn { width: 48px; height: 48px; }
.lgp-transport--lg .lgp-btn svg { width: 24px; height: 24px; }
.lgp-transport--lg .lgp-play { width: 68px; height: 68px; }
.lgp-transport--lg .lgp-play svg { width: 28px; height: 28px; }
.lgp-sheet__vol { display: flex; justify-content: center; margin: 4px 0 8px; }
.lgp-sheet__vol .lgp-vol__range { width: 160px; }
.lgp-sheet__queue { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--lgp-line); }
.lgp-sheet__queue .lgp-eyebrow { margin: 0 8px 8px; }
.lgp-sheet__queue .lgp-list { margin: 0 -8px; }

/* ---------- floating video ---------- */
.lgp-video {
  position: fixed;
  z-index: 70;
  right: 16px;
  bottom: calc(var(--player-h) + 12px);
  width: 360px;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--lgp-line);
  /* Kept on-screen at full size (just transparent) so browsers never throttle or block playback. */
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px) scale(0.97);
  transition: opacity 0.25s, transform 0.35s var(--lgp-ease);
}
.lgp.is-video .lgp-video { opacity: 1; pointer-events: auto; transform: none; }
.lgp.is-queue.is-video .lgp-video { right: calc(min(380px, 100vw - 32px) + 28px); }
.lgp.is-sheet .lgp-video { z-index: 90; }
.lgp-video__frame, .lgp-video__host, .lgp-video iframe { display: block; width: 100%; height: 100%; border: 0; }
.lgp-video__close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  opacity: 0;
}
.lgp-video__close svg { width: 18px; height: 18px; }
.lgp-video:hover .lgp-video__close, .lgp-video__close:focus-visible { opacity: 1; }
.lgp-video__close:hover { color: #fff; background: rgba(0, 0, 0, 0.8); }
@media (hover: none) { .lgp-video__close { opacity: 1; } }

/* ---------- toast ---------- */
.lgp-toast {
  position: fixed;
  z-index: 95;
  left: 50%;
  bottom: calc(var(--player-h) + 16px);
  max-width: calc(100vw - 32px);
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--lgp-fg);
  color: var(--lgp-solid);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 0.2s, transform 0.3s var(--lgp-ease);
}
.lgp-toast:empty { display: none; }
.lgp-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.lgp.is-sheet .lgp-toast { bottom: calc(24px + var(--lgp-safe-b)); }

/* ---------- mid widths ---------- */
@media (max-width: 1024px) and (min-width: 721px) {
  .lgp-bar { grid-template-columns: minmax(0, 1fr) auto minmax(0, auto); gap: 16px; }
  .lgp-center { width: min(46vw, 420px); }
  .lgp-vol__range { width: 72px; }
}

/* ---------- compact (phones) ---------- */
@media (max-width: 720px) {
  .lgp-bar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 8px 6px calc(8px + var(--lgp-safe-b)) 12px;
    cursor: pointer;
  }
  .lgp-center, .lgp-right { display: none; }
  .lgp-compact { display: flex; }
  .lgp-compact .lgp-btn { width: 44px; height: 44px; color: var(--lgp-fg); }
  .lgp-compact .lgp-btn svg { width: 22px; height: 22px; }
  .lgp-art { width: 44px; height: 44px; }
  .lgp-bar__progress {
    display: block;
    position: absolute;
    left: 0;
    right: 0;
    top: -1px;
    height: 2px;
    background: var(--lgp-dim);
    overflow: hidden;
  }
  .lgp-bar__progress span {
    display: block;
    height: 100%;
    background: var(--lgp-acc);
    transform-origin: left;
    transform: scaleX(0);
  }
  .lgp-queue { left: 16px; right: 16px; width: auto; }
  .lgp-video { left: 12px; right: 12px; width: auto; bottom: calc(var(--player-h) + 10px); }
  .lgp.is-queue.is-video .lgp-video { right: 12px; }
  .lgp.is-sheet .lgp-video { top: calc(var(--lgp-safe-t) + 64px); bottom: auto; z-index: 90; }
}

/* Touch devices can't set YouTube volume reliably (iOS ignores it): keep mute only
   (the sheet's mute button stays, so a saved muted state can be undone on phones). */
@media (hover: none) and (pointer: coarse) {
  .lgp-vol__range { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .lgp *, .lgp *::before, .lgp *::after {
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
    animation: none !important;
  }
  .lgp-qi__eq i { transform: scaleY(0.7); }
}
