:root {
  --bg-main: #07090d;
  --bg-deep: #0e1219;
  --bg-soft: #151c28;
  --ink: #f4f5f7;
  --ink-soft: rgba(244, 245, 247, 0.8);
  --glass-fill: rgba(255, 255, 255, 0.09);
  --glass-fill-strong: rgba(255, 255, 255, 0.16);
  --glass-border: rgba(255, 255, 255, 0.22);
  --glass-border-soft: rgba(255, 255, 255, 0.17);
  --shadow-soft: 0 20px 40px rgba(0, 0, 0, 0.32);
  --shadow-strong: 0 28px 80px rgba(0, 0, 0, 0.45);
  --blur: blur(20px);
  --radius-xxl: 32px;
  --radius-xl: 26px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --container-width: min(1400px, 86vw);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

html {
  background-color: #07090d;
  scrollbar-gutter: stable;
}

body {
  position: relative;
  overflow-x: hidden;
  color: var(--ink);
  font-family: "Segoe UI", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  background:
    linear-gradient(140deg, rgba(6, 9, 13, 0.72), rgba(9, 13, 21, 0.82) 45%, rgba(14, 19, 29, 0.88) 100%),
    radial-gradient(1100px 700px at 8% 8%, rgba(84, 112, 168, 0.18) 0%, transparent 60%),
    radial-gradient(900px 620px at 92% 12%, rgba(122, 158, 207, 0.14) 0%, transparent 58%),
    radial-gradient(1200px 720px at 60% 110%, rgba(72, 86, 116, 0.22) 0%, transparent 70%),
    url("../img/background.png");
  background-position: center center, 8% 8%, 92% 12%, 60% 110%, center center;
  background-size: cover, auto, auto, auto, cover;
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat;
  background-attachment: fixed, scroll, scroll, scroll, fixed;
}

body.modal-open {
  overflow: hidden;
}

body:not(.view-library):not(.modal-open) {
  overflow: hidden;
}

.ambient {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  filter: blur(42px);
}

.ambient-a {
  width: min(38vw, 560px);
  height: min(38vw, 560px);
  left: -12vw;
  top: -16vh;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0));
}

.ambient-b {
  width: min(26vw, 420px);
  height: min(26vw, 420px);
  right: 4vw;
  top: 16vh;
  background: radial-gradient(circle, rgba(183, 215, 255, 0.2), rgba(183, 215, 255, 0));
}

.ambient-c {
  width: min(30vw, 440px);
  height: min(30vw, 440px);
  left: 40vw;
  bottom: -20vh;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0));
}

.site-shell {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  padding: 24px 0 44px;
}

.hero {
  --hero-lift: clamp(44px, 5.2vw, 86px);
  min-height: calc(100dvh - 68px + clamp(52px, 5vw, 92px));
  max-height: 1200px;
  overflow: hidden;
  opacity: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: clamp(42px, 5.8vh, 74px) 24px clamp(124px, 13vh, 198px);
  transform: translateY(calc(-1 * var(--hero-lift)));
  transition:
    transform 0.52s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.52s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform, opacity;
}

.hero-title-image {
  margin: 0;
  width: min(82vw, 1460px);
  height: auto;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 12px 36px rgba(0, 0, 0, 0.42));
  opacity: 0;
  transform: translateY(24px) scale(0.985);
  animation: heroReveal 1.35s cubic-bezier(0.2, 1, 0.3, 1) 0.05s forwards;
  transition:
    opacity 0.52s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.52s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform, opacity;
}

