:root {
    --abr-highlight-light: #f3e29a;
    --abr-highlight-dark: #8c7440;
    --abr-surface: #ffffff;
    --abr-surface-2: #f7f8fa;
    --abr-surface-3: #eef1f5;
    --abr-border: rgba(17,24,39,.12);
    --abr-text: #111827;
    --abr-muted: #667085;
    --abr-button: #111111;
    --abr-button-text: #ffffff;
    --abr-shadow: 0 12px 34px rgba(15,23,42,.08);
    --abr-highlight-color: var(--abr-highlight-light);
}

body[data-cs-theme="dark"],
body[data-cs-dark="dark"],
body.cz-dark,
body.dark,
html.dark body,
body[class*="dark-mode"],
body[class*="theme-dark"] {
    --abr-surface: #191d24;
    --abr-surface-2: #2a313d;
    --abr-surface-3: #353d4a;
    --abr-border: rgba(255,255,255,.12);
    --abr-text: #f4f6fb;
    --abr-muted: #c4ccda;
    --abr-button: #0b0d10;
    --abr-button-text: #ffffff;
    --abr-shadow: 0 12px 34px rgba(0,0,0,.35);
    --abr-highlight-color: var(--abr-highlight-dark);
}

.abr-player {
    box-sizing: border-box;
    margin: 0 0 20px;
    padding: 16px;
    border-radius: 16px;
    border: 1px solid var(--abr-border);
    background: var(--abr-surface);
    color: var(--abr-text);
    box-shadow: var(--abr-shadow);
}
.abr-player *, .abr-player *::before, .abr-player *::after { box-sizing: border-box; }

.abr-player__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.abr-player__row + .abr-player__row { margin-top: 12px; }

.abr-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.abr-btn,
.abr-speed-select,
.abr-voice-select {
    appearance: none;
    border: 1px solid var(--abr-border);
    background: var(--abr-surface-2);
    color: var(--abr-text);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.2;
    transition: transform .15s ease, opacity .15s ease, background-color .15s ease, border-color .15s ease;
}

.abr-btn { cursor: pointer; }
.abr-btn:hover:not(:disabled) { transform: translateY(-1px); }
.abr-btn:disabled { opacity: .45; cursor: not-allowed; }

.abr-btn--primary {
    background: var(--abr-button);
    border-color: var(--abr-button);
    color: var(--abr-button-text);
}

.abr-speed-wrap,
.abr-voice-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--abr-text);
    font-size: 14px;
}

