:root {
  --bg-void: #080b10;
  --bg-deep: #0d1117;
  --bg-surface: #161c25;
  --bg-elevated: #1e2733;
  --bg-hover: #252e3d;
  --bg-glass: rgba(22, 28, 37, 0.92);

  --accent: #3b82f6;
  --accent-bright: #60a5fa;
  --accent-dim: rgba(59, 130, 246, 0.18);
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --purple: #8b5cf6;
  --pink: #ec4899;

  --text-primary: #e8edf3;
  --text-secondary: #8a96a3;
  --text-muted: #4a5568;
  --text-accent: #60a5fa;

  --border: rgba(255, 255, 255, 0.07);
  --border-bright: rgba(255, 255, 255, 0.14);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.7);

  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --controls-h: 54px;
  --header-h: 52px;
  --seekbar-h: 5px;
  --seekbar-h-hover: 6px;
  --panel-w: 340px;
}

/*  Reset & Base  */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg-void);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/*  Page Layout  */
.ivp-page {
  width: 100%;
  max-width: 960px;
}

/*  Player Container  */
#ivp-container {
  position: relative;
  width: 100%;
  background: #000;
  overflow: hidden;
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--border);
  aspect-ratio: 16/9;
  user-select: none;
}

#ivp-container.ivp-locked {
  cursor: not-allowed;
}

#ivp-container.ivp-playing #ivp-btn-center-play {
  display: none;
}

/*  Video Element  */
#ivp-video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  background: #000;
}

/* Click zone (transparent overlay for click-to-play) */
#ivp-video-clickzone {
  position: absolute;
  inset: 0;
  z-index: 2;
  cursor: pointer;
}

/*  Spinner  */
#ivp-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
  z-index: 10;
  pointer-events: none;
}

#ivp-spinner.ivp-spinner--visible {
  display: block;
}

@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/*  Center Play Button  */
#ivp-btn-center-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  border: 2px solid rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s;
}

#ivp-btn-center-play:hover {
  background: rgba(59, 130, 246, 0.45);
  transform: translate(-50%, -50%) scale(1.1);
}

#ivp-btn-center-play svg {
  width: 28px;
  height: 28px;
}

/*  Controls Wrapper  */
#ivp-controls-wrapper {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  background: linear-gradient(to bottom,
      rgba(0, 0, 0, 0.6) 0%,
      transparent 22%,
      transparent 65%,
      rgba(0, 0, 0, 0.8) 100%);
}

#ivp-controls-wrapper.ivp-controls--visible {
  opacity: 1;
}

#ivp-container:not(.ivp-playing) #ivp-controls-wrapper {
  opacity: 1;
}

/*  Top Header Bar  */
#ivp-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0) 100%);
  z-index: 25;
  pointer-events: auto;
}

.ivp-video-info {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  left: 12px;
  max-width: calc(100% - 60px);
  min-width: 0;
}

.ivp-video-name {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ivp-video-subtitle-text {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/*  Top Right Menu  */
.ivp-top-menu {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  right: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/*  Controls Bar  */
#ivp-controls-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--controls-h);
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0) 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 1px;
  z-index: 25;
  pointer-events: auto;
}

/* Interaction Cooldown (0.25s) */
.ivp-controls--cooldown .ivp-btn:not(#ivp-btn-play),
.ivp-controls--cooldown .ivp-volume-group,
.ivp-controls--cooldown .ivp-top-menu {
  pointer-events: none !important;
  cursor: default !important;
}

/*  Seekbar  */
.ivp-seekbar-container {
  position: relative;
  height: 20px;
  display: flex;
  align-items: center;
  cursor: pointer;
  margin-bottom: 2px;
}

#ivp-seekbar {
  position: relative;
  width: 100%;
  height: var(--seekbar-h);
  background: rgba(255, 255, 255, 0.18);
  border-radius: 99px;
  transition: height 0.15s;
  overflow: visible;
  /* Ensure children don't block mouse events */
}

#ivp-seekbar>div {
  pointer-events: none;
}

.ivp-seekbar-container:hover #ivp-seekbar {
  height: var(--seekbar-h-hover);
}

#ivp-seekbar-buffer {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 99px;
  width: 0;
  transition: width 0.3s;
}