@keyframes heroReveal {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.hero-categories {
  margin-top: clamp(28px, 3.4vh, 42px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 2vw, 28px);
  flex-wrap: wrap;
  opacity: 0;
  transform: translateY(16px);
  animation: heroTabsReveal 0.92s cubic-bezier(0.2, 1, 0.3, 1) 0.18s forwards;
  transition:
    opacity 0.52s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.52s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}

body.hero-intro-complete .hero-title-image {
  animation: none;
  opacity: 1;
  transform: translateY(0) scale(1);
}

body.hero-intro-complete .hero-categories {
  animation: none;
  opacity: 1;
  transform: translateY(0);
}

@keyframes heroTabsReveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.category-pill {
  width: clamp(132px, 10.5vw, 168px);
  height: clamp(54px, 4.9vw, 66px);
  border-radius: 24px;
  border: 1px solid var(--glass-border);
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.045) 46%, rgba(255, 255, 255, 0.085)),
    rgba(255, 255, 255, 0.065);
  color: #f7f9fc;
  font-family: "Segoe UI", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(17px, 1.3vw, 21px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.03em;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.46),
    inset 0 -14px 28px rgba(255, 255, 255, 0.06),
    0 16px 32px rgba(0, 0, 0, 0.36);
  backdrop-filter: var(--blur) saturate(1.3);
  -webkit-backdrop-filter: var(--blur) saturate(1.3);
  transition:
    transform 0.34s cubic-bezier(0.2, 0.9, 0.2, 1),
    box-shadow 0.34s ease,
    filter 0.34s ease,
    border-color 0.34s ease,
    opacity 0.34s ease;
}

.category-pill:hover,
.category-pill:focus-visible {
  transform: translateY(-2px) scale(1.05);
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.52),
    inset 0 -16px 28px rgba(255, 255, 255, 0.07),
    0 20px 36px rgba(0, 0, 0, 0.4);
  filter: brightness(1.08);
}

.category-pill.active {
  border-color: rgba(255, 255, 255, 0.48);
  filter: brightness(1.1);
}

.category-pill:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.65);
  outline-offset: 3px;
}

.library-section {
  width: var(--container-width);
  margin: 0 auto;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.56s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity;
}

.library-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  padding: 16px 18px;
  border-radius: 28px;
}

.glass-card {
  border: 1px solid var(--glass-border-soft);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.06) 55%, rgba(255, 255, 255, 0.09)),
    var(--glass-fill);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    var(--shadow-soft);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
}

.active-chip-wrap {
  justify-self: center;
  display: flex;
  align-items: center;
}

.library-switcher {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 10px;
}

.library-contacts {
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar-pill,
.control-btn,
.center-play-btn,
.resume-actions .glass-icon-btn {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.045) 65%, rgba(255, 255, 255, 0.08)),
    rgba(255, 255, 255, 0.06);
  color: #fbfcfd;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.42),
    0 12px 24px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(16px) saturate(1.25);
  -webkit-backdrop-filter: blur(16px) saturate(1.25);
  cursor: pointer;
  transition:
    transform 0.28s ease,
    filter 0.28s ease,
    border-color 0.28s ease,
    box-shadow 0.28s ease;
}

.toolbar-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  width: clamp(132px, 10.5vw, 168px);
  height: clamp(54px, 4.9vw, 66px);
  border-radius: 22px;
  padding: 0 16px;
  font-family: "Segoe UI", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(15px, 1.2vw, 19px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: none;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 0.54s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.54s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.28s ease,
    box-shadow 0.28s ease,
    filter 0.28s ease;
}

.toolbar-pill[hidden],
.switch-pill[hidden] {
  display: none !important;
}

.contact-pill {
  width: clamp(52px, 4.4vw, 62px);
  min-width: clamp(52px, 4.4vw, 62px);
  height: clamp(52px, 4.4vw, 62px);
  padding: 0;
  border-radius: 18px;
}

.contact-pill-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.social-icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
  flex: 0 0 auto;
  opacity: 0.96;
}

.switch-pill.active,
.active-chip {
  border-color: rgba(255, 255, 255, 0.5);
  filter: brightness(1.1);
}

.active-chip {
  pointer-events: none;
}

.active-chip.is-hidden {
  opacity: 0;
}

.toolbar-pill:hover,
.toolbar-pill:focus-visible,
.glass-icon-btn:hover,
.glass-icon-btn:focus-visible,
.control-btn:hover,
.control-btn:focus-visible,
.resume-actions .glass-icon-btn:hover,
.resume-actions .glass-icon-btn:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.4);
  filter: brightness(1.08);
}

