/* Ported from language-learner-app 53e78d3588390cf29bb31efc9830552bc9b65d89
 * src/components/QuizArticle.css and InteractiveText.css. Keep player appearance in sync. */
.article-audio-player {
    width: auto;
    margin: 0 24px 14px 24px;
}

.article-audio-player-reveal {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 520ms cubic-bezier(0.22, 0.9, 0.24, 1), opacity 360ms ease;
    position: relative;
}

.article-audio-player-reveal.is-visible {
    max-height: 110px;
    opacity: 1;
}

.article-audio-player-reveal.is-visible .dre-audio-player {
    animation: dre-audio-pop-in 780ms cubic-bezier(0.2, 0.86, 0.2, 1);
}

.dre-audio-player {
    animation: dre-audio-pop-in 780ms cubic-bezier(0.2, 0.86, 0.2, 1);
}

.article-audio-tap-coachmark {
    position: fixed;
    width: 62px;
    height: 62px;
    margin-left: -31px;
    margin-top: -31px;
    z-index: 10050;
    pointer-events: none;
    animation: tap-coachmark-flytap 1.2s ease-out both;
}

.article-audio-tap-coachmark-hand {
    position: absolute;
    left: 12px;
    top: 6px;
    width: 38px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    animation: tap-hand-press 1.2s ease-in-out 1;
}

.article-audio-tap-coachmark-hand svg {
    width: 100%;
    height: 100%;
    fill: #ffffff;
    stroke: var(--accent-primary);
    stroke-width: 1.35;
    stroke-linejoin: round;
    stroke-linecap: round;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.35));
}

.article-audio-tap-coachmark-crease {
    fill: none;
    stroke: rgba(17, 24, 39, 0.22);
    stroke-width: 1.2;
    stroke-linecap: round;
}

.article-audio-tap-coachmark-ripple {
    position: absolute;
    inset: 0;
    border: 2px solid rgba(255, 255, 255, 0.92);
    border-radius: 999px;
    animation: tap-ripple 1.2s ease-out 1;
}