#ivp-seekbar-progress {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
  border-radius: 99px;
  width: 0;
  transition: width 0.1s;
}

#ivp-seekbar-thumb {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 0 10px rgba(0, 120, 255, 0.4);
  z-index: 5;
}

#ivp-seekbar-hover-thumb {
  position: absolute;
  top: 50%;
  width: 10px;
  height: 10px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  display: none;
  z-index: 4;
}

.ivp-seekbar-container:hover #ivp-seekbar-thumb,
.ivp-seeking #ivp-seekbar-thumb {
  transform: translate(-50%, -50%) scale(1);
}

#ivp-seekbar-markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

/* Hover time indicator */
#ivp-seekbar-hover {
  position: absolute;
  bottom: 16px;
  transform: translateX(-50%);
  pointer-events: none;
  display: none;
}

#ivp-seekbar-hover-time {
  background: rgba(0, 0, 0, 0.8);
  color: white;
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

/*  Break Markers  */
.ivp-marker {
  position: absolute;
  top: -2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transform: translateX(-50%);
  cursor: pointer;
  z-index: 10;
  transition: transform 0.2s;
}

.ivp-marker-segment {
  top: 0;
  height: 100%;
  width: auto;
  border-radius: 0;
  transform: none;
  opacity: 0.8;
  border-right: 1px solid var(--bg);
}

.ivp-marker-segment:hover {
  transform: scaleY(1.5);
  opacity: 1;
}

.ivp-marker:hover {
  transform: translateX(-50%) scale(1.5);
}

.ivp-marker-segment.ivp-marker:hover {
  transform: scaleY(1.5);
}

.ivp-marker-tooltip {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  color: white;
  font-size: 10px;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  display: none;
  z-index: 10;
}

.ivp-marker:hover .ivp-marker-tooltip {
  display: block;
}

/*  Controls Row  */
.ivp-controls-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ivp-controls-left {
  flex: 1;
}

.ivp-controls-right {
  flex-shrink: 0;
  gap: 6px;
}

/*  Buttons  */
.ivp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 0.15s, color 0.15s, transform 0.1s;
  flex-shrink: 0;
  padding: 0;
}

.ivp-btn svg {
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.ivp-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: white;
}

.ivp-btn:active {
  transform: scale(0.9);
}

.ivp-btn--lg svg {
  width: 22px;
  height: 22px;
}

.ivp-btn--active {
  color: var(--accent) !important;
}

.ivp-btn--active:hover {
  background: var(--accent-dim);
}

.ivp-btn--overlay {
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border-bright);
}

/*  Volume control  */
.ivp-volume-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

#ivp-volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 70px;
  height: 3px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.25);
  cursor: pointer;
  outline: none;
}

#ivp-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: white;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

/*  Time display  */
.ivp-time-display {
  display: flex;
  align-items: center;
  gap: 2px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  padding: 0 6px;
  white-space: nowrap;
}

.ivp-time-display .sep {
  color: var(--text-muted);
  margin: 0 2px;
}

#ivp-current-time {
  color: var(--text-primary);
  font-weight: 500;
}

/*  Settings Panel  */
#ivp-settings-panel {
  position: absolute;
  bottom: 85px;
  right: 20px;
  width: 260px;
  background: var(--bg-surface);
  border: 1px solid var(--border-bright);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(15px);
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
}

#ivp-settings-panel.ivp-panel--open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.ivp-settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.ivp-settings-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
}

.ivp-settings-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.ivp-settings-close svg {
  width: 16px;
  height: 16px;
}

#ivp-more-menu {
  position: absolute;
  top: calc(var(--header-h) + 6px);
  right: 12px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  padding: 14px;
  width: 230px;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  transform: translateY(-10px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transform-origin: top right;
  transition: opacity 0.18s, transform 0.18s;
}

#ivp-settings-panel.ivp-panel--open,
#ivp-more-menu.ivp-panel--open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Settings Panel Tabs */
.ivp-settings-tabs {
  display: flex;
  gap: 4px;
}

.ivp-settings-tab {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px 0;
  position: relative;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
}

.ivp-settings-tab svg {
  width: 18px;
  height: 18px;
}

