/* ===== 播放頁版面 ===== */
.viewer-body {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #0f172a;
}

/* ===== 頂部工具列 ===== */
.viewer-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 4px rgba(15,23,42,.08);
  z-index: 20;
}

.vb-back {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--brand-lt);
  color: var(--brand);
  font-size: 14px;
  font-weight: 700;
  transition: .15s;
}
.vb-back:hover { background: var(--brand); color: #fff; }

.vb-title {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex: 1;
}
.vb-icon { font-size: 19px; flex-shrink: 0; }
.vb-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vb-actions { display: flex; gap: 8px; flex-shrink: 0; }
.vb-btn {
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: .15s;
}
.vb-btn:hover { border-color: var(--brand); color: var(--brand); }

/* ===== 動畫舞台 ===== */
.viewer-stage {
  flex: 1;
  min-height: 0;
  background: #fff;
  position: relative;
}
.viewer-stage iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.viewer-stage:fullscreen { background: #fff; }
.viewer-stage:-webkit-full-screen { background: #fff; }

.stage-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 14px;
  z-index: 5;
}
.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--brand-lt);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 底部廣告條 ===== */
.viewer-ad {
  flex-shrink: 0;
  background: #fff;
  border-top: 1px solid var(--line);
}
.viewer-ad a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  max-width: 1240px;
  margin: 0 auto;
}
.viewer-ad img {
  width: 64px;
  height: 44px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}
.va-text { min-width: 0; flex: 1; }
.va-text strong {
  display: block;
  font-size: 14px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.va-text span {
  display: block;
  font-size: 12px;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.viewer-ad .tag.ad { flex-shrink: 0; }

/* ===== 使用說明側邊面板 ===== */
.guide-mask {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.45);
  opacity: 0;
  visibility: hidden;
  transition: .22s;
  z-index: 90;
}
.guide-mask.on { opacity: 1; visibility: visible; }

.guide-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  max-width: 88vw;
  height: 100%;
  background: #fff;
  box-shadow: -6px 0 24px rgba(15,23,42,.18);
  transform: translateX(100%);
  transition: transform .26s cubic-bezier(.4,0,.2,1);
  z-index: 100;
  display: flex;
  flex-direction: column;
}
.guide-panel.on { transform: translateX(0); }

.guide-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--brand-lt);
}
.guide-head h2 { font-size: 17px; color: var(--brand); }
.guide-close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.7);
  color: var(--ink-soft);
  font-size: 16px;
  cursor: pointer;
  font-family: inherit;
}
.guide-close:hover { background: #fff; color: var(--ink); }

.guide-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 18px 40px;
  -webkit-overflow-scrolling: touch;
}
.guide-body h3 { font-size: 19px; margin-bottom: 10px; }
.guide-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.guide-sum {
  font-size: 14px;
  color: var(--ink-soft);
  background: var(--bg);
  padding: 12px 14px;
  border-radius: 10px;
  border-left: 3px solid var(--brand);
  margin-bottom: 16px;
}
.guide-text {
  font-size: 15px;
  line-height: 1.85;
  color: var(--ink);
}

/* ===== 手機調整 ===== */
@media (max-width: 640px) {
  .viewer-bar { padding: 7px 10px; gap: 8px; }
  .vb-back { padding: 5px 11px; font-size: 13px; }
  .vb-name { font-size: 14px; }
  .vb-icon { font-size: 17px; }
  .vb-title .tag { display: none; }
  .vb-btn { padding: 5px 10px; font-size: 13px; }

  .viewer-ad img { width: 54px; height: 38px; }
  .va-text strong { font-size: 13px; }
  .va-text span { font-size: 11px; }

  .guide-panel { width: 100%; max-width: 100%; }
}

/* ===== 橫向手機／平板：工具列更薄，讓動畫空間最大化 ===== */
@media (max-height: 480px) and (orientation: landscape) {
  .viewer-bar { padding: 4px 10px; }
  .vb-name { font-size: 13px; }
  .vb-btn, .vb-back { padding: 4px 10px; font-size: 12px; }
  .viewer-ad { display: none; }
}
