/* Phase 19 OVR-13: Safari 15 baseline for vMix CEF compatibility.
 *
 * vMix 27+ идёт с CEF 100+, но мы НЕ контролируем версию у клиента.
 * Baseline Safari 15 (август 2021) — максимально conservative, работает
 * во всех современных CEF (Chromium 94+).
 *
 * Не использовать в overlay/css:
 *   - @container / container-queries (Safari 16)
 *   - :has(...) без @supports fallback (Safari 15.4+)
 *   - @layer (CEF 100+ OK, но старым WebKit — проблема)
 *   - subgrid (Safari 16)
 *
 * Guard-скрипт scripts/check-overlay-css-baseline.js в CI валит build если
 * найдёт эти фичи без @supports fallback'ов.
 */

/* Universal reset — consistent rendering в CEF */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: transparent; /* прозрачный фон для vMix Browser Source */
  width: 1920px;
  height: 1080px;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  /* GPU acceleration — помогает CEF с большими overlay */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Overlay root — главное полотно */
#overlay-root {
  position: relative;
  width: 1920px;
  height: 1080px;
  overflow: hidden;
  background: transparent;
}

/* Liquid glass — с @supports fallback для старого CEF */
.liquid-glass {
  background: rgba(20, 22, 28, 0.72);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Fallback для CEF без backdrop-filter — более opaque background */
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .liquid-glass {
    background: rgba(20, 22, 28, 0.95);
  }
}

/* Reduce motion — оператор настраивает overlay без тормозящих анимаций */
@media (prefers-reduced-motion: reduce) {
  .overlay-element,
  .overlay-element * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Typography utilities — стабильно с Safari 15 */
.ov-text-center {
  text-align: center;
}

.ov-text-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Flex + Grid — стабильно с Safari 15 (НЕ используем subgrid) */
.ov-flex {
  display: flex;
}
.ov-flex-col {
  display: flex;
  flex-direction: column;
}
.ov-grid {
  display: grid;
}

/* aspect-ratio — Safari 15+ OK */
.ov-aspect-16-9 {
  aspect-ratio: 16 / 9;
}

/* Hidden элементы — универсальный способ (без :has()) */
.ov-hidden {
  display: none !important;
}

/* Connection indicator — показывается при disconnect */
#connection-indicator {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 6px 14px;
  border-radius: 999px;
  font: 600 12px/1.2 -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: transparent;
  color: #fff;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
  z-index: 9998;
  pointer-events: none;
}
#connection-indicator.disconnected {
  background: rgba(220, 38, 38, 0.9);
  opacity: 1;
}
#connection-indicator.error {
  background: rgba(220, 38, 38, 0.95);
  opacity: 1;
}
