/* video_player.css — the tutorial player (video_player.js), shared by
   video.html and the map's Video guide overlay. Everything here is .vg-*;
   the hosts style their own page around it. */
/* The palette the .vg-* rules read. A host may override these; the map's
   overlay does, to stay dark whatever the page theme. */
:root {
  --vg-ink: #0f172a;
  --vg-muted: #64748b;
  --vg-card: #ffffff;
  --vg-line: rgba(15, 23, 42, 0.08);
  --vg-forest: #1a3c34;
  --vg-brand: #228b22;
  --vg-accent: #4ade80;
  --vg-chip: #eef2f7;
  --vg-soft: #f0fdf4;
}
[data-theme='dark'] {
  --vg-ink: #e5e7eb;
  --vg-muted: #94a3b8;
  --vg-card: #1e293b;
  --vg-line: rgba(255, 255, 255, 0.08);
  --vg-chip: #263447;
  --vg-soft: #052e16;
}


.vg-theatre {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}
@media (max-width: 960px) {
  .vg-theatre { grid-template-columns: 1fr; }
}

/* ── the player ─────────────────────────────────────────── */
.vg-player {
  position: relative;
  background: #000;
  border-radius: 18px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  box-shadow: 0 30px 60px -20px rgba(15, 58, 50, 0.5);
  outline: none;
  user-select: none;
}
.vg-player video {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
  object-fit: contain;
}
/* A large centred play button while paused, and a spinner while
   the browser waits for data. */
.vg-bigplay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.35));
  border: 0;
  cursor: pointer;
  padding: 0;
  transition: opacity 0.2s;
}
.vg-bigplay span {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--vg-forest);
  display: grid;
  place-items: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s;
}
.vg-bigplay:hover span { transform: scale(1.06); }
.vg-bigplay svg { width: 34px; height: 34px; margin-left: 5px; }
.vg-player.is-playing .vg-bigplay { opacity: 0; pointer-events: none; }
.vg-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 54px;
  height: 54px;
  margin: -27px 0 0 -27px;
  border: 4px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: vgSpin 0.8s linear infinite;
  display: none;
  pointer-events: none;
}
.vg-player.is-waiting .vg-spinner { display: block; }
@keyframes vgSpin { to { transform: rotate(360deg); } }
/* A flash in the middle when a keyboard shortcut fires. */
.vg-flash {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.vg-flash.show { opacity: 1; }

/* The control bar: shown while paused or the pointer is moving. */
.vg-controls {
  position: absolute;
  inset: auto 0 0 0;
  padding: 34px 14px 10px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.75));
  color: #fff;
  transition: opacity 0.25s;
}
.vg-player.is-playing.is-idle .vg-controls { opacity: 0; }
.vg-player.is-playing.is-idle { cursor: none; }
.vg-seek {
  position: relative;
  height: 14px;
  display: flex;
  align-items: center;
  cursor: pointer;
  margin-bottom: 6px;
}
.vg-seek-track {
  position: relative;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
  overflow: hidden;
  transition: height 0.12s;
}
.vg-seek:hover .vg-seek-track { height: 6px; }
.vg-seek-buffered,
.vg-seek-played {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: 999px;
}
.vg-seek-buffered { background: rgba(255, 255, 255, 0.35); }
.vg-seek-played { background: var(--vg-accent); }
.vg-seek-thumb {
  position: absolute;
  top: 50%;
  left: 0;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.35);
  transform: scale(0);
  transition: transform 0.12s;
}
.vg-seek:hover .vg-seek-thumb,
.vg-seek.is-scrubbing .vg-seek-thumb { transform: scale(1); }
.vg-seek-tip {
  position: absolute;
  bottom: 18px;
  transform: translateX(-50%);
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.8);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  display: none;
  pointer-events: none;
}
.vg-seek:hover .vg-seek-tip { display: block; }
.vg-bar {
  display: flex;
  align-items: center;
  gap: 4px;
}
.vg-btn {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  transition: background 0.12s;
}
.vg-btn:hover { background: rgba(255, 255, 255, 0.14); }
.vg-btn:focus-visible { outline: 2px solid var(--vg-accent); outline-offset: -2px; }
.vg-btn svg { width: 22px; height: 22px; }
.vg-btn[data-alt] .alt, .vg-btn[data-alt].on .main { display: none; }
.vg-btn[data-alt].on .alt { display: block; }
.vg-time {
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  margin: 0 8px;
  white-space: nowrap;
  opacity: 0.92;
}
.vg-spacer { flex: 1; }
.vg-vol {
  display: flex;
  align-items: center;
  gap: 2px;
}
.vg-vol input {
  width: 0;
  opacity: 0;
  transition: width 0.15s, opacity 0.15s;
  accent-color: var(--vg-accent);
  cursor: pointer;
}
.vg-vol:hover input,
.vg-vol:focus-within input { width: 80px; opacity: 1; }
.vg-speed {
  height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  min-width: 48px;
  font-variant-numeric: tabular-nums;
}
.vg-speed:hover { background: rgba(255, 255, 255, 0.14); }
.vg-player:fullscreen { border-radius: 0; }
.vg-player:fullscreen video { object-fit: contain; }

