:root {
    color-scheme: dark;
    --embed-bg: #0a0a0a;
    --embed-surface: rgba(12, 12, 12, 0.94);
    --embed-panel: rgba(18, 18, 18, 0.92);
    --embed-border: rgba(255, 255, 255, 0.08);
    --embed-border-strong: rgba(255, 255, 255, 0.16);
    --embed-text: #f5f5f5;
    --embed-text-soft: rgba(245, 245, 245, 0.62);
    --embed-accent: #b21f24;
    --embed-accent-strong: #dc2626;
    --embed-accent-glow: rgba(178, 31, 36, 0.35);
    --embed-shadow: 0 18px 36px rgba(0, 0, 0, 0.5);
    --embed-radius-xl: 20px;
    --embed-radius-lg: 14px;
    --embed-radius-md: 10px;
    --embed-radius-sm: 999px;
    --embed-font-display: 'Fraunces', Georgia, serif;
    --embed-font-body: 'Manrope', 'Segoe UI', sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--embed-font-body);
    background:
        radial-gradient(ellipse at 20% 0%, rgba(178, 31, 36, 0.14), transparent 50%),
        radial-gradient(ellipse at 90% 100%, rgba(178, 31, 36, 0.08), transparent 40%),
        linear-gradient(168deg, #0a0a0a 0%, #111 50%, #0d0d0d 100%);
    color: var(--embed-text);
}

.podcast-embed-page {
    width: 100%;
    height: 100%;
}

.podcast-embed-root {
    width: 100%;
    height: 100%;
    margin: 0 auto;
    padding: 3px;
}

/* ── Main container ───────────────────────────────────────── */

.podcast-embed-player {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: clamp(5px, 3.5vh, 12px);
    height: 100%;
    min-height: 0;
    max-height: none;
    padding: clamp(7px, 4vh, 14px);
    overflow: hidden;
    border: 1px solid var(--embed-border);
    border-radius: var(--embed-radius-xl);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 20%), var(--embed-surface);
    box-shadow: var(--embed-shadow);
    isolation: isolate;
}

.podcast-embed-player::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at top right, rgba(178, 31, 36, 0.1), transparent 40%),
        radial-gradient(circle at bottom left, rgba(220, 38, 38, 0.06), transparent 40%);
    pointer-events: none;
    z-index: -1;
}

/* Subtle top-edge highlight */
.podcast-embed-player::after {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(178, 31, 36, 0.4), transparent);
    pointer-events: none;
    z-index: 1;
}

.podcast-embed-player.is-loading .podcast-embed-play-button {
    cursor: wait;
    opacity: 0.7;
}

/* ── Controls flex row ────────────────────────────────────── */

.podcast-embed-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

/* ── Shared pill/chip base ────────────────────────────────── */

.podcast-embed-chip,
.podcast-embed-speed-button,
.podcast-embed-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: var(--embed-radius-sm);
    border: 1px solid var(--embed-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--embed-text);
    font: inherit;
    text-decoration: none;
}

.podcast-embed-chip {
    padding: 3px 8px;
    color: var(--embed-text-soft);
    font-size: 0.56rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* ── Interactive pills ────────────────────────────────────── */

.podcast-embed-speed-button,
.podcast-embed-icon-button {
    min-height: 30px;
    padding: 0 10px;
    cursor: pointer;
    transition:
        background-color 180ms ease,
        border-color 180ms ease,
        transform 180ms ease;
}

.podcast-embed-icon-button {
    min-width: 32px;
    padding: 0 8px;
}

.podcast-embed-icon-button--plain {
    min-width: 26px;
    min-height: 26px;
    padding: 0;
    background: transparent;
    border-color: transparent;
}

.podcast-embed-speed-button:hover,
.podcast-embed-icon-button:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--embed-border-strong);
}

.podcast-embed-share-button.is-copied {
    border-color: var(--embed-accent-strong);
    color: var(--embed-accent-strong);
}

/* ── Hero: art + copy ─────────────────────────────────────── */

.podcast-embed-player__hero {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: clamp(8px, 1.6vw, 12px);
    min-width: 0;
}

.podcast-embed-art {
    position: relative;
    flex: 0 0 auto;
    width: clamp(50px, 32vh, 88px);
    aspect-ratio: 1;
    border-radius: clamp(10px, 2.4vh, 14px);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow:
        0 10px 20px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(178, 31, 36, 0.15);
    background: linear-gradient(145deg, rgba(178, 31, 36, 0.25), rgba(60, 10, 12, 0.4));
}

