/* 影片館：播放器（畫面是 iframe 裡的 HTML 動畫）、開關、下載、章節、挑影片。全站的顏色和字體在 site.css */

.vsec { padding-bottom: 0; }
.vmain { display: flex; flex-wrap: wrap; gap: 24px 28px; align-items: flex-start; justify-content: center; padding-bottom: clamp(20px, 3vw, 36px); }
.vcol { flex: 1 1 520px; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.vcol > * { max-width: 100%; }

/* ── 播放器 ── */
.vp { position: relative; background: #000; border-radius: 20px; overflow: hidden; box-shadow: var(--shadow-lg); outline: none; flex: none;
    user-select: none; -webkit-user-select: none; scroll-margin-top: calc(var(--header-h) + 16px); color: #fff; }
.vp:focus-visible { box-shadow: 0 0 0 4px var(--blue), var(--shadow-lg); }
.vp iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; pointer-events: none; }
.vp .hit { position: absolute; inset: 0; cursor: pointer; }
.vp.fs { border-radius: 0; }
.vp.pseudo-fs { position: fixed; inset: 0; z-index: 100; width: 100vw !important; height: 100vh !important; height: 100dvh !important; border-radius: 0; }
/* 假全螢幕（iPhone 不准網頁元素全螢幕時用）：播放器鋪滿整個視窗，後面的頁面先不能捲 */
html.vp-pseudo-open, html.vp-pseudo-open body { overflow: hidden; }
.vp button { color: inherit; }

.big { position: absolute; left: 50%; top: 50%; width: 88px; height: 88px; margin: -44px 0 0 -44px; border-radius: 50%; border: 0;
    background: rgba(12, 63, 122, .72); cursor: pointer; display: none; align-items: center; justify-content: center; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.big svg { width: 42px; height: 42px; fill: #fff; }
.vp.paused .big, .vp.ended .big { display: flex; }
.vp.has-end .big { display: none; }

/* 播完：再看一次、接著看下一支 */
.vend { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
    padding: 24px; background: rgba(8, 24, 48, .66); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.vend-replay, .vend-next { border: 0; cursor: pointer; border-radius: 999px; font-weight: 800; display: inline-flex; align-items: center; gap: 10px; max-width: 100%; }
.vend-replay { background: rgba(255, 255, 255, .16); color: #fff; padding: 10px 20px; font-size: .95rem; }
.vend-replay:hover { background: rgba(255, 255, 255, .28); }
.vend-replay svg { width: 20px; height: 20px; fill: #fff; flex: none; }
.vend-next { background: #fff; color: var(--navy) !important; padding: 12px 22px; font-size: 1rem; text-align: left; }
.vend-next:hover { background: var(--sky); }
.vend-k { font-size: .75rem; font-weight: 800; letter-spacing: .08em; padding: 3px 9px; border-radius: 999px; background: var(--blue); color: #fff; flex: none; }

.unmute { position: absolute; right: 14px; top: 14px; border: 0; cursor: pointer;
    display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px;
    background: rgba(8, 24, 48, .8); font-size: .88rem; letter-spacing: .04em; white-space: nowrap; }
.unmute .ico svg { width: 18px; height: 18px; fill: #fff; display: block; }
.vp.sound .unmute { display: none; }
.vp.paused .unmute, .vp.ended .unmute { display: none; }   /* 還沒播放時只顯示大播放鍵（按播放就連聲音一起開始） */

.controls { position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 12px 8px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, .72) 100%); transition: opacity .25s; }
.vp.idle .controls { opacity: 0; pointer-events: none; }
.vp.idle .hit { cursor: none; }
.controls .row { display: flex; align-items: center; gap: 4px; }
.controls .row .sp { flex: 1; }
.ib, .tb { border: 0; background: transparent; cursor: pointer; border-radius: 8px; height: 38px; display: inline-flex; align-items: center; justify-content: center; }
.ib { width: 38px; }
.ib svg { width: 22px; height: 22px; fill: #fff; }
.ib svg, .big svg, .unmute svg { pointer-events: none; }   /* 點擊一律落在按鈕本身 */
.tb { padding: 0 8px; font-size: .78rem; font-weight: 800; letter-spacing: .04em; color: rgba(255, 255, 255, .6) !important; }
.tb.on { color: #fff !important; box-shadow: inset 0 -2px 0 var(--coral); }
.ib:hover, .tb:hover { background: rgba(255, 255, 255, .14); }
.time { font-size: .82rem; font-variant-numeric: tabular-nums; margin-left: 4px; white-space: nowrap; }
.chapname { font-size: .82rem; color: rgba(255, 255, 255, .8); margin-left: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.progress { position: relative; height: 18px; display: flex; align-items: center; cursor: pointer; touch-action: none; outline: none; }
.progress:focus-visible .segs { box-shadow: 0 0 0 2px #fff; border-radius: 3px; }
.segs { display: flex; gap: 3px; width: 100%; height: 4px; transition: height .12s; }
.progress:hover .segs, .progress.drag .segs { height: 7px; }
.segs .s { position: relative; height: 100%; background: rgba(255, 255, 255, .3); border-radius: 2px; overflow: hidden; }
.segs .s i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--coral); width: 0; }
.tip { position: absolute; bottom: 22px; transform: translateX(-50%); padding: 5px 10px; border-radius: 8px; background: rgba(8, 24, 48, .94);
    font-size: .76rem; white-space: nowrap; pointer-events: none; display: none; }
.progress:hover .tip, .progress.drag .tip { display: block; }

/* 輸出影片時：控制列藏起來，畫面照常逐格顯示，下方是進度 */
.vp.exporting .controls, .vp.exporting .big, .vp.exporting .unmute { display: none !important; }
.vp.exporting .hit { cursor: default; }
body.exporting .switches, body.exporting .side { opacity: .5; pointer-events: none; }
.xo { position: absolute; left: 12px; right: 12px; bottom: 12px; padding: 14px 16px; border-radius: 14px;
    background: rgba(8, 24, 48, .9); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.xo-title { font-weight: 800; font-size: .9rem; margin-bottom: 8px; }
.xo-bar { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .2); overflow: hidden; }
.xo-bar i { display: block; height: 100%; width: 0; background: var(--coral); }
.xo-sub { margin-top: 8px; font-size: .78rem; color: rgba(255, 255, 255, .78); font-variant-numeric: tabular-nums; word-break: break-all; line-height: 1.5; }
.xo-stay { margin-top: 6px; font-size: .78rem; color: #ffd9a3; line-height: 1.5; }
.xo-act { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.xo-save { background: #fff; color: var(--navy); font-weight: 800; padding: 8px 16px; border-radius: 999px; text-decoration: none; font-size: .85rem;
    display: inline-flex; align-items: center; gap: 6px; }
.xo-save:hover { background: var(--sky); color: var(--navy); }
.xo-save svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.xo-btn { border: 1.5px solid rgba(255, 255, 255, .5); background: transparent; padding: 7px 14px; border-radius: 999px; cursor: pointer; font-size: .82rem; }
.xo-btn:hover { background: rgba(255, 255, 255, .14); }

/* ── 影片底下：片名、開關、下載 ── */
.vbar { width: 100%; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.vbar h2 { font-size: clamp(1.1rem, 2vw, 1.35rem); }
.switches { display: flex; gap: 8px; flex-wrap: wrap; }
.seg { display: inline-flex; background: #fff; border: 1.5px solid var(--line); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; cursor: pointer; font-size: .88rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.seg button.on { background: var(--blue); color: #fff; }
.export { width: 100%; display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; }
.export-btn { border: 0; background: var(--navy); color: #fff; font-weight: 800; padding: 11px 20px; border-radius: 12px;
    cursor: pointer; font-size: .95rem; letter-spacing: .04em; display: inline-flex; align-items: center; gap: 8px; }
.export-btn:hover { background: #0a3363; }
.export-btn:disabled { opacity: .5; cursor: not-allowed; }
.export-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.export-desc { font-size: .85rem; color: var(--muted); line-height: 1.5; }
.export-msg { width: 100%; font-size: .88rem; color: var(--coral-ink); line-height: 1.6; }

/* ── 章節 ── */
.side { flex: 0 0 320px; max-width: 100%; }
.ch-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ch-head h2 { font-size: 1.1rem; letter-spacing: .06em; }
.ghost { border: 1.5px solid var(--line); background: #fff; color: var(--muted); padding: 5px 12px; border-radius: 999px; cursor: pointer; font-size: .78rem; font-weight: 700; }
.ghost:hover { color: var(--blue); border-color: var(--blue); }
.chapters { margin-top: 12px; display: grid; gap: 6px; }
.chapters li button { width: 100%; display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; text-align: left;
    padding: 9px 12px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; }
.chapters li button:hover { border-color: var(--blue); }
.chapters .code { font-weight: 800; color: var(--coral-ink); font-size: .8rem; letter-spacing: .04em; }
.chapters .nm { font-size: .92rem; font-weight: 700; color: var(--ink); line-height: 1.4; }
.chapters .dur { font-size: .76rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.chapters li.on button { border-color: var(--blue); background: #f0f6fd; box-shadow: inset 4px 0 0 var(--blue); }
.keys { margin-top: 14px; font-size: .8rem; color: var(--muted); line-height: 1.7; }
.keys kbd { font: inherit; font-size: .92em; padding: 0 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: #fff; color: var(--ink); }

/* ── 挑影片 ── */
.pick-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 8px; }
.pick-head p:not(.kicker) { color: var(--muted); font-size: .92rem; }
.pk-group { margin-top: 26px; }
.pk-group h3 { display: flex; align-items: baseline; gap: 10px; font-size: 1.05rem; color: var(--coral-ink); letter-spacing: .1em; margin-bottom: 10px; }
.pk-group h3 small { font-size: .82rem; font-weight: 700; color: var(--muted); letter-spacing: .04em; }
.pk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.pk-grid a { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; min-height: 58px;
    border: 1.5px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s var(--ease); }
.pk-grid a:hover { border-color: var(--blue); box-shadow: 0 8px 18px rgba(12, 63, 122, .1); transform: translateY(-2px); color: var(--ink); }
.pk-grid a[aria-current="true"] { border-color: var(--blue); background: #f0f6fd; box-shadow: inset 4px 0 0 var(--blue); }
.pk-no { width: 34px; height: 34px; border-radius: 10px; background: var(--sky); color: var(--blue); font-weight: 900; font-size: .88rem; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.pk-name { font-size: .98rem; font-weight: 700; line-height: 1.45; word-break: keep-all; overflow-wrap: anywhere; }
.pk-dur { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.pick.locked { opacity: .5; pointer-events: none; }

@media (max-width: 900px) {
    .side { flex: 1 1 100%; }
    .chapters { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}
@media (max-width: 760px) {
    .chapname { display: none; }
    .vbar { justify-content: center; text-align: center; }
    .switches, .export { justify-content: center; }
    .export-desc { text-align: center; }
    .pk-grid { grid-template-columns: minmax(0, 1fr); }
    .vp { border-radius: 16px; }
}
@media (prefers-reduced-motion: reduce) {
    .controls, .pk-grid a { transition: none; }
}
