.ios-webcam-player {
    --player-control-size: 42px;
    --player-control-slot: 44px;
    --player-control-icon: 24px;
    --player-live-font: 11px;
    --player-safe-top: 0px;
    --player-safe-right: 0px;
    --player-safe-bottom: 0px;
    --player-safe-left: 0px;
    --player-play-center-y: 50%;
    container-type: inline-size;
    overflow: hidden;
    background: #000;
    color: #fff;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

.ios-webcam-player--has-weather {
    --player-play-center-y: 36%;
}

.video > .ios-webcam-player {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
}

.ios-webcam-player__poster,
.ios-webcam-player__video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.ios-webcam-player__poster {
    position: absolute;
    z-index: 0;
    inset: 0;
}

.ios-webcam-player__video {
    position: relative;
    z-index: 1;
    opacity: 0;
}

.ios-webcam-player.has-video .ios-webcam-player__video {
    opacity: 1;
}

.ios-webcam-player__controls {
    position: absolute;
    z-index: 3;
    top: calc(var(--player-play-center-y) + clamp(36px, 6cqi, 50px));
    left: 50%;
    display: block;
    width: max-content;
    max-width: calc(100% - 16px);
    min-height: 0;
    height: auto;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 16px;
    background: rgba(5, 13, 28, 0.78);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.14);
    -webkit-backdrop-filter: blur(10px) saturate(1.25);
    backdrop-filter: blur(10px) saturate(1.25);
    transform: translateX(-50%);
    visibility: visible;
    opacity: 1;
    transition: opacity 180ms ease, visibility 0s linear;
}

.ios-webcam-player.is-controls-hidden .ios-webcam-player__controls {
    pointer-events: none;
    visibility: hidden;
    opacity: 0;
    transition-delay: 0s, 180ms;
}

.ios-webcam-player.is-controls-hidden:focus-within .ios-webcam-player__controls {
    pointer-events: auto;
    visibility: visible;
    opacity: 1;
    transition-delay: 0s;
}

.ios-webcam-player__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 var(--player-control-slot);
    width: var(--player-control-slot);
    height: var(--player-control-size);
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #fff;
    -webkit-appearance: none;
    appearance: none;
}

.ios-webcam-player__button[hidden] {
    display: none;
}

.ios-webcam-player__button:active {
    background: rgba(255, 255, 255, 0.2);
}

.ios-webcam-player__button--pip[aria-pressed="true"],
.ios-webcam-player__button--airplay[aria-pressed="true"],
.ios-webcam-player__button--theater[aria-pressed="true"] {
    background: rgba(54, 150, 233, 0.9);
}

.ios-webcam-player__button--theater {
    color: #61c9ff;
}

.ios-webcam-player__button--theater[aria-pressed="true"] {
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(151, 221, 255, 0.7);
}

.ios-webcam-player__button:focus-visible {
    outline: 2px solid #fff;
    outline-offset: -2px;
}

.ios-webcam-player__button--play {
    position: absolute;
    z-index: 4;
    top: var(--player-play-center-y);
    left: 50%;
    width: 54px;
    width: clamp(54px, 10cqi, 82px);
    height: 54px;
    height: clamp(54px, 10cqi, 82px);
    padding: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff3d71, #ff8a00);
    box-shadow: 0 8px 24px rgba(255, 61, 113, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.35);
    transform: translate(-50%, -50%);
    transition: opacity 180ms ease, background-color 180ms ease;
}

