/* ===== Player page base layout ===== */
main.container {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
}

/* すべての文字情報を左揃え */
h1, h2, h3, p, ul, li, .player-meta, .player-title, .player-desc, .player-info {
  text-align: left;
}

/* 映像プレイヤー部分 */
.player-wrap {
  max-width: 1100px;
  margin: 0 auto;
  gap: 12px;
}

/* ==== Composite: frame + dock as a single unit ==== */
.player-stack {
  border-radius: 12px;
  overflow: hidden; /* 子要素の角丸も一体化 */
  box-shadow: 0 10px 28px rgba(0,0,0,0.45);
}

.player-video {
  width: 100%;
  height: auto;
  display: block;
}

/* ==== Player visual frame (rounded, green accent, shadow) ==== */
.player-frame {
  position: relative;
  background: #0a0a0a; /* dark canvas behind the video */
}

/* === Big Play Button (center overlay) === */
.big-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 4; /* above videos, below overlay/toast */
  pointer-events: none; /* let inner button receive clicks only */
}
.big-play__btn {
  pointer-events: auto;
  appearance: none;
  -webkit-appearance: none;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.55);
  background: radial-gradient(ellipse at center, rgba(20,20,20,0.85) 0%, rgba(20,20,20,0.65) 60%, rgba(20,20,20,0.35) 100%);
  backdrop-filter: blur(2px);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: transform .12s ease, filter .2s ease, background .2s ease, border-color .2s ease;
}
.big-play__btn:hover { filter: brightness(1.08); border-color: rgba(255,255,255,0.8); }
.big-play__btn:active { transform: translateY(1px) scale(0.98); }
.big-play__triangle {
  width: 0; height: 0;
  border-top: 12px solid transparent;
  border-bottom: 12px solid transparent;
  border-left: 20px solid #fafaf8; /* triangle color */
  margin-left: 4px; /* optical centering */
}
.big-play.is-hidden { display: none; }

/* keep video flush with the frame */
.player-frame > .player-video {
  display: block;
  width: 100%;
  height: auto;
}

/* thin light-gray dock attached to the player */
.player-dock {
  background: #e9e9e7;
  border-top: 1px solid #d0d0cd; /* うっすら境界線 */
  padding: 10px 14px;
}

/* メタ情報の余白調整 */
.player-meta {
  margin-top: 20px;
  line-height: 1.8;
}

/* ==== Player explanation box ==== */
.player-subheading {
  margin: 18px 0 10px;
  font-size: 20px;
  font-weight: 900;
  font-family: var(--font-heading);
}
.player-desc-box {
  border: 1px solid #d0d0cd;
  background: #f5f5f3;
  border-radius: 10px;
  padding: 14px 16px;
  margin: 8px 0 18px;
  line-height: 1.9;
}
@media (max-width: 650px) {
  .player-desc-box {
    padding: 12px 12px;
    border-radius: 8px;
  }
}

/* ==== Player metadata list ==== */
.meta-list {
  display: grid;
  grid-template-columns: 8em 1fr;
  column-gap: 12px;
  row-gap: 6px;
  margin: 0;
  padding: 0;
}
.meta-list dt {
  font-weight: 900;
  font-family: var(--font-heading);
  margin: 0;
}
.meta-list dd {
  margin: 0;
  line-height: 1.9;
}
@media (max-width: 520px) {
  .meta-list { grid-template-columns: 7.5em 1fr; }
}

/* ==== Player metadata: table-like layout ==== */
.meta-table {
  display: block;
  border: 1px solid #d0d0cd;
  border-radius: 10px;
  overflow: hidden; /* clip inner row separators to rounded corners */
  background: #fff;
}
.meta-row {
  display: grid;
  grid-template-columns: 11em 1fr;
  align-items: start;
}
.meta-row + .meta-row {
  border-top: 1px solid #e2e2df;
}
.meta-th {
  padding: 10px 12px;
  font-weight: 900;
  font-family: var(--font-heading);
  background: #f2f2f0;
  border-right: 1px solid #e2e2df;
  line-height: 1.8;
}
.meta-td {
  padding: 10px 12px;
  line-height: 1.8;
}
@media (max-width: 650px) {
  .meta-row { grid-template-columns: 9.5em 1fr; }
}
@media (max-width: 520px) {
  .meta-row { grid-template-columns: 8.2em 1fr; }
}

