/* Audio Playback and Word Highlighting Styles */

/* Status Section */
.status-section {
    margin-bottom: 1rem;
}

.status-message {
    text-align: center;
    color: #9ca3af;
    font-size: 14px;
    margin-top: 0.5rem;
    padding: 8px;
    background: rgba(26, 26, 26, 0.6);
    border-radius: 6px;
    display: none;
}

.status-message.show {
    display: block;
}

.status-message.error {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
}

.status-message.success {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.perf-indicator {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 1000;
    background: rgba(26, 26, 26, 0.85);
    color: #e5e7eb;
    border: 1px solid rgba(107, 114, 128, 0.35);
    border-radius: 10px;
    padding: 6px 10px;
    font-size: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    display: none;
}

/* Loading Interface */
.loading-interface {
    text-align: center;
    margin: 2rem 0;
}

.eta-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 1rem;
    font-size: 12px;
    color: #9ca3af;
}

.countdown {
    padding: 0;
    color: #fbbf24;
    font-size: 24px;
    font-weight: 600;
    border: none;
    background: transparent;
}

.steps-display {
    color: #fbbf24;
    font-size: 14px;
    margin: 0;
    text-align: center;
    min-height: 20px;
}

/* Audio Playback Section */
.audio-playback-section {
}

.text-display {
    width: 100%;
    min-height: 100px;
    padding-top: 0;
    padding-right: 12px;
    padding-bottom: 12px;
    padding-left: 12px;
    background: none;
    background-color: transparent;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: var(--not-playing-font-size, 16px);
    color: #e5e7eb;
    word-wrap: break-word;
    overflow-y: visible;
    cursor: default;
    box-sizing: border-box;
    margin-bottom: 1rem;
    transition: opacity 0.15s ease;
    pointer-events: auto;
    /* Content-responsive height */
    height: auto;
}

.text-display.playing {
    font-size: var(--playing-font-size, 32px);
    line-height: 2;
}

.text-display.playing .text-content {
    text-align: center;
}

.text-display .text-content {
    text-align: left;
    max-width: 100%;
    word-wrap: break-word;
}


.text-display span {
    background: transparent;
    transition: all 0.2s ease;
    border-radius: 4px;
    padding: 2px 4px;
    display: inline;
    /* Inherit font size from container - no individual sizes */
}

.text-display.playing span {
    transition: all 0.2s ease;
}

.text-display.playing span.active, .word.active {
    background: #000000;
    color: var(--active-word-color, #fbbf24);
    font-weight: 700;
    transform: scale(1.13);
    transform-origin: bottom;
    opacity: 1;
    position: relative;
    z-index: 10;
    display: inline-block;
    vertical-align: middle;
    /* Removed redundant properties for a single source of truth */
}

/* Audio Controls */
.audio-controls {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 1.5rem;
    width: 100%;
    box-sizing: border-box;
}

.play-button {
    background: linear-gradient(135deg, #6b7280 0%, #9ca3af 100%);
    border: 2px solid #374151;
    border-radius: 12px;
    width: 120px;
    height: 48px;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.play-button:hover:not(:disabled):not(.play-state) {
    background: linear-gradient(135deg, #9ca3af 0%, #d1d5db 100%);
    border-color: #6b7280;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.play-button.play-state {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    border-color: #d97706;
    color: #1a1a1a;
}

.play-button.play-state:hover:not(:disabled) {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border-color: #b45309;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.play-button.pause-state {
    background: rgba(10, 10, 10, 0.75);
    border-color: #222;
    color: #888;
}

/* Dimming for UI elements during playback */
.playback-dim {
    opacity: 0.1;
    transition: opacity 0.5s ease;
}

/* Target play button specifically for selective dimming */
.play-button.playback-dim {
    opacity: 0.1;
    transition: opacity 0.5s ease;
}

/* Progress Section */
.progress-section {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    flex: 1;
    min-width: 200px;
    position: relative;
}

.progress-container {
    width: 100%;
    height: 16px;
    background: transparent;
    border-radius: 8px;
    overflow: visible;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
}

.progress-segment {
    flex: 1;
    height: 12px;
    background: rgba(64, 64, 64, 0.3);
    border-radius: 6px;
    margin: 0 2px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(107, 114, 128, 0.3);
    transition: all 0.3s ease;
}

.progress-segment.active {
    border-color: #6b7280;
    box-shadow: 0 0 0 2px rgba(107, 114, 128, 0.2);
    background: rgba(107, 114, 128, 0.1);
}

.progress-segment-fill {
    height: 100%;
    background: #6b7280;
    width: 0%;
    transition: width 0.1s ease;
    border-radius: 6px;
}

/* Unified Word Highlighting - Opacity and Weight Only */
.word {
    display: inline;
    padding: 2px 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    cursor: pointer;
    white-space: normal;
    word-wrap: break-word;
    min-width: 0;
    box-sizing: border-box;
    font-weight: 400;
    vertical-align: baseline;
    opacity: 0.2;
    /* Font size inherited from container */
}

.word.lookahead {
    opacity: calc(var(--base-text-opacity, 0.3) + var(--lookahead-offset, 0.15));
    font-weight: 500;
}

.word.lookback {
    opacity: calc(var(--base-text-opacity, 0.3) + var(--lookahead-offset, 0.15));
    font-weight: 500;
}

.word.inactive-read {
    opacity: var(--base-text-opacity, 0.3);
    font-weight: 400;
}

.word.inactive-future {
    opacity: var(--base-text-opacity, 0.3);
    font-weight: 400;
}

.word.paused-word {
    color: #ffffff !important;
    font-weight: bold !important;
    opacity: 1.0 !important;
    background: rgba(107, 114, 128, 0.3);
    /* Same font-size as surrounding text for uniform flow */
}