.ios-webcam-player.is-playing .ios-webcam-player__button--play {
    background: linear-gradient(135deg, #7c4dff, #2979ff);
    box-shadow: 0 8px 24px rgba(41, 121, 255, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.ios-webcam-player .ios-webcam-player__button--play svg {
    width: 28px;
    width: clamp(28px, 5cqi, 42px);
    height: 28px;
    height: clamp(28px, 5cqi, 42px);
}

.ios-webcam-player.is-playing.is-controls-hidden .ios-webcam-player__button--play,
.ios-webcam-player.is-playing.is-controls-hidden .ios-webcam-player__button--sound {
    pointer-events: none;
    opacity: 0;
}

.ios-webcam-player__button--sound {
    transition: opacity 180ms ease, background-color 180ms ease;
}

.ios-webcam-player__button svg {
    display: block;
    width: var(--player-control-icon);
    height: var(--player-control-icon);
    fill: currentColor;
}

.ios-webcam-player__pause-icon,
.ios-webcam-player__sound-muted,
.ios-webcam-player.is-muted .ios-webcam-player__sound-waves,
.ios-webcam-player__fullscreen-exit,
.ios-webcam-player.is-fullscreen .ios-webcam-player__fullscreen-enter {
    display: none;
}

.ios-webcam-player.is-playing .ios-webcam-player__pause-icon,
.ios-webcam-player.is-muted .ios-webcam-player__sound-muted,
.ios-webcam-player.is-fullscreen .ios-webcam-player__fullscreen-exit {
    display: block;
}

.ios-webcam-player.is-playing .ios-webcam-player__play-icon {
    display: none;
}

.ios-webcam-player__live {
    position: absolute;
    z-index: 3;
    top: 8px;
    top: max(clamp(8px, 1.5cqi, 14px), var(--player-safe-top));
    left: 8px;
    left: max(clamp(8px, 1.5cqi, 14px), var(--player-safe-left));
    display: inline-flex;
    align-items: center;
    gap: 7px;
    gap: clamp(7px, 1cqi, 9px);
    font-size: var(--player-live-font);
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.08em;
    pointer-events: none;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
}

.ios-webcam-player__live > span {
    width: 7px;
    width: clamp(7px, 1.1cqi, 9px);
    height: 7px;
    height: clamp(7px, 1.1cqi, 9px);
    border-radius: 50%;
    background: #f44336;
    box-shadow: 0 0 0 3px rgba(244, 67, 54, 0.22);
}

.ios-webcam-player__controls-end {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: auto;
    margin: 0;
}

.ios-webcam-player__controls-end .ios-webcam-player__button {
    align-self: center;
    height: var(--player-control-size);
    min-height: 0;
    line-height: 0;
    border-radius: 12px;
    color: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 4px 12px rgba(0, 0, 0, 0.3);
}

.ios-webcam-player__button--sound {
    background: linear-gradient(135deg, #ff8a00, #ff3d71);
}

.ios-webcam-player__button--pip {
    background: linear-gradient(135deg, #7c4dff, #b14cff);
}

.ios-webcam-player__button--airplay {
    background: linear-gradient(135deg, #00a8ff, #00d2c6);
}

.ios-webcam-player__button--theater {
    background: linear-gradient(135deg, #2979ff, #00b8ff);
}

.ios-webcam-player__button--fullscreen {
    background: linear-gradient(135deg, #00a86b, #35d07f);
}

.ios-webcam-player__controls-end .ios-webcam-player__button:active {
    filter: brightness(1.15);
    transform: translateY(1px);
}

.ios-webcam-player__controls-end .ios-webcam-player__button svg {
    flex: 0 0 var(--player-control-icon);
}

.ios-webcam-player__button--pip svg {
    transform: translateY(2px);
}

.ios-webcam-player__loading {
    position: absolute;
    z-index: 2;
    top: 50%;
    left: 50%;
    width: 38px;
    height: 38px;
    margin: -19px 0 0 -19px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    opacity: 0;
    animation: ios-webcam-player-spin 800ms linear infinite;
    transition: opacity 120ms ease;
}

.ios-webcam-player.is-loading .ios-webcam-player__loading {
    opacity: 1;
}

.ios-webcam-player__error {
    position: absolute;
    z-index: 2;
    top: 50%;
    left: 50%;
    width: min(80%, 360px);
    padding: 12px 16px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.72);
    font-size: 13px;
    line-height: 1.4;
    text-align: center;
    transform: translate(-50%, -50%);
}

.ios-webcam-player:fullscreen,
.ios-webcam-player:-webkit-full-screen {
    --player-safe-top: env(safe-area-inset-top);
    --player-safe-right: env(safe-area-inset-right);
    --player-safe-bottom: env(safe-area-inset-bottom);
    --player-safe-left: env(safe-area-inset-left);
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    background: #000;
}

html.has-webcam-player-theater,
body.has-webcam-player-theater {
    overflow: hidden;
    overscroll-behavior: none;
}

.video > .ios-webcam-player.is-theater,
.ios-webcam-player.is-theater {
    position: fixed !important;
    z-index: 100600;
    top: 50% !important;
    right: auto !important;
    bottom: auto !important;
    left: 50% !important;
    width: min(100vw, 177.7777778vh) !important;
    width: min(100vw, 177.7777778dvh) !important;
    height: min(56.25vw, 100vh) !important;
    height: min(56.25vw, 100dvh) !important;
    background: #000;
    box-shadow: 0 0 0 100vmax #000;
    transform: translate(-50%, -50%);
}

@keyframes ios-webcam-player-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .ios-webcam-player__controls,
    .ios-webcam-player__loading {
        transition: none;
    }
}

@supports (width: 1cqi) {
    .ios-webcam-player {
        --player-control-size: clamp(42px, 6cqi, 58px);
        --player-control-slot: clamp(44px, 7cqi, 62px);
        --player-control-icon: clamp(24px, 3.5cqi, 32px);
        --player-live-font: clamp(11px, 1.6cqi, 13px);
    }
}