/* ===== Player Title with Furigana ===== */
.player-heading { margin-bottom: 16px; }
.player-title {
  margin: 0 0 8px;
  font-family: var(--font-heading);
  font-weight: 900;
  letter-spacing: inherit;
}
.player-title ruby { ruby-position: over; }

/* layout for dock content */
.dock-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.dock-left, .dock-center, .dock-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.dock-center { justify-content: center; flex: 1 1 auto; }
.dock-left { flex: 0 0 auto; }
.dock-right { flex: 0 0 auto; }

/* ==== Responsive layout for player dock ==== */
@media (max-width: 650px) {
  /* 1段目＝カメラ（横幅いっぱい・中央）／2段目＝画質＋撮影位置（横並び） */
  .dock-inner {
    flex-wrap: wrap;
    justify-content: center;
    column-gap: 20px;
    row-gap: 10px;
  }
  /* 1段目：カメラ */
  .dock-center {
    order: 0;
    flex: 1 1 100%;
    justify-content: center;
  }
  /* 2段目：画質と撮影位置を横並び */
  .dock-left  { order: 1; flex: 0 1 auto; }
  .dock-right { order: 1; flex: 0 1 auto; }
  /* カメラボタン群が折り返せるように */
  .camera-switch { flex-wrap: wrap; }
    .quality-label { display: none; } /* 省スペース（文脈上 select のラベルで十分） */
}

@media (max-width: 380px) {
  .player-dock { padding: 8px 8px; }
  .quality-switch .q-select { min-width: 96px; }
  .camera-switch { gap: 8px; }
  .cam-btn { width: 38px; height: 28px; font-size: 13px; }
}