.ivp-settings-tab:hover {
  color: var(--text-primary);
}

.ivp-settings-tab--active {
  color: #fff !important;
  background: var(--accent) !important;
  border-radius: var(--radius-sm);
}

.ivp-settings-tab--active::after {
  display: none;
}

.ivp-settings-content {
  padding: 8px 0;
  max-height: 180px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--text-muted) transparent;
}

.ivp-settings-content::-webkit-scrollbar {
  width: 4px;
}

.ivp-settings-content::-webkit-scrollbar-track {
  background: transparent;
}

.ivp-settings-content::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 10px;
}

.ivp-settings-content::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

.ivp-settings-section {
  display: none;
}

.ivp-settings-section--active {
  display: block;
}

/* List Options with Active Dot */
.ivp-speed-opt,
.ivp-quality-opt,
.ivp-lang-opt {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  padding: 10px 20px 10px 48px;
  cursor: pointer;
  position: relative;
  transition: background 0.2s;
}

.ivp-speed-opt:hover,
.ivp-quality-opt:hover,
.ivp-lang-opt:hover {
  background: var(--bg-hover);
}

.ivp-opt--active {
  color: var(--text-primary);
  font-weight: 500;
}

.ivp-opt--active::before {
  content: '';
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: var(--text-primary);
}

#ivp-bottom-more-panel {
  position: absolute;
  bottom: calc(var(--controls-h) + 8px);
  right: 12px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-bright);
  padding: 10px;
  width: 200px;
  max-height: calc(100% - var(--controls-h) - 20px);
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  transform: translateY(10px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transform-origin: bottom right;
  transition: opacity 0.18s, transform 0.18s;
}

/* Scrollbar for popup panels */
#ivp-bottom-more-panel::-webkit-scrollbar,
#ivp-settings-panel::-webkit-scrollbar {
  width: 4px;
}

#ivp-bottom-more-panel::-webkit-scrollbar-track,
#ivp-settings-panel::-webkit-scrollbar-track {
  background: transparent;
}

#ivp-bottom-more-panel::-webkit-scrollbar-thumb,
#ivp-settings-panel::-webkit-scrollbar-thumb {
  background: var(--border-bright);
  border-radius: 99px;
}

#ivp-bottom-more-panel.ivp-panel--open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.ivp-desktop-extras {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ivp-mobile-only {
  display: none !important;
}

@media (max-width: 650px) {
  .ivp-desktop-extras {
    display: none !important;
  }

  .ivp-mobile-only {
    display: inline-flex !important;
  }
}

/*  Floating Names Animation  */
#ivp-floating-names {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  overflow: hidden;
}

.ivp-floating-name {
  position: absolute;
  background: transparent;
  backdrop-filter: none;
  border: none;
  color: rgba(255, 255, 255, 0.906);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  padding: 0;
  white-space: nowrap;
  pointer-events: none;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  animation: floatRandom forwards linear;
}

@keyframes floatRandom {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0.9);
  }

  10% {
    opacity: 1;
    transform: translate(calc(var(--drift-x) * 0.1), calc(var(--drift-y) * 0.1)) scale(1);
  }

  90% {
    opacity: 1;
    transform: translate(calc(var(--drift-x) * 0.9), calc(var(--drift-y) * 0.9)) scale(1);
  }

  100% {
    opacity: 0;
    transform: translate(var(--drift-x), var(--drift-y)) scale(1.1);
  }
}

/* Remove duplicate block found later in file */