.glass-icon-btn {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.045) 65%, rgba(255, 255, 255, 0.08)),
    rgba(255, 255, 255, 0.06);
  color: #fbfcfd;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 10px 22px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(16px) saturate(1.25);
  -webkit-backdrop-filter: blur(16px) saturate(1.25);
  cursor: pointer;
  min-height: 42px;
  border-radius: 14px;
  padding: 0 14px;
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition:
    transform 0.28s ease,
    filter 0.28s ease,
    border-color 0.28s ease,
    box-shadow 0.28s ease;
}

.library-grid-wrap {
  margin-top: 24px;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(22px, 2vw, 30px);
}

.library-grid.layout-shorts {
  grid-template-columns: repeat(3, minmax(180px, 240px));
  justify-content: center;
}

.video-card {
  position: relative;
  isolation: isolate;
  padding: 14px;
  border-radius: 30px;
  width: 100%;
  transition:
    transform 0.32s cubic-bezier(0.2, 0.9, 0.2, 1),
    box-shadow 0.32s ease,
    border-color 0.32s ease;
}

.video-card.video-card--short {
  max-width: 240px;
  justify-self: center;
}

.video-card:hover,
.video-card:focus-within {
  transform: scale(1.05);
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    var(--shadow-strong);
}

.video-preview {
  --video-clip-radius: 24px;
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: var(--video-clip-radius);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(10, 14, 21, 0.72);
  isolation: isolate;
  contain: paint;
  cursor: pointer;
}

.video-card.video-card--short .video-preview {
  aspect-ratio: 9 / 16;
}

.video-clip {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: var(--video-clip-radius, inherit);
  clip-path: inset(0 round var(--video-clip-radius, 24px));
  -webkit-clip-path: inset(0 round var(--video-clip-radius, 24px));
  isolation: isolate;
  background: #05070b;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  filter: none !important;
  mix-blend-mode: normal !important;
}

.preview-video-clip {
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.preview-video-clip,
.player-video-clip {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  filter: none !important;
  mix-blend-mode: normal !important;
}

.card-preview-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center center;
  border-radius: var(--video-clip-radius, 24px);
  background: #05070b;
  transform: none !important;
  backface-visibility: hidden;
  pointer-events: none;
  z-index: 1;
}

.video-artifact-mask {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 2;
  background: transparent;
  mix-blend-mode: normal;
}

.preview-artifact-mask {
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.card-preview-video::-webkit-media-controls,
.card-preview-video::-webkit-media-controls-enclosure,
.card-preview-video::-webkit-media-controls-overlay-play-button,
.card-preview-video::-webkit-media-controls-start-playback-button {
  display: none !important;
  -webkit-appearance: none;
}

.preview-sheen {
  display: none;
}

.preview-loader-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
  background: rgba(6, 8, 12, 0.14);
  transition: opacity 0.26s ease;
}

.video-card.preview-loading .preview-loader-overlay {
  opacity: 1;
}

.video-card.preview-ready .preview-loader-overlay {
  opacity: 0;
}

.preview-loader-snake {
  --loader-size: 32px;
  --loader-thickness: 2.2px;
  width: var(--loader-size);
  height: var(--loader-size);
  border-radius: 50%;
  position: relative;
  /* Monochrome snake with fading tail */
  background: conic-gradient(
    from 30deg,
    rgba(255, 255, 255, 0.95) 0deg,
    rgba(255, 255, 255, 0.7) 60deg,
    rgba(255, 255, 255, 0.4) 140deg,
    rgba(255, 255, 255, 0.15) 220deg,
    transparent 280deg,
    transparent 360deg
  );
  -webkit-mask: radial-gradient(
    farthest-side,
    transparent calc(100% - var(--loader-thickness)),
    #000 calc(100% - var(--loader-thickness) + 0.5px)
  );
  mask: radial-gradient(
    farthest-side,
    transparent calc(100% - var(--loader-thickness)),
    #000 calc(100% - var(--loader-thickness) + 0.5px)
  );
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.12));
  animation: previewSnakeSpin 0.78s linear infinite;
}

