/* Shared 9:16 Social Embed Player Chrome (SocialMediaViewer & Standalone /embed/*.html) */

.embed-player-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 9 / 16;
    container-type: size;
    --pad: min(3cqh, 3cqw);
    --bar-h: max(6cqh, 36px);
    background: #000000;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

.embed-tt-poster-wrap,
.embed-tt-player-slot {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background: #0c0e13;
}

.embed-tt-player-slot {
    z-index: 1;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
}

[data-tt-state="playing"] .embed-tt-player-slot {
    z-index: 2;
    opacity: 1;
    pointer-events: auto;
}

.embed-tt-poster-wrap {
    z-index: 2;
    opacity: 1;
    transition: opacity 0.28s ease;
}

[data-tt-state="playing"] .embed-tt-poster-wrap {
    opacity: 0;
    pointer-events: none;
}

.embed-tt-fallback-bg {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 22% 18%, rgba(37, 244, 238, 0.16), transparent 52%),
        radial-gradient(circle at 78% 82%, rgba(254, 44, 85, 0.16), transparent 55%),
        linear-gradient(160deg, #161823 0%, #0b0c11 100%);
}

.embed-tt-fallback-glyph {
    width: 44px;
    height: 44px;
    color: rgba(255, 255, 255, 0.14);
    transform: translateY(-8px);
}

.embed-tt-fallback-glyph svg {
    width: 100%;
    height: 100%;
    display: block;
}

.embed-tt-poster {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.28s ease;
}

[data-cover-loaded="true"] .embed-tt-poster {
    opacity: 1;
}

[data-cover-missing="true"] .embed-tt-poster {
    display: none;
}

.embed-tt-iframe,
.embed-fb-video {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    object-fit: cover;
    background: #000000;
}

.embed-shield {
    position: absolute;
    inset: 0;
    z-index: 4;
    cursor: pointer;
    display: grid;
    place-items: center;
}

.embed-shield:focus-visible {
    outline: 2px solid var(--color-brand-blue, #ff6b35);
    outline-offset: -3px;
}

.embed-player-frame[data-platform="tiktok"] .embed-shield {
    inset: calc(var(--pad) * 2 + var(--bar-h)) 0 0 0;
}

.embed-pause-badge {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.58);
    color: #ffffff;
    display: grid;
    place-items: center;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.15s ease, transform 0.15s ease;
    pointer-events: none;
}

.embed-pause-badge svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    margin-left: 2px;
    display: block;
}

.embed-play-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.embed-spinner {
    display: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2.2px solid rgba(255, 255, 255, 0.26);
    border-top-color: #ffffff;
    animation: embedSpin 0.72s linear infinite;
}

@keyframes embedSpin {
    to { transform: rotate(360deg); }
}

[data-paused="true"] .embed-pause-badge,
[data-tt-state="loading"] .embed-pause-badge {
    opacity: 1;
    transform: scale(1);
}

[data-tt-state="loading"] .embed-play-icon {
    display: none;
}

[data-tt-state="loading"] .embed-spinner {
    display: block;
}

.embed-tt-error-bar {
    display: none;
    position: absolute;
    left: var(--pad);
    right: var(--pad);
    bottom: var(--pad);
    z-index: 6;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(16, 16, 22, 0.86);
    border: 1px solid rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

[data-tt-state="error"] .embed-tt-error-bar {
    display: flex;
}

[data-tt-state="error"] .embed-mute-btn {
    display: none;
}

.embed-tt-error-text {
    min-width: 0;
    font-size: 11px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.embed-tt-external-btn {
    flex-shrink: 0;
    padding: 4px 10px;
    border-radius: 999px;
    background: #fe2c55;
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    line-height: 1.3;
    transition: transform 0.15s ease, filter 0.15s ease;
}

.embed-tt-external-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.embed-mute-btn {
    position: absolute;
    right: 10px;
    bottom: 10px;
    z-index: 6;
    width: 36px;
    height: 36px;
    background: rgba(16, 16, 20, 0.78);
    border-color: rgba(255, 255, 255, 0.18);
}

.embed-player-frame[data-platform="tiktok"] .embed-mute-btn {
    right: var(--pad);
    bottom: var(--pad);
    width: 38px;
    height: 38px;
    background: rgba(18, 18, 18, 0.92);
}

.embed-mute-btn:hover {
    background: rgba(16, 16, 20, 0.95);
    transform: scale(1.06);
}

.embed-mute-btn svg {
    width: 17px;
    height: 17px;
}

.embed-mute-btn[data-muted="true"] .mute-icon-on,
.embed-mute-btn[data-muted="false"] .mute-icon-off {
    display: none;
}

.embed-top-author,
.embed-top-logo {
    position: absolute;
    top: var(--pad);
    z-index: 5;
    height: var(--bar-h);
    display: flex;
    align-items: center;
    color: #ffffff;
    text-decoration: none;
    filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.6));
}

.embed-top-author {
    left: var(--pad);
    max-width: calc(100% - var(--pad) * 3 - var(--bar-h));
    gap: clamp(6px, 1cqw, 10px);
}

.embed-top-avatar {
    height: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.28);
}

.embed-top-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.embed-top-name,
.embed-top-handle {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.15;
}

.embed-top-name {
    font-size: calc(var(--bar-h) * 0.48);
    font-weight: 500;
    color: #ffffff;
}

.embed-top-handle {
    margin-top: 2px;
    font-size: calc(var(--bar-h) * 0.36);
    color: rgba(255, 255, 255, 0.9);
}

.embed-top-logo {
    right: var(--pad);
    width: var(--bar-h);
    justify-content: center;
    opacity: 0.92;
}

.embed-top-logo svg {
    width: 75%;
    height: 75%;
}

/* Standalone /embed/*.html Full-Viewport Stage & Prev/Next Controls */
.embed-standalone-body {
    width: 100%;
    height: 100dvh;
    background: #000000;
    display: grid;
    place-items: center;
    overflow: hidden;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

.embed-standalone-stage {
    height: min(100dvh, calc(100vw * 16 / 9));
    width: min(100vw, calc(100dvh * 9 / 16));
}

.embed-nav-controls {
    position: absolute;
    right: var(--pad);
    top: 50%;
    transform: translateY(-50%);
    z-index: 6;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.embed-nav-controls[hidden] {
    display: none;
}

.embed-nav-btn {
    width: 38px;
    height: 38px;
    background: rgba(18, 18, 22, 0.78);
    border-color: rgba(255, 255, 255, 0.22);
}

.embed-nav-btn svg {
    width: 18px;
    height: 18px;
}

.embed-nav-btn:hover:not(:disabled) {
    background: rgba(18, 18, 22, 0.96);
}

.embed-nav-btn:disabled {
    opacity: 0.35;
    cursor: default;
    transform: none;
}