.ivp-settings-speeds,
.ivp-settings-quality {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.ivp-speed-opt,
.ivp-quality-opt,
.ivp-lang-opt {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.ivp-speed-opt:hover,
.ivp-quality-opt:hover,
.ivp-lang-opt:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.ivp-opt--active {
  background: var(--accent-dim) !important;
  color: var(--accent-bright) !important;
  border-color: var(--accent) !important;
}

/* More menu items */
.ivp-more-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-size: 13px;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.ivp-more-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.ivp-more-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/*  Overlay Side Panels  */
.ivp-overlay-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: var(--panel-w);
  height: 100%;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border-left: 1px solid var(--border-bright);
  z-index: 40;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.ivp-overlay-panel.ivp-overlay--open {
  transform: translateX(0);
  pointer-events: all;
}

/*  Reusable Modal (Centered)  */
.ivp-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.ivp-modal-overlay.ivp-modal--open {
  opacity: 1;
  pointer-events: all;
}

.ivp-modal {
  width: 80%;
  height: 80%;
  background: var(--bg-surface);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ivp-modal-overlay.ivp-modal--open .ivp-modal {
  transform: scale(1);
}

/*  Overlay Side Panels  */
.ivp-overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.ivp-overlay-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.ivp-overlay-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}

.ivp-overlay-close svg {
  width: 16px;
  height: 16px;
}

.ivp-overlay-close:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.ivp-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.ivp-modal-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ivp-modal-title-group svg {
  width: 18px;
  height: 18px;
  color: var(--accent-bright);
}

.ivp-modal-title-group span {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.ivp-modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.ivp-modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  transform: rotate(90deg);
}

.ivp-modal-close svg {
  width: 18px;
  height: 18px;
}

.ivp-modal-body {
  flex: 1;
  background: #fff;
  /* White background for iframe contents usually looks better */
  position: relative;
}

.ivp-modal-body iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

#ivp-overlay-glossary {
  width: 600px;
  max-width: 90%;
}

.ivp-overlay-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
}

.ivp-overlay-body::-webkit-scrollbar {
  width: 4px;
}

.ivp-overlay-body::-webkit-scrollbar-track {
  background: transparent;
}

.ivp-overlay-body::-webkit-scrollbar-thumb {
  background: var(--border-bright);
  border-radius: 99px;
}

/*  Notes Panel  */
.ivp-note-compose {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

#ivp-note-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 10px 12px;
  resize: vertical;
  min-height: 72px;
  outline: none;
  transition: border-color 0.2s;
}

#ivp-note-input:focus {
  border-color: var(--accent);
}

#ivp-note-input::placeholder {
  color: var(--text-muted);
}

.ivp-note-compose-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ivp-note-at-time {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.ivp-btn-primary {
  background: var(--accent);
  color: white;
  border: none;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.ivp-btn-primary:hover {
  background: var(--accent-bright);
}

.ivp-btn-primary:active {
  transform: scale(0.97);
}

.ivp-notes-empty {
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  padding: 24px 0;
  line-height: 1.7;
}

.ivp-note-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
  transition: border-color 0.2s;
}

.ivp-note-item:hover {
  border-color: var(--border-bright);
}

.ivp-note-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.ivp-note-timestamp {
  background: var(--accent-dim);
  color: var(--accent-bright);
  border: none;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.ivp-note-timestamp:hover {
  background: var(--accent);
  color: white;
}

.ivp-note-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ivp-note-edit,
.ivp-note-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.ivp-note-edit svg,
.ivp-note-delete svg {
  width: 14px;
  height: 14px;
}

.ivp-note-edit:hover {
  color: var(--accent-bright);
  background: var(--accent-dim);
}

.ivp-note-delete:hover {
  color: #ff4d4d;
  background: rgba(255, 77, 77, 0.1);
}

.ivp-note-text {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.5;
  margin: 0;
  white-space: pre-wrap;
}

/* Edit Mode */
.ivp-note-edit-box {
  margin-top: 8px;
}

.ivp-note-edit-input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 10px;
  min-height: 80px;
  resize: vertical;
  outline: none;
  margin-bottom: 8px;
  display: block;
}

.ivp-note-edit-input:focus {
  border-color: var(--accent);
}

.ivp-note-edit-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.ivp-note-save-btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ivp-note-save-btn svg {
  width: 12px;
  height: 12px;
}

.ivp-note-cancel-btn {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
}

.ivp-note-cancel-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/*  Description Panel  */
.ivp-description-overview {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.ivp-description-overview h3 {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 8px;
}

.ivp-description-overview h4 {
  font-size: 12px;
  color: var(--text-accent);
  font-weight: 600;
  margin: 12px 0 6px;
}

.ivp-description-overview p {
  margin-bottom: 8px;
}

.ivp-description-overview ul {
  padding-left: 18px;
}

.ivp-description-overview li {
  margin-bottom: 4px;
}

.ivp-resources {
  margin-top: 16px;
}

.ivp-resources h4 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.ivp-resource-link {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--accent-bright);
  text-decoration: none;
  font-size: 12px;
  padding: 7px 10px;
  border-radius: var(--radius);
  transition: background 0.15s;
  margin-bottom: 4px;
}

.ivp-resource-link:hover {
  background: var(--accent-dim);
}

/*  Ask Expert Panel  */
.ivp-chat-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
  min-height: 100px;
}

