/* 비디아 미디어 플레이어(vidia-player.js 짝). 접두사 vdp-.
 * 영상 위 조작부는 테마와 관계없이 어두운 반투명, 오디오 플레이어는 페이지 토큰(--surface·--ink·--line…)을 따른다.
 * 화면 폭 대응은 미디어 쿼리 대신 플레이어 폭 기준 클래스(is-narrow <480px — 영상은 <560px, is-tiny <360px)로 한다. */

.vdp { position: relative; box-sizing: border-box; font-family: var(--font, system-ui, sans-serif); line-height: 1.2; -webkit-tap-highlight-color: transparent; }
.vdp *, .vdp *::before, .vdp *::after { box-sizing: border-box; }
.vdp [hidden], .vdp[hidden] { display: none !important; }
.vdp:focus { outline: none; }
.vdp:focus-visible { outline: 2px solid var(--accent, #1E4FD8); outline-offset: 2px; }

/* ---------- 버튼 공통 ---------- */
.vdp-btn { -webkit-appearance: none; appearance: none; position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none; width: 36px; height: 36px; margin: 0; padding: 0; border: 0; border-radius: var(--r-1, 8px); background: transparent; color: inherit; font: inherit; cursor: pointer; transition: background-color var(--tr, .18s ease), color var(--tr, .18s ease), opacity var(--tr, .18s ease); }
.vdp-btn:disabled { opacity: .4; cursor: default; }
.vdp-btn:focus { outline: none; }
.vdp-btn:focus-visible { outline: 2px solid currentColor; outline-offset: -2px; }
.vdp-btn[aria-pressed="true"]::after { content: ""; position: absolute; left: 50%; bottom: 3px; width: 14px; height: 2px; margin-left: -7px; border-radius: 1px; background: currentColor; }
.vdp-ico { display: block; width: 22px; height: 22px; fill: none; pointer-events: none; }
.vdp-spacer { flex: 1 1 auto; min-width: 4px; }
.vdp-pop { position: relative; display: flex; flex: none; }

.vdp-tbtn { -webkit-appearance: none; appearance: none; display: inline-flex; align-items: center; gap: 6px; height: 32px; margin: 0; padding: 0 12px; border: 1px solid var(--line-2, #D1D5DB); border-radius: var(--r-1, 8px); background: var(--surface, #FFFFFF); color: var(--ink, #111827); font: 600 13px/1 var(--font, system-ui, sans-serif); white-space: nowrap; cursor: pointer; transition: background-color var(--tr, .18s ease), border-color var(--tr, .18s ease); }
.vdp-tbtn:hover:not(:disabled) { background: var(--surface-2, #F3F4F6); }
.vdp-tbtn:disabled { opacity: .45; cursor: default; }
.vdp-tbtn:focus { outline: none; }
.vdp-tbtn:focus-visible { outline: 2px solid var(--accent, #1E4FD8); outline-offset: 1px; }
.vdp-tbtn .vdp-ico { width: 16px; height: 16px; }

.vdp-time { display: inline-flex; align-items: center; flex: none; padding: 0 6px; font: 500 13px/1 var(--font, system-ui, sans-serif); font-variant-numeric: tabular-nums; white-space: nowrap; }
.vdp-time__sep { padding: 0 4px; }
.vdp-time__sep, .vdp-time__dur { opacity: .72; }

/* ---------- 메뉴 ---------- */
.vdp-menu { position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 10; display: flex; flex-direction: column; min-width: 132px; max-height: 260px; overflow-y: auto; padding: 4px; border: 1px solid rgba(255, 255, 255, .12); border-radius: var(--r-2, 12px); background: rgba(18, 21, 27, .96); color: #FFFFFF; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); }
.vdp-menu__item { -webkit-appearance: none; appearance: none; position: relative; display: flex; align-items: center; width: 100%; min-height: 32px; margin: 0; padding: 6px 12px 6px 30px; border: 0; border-radius: var(--r-1, 8px); background: transparent; color: inherit; font: 500 13px/1.2 var(--font, system-ui, sans-serif); text-align: left; white-space: nowrap; cursor: pointer; }
.vdp-menu__item:hover, .vdp-menu__item:focus { outline: none; background: rgba(255, 255, 255, .12); }
.vdp-menu__item[aria-checked="true"] { font-weight: 700; }
.vdp-menu__item[aria-checked="true"]::before { content: ""; position: absolute; left: 11px; top: 50%; width: 10px; height: 5px; margin-top: -5px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); }

/* ---------- 볼륨 ---------- */
.vdp-vol { display: flex; align-items: center; flex: none; }
.vdp-vol__range { -webkit-appearance: none; appearance: none; --vdp-fill: 100%; width: 0; height: 36px; margin: 0; padding: 0; opacity: 0; background: transparent; color: inherit; cursor: pointer; transition: width .2s ease, opacity .2s ease, margin .2s ease; }
.vdp-vol:hover .vdp-vol__range, .vdp-vol:focus-within .vdp-vol__range { width: 72px; margin: 0 8px 0 2px; opacity: 1; }
.vdp-vol__range:focus { outline: none; }
.vdp-vol__range:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; border-radius: 2px; }
.vdp-vol__range::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, currentColor var(--vdp-fill), var(--vdp-track, rgba(255, 255, 255, .3)) var(--vdp-fill)); }
.vdp-vol__range::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; margin-top: -4px; border: 0; border-radius: 50%; background: currentColor; }
.vdp-vol__range::-moz-range-track { height: 4px; border-radius: 2px; background: var(--vdp-track, rgba(255, 255, 255, .3)); }
.vdp-vol__range::-moz-range-progress { height: 4px; border-radius: 2px; background: currentColor; }
.vdp-vol__range::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: currentColor; }

/* =====================================================================
 * 영상
 * ===================================================================== */
.vdp--video { display: block; width: 100%; max-width: 100%; overflow: hidden; background: #000000; color: #FFFFFF; isolation: isolate; -webkit-user-select: none; user-select: none; }
.vdp--video > .vdp-media { display: block; width: 100%; max-width: 100%; margin: 0; background: #000000; touch-action: pan-y pinch-zoom; }
.vdp--video.is-fs { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; max-width: none; border-radius: 0 !important; }
.vdp--video.is-fs > .vdp-media { width: 100%; height: 100%; max-height: none; object-fit: contain; }
.vdp--video.is-idle { cursor: none; }
.vdp--video .vdp-btn:hover { background: rgba(255, 255, 255, .14); }
.vdp--video .vdp-btn[aria-pressed="true"] { color: #A9C1FF; }

/* 조작부 */
.vdp-controls { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; padding: 0 10px 4px; transition: opacity .25s ease, transform .25s ease; }
.vdp-controls::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; z-index: -1; height: calc(100% + 36px); background: linear-gradient(to top, rgba(0, 0, 0, .78), rgba(0, 0, 0, .38) 55%, rgba(0, 0, 0, 0)); pointer-events: none; }
.vdp--video.is-idle .vdp-controls { opacity: 0; transform: translateY(6px); pointer-events: none; }
.vdp-bar { display: flex; align-items: center; gap: 2px; min-height: 40px; }
.vdp-speed { width: auto; min-width: 44px; padding: 0 8px; font: 600 13px/1 var(--font, system-ui, sans-serif); font-variant-numeric: tabular-nums; }
.vdp-ab { width: auto; min-width: 38px; padding: 0 6px; font: 700 12px/1 var(--mono, monospace); letter-spacing: -.02em; }
.vdp-ab.is-half { color: #FFC845; }

/* 탐색 막대 */
.vdp-seek { position: relative; display: flex; align-items: center; height: 18px; cursor: pointer; touch-action: none; outline: none; }
.vdp-seek:focus-visible { outline: 2px solid #FFFFFF; outline-offset: 2px; border-radius: 4px; }
.vdp-seek__track { position: relative; width: 100%; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .28); transition: height .12s ease; }
.vdp-seek:hover .vdp-seek__track, .vdp-seek:focus-visible .vdp-seek__track, .vdp.is-scrub .vdp-seek__track { height: 6px; }
.vdp-seek__buf, .vdp-seek__hover, .vdp-seek__played { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; border-radius: 2px; transform: scaleX(0); transform-origin: 0 50%; pointer-events: none; }
.vdp-seek__buf { background: rgba(255, 255, 255, .34); }
.vdp-seek__hover { background: rgba(255, 255, 255, .22); }
.vdp-seek__played { background: var(--accent, #1E4FD8); }
.vdp.has-range .vdp-seek__track { background: rgba(255, 255, 255, .14); }
.vdp-seek__range { position: absolute; top: -2px; bottom: -2px; border-left: 2px solid #FFFFFF; border-right: 2px solid #FFFFFF; border-radius: 2px; background: rgba(255, 255, 255, .22); pointer-events: none; }
.vdp-seek__ab { position: absolute; top: -3px; bottom: -3px; border-left: 2px solid #FFC845; border-right: 2px solid #FFC845; background: rgba(255, 200, 69, .32); pointer-events: none; }
.vdp-seek__ab.is-half { width: 2px; border: 0; background: #FFC845; }
.vdp-seek__marks { position: absolute; inset: 0; }
.vdp-seek__mark { position: absolute; top: -3px; bottom: -3px; width: 3px; margin-left: -1.5px; border-radius: 1px; background: #FFD54A; }
.vdp-seek__knob { position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 3px rgba(0, 0, 0, .5); transform: scale(0); transition: transform .12s ease; pointer-events: none; }
.vdp-seek:hover .vdp-seek__knob, .vdp-seek:focus-visible .vdp-seek__knob, .vdp.is-scrub .vdp-seek__knob, .vdp.is-paused .vdp-seek__knob { transform: scale(1); }

/* 미리보기 말풍선 */
.vdp-tip { position: absolute; left: 0; bottom: calc(100% + 6px); z-index: 4; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 3px; border: 1px solid rgba(255, 255, 255, .14); border-radius: var(--r-1, 8px); background: rgba(12, 14, 18, .92); color: #FFFFFF; white-space: nowrap; transform: translateX(-50%); pointer-events: none; }
.vdp-tip__img { display: block; width: 160px; height: 90px; border-radius: 5px; background: #000000; }
.vdp-tip__label { max-width: 180px; overflow: hidden; padding: 0 4px; font-size: 12px; font-weight: 600; text-overflow: ellipsis; }
.vdp-tip__time { padding: 1px 4px 2px; font: 600 12px/1.2 var(--mono, monospace); font-variant-numeric: tabular-nums; }

/* 가운데 요소 */
.vdp-big { position: absolute; left: 50%; top: 50%; z-index: 2; width: 68px; height: 68px; margin: -34px 0 0 -34px; border: 1px solid rgba(255, 255, 255, .22); border-radius: 50%; background: rgba(0, 0, 0, .55); color: #FFFFFF; transition: opacity .2s ease, transform .2s ease, background-color .2s ease; }
.vdp-big .vdp-ico { width: 34px; height: 34px; margin-left: 3px; }
.vdp--video .vdp-big:hover { border-color: transparent; background: var(--accent, #1E4FD8); }
.vdp--video .vdp-big:focus-visible { outline: 2px solid #FFFFFF; outline-offset: 3px; }
.vdp--video.is-playing .vdp-big, .vdp--video.is-error .vdp-big, .vdp--video.is-loading .vdp-big, .vdp.is-scrub .vdp-big { opacity: 0; transform: scale(.9); pointer-events: none; }

.vdp-spin { position: absolute; left: 50%; top: 50%; z-index: 2; width: 44px; height: 44px; margin: -22px 0 0 -22px; border: 3px solid rgba(255, 255, 255, .25); border-top-color: #FFFFFF; border-radius: 50%; opacity: 0; visibility: hidden; pointer-events: none; animation: vdp-rot .8s linear infinite; animation-play-state: paused; transition: opacity .15s ease, visibility 0s linear .15s; }
.vdp--video.is-loading .vdp-spin { opacity: 1; visibility: visible; animation-play-state: running; transition: opacity .2s ease .4s, visibility 0s linear .4s; }
@keyframes vdp-rot { to { transform: rotate(360deg); } }

.vdp-flash { position: absolute; left: 50%; top: 50%; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 8px; opacity: 0; transform: translate(-50%, -50%); pointer-events: none; }
.vdp-flash__ico { display: flex; align-items: center; justify-content: center; width: 60px; height: 60px; border-radius: 50%; background: rgba(0, 0, 0, .55); }
.vdp-flash__ico .vdp-ico { width: 30px; height: 30px; }
.vdp-flash__txt { padding: 5px 12px; border-radius: var(--r-pill, 999px); background: rgba(0, 0, 0, .66); font: 600 13px/1.3 var(--font, system-ui, sans-serif); font-variant-numeric: tabular-nums; white-space: nowrap; }
.vdp-flash.is-on { animation: vdp-flash .7s ease-out forwards; }
.vdp-flash.is-hold { opacity: 1; }
@keyframes vdp-flash {
	0% { opacity: 0; transform: translate(-50%, -50%) scale(.86); }
	20% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
	70% { opacity: 1; }
	100% { opacity: 0; transform: translate(-50%, -50%) scale(1.05); }
}
@keyframes vdp-fade { 0% { opacity: 0; } 15% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; } }

/* 자막 */
.vdp-cc { position: absolute; left: 4%; right: 4%; bottom: 5%; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: var(--vdp-cc-size, 18px); text-align: center; pointer-events: none; transition: bottom .2s ease; }
.vdp--video:not(.is-idle) .vdp-cc { bottom: 66px; }
.vdp--compact:not(.is-idle) .vdp-cc { bottom: 56px; }
.vdp-cc__txt { display: inline; padding: .12em .45em; border-radius: 4px; background: rgba(0, 0, 0, .72); color: #FFFFFF; font-weight: 600; line-height: 1.45; white-space: pre-line; -webkit-box-decoration-break: clone; box-decoration-break: clone; }

/* 오류 */
.vdp-error { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 16px; background: rgba(0, 0, 0, .84); text-align: center; }
.vdp-error > .vdp-ico { width: 32px; height: 32px; color: #FFB4AB; }
.vdp-error__msg { max-width: 34em; margin: 0; font-size: 14px; line-height: 1.55; }
.vdp-error .vdp-tbtn { border-color: transparent; background: #FFFFFF; color: #111827; }
.vdp-error .vdp-tbtn:hover { background: #E5E7EB; }

/* 작게(compact: 카드·라이트박스) */
.vdp--compact .vdp-btn { width: 32px; height: 32px; }
.vdp--compact .vdp-ico { width: 20px; height: 20px; }
.vdp--compact .vdp-bar { min-height: 34px; }
.vdp--compact .vdp-controls { padding: 0 6px 2px; }
.vdp--compact .vdp-time { font-size: 12px; }
.vdp--compact .vdp-big { width: 52px; height: 52px; margin: -26px 0 0 -26px; }
.vdp--compact .vdp-big .vdp-ico { width: 26px; height: 26px; }
.vdp--compact .vdp-speed { min-width: 40px; padding: 0 6px; font-size: 12px; }
.vdp--compact .vdp-hide-compact { display: none !important; }

/* 폭 기준 숨김(ResizeObserver 가 붙이는 클래스) */
.vdp.is-narrow .vdp-hide-narrow, .vdp.is-tiny .vdp-hide-tiny, .vdp.is-micro .vdp-hide-micro { display: none !important; }
.vdp.is-tiny .vdp-time { padding: 0 4px; }

/* =====================================================================
 * 오디오(파형)
 * ===================================================================== */
.vdp--audio { --vdp-track: var(--line-2, #D1D5DB); display: block; width: 100%; padding: 8px 10px 10px; border: 1px solid var(--line, #E5E7EB); border-radius: var(--r-2, 12px); background: var(--surface, #FFFFFF); color: var(--ink, #111827); }
.vdp--audio > .vdp-media { display: none !important; }
.vdp-a-head { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; min-height: 40px; }
.vdp--audio .vdp-btn { color: var(--ink-2, #374151); }
.vdp--audio .vdp-btn:hover { background: var(--surface-2, #F3F4F6); color: var(--ink, #111827); }
.vdp--audio .vdp-btn:focus-visible { outline: 2px solid var(--accent, #1E4FD8); outline-offset: 1px; }
.vdp--audio .vdp-btn[aria-pressed="true"] { background: var(--accent-soft, #E8EEFF); color: var(--accent, #1E4FD8); }
.vdp--audio .vdp-btn[aria-pressed="true"]::after { display: none; }
.vdp--audio .vdp-btn.vdp-a-play { width: 38px; height: 38px; margin-right: 4px; border-radius: 50%; background: var(--accent, #1E4FD8); color: #FFFFFF; }
.vdp--audio .vdp-btn.vdp-a-play:hover { background: var(--accent-hover, #173FB0); color: #FFFFFF; }
.vdp--audio .vdp-a-play .vdp-ico { width: 20px; height: 20px; }
.vdp--audio .vdp-a-play:not([aria-label="일시정지"]) .vdp-ico { margin-left: 2px; }
.vdp--audio .vdp-time { color: var(--ink-2, #374151); font-family: var(--mono, monospace); font-size: 12.5px; }
.vdp-a-zoom { display: flex; align-items: center; gap: 2px; }
.vdp--audio .vdp-vol__range { width: 72px; margin: 0 4px; opacity: 1; color: var(--accent, #1E4FD8); }
.vdp--audio .vdp-menu { top: calc(100% + 6px); bottom: auto; border-color: var(--line, #E5E7EB); background: var(--surface, #FFFFFF); color: var(--ink, #111827); box-shadow: var(--sh-2, 0 8px 24px rgba(17, 24, 39, .10)); }
.vdp--audio .vdp-menu__item:hover, .vdp--audio .vdp-menu__item:focus { background: var(--surface-2, #F3F4F6); }

.vdp-a-wave { position: relative; height: 96px; margin-top: 6px; overflow: hidden; border-radius: var(--r-1, 8px); background: var(--surface-2, #F3F4F6); cursor: pointer; outline: none; touch-action: pan-y; -webkit-user-select: none; user-select: none; }
.vdp-a-wave:focus-visible { box-shadow: 0 0 0 2px var(--accent, #1E4FD8); }
.vdp--audio.is-selectable .vdp-a-wave { cursor: crosshair; }
.vdp-a-canvas { display: block; width: 100%; height: 100%; }
.vdp-a-tip { position: absolute; left: 0; bottom: 4px; padding: 2px 6px; border-radius: 6px; background: var(--ink, #111827); color: var(--surface, #FFFFFF); font: 600 11px/1.3 var(--mono, monospace); white-space: nowrap; transform: translateX(-50%); pointer-events: none; }
.vdp-a-loading { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: linear-gradient(90deg, rgba(127, 127, 127, 0) 0%, rgba(127, 127, 127, .16) 50%, rgba(127, 127, 127, 0) 100%); background-size: 200% 100%; color: var(--muted, #5B6472); font-size: 12px; pointer-events: none; animation: vdp-shimmer 1.3s linear infinite; }
.vdp-a-wave.is-loading .vdp-a-loading { display: flex; }
@keyframes vdp-shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }

.vdp-a-scroll { position: relative; height: 10px; margin-top: 4px; border-radius: 5px; background: var(--surface-2, #F3F4F6); cursor: pointer; touch-action: none; }
.vdp-a-scroll__thumb { position: absolute; top: 1px; bottom: 1px; min-width: 16px; border-radius: 4px; background: var(--line-2, #D1D5DB); }
.vdp-a-scroll:hover .vdp-a-scroll__thumb { background: var(--muted-2, #8B94A3); }

.vdp-a-err { margin: 6px 0 0; color: var(--danger, #B42318); font-size: 12.5px; line-height: 1.5; }

.vdp-a-sel { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 8px; color: var(--ink-2, #374151); font-size: 13px; }
.vdp-a-field { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.vdp-a-num { width: 96px; height: 32px; margin: 0; padding: 0 8px; border: 1px solid var(--line-2, #D1D5DB); border-radius: var(--r-1, 8px); background: var(--surface, #FFFFFF); color: var(--ink, #111827); font: 13px/1 var(--mono, monospace); font-variant-numeric: tabular-nums; }
.vdp-a-num:focus { outline: 2px solid var(--accent, #1E4FD8); outline-offset: -1px; border-color: transparent; }
.vdp-a-len { color: var(--muted, #5B6472); font-family: var(--mono, monospace); font-size: 12.5px; white-space: nowrap; }

.vdp--audio.vdp--compact { padding: 6px 8px 8px; }
.vdp--audio.vdp--compact .vdp-btn { width: 32px; height: 32px; }
.vdp--audio.vdp--compact .vdp-btn.vdp-a-play { width: 34px; height: 34px; }
.vdp--audio.is-narrow .vdp-vol__range { display: none; }
.vdp--audio.is-micro .vdp-time__sep, .vdp--audio.is-micro .vdp-time__dur { display: none; }

/* ---------- 입력 방식·움직임 줄이기 ---------- */
@media (pointer: coarse) {
	.vdp--video .vdp-btn { width: 40px; height: 40px; }
	.vdp--video.vdp--compact .vdp-btn { width: 36px; height: 36px; }
	.vdp-seek { height: 24px; }
	.vdp-seek__knob { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
	.vdp, .vdp *, .vdp *::before, .vdp *::after { transition-duration: .01ms !important; transition-delay: 0s !important; }
	.vdp-flash.is-on { animation-name: vdp-fade; }
	.vdp-spin { animation-duration: 2.4s; }
	.vdp-a-loading { animation: none; }
	.vdp--video.is-idle .vdp-controls { transform: none; }
}
