:root {
    --yak3d-bg: #111;
    --yak3d-text: #fff;
    --yak3d-muted: #b8b8b8;
    --yak3d-accent: #a01828;
    --yak3d-control: #303030;
}

html.yak3d-open {
    overflow: hidden;
}

.yak3d-overlay {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: none;
    box-sizing: border-box;
    align-items: center;
    justify-content: center;
    padding: clamp(12px, 3vw, 44px);
    background: rgba(0, 0, 0, 0.68);
    font-family: Arial, Helvetica, sans-serif;
}

.yak3d-overlay.is-open {
    display: flex;
}

.yak3d-dialog {
    display: flex;
    flex-direction: column;
    width: min(1080px, 94vw);
    height: min(760px, 90vh);
    min-height: 280px;
    overflow: hidden;
    color: var(--yak3d-text);
    background: var(--yak3d-bg);
    border-radius: 12px;
    box-shadow: 0 18px 70px rgba(0, 0, 0, 0.48);
}

.yak3d-header {
    position: relative;
    flex: 0 0 66px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 72px;
}

.yak3d-title {
    overflow: hidden;
    margin: 0;
    color: #fff;
    font-size: clamp(17px, 2vw, 21px);
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.yak3d-close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 44px;
    height: 44px;
    padding: 0 0 4px;
    color: #fff;
    background: var(--yak3d-control);
    border: 0;
    border-radius: 50%;
    font: 700 34px/40px Arial, sans-serif;
    cursor: pointer;
}

.yak3d-close:hover,
.yak3d-close:focus-visible {
    background: #4a4a4a;
    outline: 3px solid rgba(255, 255, 255, 0.72);
    outline-offset: 2px;
}

.yak3d-content {
    position: relative;
    flex: 1 1 auto;
    display: flex;
    min-width: 0;
    min-height: 0;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.yak3d-image,
.yak3d-video {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.yak3d-video {
    width: 100%;
    height: 100%;
    background: #000;
}

.yak3d-frame {
    display: block;
    width: 100%;
    height: 100%;
    background: #fff;
    border: 0;
}

.yak3d-message {
    max-width: 620px;
    padding: 28px;
    color: #fff;
    text-align: center;
}

.yak3d-external-link {
    display: inline-block;
    margin-top: 14px;
    padding: 12px 18px;
    color: #fff;
    background: var(--yak3d-accent);
    border-radius: 6px;
    text-decoration: none;
}

.yak3d-dialog--audio {
    width: min(680px, 94vw);
    height: auto;
    min-height: 350px;
}

.yak3d-dialog--audio .yak3d-content {
    padding: 18px 46px 48px;
}

.yak3d-audio {
    width: 100%;
    text-align: center;
}

.yak3d-audio-icon {
    display: block;
    width: 84px;
    height: 84px;
    margin: 2px auto 34px;
}

.yak3d-audio-timeline {
    display: grid;
    grid-template-columns: 52px minmax(120px, 1fr) 52px;
    gap: 14px;
    align-items: center;
}

.yak3d-audio-time {
    color: var(--yak3d-muted);
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

.yak3d-audio-progress,
.yak3d-audio-volume {
    accent-color: var(--yak3d-accent);
    cursor: pointer;
}

.yak3d-audio-progress {
    width: 100%;
    min-height: 36px;
}

.yak3d-audio-controls {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    margin-top: 24px;
}

.yak3d-audio-play {
    grid-column: 2;
    width: 68px;
    height: 68px;
    padding: 0;
    color: #fff;
    background: var(--yak3d-accent);
    border: 0;
    border-radius: 50%;
    font: 700 25px/68px Arial, sans-serif;
    cursor: pointer;
}

.yak3d-audio-play:hover,
.yak3d-audio-play:focus-visible {
    background: #bd2436;
    outline: 3px solid rgba(255, 255, 255, 0.72);
    outline-offset: 3px;
}

.yak3d-audio-volume-label {
    grid-column: 3;
    display: flex;
    gap: 8px;
    align-items: center;
    justify-self: end;
}

.yak3d-audio-volume-icon {
    font-size: 20px;
}

.yak3d-audio-volume {
    width: 92px;
    min-height: 36px;
}

@media (max-width: 640px) {
    .yak3d-overlay {
        padding: 8px;
    }

    .yak3d-dialog {
        width: 100%;
        height: 94vh;
        border-radius: 10px;
    }

    .yak3d-header {
        flex-basis: 58px;
        padding: 0 60px 0 18px;
    }

    .yak3d-close {
        top: 7px;
        right: 8px;
    }

    .yak3d-dialog--audio {
        height: auto;
        min-height: 340px;
    }

    .yak3d-dialog--audio .yak3d-content {
        padding: 12px 18px 34px;
    }

    .yak3d-audio-icon {
        width: 72px;
        height: 72px;
        margin-bottom: 24px;
    }

    .yak3d-audio-timeline {
        grid-template-columns: 44px minmax(90px, 1fr) 44px;
        gap: 8px;
    }

    .yak3d-audio-controls {
        grid-template-columns: 1fr auto 1fr;
    }

    .yak3d-audio-volume {
        width: 70px;
    }
}