/* ==== Camera Switch Buttons inside Dock ==== */
.camera-switch-dock {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.cam-switch {
  width: 48px;
  height: 32px;
  background: #ccc;
  border: 1px solid #aaa;
  border-radius: 6px;
  font-family: "Zen Old Mincho", serif;
  font-weight: 700;
  color: #111;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cam-switch:hover {
  background: #ddd;
}

.cam-switch.is-active {
  background: #35bf5c;
  color: #fff;
  border-color: #35bf5c;
}


/* ==== Quality Switch Buttons (left) ==== */
.quality-switch { display: flex; gap: 8px; align-items: center; }
.quality-label {
  font-family: "Zen Old Mincho", serif;
  font-weight: 700;
  font-size: 14px;
  color: #222;
  margin-right: 2px;
}
.q-btn {
  min-width: 56px;
  height: 32px;
  padding: 0 10px;
  background: #ccc;
  border: 1px solid #aaa;
  border-radius: 6px;
  font-family: "Zen Old Mincho", serif;
  font-weight: 700;
  font-size: 14px;
  color: #111;
  cursor: pointer;
  transition: all 0.2s ease;
}
.q-btn:hover { background: #ddd; }
.q-btn.active {
  background: #2f8fcd;
  color: #fff;
  border-color: #2f8fcd;
}
.q-btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ==== Quality dropdown variant ==== */
.quality-switch .q-select {
  height: 32px;
  min-width: 85px;
  width: 65%;               /* ← 追加：今の約65%に */
  background: #fff;
  border: 1px solid #aaa;
  border-radius: 6px;
  font-family: "Zen Old Mincho", serif;
  font-weight: 700;
  font-size: 14px;
  color: #111;
  padding: 0 10px;
  cursor: pointer;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.quality-switch .q-select:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(47, 143, 205, 0.35);
  border-color: #2f8fcd;
}
.quality-switch .q-select[disabled] {
  background: #eee;
  color: #666;
  cursor: not-allowed;
}

/* ==== Camera Switch Buttons (actual .cam-btn used) ==== */
.camera-switch { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.cam-btn {
  width: 48px;
  height: 32px;
  background: #ccc;
  border: 1px solid #aaa;
  border-radius: 6px;
  font-family: "Zen Old Mincho", serif;
  font-weight: 700;
  color: #111;
  cursor: pointer;
  transition: all 0.2s ease;
}
.cam-btn:hover { background: #ddd; }
.cam-btn.active {
  background: #35bf5c;
  color: #fff;
  border-color: #35bf5c;
}

/* ==== Info button (right) ==== */
.info-btn {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #2b2b2b;
  color: #fafaf8;
  border: 1px solid #454545;
  border-radius: 999px; /* pill shape */
  padding: 6px 10px 6px 8px;
  cursor: pointer;
  font-size: 14px;
  transition: filter 0.2s ease, transform 0.15s ease;
}
.info-btn:hover { filter: brightness(1.05); }
.info-btn:active { transform: translateY(1px); }
.info-btn:focus-visible { outline: 2px solid #35bf5c; outline-offset: 2px; }
.info-badge {
  display: inline-grid;
  place-items: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #35bf5c; /* green accent */
  color: #0b0b0b;
  font-weight: 900;
  font-size: 13px;
  line-height: 1;
}
.info-label { font-weight: 700; }

/* ==== Modal (shooting map) ==== */
.modal { display: none; }
.modal.is-open { display: block; }
.modal .modal__backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(1px);
}
.modal .modal__dialog {
  position: fixed; inset: 0; display: grid; place-items: center; padding: 24px;
}
.modal .modal__dialog img {
  max-width: min(100%, 900px);
  max-height: min(80vh, 900px);
  width: auto; height: auto;
  display: block;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}
.modal .modal__close {
  background: #2b2b2b; color: #fafaf8; border: 1px solid #454545;
  border-radius: 8px; padding: 8px 12px; cursor: pointer;
  z-index: 10002;
  font-size: 18px; line-height: 1;
}
@media (max-width: 600px) {
  .info-btn { font-size: 13px; padding: 6px 8px; }
  .modal .modal__dialog { padding: 14px; }
  .modal .modal__close { top: -10px; }
}


/* ===== Modal fixes: layering & click-through ===== */
.modal { display: none; z-index: 10000; }
.modal.is-open { display: block; }
.modal .modal__backdrop { z-index: 10000; }
.modal .modal__dialog {
  position: fixed; inset: 0; display: grid; place-items: center; padding: 24px;
  z-index: 10001;
  pointer-events: none; /* 透過して背面のbackdropがクリックを受け取れる */
}
.modal .modal__dialog img {
  pointer-events: auto; /* 画像自体は操作可能に */
}

/* Position close button relative to the image container */
.modal .modal__content {
  position: relative;
  display: inline-block; /* shrink-wrap to image size */
  pointer-events: auto;  /* enable interactions inside */
}

/* Move the close button to just above the map's right edge */
.modal .modal__close {
  position: absolute;
  top: -12px;   /* slightly above the image */
  right: 0;     /* align with image right edge */
  z-index: 2;
}

/* Ensure image keeps its existing style */
.modal .modal__content img {
  max-width: min(100%, 900px);
  max-height: min(80vh, 900px);
  width: auto; height: auto;
  display: block;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

/* === Dual-video stacking & crossfade === */
.player-frame {
  position: relative;
}
/* 置き換え推奨（player.css） */
.player-frame .video-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;   /* ← 非表示時は拾わない */
  z-index: 1;
}
.player-frame .video-layer.visible {
  opacity: 1;
  pointer-events: auto;   /* ← 表示中だけ操作可 */
}

/* === Overlay for switching (切り替え中…) === */
.player-stack {
  position: relative; /* overlay位置の基準 */
}
.switch-overlay {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 8px;
  z-index: 5;
  background: rgba(20, 20, 20, 0.85);
  color: #fafaf8;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 14px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

/* Ensure overlay remains non-interactive */
.switch-overlay { pointer-events: none; }
.switch-overlay.active {
  opacity: 1;
}


.player-frame { aspect-ratio: 16 / 9; }