.tts-wrapper {
    position: fixed;
    bottom: 20px;
    right: 80px;
    z-index: 9999;
}

.tts-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.tts-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.tts-btn svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.tts-btn.playing {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(102, 126, 234, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0);
    }
}

.tts-panel {
    position: absolute;
    bottom: 60px;
    right: 0;
    width: 320px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    overflow: hidden;
}

.tts-panel.show {
    display: block;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tts-panel-header {
    padding: 15px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tts-panel-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
}

.tts-panel-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.tts-panel-close:hover {
    opacity: 1;
}

.tts-panel-body {
    padding: 20px;
}

.tts-control-group {
    margin-bottom: 20px;
}

.tts-control-group:last-child {
    margin-bottom: 0;
}

.tts-control-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

.tts-slider-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tts-slider {
    flex: 1;
    -webkit-appearance: none;
    height: 6px;
    border-radius: 3px;
    background: #e0e0e0;
    outline: none;
}

.tts-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.4);
}

.tts-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    border: none;
}

.tts-slider-value {
    min-width: 45px;
    text-align: right;
    font-size: 14px;
    color: #666;
}

.tts-voice-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    color: #333;
    background: white;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.tts-voice-select:focus {
    border-color: #667eea;
}

.tts-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.tts-action-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.tts-action-btn.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.tts-action-btn.primary:hover {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.tts-action-btn.secondary {
    background: #f5f5f5;
    color: #333;
}

.tts-action-btn.secondary:hover {
    background: #e8e8e8;
}

.tts-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tts-status {
    margin-top: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 13px;
    color: #666;
    text-align: center;
}

.tts-status.error {
    background: #fff3f3;
    color: #dc3545;
}

.tts-highlight {
    background-color: var(--tts-highlight-color, #ffeb3b);
    border-radius: 3px;
    transition: background-color 0.3s;
}

.tts-not-supported {
    position: fixed;
    bottom: 20px;
    right: 80px;
    background: #fff;
    padding: 25px 20px 15px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    max-width: 300px;
}

.tts-not-supported-icon {
    color: #dc3545;
    font-size: 24px;
    margin-bottom: 10px;
}

.tts-not-supported h4 {
    margin: 0 0 8px 0;
    color: #333;
    font-size: 16px;
}

.tts-not-supported p {
    margin: 0;
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

.tts-progress {
    margin-top: 15px;
}

.tts-progress-bar {
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    overflow: hidden;
}

.tts-progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.3s;
}

.tts-progress-text {
    margin-top: 8px;
    font-size: 12px;
    color: #999;
    text-align: center;
}

.tts-checkbox-group {
    margin-bottom: 15px;
}

.tts-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    user-select: none;
}

.tts-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    cursor: pointer;
    accent-color: #667eea;
}

.tts-checkbox-label span {
    flex: 1;
}

@media screen and (max-width: 768px) {
    .tts-wrapper {
        bottom: 15px;
        right: 15px;
        transition: transform 0.3s ease;
    }

    .tts-wrapper.hidden-edge {
        transform: translateX(calc(100% - 8px));
    }

    .tts-wrapper.hidden-edge .tts-btn {
        width: 16px;
        min-width: 16px;
        height: 44px;
        border-radius: 8px 0 0 8px;
    }

    .tts-wrapper.hidden-edge .tts-btn svg {
        display: none;
    }

    .tts-wrapper.hidden-edge .tts-panel {
        display: none !important;
    }

    .tts-btn {
        width: 44px;
        height: 44px;
    }

    .tts-btn svg {
        width: 20px;
        height: 20px;
    }

    .tts-panel {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        border-radius: 16px 16px 0 0;
        max-height: 80vh;
        overflow-y: auto;
    }

    .tts-panel.show {
        animation: slideUpMobile 0.3s ease;
    }

    @keyframes slideUpMobile {
        from {
            opacity: 0;
            transform: translateY(100%);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .tts-panel-header {
        padding: 12px 16px;
    }

    .tts-panel-header h3 {
        font-size: 15px;
    }

    .tts-panel-body {
        padding: 16px;
    }

    .tts-control-group {
        margin-bottom: 16px;
    }

    .tts-control-group label {
        font-size: 13px;
        margin-bottom: 6px;
    }

    .tts-slider-wrap {
        gap: 10px;
    }

    .tts-slider {
        height: 8px;
    }

    .tts-slider::-webkit-slider-thumb {
        width: 22px;
        height: 22px;
    }

    .tts-slider::-moz-range-thumb {
        width: 22px;
        height: 22px;
    }

    .tts-slider-value {
        font-size: 13px;
        min-width: 40px;
    }

    .tts-voice-select {
        padding: 12px;
        font-size: 14px;
    }

    .tts-buttons {
        gap: 8px;
    }

    .tts-action-btn {
        padding: 14px 10px;
        font-size: 14px;
    }

    .tts-not-supported {
        left: 15px;
        right: 15px;
        bottom: 15px;
        max-width: none;
    }
}

@media screen and (max-width: 360px) {
    .tts-panel-body {
        padding: 12px;
    }

    .tts-action-btn {
        padding: 12px 8px;
        font-size: 13px;
    }

    .tts-buttons {
        gap: 6px;
    }
}
