/* ===== Custom video player (Yomikaze TV) ===== */
.player-page { max-width: var(--maxw); margin: 0 auto; }
.player-body { display: flex; gap: 18px; align-items: flex-start; }

.player-boot { aspect-ratio: 16 / 9; display: grid; place-items: center; background: #000; border-radius: var(--radius); }

/* ---- stage ---- */
.pv-stage {
  position: relative; flex: 1 1 auto; min-width: 0;
  aspect-ratio: 16 / 9; background: #000;
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-lg);
  user-select: none;
}
.pv-video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.pv-stage:fullscreen { border-radius: 0; }
.pv-stage:fullscreen .pv-video { height: 100vh; }
.pv-stage.pv-idle { cursor: none; }

/* ---- overlay (pass-through except its controls) ---- */
.pv-overlay { position: absolute; inset: 0; pointer-events: none; }
.pv-overlay::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(0,0,0,0.55), transparent 22%),
    linear-gradient(to top, rgba(0,0,0,0.78), transparent 34%);
  opacity: 1; transition: opacity 0.3s;
}
.pv-stage.pv-idle .pv-overlay::before { opacity: 0; }

.pv-top, .pv-controls, .pv-skip, .pv-bigplay, .pv-settings { pointer-events: auto; }
.pv-stage.pv-idle .pv-top,
.pv-stage.pv-idle .pv-controls { opacity: 0; transform: translateY(6px); pointer-events: none; }

