:root {
    --brandfilm-edge: clamp(14px, 2.4vw, 30px);
    --brandfilm-reserved-button-slot: clamp(72px, 8vw, 96px);
    --brandfilm-existing-button-slot: clamp(88px, 10vw, 124px);
}

.brandfilm-launcher {
    position: fixed;
    right: var(--brandfilm-edge);
    bottom: calc(env(safe-area-inset-bottom, 0px) + var(--brandfilm-existing-button-slot) + var(--brandfilm-reserved-button-slot));
    z-index: 9998;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 9px;
    min-width: 132px;
    min-height: 54px;
    padding: 8px 14px 8px 9px;
    border: 1px solid rgba(255, 221, 153, .8);
    border-radius: 999px;
   background: linear-gradient(145deg, rgba(38, 14, 8, .96), rgba(91, 31, 15, .94));
    color: #fff7dc;
    box-shadow: 0 10px 30px rgba(9, 3, 20, .42), 0 0 20px rgba(231, 196, 123, .22);
    font: 700 14px/1.1 system-ui, sans-serif;
    letter-spacing: .02em;
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.brandfilm-launcher:hover,
.brandfilm-launcher:focus-visible {
    transform: translateY(-3px);
    border-color: #ffe6aa;
    box-shadow: 0 14px 34px rgba(9, 3, 20, .5), 0 0 26px rgba(255, 221, 153, .42);
}

.brandfilm-launcher:focus-visible,
.brandfilm-modal button:focus-visible {
    outline: 3px solid #fff2bd;
    outline-offset: 3px;
}

.brandfilm-launcher__play {
    display: grid;
    place-items: center;
    width: 38px;
    aspect-ratio: 1;
    border-radius: 50%;
    background: linear-gradient(145deg, #ffe7a9, #c9963e);
    color: #241037;
    box-shadow: inset 0 1px rgba(255,255,255,.65);
    font-size: 15px;
    padding-left: 2px;
}

.brandfilm-modal[hidden] { display: none; }

.brandfilm-modal {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: grid;
    place-items: center;
    padding: clamp(14px, 3vw, 38px);
}

.brandfilm-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(12, 7, 3, .84);
    backdrop-filter: blur(10px);
}

.brandfilm-modal__panel {
    position: relative;
    width: min(960px, 94vw);
    max-height: 92vh;
    overflow: hidden;
    border: 1px solid rgba(255, 221, 153, .62);
    border-radius: clamp(14px, 2vw, 24px);
    background: #160c07;
    box-shadow: 0 28px 90px rgba(0, 0, 0, .72), 0 0 40px rgba(231, 196, 123, .18);
    transition: width .2s ease;
}

.brandfilm-modal.is-expanded .brandfilm-modal__panel { width: min(1280px, 97vw); }

.brandfilm-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 12px 10px 18px;
    background: linear-gradient(90deg, rgba(92, 18, 35, .98), rgba(22, 5, 10, .98));
}

.brandfilm-modal__header h2 {
    margin: 0;
    color: #ffe8ae;
    font: 700 clamp(15px, 2vw, 19px)/1.2 system-ui, sans-serif;
}

.brandfilm-modal__actions { display: flex; gap: 7px; }

.brandfilm-modal__actions button {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid rgba(255, 232, 174, .4);
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
    color: #fff7dc;
    font: 700 21px/1 system-ui, sans-serif;
    cursor: pointer;
}

.brandfilm-modal__actions button:hover { background: rgba(255, 232, 174, .2); }

.brandfilm-modal__media { background: #000; }

.brandfilm-modal video {
    display: block;
    width: 100%;
    max-height: calc(92vh - 58px);
    aspect-ratio: 16 / 9;
    object-fit: contain;
    background: #000;
}

body.brandfilm-is-open { overflow: hidden; }

@media (max-width: 600px) {
    :root {
        --brandfilm-reserved-button-slot: 62px;
        --brandfilm-existing-button-slot: 72px;
    }

    .brandfilm-launcher {
        min-width: 0;
        min-height: 48px;
        padding: 6px 11px 6px 7px;
        font-size: 12px;
    }

    .brandfilm-launcher__play { width: 34px; }
    .brandfilm-modal { padding: 9px; }
    .brandfilm-modal__panel { width: 100%; border-radius: 14px; }
    .brandfilm-modal__header { padding: 8px 8px 8px 13px; }
    .brandfilm-modal__actions button { width: 36px; height: 36px; }
}

@media (max-width: 360px) {
    .brandfilm-launcher__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
    .brandfilm-launcher { border-radius: 50%; padding: 6px; }
}

@media (prefers-reduced-motion: reduce) {
    .brandfilm-launcher,
    .brandfilm-modal__panel { transition: none; }
}