@keyframes previewSnakeSpin {
  to {
    transform: rotate(1turn);
  }
}

.duration-chip,
.progress-track {
  z-index: 2;
}

.duration-chip {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 6px 10px;
  border-radius: 12px;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: #ffffff;
  font-weight: 600;
  background: rgba(8, 11, 16, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.24);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.progress-track {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
  overflow: hidden;
}

.progress-fill {
  display: block;
  width: 0%;
  height: 100%;
  background: rgba(255, 255, 255, 0.95);
  border-radius: inherit;
  transition: width 0.24s ease;
}

.video-body {
  margin-top: 14px;
  padding: 2px 4px 8px;
}

.video-title {
  margin: 0;
  font-size: 19px;
  line-height: 1.3;
  font-weight: 500;
  color: var(--ink);
  word-break: break-word;
}

.video-meta {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.4;
}

.empty-state {
  grid-column: 1 / -1;
  border-radius: 28px;
  padding: 30px 26px;
  text-align: center;
}

.empty-state h2 {
  margin: 0 0 10px;
  font-family: "Didot", "Bodoni MT", "Times New Roman", serif;
  font-size: clamp(32px, 3.2vw, 48px);
  font-weight: 400;
  line-height: 1;
}

.empty-state p {
  margin: 0;
  color: var(--ink-soft);
}

.player-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
}

.player-overlay[hidden] {
  display: none;
}

.player-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 8, 12, 0.72);
}

.player-modal {
  --player-shell-pad: 20px;
  position: relative;
  z-index: 1;
  width: fit-content;
  max-width: 98vw;
  border-radius: 30px;
  padding: var(--player-shell-pad);
  background: rgba(12, 16, 24, 0.9);
  border-color: rgba(255, 255, 255, 0.16);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    0 18px 56px rgba(0, 0, 0, 0.5);
}

.player-modal.glass-card,
.player-modal .glass-card {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.player-close-btn {
  position: absolute;
  right: calc(var(--player-shell-pad) + 18px + env(safe-area-inset-right, 0px));
  top: calc(var(--player-shell-pad) + 18px + env(safe-area-inset-top, 0px));
  z-index: 3;
}

.player-stage {
  --video-clip-radius: 26px;
  position: relative;
  border-radius: var(--video-clip-radius);
  overflow: visible;
  border: 0;
  isolation: isolate;
  width: min(78vw, 1420px);
  height: calc(min(78vw, 1420px) / 1.7777778);
  max-height: 84vh;
  background: transparent;
}

.player-video-clip {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: 0;
  pointer-events: none;
  background: #04060a;
}

.player-stage:focus-visible {
  outline: 1px solid rgba(255, 255, 255, 0.28);
  outline-offset: 2px;
}

#playerVideo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: var(--video-clip-radius, 26px);
  background: transparent;
  transform: none !important;
  pointer-events: none;
}

.player-artifact-mask {
  box-shadow:
    inset 0 0 0 1px rgba(4, 7, 11, 0.92),
    inset 0 0 0 2px rgba(4, 7, 11, 0.52),
    inset 0 0 14px rgba(4, 7, 11, 0.2);
}

#playerVideo::-webkit-media-controls,
#playerVideo::-webkit-media-controls-enclosure,
#playerVideo::-webkit-media-controls-overlay-play-button,
#playerVideo::-webkit-media-controls-start-playback-button {
  display: none !important;
  -webkit-appearance: none;
}

.center-play-btn {
  position: absolute;
  left: 50%;
  top: 54%;
  z-index: 31;
  transform: translate(-50%, -50%);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.96;
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.center-play-btn:hover,
.center-play-btn:focus-visible {
  transform: translate(-50%, -50%) scale(1.035);
  border-color: rgba(255, 255, 255, 0.45);
  filter: brightness(1.08);
}

.center-play-btn.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.92);
}

.player-controls {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 30;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  padding: 14px 14px 12px;
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.03) 68%, rgba(255, 255, 255, 0.06)),
    rgba(10, 14, 21, 0.7);
  border-color: rgba(255, 255, 255, 0.2);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

