/* Simple media player — in-page placement (player-home-slot), not a popup */

#player-shell.sp-mode {
  position: relative;
  z-index: auto;
  left: auto;
  right: auto;
  bottom: auto;
  transform: none;
  width: 100%;
  max-width: var(--player-shell-max, min(960px, calc(100vw - 48px)));
  margin-left: auto;
  margin-right: auto;
  pointer-events: auto;
}

#player-shell.sp-mode.hidden {
  display: none !important;
}

#player-shell.sp-mode .mp-fab {
  display: none !important;
}

#player-shell.sp-mode #media-player-root {
  display: block;
  width: 100%;
}

#player-home-slot #player-shell.sp-mode {
  max-width: 100%;
}

.player-inline-slot #player-shell.sp-mode {
  max-width: 100%;
}

.sp-card {
  background: linear-gradient(
    180deg,
    var(--theme-color-dark, #3d2214) 0%,
    color-mix(in srgb, var(--theme-color-dark, #3d2214) 55%, black) 100%
  );
  border: 1px solid var(--theme-color-border-strong, rgba(87, 48, 28, 0.55));
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  color: var(--theme-on-dark, #fbf6ef);
  overflow: hidden;
  width: 100%;
}

.sp-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: color-mix(in srgb, var(--theme-color) 38%, black);
}

.sp-titles {
  min-width: 0;
  flex: 1;
}

.sp-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--theme-on-theme, #fff);
  word-break: break-word;
}

.sp-meta {
  margin-top: 4px;
  font-size: 12px;
  opacity: 0.82;
  line-height: 1.35;
}

.sp-close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--theme-on-theme, #fff);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.sp-close:hover {
  background: color-mix(in srgb, var(--theme-color) 28%, rgba(255, 255, 255, 0.14));
}

.sp-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.sp-iconbtn-header {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}

.sp-media-wrap {
  position: relative;
  background: #000;
  width: 100%;
  aspect-ratio: 16 / 9;
}

.sp-video {
  display: block;
  width: 100%;
  height: 100%;
  background: #000;
  object-fit: contain;
}

.sp-video {
  accent-color: var(--theme-color);
}

.sp-audio-el,
.sp-progress,
.sp-volume {
  accent-color: var(--theme-color);
}

/* Hidden audio element — custom bar only */
.sp-audio-el {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

.sp-media-wrap.sp-audio-wrap {
  aspect-ratio: auto;
  min-height: 0;
  padding: 10px 12px 12px;
  background: color-mix(in srgb, var(--theme-color-dark, #2a1810) 40%, black);
}

.sp-audio-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sp-progress {
  width: 100%;
  height: 6px;
  margin: 0;
  cursor: pointer;
  touch-action: none;
}

.sp-audio-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.sp-iconbtn {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.95);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.sp-iconbtn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.sp-iconbtn:active {
  background: color-mix(in srgb, var(--theme-color) 30%, rgba(255, 255, 255, 0.12));
}

.sp-iconbtn svg {
  width: 18px;
  height: 18px;
  display: block;
}

.sp-iconbtn-play {
  width: 44px;
  height: 44px;
}

.sp-iconbtn-play svg {
  width: 20px;
  height: 20px;
}

.sp-volwrap {
  display: inline-flex;
  align-items: center;
  position: relative;
  flex-shrink: 0;
}

.sp-volslide {
  width: 0;
  overflow: hidden;
  transition: width 0.2s ease;
  display: flex;
  align-items: center;
}

.sp-volwrap:hover .sp-volslide,
.sp-volwrap:focus-within .sp-volslide,
.sp-volwrap.open .sp-volslide {
  width: 88px;
}

.sp-volume {
  width: 80px;
  min-width: 80px;
  height: 4px;
  margin: 0;
  cursor: pointer;
}

.sp-volwrap--mute-only .sp-volslide {
  display: none !important;
  width: 0 !important;
}

@media (max-width: 1100px), (pointer: coarse) {
  .sp-volwrap .sp-volslide {
    display: none !important;
    width: 0 !important;
  }
}

.sp-time {
  margin-left: auto;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  opacity: 0.9;
  white-space: nowrap;
}

.sp-skip-flash {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  padding: 10px 16px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  pointer-events: none;
  z-index: 4;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.sp-skip-flash.is-left {
  left: 12%;
}

.sp-skip-flash.is-right {
  right: 12%;
}

.sp-skip-flash.is-visible {
  opacity: 1;
}

.sp-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  font-size: 14px;
  color: var(--theme-on-dark, #fbf6ef);
  pointer-events: none;
  z-index: 3;
}

.sp-loading[hidden] {
  display: none !important;
}

.sp-error {
  margin: 0 12px 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(120, 30, 30, 0.2);
  border: 1px solid rgba(180, 60, 60, 0.35);
  color: #ffd4d4;
  font-size: 13px;
  line-height: 1.4;
}

.sp-error[hidden] {
  display: none !important;
}

.sp-error p {
  margin: 0;
}

@media (max-width: 1100px) {
  #player-shell.sp-mode {
    max-width: 100%;
  }
}

/* Simple player: never dock/mini — stay inline or in home slot */
#player-shell.sp-mode.is-mini,
#player-shell.sp-mode.is-mini-controls-only,
#player-shell.sp-mode.mp-inline-split,
#player-shell.sp-mode.mp-mini-collapsed,
#player-shell.sp-mode.mp-static-video,
body.mp-inline-remote #player-shell.sp-mode,
body.mp-inline-docked #player-shell.sp-mode {
  position: relative !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  top: auto !important;
  width: 100% !important;
  max-width: var(--player-shell-max, min(960px, calc(100vw - 48px))) !important;
  height: auto !important;
  min-height: 0 !important;
  transform: none !important;
  z-index: auto !important;
  pointer-events: auto !important;
  opacity: 1 !important;
  visibility: visible !important;
}

#player-shell.sp-mode .mp-fab,
body:has(#player-shell.sp-mode:not(.hidden)) .player-inline-video-fab {
  display: none !important;
}

/* Jump-to-player arrow (not a mini player) */
.sp-jump-player {
  position: fixed;
  z-index: 75;
  right: 16px;
  bottom: 20px;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--theme-color-dark, #3d2214) 70%, transparent);
  background: var(--theme-color, #57301c);
  color: var(--theme-on-theme, #fbf6ef);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, background 0.18s ease;
}

.sp-jump-player.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.sp-jump-player:hover,
.sp-jump-player:focus-visible {
  background: var(--theme-color-dark, #3d2214);
  outline: 2px solid var(--theme-color, #57301c);
  outline-offset: 2px;
}

.sp-jump-player svg {
  width: 22px;
  height: 22px;
  display: block;
}

.sp-jump-player--up svg {
  transform: rotate(180deg);
}

.sp-jump-player[hidden] {
  display: none !important;
}

@media (min-width: 1101px) {
  .sp-jump-player {
    bottom: 24px;
    right: 20px;
  }
}