.podcast-embed-art a,
.podcast-embed-art img {
    display: block;
    width: 100%;
    height: 100%;
}

.podcast-embed-art img {
    object-fit: cover;
}

.podcast-embed-art__fallback {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    font-family: var(--embed-font-display);
    font-size: clamp(1.1rem, 10vh, 1.6rem);
    font-weight: 700;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.92);
}

/* ── Copy block ───────────────────────────────────────────── */

.podcast-embed-copy {
    flex: 1 1 auto;
    min-width: 0;
}

.podcast-embed-copy__eyebrow {
    margin: 0 0 3px;
    overflow: hidden;
    color: var(--embed-accent-strong);
    font-size: 0.55rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.podcast-embed-copy__title {
    margin: 0;
    font-family: var(--embed-font-display);
    font-size: clamp(0.92rem, 3vw, 1.12rem);
    line-height: 1.02;
    letter-spacing: -0.035em;
}

.podcast-embed-copy__title-viewport {
    display: block;
    overflow: hidden;
}

.podcast-embed-copy__title.is-marquee .podcast-embed-copy__title-viewport {
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 22px), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 22px), transparent);
}

.podcast-embed-copy__title-track {
    display: inline-flex;
    align-items: baseline;
    min-width: 100%;
    white-space: nowrap;
}

.podcast-embed-copy__title.is-marquee .podcast-embed-copy__title-track {
    gap: 24px;
    width: max-content;
    animation: embedTitleMarquee var(--title-scroll-duration, 16s) linear 5s infinite;
}

.podcast-embed-copy__title-segment {
    display: inline-block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.podcast-embed-copy__title a {
    color: inherit;
    text-decoration: none;
}

.podcast-embed-copy__title a:hover {
    color: var(--embed-accent-strong);
}

.podcast-embed-copy__meta {
    display: flex;
    flex-wrap: nowrap;
    gap: 5px;
    margin-top: 5px;
    overflow: hidden;
}

.podcast-embed-copy__meta .podcast-embed-chip {
    flex: 0 0 auto;
}

/* ── Progress panel ──────────────────────────────────────── */

.podcast-embed-player__panel {
    flex: 0 0 auto;
    padding: 6px 8px;
    border: 1px solid var(--embed-border);
    border-radius: var(--embed-radius-lg);
    background: var(--embed-panel);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.podcast-embed-progress {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
}

.podcast-embed-progress__slider,
.podcast-embed-volume input[type='range'] {
    width: 100%;
    height: 4px;
    margin: 0;
    appearance: none;
    border-radius: 999px;
    background: linear-gradient(
        90deg,
        var(--embed-accent) 0%,
        var(--embed-accent-strong) var(--progress, 0%),
        rgba(255, 255, 255, 0.1) var(--progress, 0%),
        rgba(255, 255, 255, 0.1) 100%
    );
    outline: none;
}

.podcast-embed-progress__slider::-webkit-slider-thumb,
.podcast-embed-volume input[type='range']::-webkit-slider-thumb {
    appearance: none;
    width: 12px;
    height: 12px;
    border: 0;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 0 0 3px var(--embed-accent-glow);
}

.podcast-embed-progress__slider::-moz-range-thumb,
.podcast-embed-volume input[type='range']::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border: 0;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 0 0 3px var(--embed-accent-glow);
}

.podcast-embed-progress__time {
    color: var(--embed-text-soft);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
}

/* ── Controls row ─────────────────────────────────────────── */

.podcast-embed-controls {
    flex: 0 0 auto;
    gap: 8px;
}

.podcast-embed-controls__cluster,
.podcast-embed-secondary {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ── Seek buttons (rewind/forward icons) ──────────────────── */

.podcast-embed-icon-button svg {
    display: block;
}

/* ── Play button ──────────────────────────────────────────── */

.podcast-embed-play-button {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: clamp(36px, 21vh, 46px);
    height: clamp(36px, 21vh, 46px);
    border: 0;
    border-radius: 999px;
    background: linear-gradient(145deg, var(--embed-accent-strong), var(--embed-accent));
    color: #fff;
    cursor: pointer;
    box-shadow:
        0 8px 20px var(--embed-accent-glow),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    transition:
        transform 180ms ease,
        box-shadow 180ms ease;
}

.podcast-embed-play-button:hover {
    transform: translateY(-1px);
    box-shadow:
        0 12px 26px rgba(178, 31, 36, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.podcast-embed-play-button__ring {
    position: absolute;
    inset: -5px;
    border: 1px solid rgba(178, 31, 36, 0.3);
    border-radius: 999px;
    opacity: 0;
}

.podcast-embed-player.is-playing .podcast-embed-play-button__ring {
    opacity: 1;
    animation: embedRing 2s ease-out infinite;
}

.podcast-embed-play-button__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
}

/* ── Volume ───────────────────────────────────────────────── */

.podcast-embed-volume {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    width: 88px;
    min-height: 30px;
    padding: 0 8px;
    border: 1px solid var(--embed-border);
    border-radius: var(--embed-radius-sm);
    background: rgba(255, 255, 255, 0.04);
}

.podcast-embed-volume input[type='range'] {
    --progress: 100%;
}

/* ── Speed menu ───────────────────────────────────────────── */

.podcast-embed-speed {
    position: relative;
}

.podcast-embed-speed__menu {
    position: absolute;
    right: 0;
    bottom: calc(100% + 8px);
    display: grid;
    gap: 4px;
    min-width: 92px;
    padding: 6px;
    border: 1px solid var(--embed-border-strong);
    border-radius: 14px;
    background: rgba(10, 10, 10, 0.98);
    box-shadow: 0 16px 24px rgba(0, 0, 0, 0.5);
}

.podcast-embed-speed__option {
    padding: 8px 10px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--embed-text-soft);
    text-align: left;
    font: inherit;
    cursor: pointer;
}

.podcast-embed-speed__option.is-active,
.podcast-embed-speed__option:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--embed-text);
}