/* ── the episode below the player ───────────────────────── */
.vg-now {
  margin-top: 16px;
  background: var(--vg-card);
  border: 1px solid var(--vg-line);
  border-radius: 16px;
  padding: 18px 20px;
}
.vg-now-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.vg-now .badge {
  display: inline-block;
  background: var(--vg-soft);
  color: var(--vg-brand);
  border: 1px solid rgba(34, 139, 34, 0.2);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.vg-now h2 {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0 0 6px;
  color: var(--vg-forest);
  letter-spacing: -0.01em;
}
[data-theme='dark'] .vg-now h2 { color: #f1f5f9; }
.vg-now p { margin: 0; color: var(--vg-muted); font-size: 0.92rem; line-height: 1.55; }
.vg-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.vg-chips span {
  background: var(--vg-chip);
  color: var(--vg-muted);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.72rem;
  font-weight: 600;
}
.vg-nav {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.vg-nav button {
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--vg-line);
  background: transparent;
  color: var(--vg-ink);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.vg-nav button:hover:not(:disabled) { background: var(--vg-chip); }
.vg-nav button:disabled { opacity: 0.4; cursor: default; }
.vg-nav button.primary {
  background: linear-gradient(135deg, #1a3c34, #2c8a78);
  color: #fff;
  border: 0;
  box-shadow: 0 6px 16px rgba(44, 138, 120, 0.3);
}

/* ── the playlist ───────────────────────────────────────── */
.vg-list {
  background: var(--vg-card);
  border: 1px solid var(--vg-line);
  border-radius: 16px;
  overflow: hidden;
  position: sticky;
  top: 74px;
}
@media (max-width: 960px) { .vg-list { position: static; } }
.vg-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--vg-line);
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--vg-forest);
}
[data-theme='dark'] .vg-list-head { color: #e2e8f0; }
.vg-list-head label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--vg-muted);
  cursor: pointer;
}
.vg-list-head input { accent-color: var(--vg-brand); }
.vg-list ol {
  list-style: none;
  margin: 0;
  padding: 6px;
  max-height: min(70vh, 640px);
  overflow-y: auto;
}
.vg-ep {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  align-items: center;
  padding: 8px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.12s;
  border: 0;
  width: 100%;
  text-align: left;
  background: transparent;
  color: inherit;
  font: inherit;
}
.vg-ep:hover { background: var(--vg-chip); }
.vg-ep.is-active { background: var(--vg-soft); }
.vg-ep:focus-visible { outline: 2px solid var(--vg-brand); }
.vg-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  background: linear-gradient(135deg, #1a3c34, #2c8a78);
  color: #a7f3d0;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 1.05rem;
  overflow: hidden;
}
.vg-thumb .dur {
  position: absolute;
  right: 4px;
  bottom: 4px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 0.64rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
}
.vg-thumb .seen {
  position: absolute;
  left: 4px;
  top: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--vg-brand);
  color: #fff;
  display: none;
  place-items: center;
  font-size: 0.7rem;
}
.vg-ep.is-seen .seen { display: grid; }
.vg-thumb .prog {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.25);
}
.vg-thumb .prog i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--vg-accent);
}
.vg-ep.is-active .vg-thumb::after {
  content: '▶';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 0.9rem;
}
.vg-ep-title {
  font-weight: 700;
  font-size: 0.86rem;
  line-height: 1.3;
  color: var(--vg-ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.vg-ep-sub {
  font-size: 0.72rem;
  color: var(--vg-muted);
  margin-top: 3px;
}


/* ── The map's overlay ──────────────────────────────────────
   The same theatre inside a dialog over the map: dark chrome so the
   player reads as a theatre, the episode list beneath on phones. */
.video-overlay .video-box {
  width: min(96vw, 1180px);
  max-height: 92vh;
  overflow: auto;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 18px;
  padding: 14px 16px 18px;
  box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.7);
  animation: issueSlide 0.25s ease;
}
.video-overlay .video-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.video-overlay .video-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: #a7f3d0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.video-overlay .video-head a {
  color: #6ee7b7;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  margin-left: auto;
}
.video-overlay .video-head a:hover { text-decoration: underline; }
.video-overlay .video-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 0;
  background: #1e293b;
  color: #cbd5e1;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.video-overlay .video-close:hover { background: #334155; color: #fff; }
/* Inside the overlay the theatre is always dark, whatever the page theme. */
.video-overlay {
  --vg-ink: #e5e7eb;
  --vg-muted: #94a3b8;
  --vg-card: #1e293b;
  --vg-line: rgba(255, 255, 255, 0.08);
  --vg-forest: #e2e8f0;
  --vg-chip: #263447;
  --vg-soft: #052e16;
}
.video-overlay .vg-now h2, .video-overlay .vg-list-head { color: #f1f5f9; }
.video-overlay .vg-slide-quote { color: #e2e8f0; }
.vg-compact .vg-now { padding: 12px 14px; margin-top: 10px; }
.vg-compact .vg-now h2 { font-size: 1.05rem; }
.vg-compact .vg-now p { font-size: 0.85rem; }
.vg-compact .vg-list ol { max-height: 52vh; }
.video-overlay .vg-list { position: static; }
@media (max-width: 640px) {
  .video-overlay .video-box { width: 100vw; max-height: 100vh; border-radius: 0; padding: 10px 10px 16px; }
}

/* ── Reduced motion, phones ─────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .vg-bigplay span, .vg-seek-thumb, .vg-seek-track { transition: none; }
}
@media (max-width: 640px) {
  .vg-player { border-radius: 12px; }
  .vg-time { margin: 0 4px; font-size: 0.72rem; }
  .vg-vol input { display: none; }
  .vg-now { padding: 14px; }
}
