.magda-tts {
    --magda-orange: #f37321;
    --magda-orange-deep: #d85a12;
    --magda-ink: #141414;
    --magda-muted: #4a403a;
    --magda-paper: #fff;
    --magda-wash: #fff6f0;
    box-sizing: border-box;
    clear: both;
    margin: 0 0 1.75rem;
    max-width: 100%;
    color: var(--magda-ink);
    font-family: inherit;
    line-height: 1.35;
}

.magda-tts *,
.magda-tts *::before,
.magda-tts *::after {
    box-sizing: border-box;
}

.magda-tts__toggle {
    display: flex !important;
    align-items: center;
    gap: 1rem;
    width: 100%;
    min-height: 5.25rem;
    margin: 0 !important;
    padding: 0.85rem 1rem !important;
    border: 3px solid var(--magda-orange) !important;
    border-radius: 18px !important;
    background: var(--magda-paper) !important;
    color: var(--magda-ink) !important;
    font-family: inherit !important;
    font-size: 1.35rem !important;
    font-weight: 700 !important;
    line-height: 1.3 !important;
    letter-spacing: 0 !important;
    text-align: left !important;
    text-transform: none !important;
    text-decoration: none !important;
    box-shadow: none !important;
    cursor: pointer;
    touch-action: manipulation;
}

.magda-tts__toggle:hover {
    background: var(--magda-wash) !important;
}

.magda-tts__toggle:focus {
    outline: none;
}

.magda-tts__toggle:focus-visible {
    outline: 3px solid var(--magda-ink);
    outline-offset: 3px;
}

.magda-tts__toggle:disabled {
    cursor: progress;
    opacity: 0.72;
}

.magda-tts__mark {
    display: grid;
    place-items: center;
    flex: 0 0 4.25rem;
    width: 4.25rem;
    height: 4.25rem;
    border-radius: 50%;
    background: var(--magda-orange-deep);
}

.magda-tts__icon {
    display: none;
    fill: #fff;
}

.magda-tts[data-state="idle"] .magda-tts__icon--play,
.magda-tts[data-state="paused"] .magda-tts__icon--play,
.magda-tts[data-state="loading"] .magda-tts__icon--play,
.magda-tts[data-state="playing"] .magda-tts__icon--pause {
    display: block;
}

.magda-tts[data-state="loading"] .magda-tts__mark {
    animation: magda-tts-pulse 1.1s ease-in-out infinite;
}

.magda-tts__copy {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.magda-tts__label {
    color: var(--magda-ink);
    font-size: 1.35rem;
    font-weight: 700;
}

.magda-tts__hint,
.magda-tts__status,
.magda-tts__time {
    color: var(--magda-muted);
    font-size: 1.05rem;
    font-weight: 500;
}

.magda-tts__status {
    min-height: 0;
    margin: 0.55rem 0 0;
}

.magda-tts__status:empty {
    display: none;
}

.magda-tts__panel {
    margin-top: 0.85rem;
    padding: 0.85rem 0.2rem 0.2rem;
}

.magda-tts__panel[hidden] {
    display: none !important;
}

.magda-tts__seek-wrap {
    display: block;
    margin: 0;
}

.magda-tts__seek {
    -webkit-appearance: none;
    appearance: none;
    display: block;
    width: 100%;
    height: 2.75rem;
    margin: 0;
    background: transparent;
    cursor: pointer;
}

.magda-tts__seek::-webkit-slider-runnable-track {
    height: 0.7rem;
    border-radius: 999px;
    background: linear-gradient(to right, var(--magda-orange-deep) var(--progress, 0%), #f0d3c0 var(--progress, 0%));
}

.magda-tts__seek::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 1.75rem;
    height: 1.75rem;
    margin-top: -0.52rem;
    border: 3px solid #fff;
    border-radius: 50%;
    background: var(--magda-orange-deep);
    box-shadow: 0 0 0 1px var(--magda-orange-deep);
}

.magda-tts__seek::-moz-range-track {
    height: 0.7rem;
    border: 0;
    border-radius: 999px;
    background: #f0d3c0;
}

.magda-tts__seek::-moz-range-progress {
    height: 0.7rem;
    border-radius: 999px;
    background: var(--magda-orange-deep);
}

.magda-tts__seek::-moz-range-thumb {
    width: 1.75rem;
    height: 1.75rem;
    border: 3px solid #fff;
    border-radius: 50%;
    background: var(--magda-orange-deep);
}

.magda-tts__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.15rem;
}

.magda-tts__speeds {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.magda-tts__speeds button {
    min-height: 3rem !important;
    margin: 0 !important;
    padding: 0.4rem 0.85rem !important;
    border: 2px solid #eadfd6 !important;
    border-radius: 999px !important;
    background: #fff !important;
    color: var(--magda-ink) !important;
    font-family: inherit !important;
    font-size: 1rem !important;
    font-weight: 700 !important;
    letter-spacing: 0 !important;
    line-height: 1.2 !important;
    text-transform: none !important;
    box-shadow: none !important;
    cursor: pointer;
    touch-action: manipulation;
}

.magda-tts__speeds button[aria-pressed="true"] {
    border-color: var(--magda-orange-deep) !important;
    background: var(--magda-wash) !important;
}

.magda-tts__speeds button:focus {
    outline: none;
}

.magda-tts__speeds button:focus-visible {
    outline: 3px solid var(--magda-ink);
    outline-offset: 2px;
}

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

.magda-tts audio {
    display: none;
}

.magda-tts-admin-note {
    padding: 0.8rem 1rem;
    border: 2px solid var(--magda-orange);
    border-radius: 12px;
    background: var(--magda-wash);
    color: var(--magda-ink);
    font-size: 1rem;
}

@keyframes magda-tts-pulse {
    50% { opacity: 0.55; }
}

@media (prefers-reduced-motion: reduce) {
    .magda-tts[data-state="loading"] .magda-tts__mark {
        animation: none;
    }
}

@media (max-width: 640px) {
    .magda-tts__toggle {
        align-items: flex-start;
    }

    .magda-tts__speeds {
        width: 100%;
    }

    .magda-tts__speeds button {
        flex: 1 1 auto;
    }
}