.player-modal .glass-icon-btn,
.player-modal .control-btn,
.player-modal .center-play-btn,
.player-modal .resume-actions .glass-icon-btn {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 8px 20px rgba(0, 0, 0, 0.28);
}

.timeline-wrap {
  margin-bottom: 10px;
}

.timeline-input,
.volume-input {
  width: 100%;
  accent-color: #ffffff;
}

.timeline-input {
  height: 4px;
}

.controls-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.icon-control-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  min-width: 42px;
  padding: 0;
  line-height: 1;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.player-icon {
  position: relative;
  display: inline-block;
  width: 16px;
  height: 16px;
}

.center-play-btn .player-icon {
  width: 20px;
  height: 20px;
}

.player-icon-play::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 6px 0 6px 10px;
  border-color: transparent transparent transparent rgba(255, 255, 255, 0.95);
}

.center-play-btn .player-icon-play::before {
  left: 7px;
  top: 4px;
  border-width: 7px 0 7px 11px;
}

.player-icon-pause::before,
.player-icon-pause::after {
  content: "";
  position: absolute;
  top: 2px;
  width: 4px;
  height: 12px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.95);
}

.player-icon-pause::before {
  left: 3px;
}

.player-icon-pause::after {
  right: 3px;
}

.center-play-btn .player-icon-pause::before,
.center-play-btn .player-icon-pause::after {
  top: 3px;
  width: 5px;
  height: 14px;
}

.center-play-btn .player-icon-pause::before {
  left: 4px;
}

.center-play-btn .player-icon-pause::after {
  right: 4px;
}

.seek-icon-btn {
  width: 48px;
  min-width: 48px;
}

.seek-icon-svg {
  width: 26px;
  height: 26px;
  display: block;
  overflow: visible;
}

.seek-icon-svg .seek-arc,
.seek-icon-svg .seek-head {
  fill: none;
  stroke: rgba(255, 255, 255, 0.95);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.seek-icon-svg .seek-arc {
  stroke-width: 1.9;
}

.seek-icon-svg .seek-head {
  stroke-width: 1.9;
}

.seek-icon-svg .seek-digit {
  fill: rgba(255, 255, 255, 0.98);
  font-size: 12.6px;
  font-weight: 600;
  text-anchor: middle;
  dominant-baseline: middle;
  font-family: "Segoe UI", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
}

.controls-block {
  display: flex;
  align-items: center;
  gap: 8px;
}

.controls-main {
  justify-content: flex-start;
}

.controls-time {
  justify-content: center;
  min-width: 132px;
}

.controls-extra {
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.control-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: 12px;
  padding: 0 12px;
  font-size: 13px;
  letter-spacing: 0.03em;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
}

#timeLabel {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.98);
  white-space: nowrap;
}

.volume-wrap,
.speed-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 5px 8px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.23);
  background: rgba(255, 255, 255, 0.085);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-sizing: border-box;
}

.volume-wrap span,
.speed-wrap span {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.9);
}

.volume-input {
  width: 92px;
  height: 3px;
}

.volume-input::-webkit-slider-thumb {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffffff;
  border: 0;
}

.volume-input::-moz-range-thumb {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffffff;
  border: 0;
}

#speedSelect {
  min-width: 70px;
  min-height: 28px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(8, 12, 18, 0.56);
  color: #fbfcfd;
  padding: 4px 8px;
  font-size: 14px;
  font-weight: 600;
}

.resume-prompt {
  position: absolute;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  border-radius: 16px;
  padding: 12px 14px;
  z-index: 32;
  min-width: 260px;
  max-width: min(92%, 420px);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: rgba(10, 14, 21, 0.9);
}

.resume-text {
  margin: 0 0 10px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.95);
}

.resume-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.flying-category {
  position: fixed;
  z-index: 40;
  pointer-events: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transform-origin: center center;
  will-change: transform, opacity;
}

body.hero-transitioning .hero {
  opacity: 0;
  transform: translateY(calc(-1 * var(--hero-lift) - 26px));
  pointer-events: none;
}

