/* Speech TTS Plugin Styles - Chapter player */
.speech-tts-wrapper {
    margin: 30px 0;
    padding: 24px;
    border-radius: 18px;
    background: radial-gradient(circle at top, rgba(20, 30, 57, 0.9), rgba(7, 11, 25, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.55);
    color: #e2e8f0;
}

.speech-tts-player-shell {
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(135deg, rgba(26, 42, 88, 0.8), rgba(17, 24, 39, 0.95));
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.35);
}

.speech-tts-screen {
    position: relative;
    min-height: 190px;
    padding: 72px 32px 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.08), transparent 55%),
                radial-gradient(circle at 80% 0%, rgba(96, 165, 250, 0.12), transparent 50%),
                #0f172a;
}

.speech-tts-screen-head {
    position: absolute;
    top: 18px;
    left: 24px;
    right: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 2;
    pointer-events: none;
}

.speech-tts-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 600;
    color: #f8fafc;
    transition: background 0.3s ease, color 0.3s ease;
}

.speech-tts-live-badge .speech-tts-live-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #fbbf24;
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.8);
    display: inline-flex;
}

.speech-tts-live-badge.is-loading {
    background: rgba(56, 189, 248, 0.25);
}

.speech-tts-live-badge.is-loading .speech-tts-live-dot {
    background: #38bdf8;
    animation: speech-tts-pulse 1.2s ease-in-out infinite;
}

.speech-tts-live-badge.is-active {
    background: rgba(248, 113, 113, 0.2);
}

.speech-tts-live-badge.is-active .speech-tts-live-dot {
    background: #f87171;
    animation: speech-tts-pulse 0.9s ease-in-out infinite;
}

.speech-tts-live-badge.is-paused {
    background: rgba(147, 197, 253, 0.2);
    color: #cbd5f5;
}

.speech-tts-progress-label {
    font-size: 13px;
    font-weight: 600;
    color: rgba(226, 232, 240, 0.85);
}

.speech-tts-subtitle {
    font-size: 1.45rem;
    line-height: 1.7;
    font-weight: 600;
    color: #f8fafc;
    text-align: left;
    text-shadow: 0 8px 20px rgba(15, 23, 42, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 6px;
    min-height: 78px;
    width: 100%;
    padding: 0 20px;
}

.speech-tts-subtitle-line {
    display: block;
    width: 100%;
    margin: 2px 0;
    max-width: 100%;
    word-break: break-word;
    overflow: hidden;
}

.speech-tts-subtitle-empty {
    opacity: 0.35;
}

.speech-tts-subtitle-word {
    color: rgba(241, 245, 249, 0.9);
}

.speech-tts-subtitle-active {
    color: #f472b6;
    text-shadow: 0 4px 12px rgba(244, 114, 182, 0.6);
}

.speech-tts-subtitle-placeholder {
    color: rgba(226, 232, 240, 0.75);
    font-weight: 500;
}

.speech-tts-progress {
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.speech-tts-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #38bdf8 0%, #c084fc 50%, #f87171 100%);
    transition: width 0.25s ease;
}

.speech-tts-control-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 24px;
    align-items: stretch;
}

.speech-tts-card {
    background: rgba(15, 23, 42, 0.65);
    border-radius: 14px;
    padding: 18px 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(6px);
}

.speech-tts-voice-control {
    flex: 1;
    min-width: 240px;
}

.speech-tts-slider-group {
    display: flex;
    flex: 1;
    gap: 16px;
    min-width: 280px;
}

.speech-tts-speed-control,
.speech-tts-pitch-control {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.speech-tts-voice-control label,
.speech-tts-speed-control label,
.speech-tts-pitch-control label {
    font-weight: 600;
    font-size: 14px;
    color: rgba(226, 232, 240, 0.85);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.speech-tts-select {
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: rgba(15, 23, 42, 0.8);
    color: #f8fafc;
    font-size: 15px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.speech-tts-select:focus {
    outline: none;
    border-color: #c084fc;
    box-shadow: 0 0 0 2px rgba(192, 132, 252, 0.25);
}

.speech-tts-range {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.35);
    -webkit-appearance: none;
    appearance: none;
    outline: none;
}

.speech-tts-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #38bdf8, #c084fc);
    box-shadow: 0 8px 15px rgba(56, 189, 248, 0.45);
    cursor: pointer;
}

.speech-tts-range::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #38bdf8, #c084fc);
    border: none;
    box-shadow: 0 8px 15px rgba(56, 189, 248, 0.45);
}

.speech-tts-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 28px;
}

.speech-tts-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    min-width: 130px;
}

.speech-tts-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.speech-tts-btn-primary {
    background: linear-gradient(135deg, #38bdf8 0%, #6366f1 50%, #c084fc 100%);
    color: #f8fafc;
    box-shadow: 0 12px 25px rgba(99, 102, 241, 0.35);
}

.speech-tts-btn-secondary {
    background: rgba(148, 163, 184, 0.25);
    color: #e2e8f0;
}

.speech-tts-btn-danger {
    background: linear-gradient(135deg, #fb7185, #f43f5e);
    color: #fff;
    box-shadow: 0 12px 25px rgba(248, 113, 113, 0.35);
}

.speech-tts-btn:hover:not(:disabled) {
    transform: translateY(-2px);
}

.speech-tts-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.speech-tts-spinner {
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-top: 2px solid #fff;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    animation: speech-tts-spin 0.8s linear infinite;
}

@keyframes speech-tts-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes speech-tts-pulse {
    0% { transform: scale(0.95); opacity: 0.7; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.7; }
}

/* Highlight words inside chapter content */
.speech-tts-word-inline {
    display: inline;
    padding: 1px 2px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.speech-tts-word-inline.highlight {
    background: rgba(99, 102, 241, 0.18);
    color: #4f46e5;
    font-weight: 600;
}

.speech-tts-word-inline.read {
    color: rgba(100, 116, 139, 0.7);
}

/* Notifications */
.speech-tts-notification {
    margin-top: 20px;
    padding: 14px 18px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(15, 23, 42, 0.6);
    color: #e2e8f0;
}

.speech-tts-notification-warning {
    border-color: rgba(251, 191, 36, 0.35);
    background: rgba(120, 53, 15, 0.4);
    color: #fde68a;
}

.speech-tts-notification-info {
    border-color: rgba(59, 130, 246, 0.35);
    background: rgba(30, 64, 175, 0.35);
    color: #bfdbfe;
}

/* Responsive */
@media (max-width: 768px) {
    .speech-tts-wrapper {
        padding: 18px;
    }

    .speech-tts-screen {
        padding: 28px 18px 32px;
        min-height: 160px;
    }

    .speech-tts-control-row {
        flex-direction: column;
    }

    .speech-tts-slider-group {
        flex-direction: column;
    }

    .speech-tts-buttons {
        flex-direction: column;
    }

    .speech-tts-btn {
        width: 100%;
    }
}

