/* The B2 player uses a retired third-party endpoint. Hide only that player when
   this replacement is active on a single post. */
body.single-post.zglyw-voice-reader-active .b2-audio-content {
    display: none !important;
}

.zglyw-voice-reader {
    display: none;
    box-sizing: border-box;
    margin: 0 0 22px;
    padding: 15px 17px 12px;
    border: 1px solid #edf0f4;
    border-radius: 8px;
    background: #f8fafc;
    color: #30343b;
    font-size: 14px;
    line-height: 1.5;
}

body.zglyw-voice-reader-active .zglyw-voice-reader {
    display: block;
}

.zglyw-voice-reader *,
.zglyw-voice-reader *::before,
.zglyw-voice-reader *::after {
    box-sizing: border-box;
}

.zglyw-voice-reader__top,
.zglyw-voice-reader__controls,
.zglyw-voice-reader__progress-row {
    display: flex;
    align-items: center;
}

.zglyw-voice-reader__top {
    justify-content: space-between;
    gap: 14px;
}

.zglyw-voice-reader__heading {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 92px;
    font-weight: 600;
    color: #1f2937;
}

.zglyw-voice-reader__speaker {
    line-height: 1;
}

.zglyw-voice-reader__controls {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.zglyw-voice-reader__button,
.zglyw-voice-reader__rate,
.zglyw-voice-reader__voice {
    min-height: 32px;
    border: 1px solid #d7dde5;
    border-radius: 5px;
    background: #fff;
    color: #374151;
    font: inherit;
}

.zglyw-voice-reader__button {
    min-width: 58px;
    padding: 5px 13px;
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}

.zglyw-voice-reader__button:hover:not(:disabled),
.zglyw-voice-reader__button:focus-visible,
.zglyw-voice-reader__rate:focus-visible,
.zglyw-voice-reader__voice:focus-visible {
    border-color: #2563eb;
    outline: 2px solid rgba(37, 99, 235, .16);
    outline-offset: 1px;
}

.zglyw-voice-reader__button--primary {
    border-color: #2563eb;
    background: #2563eb;
    color: #fff;
}

.zglyw-voice-reader__button--primary:hover:not(:disabled) {
    border-color: #1d4ed8;
    background: #1d4ed8;
}

.zglyw-voice-reader__button:disabled,
.zglyw-voice-reader__rate:disabled,
.zglyw-voice-reader__voice:disabled,
.zglyw-voice-reader__pitch:disabled {
    cursor: not-allowed;
    opacity: .48;
}

.zglyw-voice-reader__rate-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #5b6470;
    white-space: nowrap;
}

.zglyw-voice-reader__rate,
.zglyw-voice-reader__voice {
    padding: 4px 6px;
}

.zglyw-voice-reader__pitch {
    width: 82px;
    accent-color: #2563eb;
    vertical-align: middle;
}

.zglyw-voice-reader__pitch + output {
    min-width: 28px;
    color: #6b7280;
    font-size: 12px;
}

.zglyw-voice-reader__progress-row {
    gap: 10px;
    margin-top: 12px;
}

.zglyw-voice-reader__progress {
    position: relative;
    flex: 1 1 auto;
    height: 5px;
    overflow: hidden;
    border-radius: 999px;
    background: #e2e7ee;
}

.zglyw-voice-reader__progress > span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: #2563eb;
    transition: width .18s linear;
}

.zglyw-voice-reader__percent {
    min-width: 36px;
    color: #6b7280;
    font-size: 12px;
    text-align: right;
}

.zglyw-voice-reader__status {
    margin: 7px 0 0 !important;
    color: #6b7280;
    font-size: 12px;
}

.zglyw-voice-reader.is-speaking .zglyw-voice-reader__heading,
.zglyw-voice-reader.is-speaking .zglyw-voice-reader__status {
    color: #1d4ed8;
}

.zglyw-voice-reader.has-error {
    border-color: #fecaca;
    background: #fff7f7;
}

.zglyw-voice-reader.has-error .zglyw-voice-reader__status {
    color: #b42318;
}

.zglyw-voice-reader__source-marker[hidden] {
    display: none !important;
}

@media (max-width: 640px) {
    .zglyw-voice-reader {
        padding: 13px 14px 11px;
    }

    .zglyw-voice-reader__top {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .zglyw-voice-reader__controls {
        justify-content: flex-start;
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .zglyw-voice-reader__progress > span,
    .zglyw-voice-reader__button {
        transition: none;
    }
}