body.hero-transitioning .hero-title-image {
  animation: none;
  transform: translateY(-42px) scale(0.965);
  opacity: 0;
}

body.hero-transitioning .hero-categories {
  animation: none;
  opacity: 0;
  transform: translateY(-22px);
  pointer-events: none;
}

body.view-library .hero {
  opacity: 0;
  transform: translateY(calc(-1 * var(--hero-lift) - 26px));
  pointer-events: none;
}

body.view-library.hero-collapsed .hero {
  min-height: 0;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  overflow: hidden;
}

body.view-library .hero-title-image {
  animation: none;
  transform: translateY(-42px) scale(0.965);
  opacity: 0;
}

body.view-library .hero-categories {
  animation: none;
  opacity: 0;
  transform: translateY(-22px);
  pointer-events: none;
}

body.view-library .library-section {
  max-height: 10000px;
  overflow: visible;
  opacity: 1;
  pointer-events: auto;
}

body.toolbar-measuring .library-section {
  max-height: 10000px;
  overflow: visible;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: none;
}

body.toolbar-measuring .library-header #activeCategoryChip {
  transform: translateY(0) !important;
}

body.view-library .library-header .toolbar-pill {
  opacity: 1;
  transform: translateY(0);
}

body.view-library .library-header .library-contacts .contact-pill {
  transition-delay: 40ms;
}

body.view-library .library-header #activeCategoryChip {
  transition-delay: 90ms;
}

body.view-library .library-header .switch-pill {
  transition-delay: 140ms;
}

.player-modal--shorts .controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  flex-wrap: nowrap;
}

.player-modal--shorts .controls-main,
.player-modal--shorts .controls-time,
.player-modal--shorts .controls-extra {
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
}

.player-modal--shorts .controls-main {
  justify-content: flex-start;
  flex: 0 0 auto;
}

.player-modal--shorts .controls-time {
  justify-content: center;
  min-width: 70px;
  flex: 0 0 auto;
}

.player-modal--shorts .controls-extra {
  justify-content: flex-end;
  flex: 0 1 auto;
  min-width: 0;
  gap: 4px;
}

.player-modal--shorts .player-controls {
  left: 10px;
  right: 10px;
  bottom: 10px;
  padding: 7px 7px 6px;
}

.player-modal--shorts .center-play-btn {
  top: 56%;
  width: 52px;
  height: 52px;
}

.player-modal--shorts .control-btn {
  min-height: 30px;
  min-width: 30px;
  width: 30px;
  padding: 0;
}

.player-modal--shorts .seek-icon-btn {
  width: 32px;
  min-width: 32px;
}

.player-modal--shorts .seek-icon-svg {
  width: 19px;
  height: 19px;
}

.player-modal--shorts #timeLabel {
  font-size: 10px;
  letter-spacing: 0.02em;
}

.player-modal--shorts .volume-wrap,
.player-modal--shorts .speed-wrap {
  min-height: 28px;
  padding: 3px 5px;
  border-radius: 9px;
}

.player-modal--shorts .volume-wrap span,
.player-modal--shorts .speed-wrap span {
  display: none;
}

.player-modal--shorts .volume-input {
  width: 56px;
  height: 2px;
}

.player-modal--shorts #speedSelect {
  min-width: 54px;
  min-height: 24px;
  padding: 2px 6px;
  font-size: 13px;
}

@media (max-width: 980px) {
  .container {
    --container-width: 92vw;
  }

  .library-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .library-grid.layout-shorts {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
    justify-content: center;
  }

  .category-pill {
    width: clamp(110px, 18vw, 140px);
    height: clamp(48px, 6vw, 56px);
    font-size: clamp(15px, 1.4vw, 18px);
    border-radius: 20px;
  }

  .toolbar-pill {
    width: clamp(110px, 18vw, 140px);
    height: clamp(48px, 6vw, 56px);
    font-size: clamp(14px, 1.3vw, 16px);
  }

  .player-stage {
    max-height: 80vh;
  }

  .controls-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .controls-main,
  .controls-time,
  .controls-extra {
    justify-content: center;
  }
}