.abr-speed-select,
.abr-voice-select {
    cursor: pointer;
    background-color: var(--abr-surface-2);
    background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
    background-position: calc(100% - 18px) calc(50% - 2px), calc(100% - 12px) calc(50% - 2px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    padding-right: 34px;
}

.abr-speed-select:focus,
.abr-voice-select:focus,
.abr-btn:focus {
    outline: none;
    border-color: rgba(59,130,246,.45);
    box-shadow: 0 0 0 3px rgba(59,130,246,.14);
}

.abr-speed-select { min-width: 84px; }
.abr-voice-select { min-width: 190px; max-width: 250px; }
.abr-status { color: var(--abr-muted); font-size: 14px; }
.abr-reader-wrap { position: relative; }

.abr-word {
    display: inline;
    white-space: pre-wrap;
    border-radius: 0 !important;
    transition: background-color .08s ease, color .08s ease;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.abr-word.is-speaking {
    background: var(--abr-highlight-color);
    color: #111111 !important;
}

.abr-word.is-speaking + .abr-word.is-speaking {
    margin-left: -0.08em;
    padding-left: 0.08em;
}

.abr-player--sticky {
    position: fixed;
    left: 50%;
    bottom: 16px;
    width: min(880px, calc(100% - 32px));
    margin: 0;
    transform: translate(-50%, calc(100% + 20px));
    opacity: 0;
    pointer-events: none;
    z-index: 99999;
    transition: transform .25s ease, opacity .25s ease;
    padding: 10px 12px;
}
.abr-player--sticky.is-visible {
    transform: translate(-50%, 0);
    opacity: 1;
    pointer-events: auto;
}
.abr-player--sticky.is-hidden-by-user { display: none; }

.abr-sticky-close {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid var(--abr-border);
    background: var(--abr-surface-2);
    color: var(--abr-text);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 0;
}

.abr-speed-wrap--mini span,
.abr-voice-wrap--mini span { display: none; }

.abr-player--sticky .abr-player__row--sticky {
    display: grid;
    grid-template-columns: auto auto auto minmax(160px,220px) 1fr auto;
    gap: 10px;
    align-items: center;
}
.abr-player--sticky .abr-play-toggle { white-space: nowrap; }
.abr-player--sticky .abr-controls { flex-wrap: nowrap; }
.abr-player--sticky .abr-btn { padding: 9px 12px; }
.abr-player--sticky .abr-speed-select { min-width: 72px; width: 72px; }
.abr-player--sticky .abr-voice-select { min-width: 160px; max-width: 220px; }
.abr-player--sticky .abr-status { justify-self: end; text-align: right; white-space: nowrap; }

@media (max-width: 767px) {
    .abr-player { padding: 12px; border-radius: 14px; }

    .abr-player__row--top,
    .abr-player__row--bottom {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .abr-controls {
        display: grid;
        grid-template-columns: repeat(3, minmax(0,1fr));
        width: 100%;
        gap: 6px;
    }

    .abr-btn,
    .abr-speed-select,
    .abr-voice-select,
    .abr-btn--primary,
    .abr-status,
    .abr-speed-wrap,
    .abr-voice-wrap { width: 100%; }

    .abr-voice-select { max-width: none; min-width: 0; }

    .abr-player--sticky {
        left: 8px;
        right: 8px;
        bottom: 8px;
        width: calc(100% - 16px);
        transform: translateY(calc(100% + 20px));
        border-radius: 12px;
        padding: 10px;
    }
    .abr-player--sticky.is-visible { transform: translateY(0); }

    .abr-player--sticky .abr-player__row--sticky {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 8px;
        align-items: center;
    }
    .abr-player--sticky .abr-play-toggle {
        grid-column: 1 / -1;
        padding: 9px 10px;
        font-size: 13px;
    }
    .abr-player--sticky .abr-controls {
        grid-column: 1 / -1;
        grid-template-columns: repeat(3, minmax(0,1fr));
    }
    .abr-player--sticky .abr-speed-wrap,
    .abr-player--sticky .abr-voice-wrap {
        width: auto;
        justify-self: start;
    }
    .abr-player--sticky .abr-speed-select {
        min-width: 72px;
        width: 72px;
        padding: 8px 28px 8px 8px;
        font-size: 13px;
    }
    .abr-player--sticky .abr-voice-select {
        min-width: 118px;
        max-width: 148px;
        padding: 8px 28px 8px 8px;
        font-size: 13px;
    }
    .abr-player--sticky .abr-status {
        grid-column: 1;
        justify-self: start;
        width: auto;
        font-size: 12px;
        text-align: left;
        white-space: normal;
    }
    .abr-player--sticky .abr-sticky-close {
        grid-column: 2;
        justify-self: end;
        align-self: end;
    }
}

.abr-sticky-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-self: end;
}

.abr-sticky-toggle-controls {
    display: none;
    white-space: nowrap;
}

.abr-sticky-extra-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    justify-self: end;
    gap: 10px;
    grid-column: auto;
    width: auto;
}

.abr-sticky-extra-controls[hidden] {
    display: flex !important;
}

@media (max-width: 767px) {
    .abr-sticky-toggle-controls {
        display: inline-flex;
    }

    .abr-sticky-extra-controls[hidden] {
        display: none !important;
    }
}
.abr-sticky-extra-controls .abr-speed-wrap,
.abr-sticky-extra-controls .abr-voice-wrap {
    width: auto;
}

.abr-player--sticky .abr-player__row--sticky {
    grid-template-columns: auto auto 1fr auto auto;
}

.abr-player--sticky .abr-status {
    justify-self: start;
    text-align: left;
    white-space: nowrap;
}

@media (max-width: 767px) {
    .abr-player--sticky .abr-player__row--sticky {
        grid-template-columns: minmax(0,1fr) auto;
    }

    .abr-player--sticky .abr-status {
        grid-column: 1 / -1;
        order: 4;
    }

    .abr-sticky-actions {
        grid-column: 2;
        grid-row: 1;
    }

    .abr-sticky-extra-controls {
        flex-direction: column;
        align-items: stretch;
        justify-content: stretch;
    }

    .abr-sticky-extra-controls .abr-speed-wrap,
    .abr-sticky-extra-controls .abr-voice-wrap {
        width: 100%;
    }
}