/* ---- top bar ---- */
.pv-top {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; transition: opacity 0.3s, transform 0.3s var(--ease);
}
.pv-titlebar { color: #fff; font-weight: 700; font-size: 15px; text-shadow: 0 1px 6px rgba(0,0,0,0.6); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- center: big play + buffering ---- */
.pv-center { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.pv-bigplay {
  width: 78px; height: 78px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center;
  background: rgba(10,10,16,0.5); backdrop-filter: blur(6px);
  color: #fff; box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  transition: transform 0.2s var(--ease), background 0.2s, opacity 0.2s;
}
.pv-bigplay svg { width: 34px; height: 34px; margin-left: 4px; }
.pv-bigplay:hover { transform: scale(1.08); background: var(--accent); }
.pv-bigplay[hidden] { display: none; }

.pv-spin { width: 54px; height: 54px; border-radius: 50%; border: 4px solid rgba(255,255,255,0.18); border-top-color: #fff; animation: pv-rot 0.8s linear infinite; }
.pv-buffering { position: absolute; }
.pv-buffering[hidden] { display: none; }
@keyframes pv-rot { to { transform: rotate(360deg); } }

/* ---- skip intro/outro ---- */
.pv-skip {
  position: absolute; right: 20px; bottom: 92px;
  padding: 11px 20px; border-radius: 10px; cursor: pointer;
  background: rgba(20,20,28,0.9); color: #fff; font-weight: 700; font-size: 14px;
  border: 1px solid rgba(255,255,255,0.28); backdrop-filter: blur(6px);
  transition: background 0.15s, transform 0.15s;
}
.pv-skip:hover { background: var(--accent); transform: translateY(-1px); }

/* ---- controls ---- */
.pv-controls {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 0 14px 12px; display: flex; flex-direction: column; gap: 8px;
  transition: opacity 0.3s, transform 0.3s var(--ease);
}
.pv-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pv-left, .pv-right { display: flex; align-items: center; gap: 2px; }

.pv-icon {
  width: 40px; height: 40px; border: 0; border-radius: 10px; cursor: pointer;
  display: inline-grid; place-items: center;
  background: transparent; color: #fff;
  transition: background 0.15s, color 0.15s, transform 0.12s var(--ease);
}
.pv-icon svg { width: 23px; height: 23px; }
.pv-icon:hover { background: rgba(255,255,255,0.14); }
.pv-icon:active { transform: scale(0.92); }
.pv-icon:disabled { opacity: 0.35; cursor: default; }
.pv-icon.active { color: var(--accent-2); }

.pv-time { color: #e7e8f0; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; margin-left: 6px; white-space: nowrap; }

/* volume */
.pv-volwrap { display: flex; align-items: center; }
.pv-vol {
  width: 0; opacity: 0; height: 4px; margin: 0; cursor: pointer;
  -webkit-appearance: none; appearance: none; background: rgba(255,255,255,0.3); border-radius: 999px;
  transition: width 0.22s var(--ease), opacity 0.22s;
}
.pv-volwrap:hover .pv-vol { width: 78px; opacity: 1; margin: 0 6px 0 2px; }
.pv-vol::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; background: #fff; cursor: pointer; }
.pv-vol::-moz-range-thumb { width: 13px; height: 13px; border: 0; border-radius: 50%; background: #fff; }

/* seek bar */
.pv-seek { position: relative; height: 5px; border-radius: 999px; background: rgba(255,255,255,0.22); cursor: pointer; touch-action: none; }
.pv-seek:hover { height: 7px; }
.pv-buffered { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: rgba(255,255,255,0.32); border-radius: 999px; }
.pv-played { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--accent-grad); border-radius: 999px; }
.pv-thumb { position: absolute; top: 50%; width: 14px; height: 14px; border-radius: 50%; background: #fff; transform: translate(-50%, -50%) scale(0); box-shadow: 0 2px 8px rgba(0,0,0,0.5); transition: transform 0.15s var(--ease); }
.pv-seek:hover .pv-thumb { transform: translate(-50%, -50%) scale(1); }
.pv-seektip {
  position: absolute; bottom: 16px; transform: translateX(-50%);
  padding: 3px 8px; border-radius: 6px; background: rgba(10,10,16,0.92);
  color: #fff; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
  pointer-events: none; white-space: nowrap;
}
.pv-seektip[hidden] { display: none; }

/* settings panel */
.pv-settings {
  position: absolute; right: 14px; bottom: 74px; z-index: 5;
  width: min(300px, 80vw); max-height: 60%; overflow-y: auto;
  padding: 12px; border-radius: 14px;
  background: rgba(16,16,24,0.94); backdrop-filter: blur(16px);
  border: 1px solid var(--border); box-shadow: var(--shadow-lg);
}
.pv-settings[hidden] { display: none; }
.pv-set-group { margin-bottom: 12px; }
.pv-set-group:last-child { margin-bottom: 0; }
.pv-set-label { color: var(--faint); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.pv-set-opt {
  display: inline-flex; margin: 0 6px 6px 0; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
  font-size: 13px; font-weight: 600; transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.pv-set-opt:hover { color: #fff; border-color: var(--accent); }
.pv-set-opt.active { color: #fff; background: var(--accent-soft); border-color: var(--accent); }

/* ---- episode aside ---- */
.pv-aside {
  flex: 0 0 340px; align-self: stretch;
  max-height: min(78vh, 720px);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); overflow: hidden;
}
.pv-aside-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; font-weight: 800; border-bottom: 1px solid var(--border-soft); }
.pv-aside-close { display: none; }
.pv-aside-controls { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--border-soft); }

/* Streaming-server picker (Neko / Pewe / NoSub / Zone / BD / Senshi / KAA) — same
   pill look as the Sub/Dub tabs. */
.pv-servers { display: flex; flex-wrap: wrap; gap: 6px; }
.pv-server {
  padding: 6px 13px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); font-weight: 600; font-size: 0.82rem; cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.pv-server:hover { color: var(--text); border-color: var(--accent); }
.pv-server.active { color: #fff; background: var(--accent-soft); border-color: var(--accent); }
.pv-server-hint { color: var(--faint); font-size: 0.76rem; line-height: 1.45; margin: 0; }

.pv-eplist { overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; }

.pv-ep {
  display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-sm); cursor: pointer; width: 100%; text-align: left;
  background: transparent; border: 1px solid transparent; color: var(--muted);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.pv-ep:hover { background: var(--surface-2); color: var(--text); }
.pv-ep.current { background: var(--accent-soft); color: #fff; border-color: var(--accent); }
.pv-ep-thumb { flex: 0 0 auto; width: 92px; aspect-ratio: 16/9; border-radius: 8px; overflow: hidden; background: var(--surface-3); position: relative; }
.pv-ep-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pv-ep-thumb-empty { display: grid; place-items: center; color: var(--faint); }
.pv-ep-thumb-empty svg { width: 22px; height: 22px; }
.pv-ep-meta { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pv-ep-no { font-size: 13px; font-weight: 700; }
.pv-ep-name { font-size: 12px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-ep-badge { flex: 0 0 auto; color: var(--accent-2); }
.pv-ep-badge svg { width: 16px; height: 16px; }

/* ---- below the player ---- */
.pv-below { margin-top: 18px; }
.pv-anime-title { font-size: clamp(20px, 3vw, 28px); font-weight: 800; letter-spacing: -0.02em; margin: 0 0 4px; }
.pv-anime-title a { color: var(--text); }
.pv-anime-title a:hover { color: var(--accent-2); }
.pv-ep-caption { color: var(--muted); font-weight: 600; }

/* thin scrollbar for episode list */
.pv-eplist::-webkit-scrollbar, .pv-settings::-webkit-scrollbar { width: 8px; }
.pv-eplist::-webkit-scrollbar-thumb, .pv-settings::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 999px; }

/* ---- responsive ---- */
.pv-only-narrow { display: none; }
@media (max-width: 1040px) {
  .player-body { flex-direction: column; }
  .pv-aside {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 200; width: min(360px, 86vw);
    max-height: none; border-radius: 0; transform: translateX(100%); transition: transform 0.28s var(--ease);
  }
  .pv-aside.open { transform: translateX(0); box-shadow: -20px 0 60px rgba(0,0,0,0.5); }
  .pv-aside-close { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 0; background: var(--surface-2); border-radius: 8px; color: var(--text); cursor: pointer; }
  .pv-only-narrow { display: inline-grid; }
}
@media (max-width: 560px) {
  .pv-icon { width: 36px; height: 36px; }
  .pv-icon svg { width: 21px; height: 21px; }
  .pv-time { font-size: 12px; margin-left: 2px; }
  .pv-left, .pv-right { gap: 0; }
  .pv-titlebar { font-size: 13px; }
  /* keep only the essentials on tiny screens */
  .pv-controls .pv-left .pv-icon:nth-child(2),
  .pv-controls .pv-left .pv-icon:nth-child(3) { display: none; }
}
