/* =========================================================
   Video im Smartphone: Hochformat-Videos im stehenden, Querformat im liegenden Handy.
   Rahmen komplett in CSS. Auf kleinen Bildschirmen ohne Rahmen, fast bildschirmfüllend.
   ========================================================= */

.vd { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 24px; }
.vd[hidden] { display: none; }
.vd-backdrop { position: absolute; inset: 0; background: rgba(10, 10, 11, .82); opacity: 0; transition: opacity .22s ease-out; }
.vd.is-open .vd-backdrop { opacity: 1; }

.vd-stage { position: relative; display: flex; flex-direction: column; align-items: center; gap: 18px;
  opacity: 0; translate: 0 14px; scale: .96; transition: opacity .3s cubic-bezier(.23, 1, .32, 1),
  translate .38s cubic-bezier(.23, 1, .32, 1), scale .38s cubic-bezier(.23, 1, .32, 1); }
.vd.is-open .vd-stage { opacity: 1; translate: 0 0; scale: 1; }
.vd.is-closing .vd-stage { transition-duration: .16s; opacity: 0; scale: .98; }
.vd.is-closing .vd-backdrop { transition-duration: .18s; opacity: 0; }

/* Das Gerät: Bildschirm hat exakt das Seitenverhältnis des Videos (--ar), der Rahmen liegt drumherum */
.vd-phone { --bezel: 11px; position: relative; padding: var(--bezel); border-radius: 46px; background: #111214;
  box-shadow: inset 0 0 0 1.5px #3a3c42, inset 0 0 0 3px #0a0a0b, 0 40px 80px -30px rgba(0, 0, 0, .7); }
.vd-phone.is-portrait { height: min(76vh, 780px); aspect-ratio: auto; }
.vd-phone.is-portrait .vd-screen { height: 100%; aspect-ratio: var(--ar, 9 / 16); }
.vd-phone.is-landscape { width: min(86vw, 1040px, calc(66vh * var(--arn, 1.78))); }
.vd-phone.is-landscape .vd-screen { width: 100%; aspect-ratio: var(--ar, 16 / 9); }
.vd-screen { position: relative; overflow: hidden; border-radius: 36px; background: #000; }
.vd-screen video { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }

/* Dynamic Island: oben im Hochformat, links im Querformat */
.vd-island { position: absolute; z-index: 2; background: #000; border-radius: 100px; pointer-events: none; }
.vd-phone.is-portrait .vd-island { top: calc(var(--bezel) + 10px); left: 50%; width: 27%; height: 24px; translate: -50% 0; }
.vd-phone.is-landscape .vd-island { left: calc(var(--bezel) + 10px); top: 50%; width: 24px; height: 17%; translate: 0 -50%; }
/* Seitentasten */
.vd-phone::before, .vd-phone::after { content: ""; position: absolute; background: #2a2c31; border-radius: 3px; }
.vd-phone.is-portrait::before { right: -3px; top: 22%; width: 3px; height: 9%; }
.vd-phone.is-portrait::after { left: -3px; top: 18%; width: 3px; height: 14%; }
.vd-phone.is-landscape::before { top: -3px; right: 22%; height: 3px; width: 9%; }
.vd-phone.is-landscape::after { top: -3px; left: 18%; height: 3px; width: 14%; }

/* Ladezustand, bevor das Format bekannt ist */
.vd-phone.is-loading { width: 240px; height: 420px; }
.vd-phone.is-loading .vd-screen { width: 100%; height: 100%; }
.vd-spinner { position: absolute; left: 50%; top: 50%; width: 28px; height: 28px; margin: -14px 0 0 -14px; z-index: 3;
  border: 2.5px solid rgba(255, 255, 255, .25); border-top-color: #fff; border-radius: 50%; animation: vd-spin .7s linear infinite; }
.vd:not(.is-waiting) .vd-spinner { display: none; }
@keyframes vd-spin { to { rotate: 360deg; } }

/* Steuerung */
.vd-bar { display: flex; align-items: center; gap: 10px; width: min(560px, 86vw); padding: 8px 10px; border-radius: 100px;
  background: rgba(255, 255, 255, .1); color: #fff; backdrop-filter: blur(8px); }
.vd-btn { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: transparent; color: #fff; cursor: pointer; transition: background-color .15s ease, scale .12s ease-out; }
.vd-btn:hover { background: rgba(255, 255, 255, .12); }
.vd-btn:active { scale: .92; }
.vd-btn:focus-visible, .vd-range:focus-visible, .vd-close:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.vd-btn svg { width: 20px; height: 20px; }
.vd-btn .i-pause, .vd.is-playing .vd-btn .i-play { display: none; }
.vd.is-playing .vd-btn .i-pause { display: block; }
.vd-btn .i-muted, .vd.is-muted .vd-btn .i-sound { display: none; }
.vd.is-muted .vd-btn .i-muted { display: block; }
.vd-time { flex: none; font: 600 .78rem/1 'Inter', sans-serif; font-variant-numeric: tabular-nums; opacity: .85; min-width: 76px; text-align: center; }
.vd-range { flex: 1; min-width: 0; height: 20px; margin: 0; background: transparent; cursor: pointer; -webkit-appearance: none; appearance: none; }
.vd-range::-webkit-slider-runnable-track { height: 4px; border-radius: 4px;
  background: linear-gradient(90deg, var(--blue) var(--p, 0%), rgba(255, 255, 255, .25) var(--p, 0%)); }
.vd-range::-moz-range-track { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .25); }
.vd-range::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--blue); }
.vd-range::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: #fff; border: 0; }
.vd-range::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 0; }

.vd-title { margin: 0; max-width: min(560px, 86vw); text-align: center; color: rgba(255, 255, 255, .85); font-size: .92rem; }
.vd-close { position: absolute; top: 18px; right: 18px; z-index: 2; display: grid; place-items: center; width: 44px; height: 44px;
  border: 0; border-radius: 50%; background: rgba(255, 255, 255, .12); color: #fff; cursor: pointer;
  transition: background-color .15s ease, scale .12s ease-out; }
.vd-close:hover { background: rgba(255, 255, 255, .22); }
.vd-close:active { scale: .92; }
.vd-close svg { width: 20px; height: 20px; }
html.vd-lock, html.vd-lock body { overflow: hidden; }

/* Kleine Bildschirme: kein Handy im Handy, Video fast bildschirmfüllend */
@media (max-width: 640px) {
  .vd { padding: 64px 12px 16px; }
  .vd-phone { --bezel: 0px; background: transparent; box-shadow: none; border-radius: 16px; }
  .vd-phone::before, .vd-phone::after, .vd-island { display: none; }
  .vd-screen { border-radius: 16px; }
  .vd-phone.is-portrait { height: min(68vh, 640px); }
  .vd-phone.is-landscape { width: 100%; }
  .vd-bar { width: 100%; }
  .vd-time { min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .vd-stage, .vd-backdrop { transition: opacity .01s; translate: none; scale: none; }
  .vd-spinner { animation-duration: 1.6s; }
}
