.jdih-tts {
    bottom: 20px;
    bottom: max(20px, env(safe-area-inset-bottom));
    position: fixed;
    right: 20px;
    right: max(20px, env(safe-area-inset-right));
    z-index: 1040;
}

.jdih-tts__toggle {
    align-items: center;
    background: #007e65;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 8px 24px rgba(0, 59, 80, .28);
    color: #fff;
    cursor: pointer;
    display: flex;
    font-size: 24px;
    height: 58px;
    justify-content: center;
    padding: 0;
    width: 58px;
}

.jdih-tts__toggle:focus,
.jdih-tts__controls button:focus,
.jdih-tts__close:focus,
#jdih-tts-rate:focus {
    outline: 3px solid rgba(0, 126, 101, .3);
    outline-offset: 2px;
}

.jdih-tts__panel {
    background: #fff;
    border: 1px solid rgba(0, 59, 80, .12);
    border-radius: 14px;
    bottom: 70px;
    box-shadow: 0 12px 34px rgba(0, 59, 80, .22);
    color: #253238;
    padding: 16px;
    position: absolute;
    right: 0;
    max-width: calc(100vw - 32px);
    width: 300px;
    width: min(300px, calc(100vw - 32px));
}

.jdih-tts__header,
.jdih-tts__rate {
    align-items: center;
    display: flex;
    justify-content: space-between;
}

.jdih-tts__close {
    background: transparent;
    border: 0;
    color: #54666e;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    padding: 0 2px;
}

.jdih-tts__status {
    color: #54666e;
    font-size: 13px;
    line-height: 1.4;
    margin: 10px 0 12px;
    min-height: 36px;
}

.jdih-tts__controls {
    display: flex;
    gap: 7px;
    margin-bottom: 14px;
}

.jdih-tts__controls button {
    align-items: center;
    background: #eef7f5;
    border: 1px solid #cce8e1;
    border-radius: 8px;
    color: #005f4c;
    cursor: pointer;
    display: flex;
    flex: 1;
    flex-direction: column;
    font-size: 12px;
    gap: 2px;
    padding: 8px 4px;
}

.jdih-tts__controls button:hover {
    background: #007e65;
    color: #fff;
}

.jdih-tts__rate {
    font-size: 12px;
    margin-bottom: 4px;
}

#jdih-tts-rate {
    accent-color: #007e65;
    cursor: pointer;
    width: 100%;
}

.jdih-tts__progress {
    background: #e7efed;
    border-radius: 3px;
    height: 4px;
    margin-top: 10px;
    overflow: hidden;
}

.jdih-tts__progress span {
    background: #007e65;
    display: block;
    height: 100%;
    transition: width .2s ease;
    width: 0;
}

@media (max-width: 575.98px) {
    .jdih-tts {
        bottom: max(14px, env(safe-area-inset-bottom));
        right: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .jdih-tts__progress span {
        transition: none;
    }
}