.ivp-chat-msg {
  max-width: 90%;
  padding: 9px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  line-height: 1.5;
  word-break: break-word;
}

.ivp-chat-msg--bot {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  align-self: flex-start;
  border-radius: var(--radius) var(--radius) var(--radius) 2px;
}

.ivp-chat-msg--user {
  background: var(--accent);
  color: white;
  align-self: flex-end;
  border-radius: var(--radius) var(--radius) 2px var(--radius);
}

.ivp-chat-msg--bot-typing {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  align-self: flex-start;
  font-size: 18px;
  letter-spacing: 3px;
}

.ivp-expert-input-row {
  display: flex;
  gap: 6px;
}

#ivp-expert-input {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 12px;
  padding: 8px 10px;
  outline: none;
  transition: border-color 0.2s;
  resize: none;
}

#ivp-expert-input:focus {
  border-color: var(--accent);
}

#ivp-expert-input::placeholder {
  color: var(--text-muted);
}

/*  Shortcuts Panel  */
.ivp-shortcut-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-secondary);
}

.ivp-shortcut-row:last-child {
  border-bottom: none;
}

.ivp-kbd {
  background: var(--bg-elevated);
  border: 1px solid var(--border-bright);
  border-radius: 5px;
  padding: 2px 7px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-primary);
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 70px;
  text-align: center;
}

/*  Break Modals  */
#ivp-break-modal {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 11, 16, 0.7);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

#ivp-break-modal.ivp-modal--visible {
  opacity: 1;
  pointer-events: all;
}

.ivp-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.ivp-modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.ivp-modal-close svg {
  width: 18px;
  height: 18px;
}

.ivp-modal-inner {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: min(420px, 90%);
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalIn {
  from {
    transform: scale(0.85) translateY(20px);
    opacity: 0;
  }

  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.ivp-modal-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 4px 10px;
  border-radius: 99px;
  margin-bottom: 14px;
}

.ivp-badge--question {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-bright);
}

.ivp-badge--quiz {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
}

.ivp-badge--branch {
  background: rgba(236, 72, 153, 0.15);
  color: #f472b6;
}

.ivp-modal-question {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.5;
  margin-bottom: 18px;
}

.ivp-modal-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ivp-option-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 10px 14px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}

.ivp-option-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-bright);
}

.ivp-option-btn:disabled {
  cursor: not-allowed;
}

.ivp-option--correct {
  background: rgba(34, 197, 94, 0.12) !important;
  border-color: var(--success) !important;
  color: var(--success) !important;
}

.ivp-option--wrong {
  background: rgba(239, 68, 68, 0.12) !important;
  border-color: var(--danger) !important;
  color: var(--danger) !important;
}

.ivp-modal-feedback {
  margin-top: 14px;
}

.ivp-feedback--correct,
.ivp-feedback--wrong {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 12px;
  line-height: 1.6;
}