/* ── Share sheet ───────────────────────────────────────────── */

.podcast-embed-share-sheet {
    position: absolute;
    inset: 6px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    border: 1px solid var(--embed-border-strong);
    border-radius: 16px;
    background: rgba(8, 8, 8, 0.97);
    box-shadow: 0 24px 34px rgba(0, 0, 0, 0.5);
    transform: translateY(10px);
    opacity: 0;
    pointer-events: none;
    transition:
        transform 220ms ease,
        opacity 220ms ease;
}

.podcast-embed-player.is-share-open .podcast-embed-share-sheet {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.podcast-embed-share-sheet__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 0;
}

.podcast-embed-share-sheet__title {
    margin: 0;
    font-family: var(--embed-font-display);
    font-size: 0.92rem;
    letter-spacing: -0.03em;
}

.podcast-embed-share-sheet__text {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    margin: 0;
    overflow: hidden;
    color: var(--embed-text-soft);
    font-size: 0.72rem;
    line-height: 1.3;
}

.podcast-embed-share-sheet__actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin-top: 2px;
}

.podcast-embed-share-sheet__actions button,
.podcast-embed-share-sheet__actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0 6px;
    border: 1px solid var(--embed-border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--embed-text);
    text-decoration: none;
    font: inherit;
    font-size: 0.68rem;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
}

.podcast-embed-share-sheet__actions button:hover,
.podcast-embed-share-sheet__actions a:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--embed-border-strong);
}

/* ── Utilities ────────────────────────────────────────────── */

.podcast-embed-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Keyframes ────────────────────────────────────────────── */

@keyframes embedRing {
    0% {
        transform: scale(0.92);
        opacity: 0.55;
    }
    100% {
        transform: scale(1.14);
        opacity: 0;
    }
}

@keyframes embedTitleMarquee {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(calc(var(--title-scroll-distance, 0px) * -1));
    }
}

/* ── Short frames (legacy 175px embeds) ───────────────────── */

@media (max-height: 185px) {
    .podcast-embed-copy__eyebrow {
        margin-bottom: 2px;
    }

    .podcast-embed-copy__meta {
        margin-top: 4px;
    }

    .podcast-embed-progress__time {
        font-size: 0.58rem;
    }
}

@media (max-height: 150px) {
    .podcast-embed-copy__meta {
        display: none;
    }

    .podcast-embed-volume {
        width: 72px;
    }
}

/* ── Narrow frames ────────────────────────────────────────── */

@media (max-width: 330px) {
    .podcast-embed-volume {
        width: auto;
        padding: 0;
        border-color: transparent;
        background: transparent;
    }

    .podcast-embed-volume input[type='range'] {
        display: none;
    }
}

@media (max-width: 260px) {
    .podcast-embed-copy__meta {
        display: none;
    }
}

/* ── Reduced motion ───────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .podcast-embed-player *,
    .podcast-embed-player::before {
        animation: none !important;
        transition-duration: 0.01ms !important;
        transition-delay: 0ms !important;
        scroll-behavior: auto !important;
    }
}
