/* assets/css/player.css — episode player (/play?series=…&ep=N).
   Black canvas so the video is the only thing that glows. The vertical stage
   fills the viewport height; custom controls fade in on hover / tap. Desktop
   adds a right dock (story plate, thumbnail episode grid, upsell). */

body.player-page {
  background: #000;
}
body.player-page .site-header,
body.player-page .site-header.is-scrolled {
  background: rgba(0, 0, 0, 0.82);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}
.player-main {
  padding: 14px 0 32px;
}
.player-layout {
  display: grid;
  gap: 16px;
}
@media (min-width: 1000px) {
  .player-layout {
    grid-template-columns: minmax(0, 1fr) 420px;
    gap: 28px;
    align-items: start;
  }
}
@media (min-width: 1280px) {
  .player-layout {
    grid-template-columns: minmax(0, 1fr) 460px;
  }
}

/* ------------------------------------------------------------------ stage */
.stage-wrap {
  position: relative;
  display: grid;
  justify-items: center;
}
.stage {
  --stage-h: calc(100dvh - var(--header-h) - 120px);
  position: relative;
  width: min(100%, calc(var(--stage-h) * 9 / 16));
  aspect-ratio: 9 / 16;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.8);
  user-select: none;
}
@media (min-width: 1000px) {
  .stage {
    --stage-h: calc(100dvh - var(--header-h) - 28px);
  }
}
.stage-backdrop {
  position: absolute;
  inset: -8%;
  background: var(--poster) center / cover no-repeat;
  filter: blur(30px) brightness(0.3);
}
.stage video {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
  cursor: pointer;
}
.stage.is-locked video {
  opacity: 0.25;
  filter: blur(3px);
}
.player-back {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 6;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.55);
  color: var(--chalk);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  transition: background 0.2s ease;
}
.player-back:hover {
  background: rgba(0, 0, 0, 0.8);
}
.player-back svg {
  width: 18px;
  height: 18px;
}

/* Custom controls */
.stage-center {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: rgba(0, 0, 0, 0.18);
  color: var(--chalk);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.stage-center span {
  width: 74px;
  height: 74px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(6px);
}
.stage-center svg {
  width: 34px;
  height: 34px;
  margin-left: 4px;
}
.stage.is-paused .stage-center {
  opacity: 1;
  pointer-events: auto;
}
.stage-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  padding: 26px 12px 10px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.85));
  opacity: 0;
  transition: opacity 0.25s ease;
}
.stage:hover .stage-controls,
.stage.is-paused .stage-controls,
.stage.is-touched .stage-controls {
  opacity: 1;
}
.stage.is-idle:not(.is-paused) .stage-controls {
  opacity: 0;
}
.seek {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  margin: 0 0 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--red) var(--played, 0%), rgba(255, 255, 255, 0.28) var(--played, 0%));
  cursor: pointer;
}
.seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--chalk);
  box-shadow: 0 0 0 3px rgba(237, 27, 36, 0.5);
}
.seek::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 999px;
  background: var(--chalk);
}
.controls-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ctl {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--chalk);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.ctl:hover {
  background: rgba(255, 255, 255, 0.14);
}
.ctl svg {
  width: 20px;
  height: 20px;
}
.ctl-time {
  margin-left: 2px;
  color: var(--chalk);
  font-size: 0.74rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.ctl-time span {
  color: rgba(255, 255, 255, 0.55);
}
.ctl-spacer {
  flex: 1;
}
.loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.6);
  color: var(--mist);
  font-size: 0.86rem;
  font-weight: 600;
}
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Lock panel: the paywall, anchored where the episode stopped. */
.lock-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 7;
  padding: 18px 16px 18px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.94) 32%);
  backdrop-filter: blur(6px);
}
.lock-panel .sheet-kicker {
  margin-bottom: 4px;
}
.lock-panel h2 {
  font-size: 1.25rem;
  margin-bottom: 4px;
}
.lock-panel p {
  color: var(--mist);
  font-size: 0.86rem;
  margin-bottom: 12px;
}
.lock-actions {
  display: grid;
  gap: 8px;
}
.lock-fine {
  margin-top: 10px;
  color: var(--steel);
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
}

/* ------------------------------------------------------------ control bar */
.control-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  width: min(100%, calc(var(--stage-h, 70vh) * 9 / 16));
  margin-top: 10px;
}
.control-bar .btn {
  min-height: 42px;
  padding: 0 14px;
}
.control-bar .btn svg {
  width: 18px;
  height: 18px;
}
.control-title {
  min-width: 0;
  text-align: center;
}
.control-title strong {
  display: block;
  font-size: 0.86rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.control-title span {
  color: var(--steel);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.control-episodes {
  width: min(100%, calc(var(--stage-h, 70vh) * 9 / 16));
  margin-top: 8px;
}
@media (min-width: 1000px) {
  .control-episodes {
    display: none;
  }
}

/* ------------------------------------------------------------------- dock */
.dock {
  display: grid;
  gap: 12px;
}
.plate {
  padding: 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #0f0f10;
}
.plate-series {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 14px;
  align-items: start;
}
.plate-series img {
  width: 64px;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--hairline);
}
.plate-series h1 {
  font-size: 1.05rem;
  line-height: 1.15;
}
.plate-series .series-meta {
  margin-top: 4px;
}
.plate-series p {
  margin-top: 8px;
  color: var(--mist);
  font-size: 0.84rem;
}
.plate-series .tag-row {
  margin-top: 10px;
}
.plate-series a.plate-link {
  display: inline-block;
  margin-top: 8px;
  color: var(--red-soft);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.plate-episodes .episode-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  max-height: calc(100dvh - var(--header-h) - 420px);
  min-height: 260px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
}
@media (min-width: 1000px) {
  .plate-episodes .episode-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}
.plate-upsell {
  border-color: rgba(237, 27, 36, 0.45);
  background: radial-gradient(400px 160px at 0% 0%, rgba(237, 27, 36, 0.3), transparent 60%), #0f0f10;
}
.plate-upsell h2 {
  font-size: 1.1rem;
  margin-bottom: 4px;
}
.plate-upsell p {
  color: var(--mist);
  font-size: 0.84rem;
  margin-bottom: 12px;
}
.dock-hide-mobile {
  display: none;
}
@media (min-width: 1000px) {
  .dock-hide-mobile {
    display: block;
  }
}