.ivp-feedback--correct {
  background: rgba(34, 197, 94, 0.1);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.ivp-feedback--wrong {
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.ivp-quiz-score {
  font-size: 56px;
  font-weight: 700;
  text-align: center;
  color: var(--accent-bright);
  line-height: 1;
  margin: 10px 0 6px;
  font-family: var(--font-mono);
}

.ivp-quiz-score-label {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.ivp-modal-branches {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ivp-branch-btn {
  background: linear-gradient(135deg, var(--bg-elevated), var(--bg-hover));
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  padding: 14px 18px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.ivp-branch-btn::after {
  content: '';
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  transition: color 0.2s, transform 0.2s;
}

.ivp-branch-btn:hover {
  border-color: var(--pink);
  background: rgba(236, 72, 153, 0.08);
  color: white;
}

.ivp-branch-btn:hover::after {
  color: var(--pink);
  transform: translateY(-50%) translateX(4px);
}

.ivp-btn-modal-continue {
  display: block;
  width: 100%;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  padding: 12px;
  cursor: pointer;
  margin-top: 10px;
  transition: background 0.15s;
}

.ivp-btn-modal-continue:hover {
  background: var(--accent-bright);
}

/*  Skip Banner  */
#ivp-break-skip-banner {
  position: absolute;
  bottom: calc(var(--controls-h) + 16px);
  right: 16px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
}

#ivp-break-skip-banner.ivp-break--visible {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.ivp-skip-label {
  color: var(--text-secondary);
}

.ivp-skip-countdown {
  font-family: var(--font-mono);
  color: var(--warning);
  font-weight: 600;
}

.ivp-btn-skip-now {
  background: var(--warning);
  color: black;
  border: none;
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.ivp-btn-skip-cancel {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
}

/*  Lock Overlay  */
#ivp-lock-overlay {
  position: absolute;
  inset: 0;
  z-index: 80;
  /* display: flex; */
  /* flex-direction: column; */
  align-items: center;
  /* justify-content: center; */
  gap: 12px;
  /* background: rgba(8, 11, 16, 0.55); */
  /* backdrop-filter: blur(2px); */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

#ivp-lock-overlay.ivp-lock--visible {
  opacity: 1;
  pointer-events: all;
}

.ivp-lock-icon {
  font-size: 36px;
  animation: lockPulse 2s infinite;
}

@keyframes lockPulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.08);
  }
}

.ivp-lock-label {
  color: var(--text-secondary);
  font-size: 14px;
}

#ivp-btn-unlock {
  background: var(--bg-elevated);
  border: 1px solid var(--border-bright);
  color: var(--text-primary);
  padding: 8px 20px;
  border-radius: var(--radius-lg);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

#ivp-btn-unlock:hover {
  background: var(--accent);
  border-color: var(--accent);
}

/*  Captions  */
#ivp-captions {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  pointer-events: none;
  max-width: 85%;
  text-align: center;
  transition: opacity 0.2s;
}

#ivp-captions.ivp-captions--hidden {
  display: none;
}

#ivp-captions-text {
  display: inline-block;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.4;
  padding: 6px 16px;
  border-radius: 6px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/*  End of floating names  */

/*  Toast Notifications  */
.ivp-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--bg-elevated);
  border: 1px solid var(--border-bright);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  padding: 7px 16px;
  border-radius: 99px;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  box-shadow: var(--shadow);
  white-space: nowrap;
}

.ivp-toast--show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.ivp-toast--success {
  border-color: var(--success);
  color: #86efac;
}

.ivp-toast--error {
  border-color: var(--danger);
  color: #fca5a5;
}

/*  Watch Progress Bar  */
#ivp-watch-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  z-index: 20;
  opacity: 1;
  transition: opacity 0.25s;
}

/* Hide watch bar when controls or specific panels are open */
#ivp-controls-wrapper.ivp-controls--visible~#ivp-watch-progress,
#ivp-container:hover #ivp-watch-progress {
  opacity: 0;
}

#ivp-watch-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--success), var(--accent));
  width: 0%;
  transition: width 0.3s ease;
}



/*  Responsive  */
@media (max-width: 600px) {
  :root {
    --panel-w: 100%;
  }

  .ivp-volume-group #ivp-volume-slider {
    width: 50px;
  }

  .ivp-time-display {
    font-size: 10px;
  }

  .ivp-overlay-panel {
    border-radius: 0;
  }


}

.ivp-indexing-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
}

.ivp-chapter-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
}

.ivp-chapter-item:hover {
  background: var(--bg-hover);
  border-color: var(--accent-dim);
  transform: translateX(4px);
}

.ivp-chapter-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ivp-chapter-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.ivp-chapter-time {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.ivp-chapter-play-icon {
  color: var(--accent-bright);
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.2s;
}

.ivp-chapter-item:hover .ivp-chapter-play-icon {
  opacity: 1;
  transform: scale(1);
}

.ivp-chapter-play-icon svg {
  width: 18px;
  height: 18px;
}