@media (max-width: 680px) {
  :root {
    --radius-xxl: 24px;
    --radius-xl: 20px;
  }

  .site-shell {
    padding-top: 16px;
  }

  .hero {
    --hero-lift: 24px;
    padding: clamp(32px, 8vh, 60px) 16px clamp(80px, 15vh, 120px);
  }

  .hero-title-image {
    width: 92vw;
  }

  .hero-categories {
    gap: 10px;
    margin-top: 32px;
  }

  .category-pill {
    width: calc(50% - 10px);
    min-width: 120px;
    height: 52px;
    border-radius: 18px;
    font-size: 16px;
  }

  .library-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    gap: 10px;
    border-radius: 20px;
  }

  .library-contacts {
    order: 1;
    gap: 8px;
  }

  .active-chip-wrap {
    order: 2;
  }

  .library-switcher {
    order: 3;
    width: 100%;
    justify-content: center;
    gap: 8px;
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  .toolbar-pill {
    width: auto;
    min-width: 80px;
    height: 42px;
    border-radius: 12px;
    font-size: 13px;
    padding: 0 12px;
  }

  .active-chip {
    height: 42px;
    min-width: 90px;
  }

  .contact-pill {
    width: 42px;
    min-width: 42px;
    height: 42px;
    border-radius: 12px;
  }

  .social-icon {
    width: 16px;
    height: 16px;
  }

  .library-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .library-grid.layout-shorts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .video-card {
    padding: 10px;
    border-radius: 20px;
  }

  .video-title {
    font-size: 16px;
  }

  .video-meta {
    font-size: 12px;
    margin-top: 4px;
  }

  .player-overlay {
    padding: 8px;
  }

  .player-modal {
    --player-shell-pad: 10px;
    max-width: 100vw;
    width: 100%;
    border-radius: 20px;
    padding: var(--player-shell-pad);
  }

  .player-stage {
    max-height: 70vh;
    border-radius: 16px;
  }

  .player-close-btn {
    min-height: 34px;
    height: 34px;
    padding: 0 10px;
    font-size: 11px;
    top: calc(var(--player-shell-pad) + 10px);
    right: calc(var(--player-shell-pad) + 10px);
  }

  .center-play-btn {
    width: 48px;
    height: 48px;
    top: 50%;
  }

  .player-controls {
    left: 6px;
    right: 6px;
    bottom: 6px;
    padding: 8px;
    border-radius: 14px;
  }

  .controls-time {
    min-width: 100px;
    font-size: 12px;
  }

  .volume-wrap {
    display: none; /* Hide volume on mobile as hardware buttons are preferred */
  }

  .speed-wrap {
    padding: 3px 6px;
    min-height: 30px;
  }

  .speed-wrap span {
    font-size: 10px;
  }

  #speedSelect {
    min-width: 60px;
    font-size: 12px;
    padding: 2px 4px;
  }

  .player-modal--shorts .controls-row {
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
  }

  .player-modal--shorts .controls-extra {
    width: 100%;
    justify-content: center;
  }

  .player-modal--shorts .controls-time {
    width: 100%;
    justify-content: center;
    margin: 4px 0;
  }
}

@media (max-width: 380px) {
  .library-grid.layout-shorts {
    grid-template-columns: 1fr;
  }

  .category-pill {
    width: 100%;
  }
}

body.hero-restoring .hero {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(calc(-1 * var(--hero-lift))) !important;
  pointer-events: auto !important;
}

body.hero-restoring .hero-title-image,
body.hero-restoring .hero-categories,
body.hero-restoring .hero-categories .category-pill {
  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;
  pointer-events: auto !important;
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass-card,
  .category-pill,
  .toolbar-pill,
  .glass-icon-btn,
  .control-btn,
  .center-play-btn,
  .resume-actions .glass-icon-btn,
  .duration-chip,
  .volume-wrap,
  .speed-wrap {
    background: rgba(20, 25, 34, 0.86);
    border-color: rgba(255, 255, 255, 0.18);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