.dre-audio-player {
    --primary-accent: var(--accent-primary, #e50914);
    --secondary-accent: color-mix(in srgb, var(--accent-primary, #e50914) 84%, black);
    --light-purple-bg: color-mix(in srgb, var(--accent-primary, #e50914) 12%, var(--bg-secondary, #ffffff));
    --playing-control-bg: color-mix(in srgb, var(--accent-primary, #e50914) 12%, #ffffff);
    --text-color-light-bg: var(--text-primary, #333);
    --text-color-dark-bg: #fff;
    --icon-color-light-bg: var(--primary-accent);
    --icon-color-dark-bg: #fff;

    display: flex;
    align-items: center;
    background-color: var(--light-purple-bg);
    border-radius: 25px;
    padding: 4px 10px;
    width: 100%;
    box-sizing: border-box;
    max-width: 350px;
    margin-left: auto;
    margin-right: 20px;
    transition: background-color 0.3s ease;
}

.dre-audio-player.is-playing {
    background-color: var(--primary-accent);
}

.dre-play-pause-btn {
    background-color: var(--primary-accent);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-right: 10px;
    flex-shrink: 0;
}

.dre-play-icon,
.dre-pause-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    line-height: 0;
}

.dre-play-loading-spinner {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #fff;
    border-right-color: transparent;
    opacity: 0;
    pointer-events: none;
}

.dre-play-loading-spinner.is-visible {
    opacity: 1;
    animation: dre-spin 0.8s linear infinite;
}

.dre-seek-btn {
    background-color: transparent;
    border: none;
    width: 24px;
    height: 24px;
    padding: 0;
    margin-right: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.dre-seek-forward-btn {
    margin-right: 8px;
}

.dre-seek-btn svg {
    width: 22px;
    height: 22px;
    fill: var(--icon-color-light-bg);
}

.dre-seek-btn svg text {
    font-size: 9px;
    font-weight: 700;
    fill: var(--icon-color-light-bg);
    font-family: Arial, sans-serif;
}

.dre-audio-player.is-playing .dre-seek-btn svg {
    fill: var(--icon-color-dark-bg);
}

.dre-audio-player.is-playing .dre-seek-btn svg text {
    fill: var(--icon-color-dark-bg);
}

.dre-audio-player.is-playing .dre-play-pause-btn {
    background-color: var(--playing-control-bg);
}

.dre-play-pause-btn:hover {
    background-color: var(--secondary-accent);
}

.dre-audio-player.is-playing .dre-play-pause-btn:hover {
    background-color: #eee;
}

.dre-play-pause-btn svg {
    width: 100%;
    height: 100%;
    display: block;
    color: #fff;
    fill: currentColor;
}

.dre-play-pause-btn svg path {
    fill: currentColor;
}

.dre-play-pause-btn.is-loading {
    background-color: #8f929a;
}

.dre-play-pause-btn.is-loading:hover {
    background-color: #8f929a;
}

.dre-audio-player.is-playing .dre-play-pause-btn svg {
    color: var(--primary-accent);
}

@keyframes dre-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes dre-audio-pop-in {
    0% {
        transform: scale(0.86);
    }
    44% {
        transform: scale(1.09);
    }
    72% {
        transform: scale(0.96);
    }
    100% {
        transform: scale(1);
    }
}

.dre-progress-container {
    flex-grow: 1;
    height: 8px;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    cursor: pointer;
    margin: 0 10px;
}

.dre-progress-bar {
    height: 100%;
    width: 0%;
    background-color: var(--primary-accent);
    border-radius: 5px;
}

.dre-audio-player.is-playing .dre-progress-bar {
    background-color: #fff;
}

.dre-timestamp,
.dre-speed-btn {
    color: var(--text-color-light-bg);
    transition: color 0.3s ease;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.dre-timestamp {
    width: 3.4em;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.dre-audio-player.is-playing .dre-timestamp,
.dre-audio-player.is-playing .dre-speed-btn {
    color: var(--text-color-dark-bg);
}

.dre-speed-btn {
    background-color: transparent;
    border: 1px solid var(--icon-color-light-bg);
    border-radius: 5px;
    width: 52px;
    min-width: 52px;
    text-align: center;
    padding: 2px 4px;
    cursor: pointer;
    font-size: 0.75rem;
    margin: 0 10px;
    transition: color 0.3s ease, border-color 0.3s ease;
}

.dre-audio-player.is-playing .dre-speed-btn {
    border-color: var(--icon-color-dark-bg);
}

.dre-volume-container {
    position: relative;
    display: flex;
    align-items: center;
}

.dre-volume-btn {
    background-color: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
}

.dre-volume-btn svg {
    width: 22px;
    height: 22px;
    color: var(--icon-color-light-bg);
    fill: currentColor;
    transition: color 0.3s ease;
}

.dre-audio-player.is-playing .dre-volume-btn svg {
    color: var(--icon-color-dark-bg);
}

.dre-audio-player.is-muted .dre-volume-btn svg {
    color: #9e9e9e;
}

.dre-volume-btn svg path {
    fill: currentColor;
}

#dre-original-audio-player-container {
    position: relative;
    height: 50px;
}

.dre-sticky-player {
    position: fixed;
    top: 20px;
    right: auto;
    z-index: 1001;
    max-width: 350px;
    width: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.dre-sticky-player.visible {
    opacity: 1;
    visibility: visible;
}

.dre-close-sticky-player-btn {
    background: transparent;
    border: none;
    color: var(--text-color-light-bg);
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    margin-left: 10px;
    opacity: 0.7;
    padding: 0;
    display: none;
}

.dre-audio-player:not(.is-playing) .dre-close-sticky-player-btn {
    display: block;
}

.dre-close-sticky-player-btn:hover {
    opacity: 1;
}

.dre-audio-player.is-playing .dre-close-sticky-player-btn {
    color: var(--text-color-dark-bg);
}


@media (max-width: 768px) {
    .dre-audio-player {
        position: relative;
        max-width: calc(100vw - 12px);
        margin-right: 0;
    }

}


#reading .reading-audio-word.audio-sync-current,
#reading .reading-audio-word.audio-sync-trailing {
    text-decoration-line: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 0.18em;
    text-decoration-color: var(--accent-primary, #e50914);
    box-shadow: inset 0 -1.05em 0 rgba(255, 232, 64, 0.58);
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

#reading .reading-audio-word.audio-sync-current {
    transition:
        box-shadow 140ms ease-out,
        text-decoration-color 120ms ease-out;
}

#reading .reading-audio-word.audio-sync-trailing {
    animation: audio-sync-highlight-fade 420ms ease-out both;
}

@keyframes audio-sync-highlight-fade {
    0% {
        box-shadow: inset 0 -1.05em 0 rgba(255, 232, 64, 0.58);
        text-decoration-color: var(--accent-primary, #e50914);
    }
    100% {
        box-shadow: inset 0 0 0 rgba(255, 232, 64, 0);
        text-decoration-color: transparent;
    }
}

/* Website host adjustments: the app supplies these theme values globally. */
#reading, .dre-sticky-player { --accent-primary: var(--primary-color, #e50914); }
.dre-audio-player { --bg-secondary: #1e1e1e; --text-primary: #fff; }
body.light-mode .dre-audio-player { --bg-secondary: #fff; --text-primary: #1c1e21; }
.dre-audio-player button { font-family: inherit; line-height: normal; }
.dre-play-pause-btn { position: relative; padding: 0; }
.dre-progress-container { min-width: 18px; }
.dre-volume-btn svg path[fill="none"] { fill: none; }
.dre-sticky-player .dre-audio-player { margin-right: 0; }
.dre-audio-player :focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
#reading .title-container.has-reading-audio { flex-wrap: wrap; border-bottom: 2px solid #333; padding-bottom: 15px; }
body.light-mode #reading .title-container.has-reading-audio { border-bottom-color: #eee; }
#reading .has-reading-audio #reading-title { flex: 1 1 auto; width: max-content; max-width: 100%; min-width: 0; margin: 0; border-bottom: 0; padding-bottom: 0; }
#reading .title-container > .article-audio-player-reveal { flex: 0 1 350px; width: 350px; max-width: 100%; margin-left: auto; }
#reading .title-container .article-audio-player { margin: 0; }
#reading .title-container #dre-original-audio-player-container { height: auto; }
#reading .title-container .dre-audio-player { margin: 0; max-width: 100%; }
@media (max-width: 768px) {
    .article-audio-player { margin: 0 0 14px; }
    .dre-audio-player { max-width: 100%; }
    .dre-speed-btn { min-width: 36px; width: 36px; margin: 0 5px; }
    .dre-timestamp { width: 3em; font-size: .75rem; }
    .dre-progress-container { margin: 0 5px; min-width: 10px; }
    .dre-play-pause-btn { margin-right: 5px; }
    .dre-seek-btn { margin-right: 3px; }
}
@media print {
    .article-audio-player-reveal, .dre-sticky-player { display: none !important; }
    #reading .reading-audio-word.audio-sync-current,
    #reading .reading-audio-word.audio-sync-trailing { box-shadow: none; text-decoration: none; }
}
@media (prefers-reduced-motion: reduce) {
    .article-audio-player-reveal, .dre-audio-player, .dre-sticky-player { transition: none; }
    .article-audio-player-reveal.is-visible .dre-audio-player { animation: none; }
}
