/**
 * Reading Fluency Popover - Isolated Styles
 * ALL classes prefixed with .fluency-* to avoid conflicts
 * NO global selectors - completely self-contained
 */

/* ===== SHIMMER BUTTON FRAMEWORK ===== */
:root {
    --shimmer-glow-hue: 222deg;
    --shimmer-shadow-hue: 180deg;
    --overlay-color: 0, 0, 0;
    --overlay-opacity: 0;
    --text-color: #ffffff;
    --border-color: rgba(255, 255, 255, 0.2);
    --shimmer-spring-easing: linear(
    0, 0.002, 0.01 0.9%, 0.038 1.8%, 0.156, 0.312 5.8%, 0.789 11.1%, 1.015 14.2%,
    1.096, 1.157, 1.199, 1.224 20.3%, 1.231, 1.231, 1.226, 1.214 24.6%,
    1.176 26.9%, 1.057 32.6%, 1.007 35.5%, 0.984, 0.968, 0.956, 0.949 42%,
    0.946 44.1%, 0.95 46.5%, 0.998 57.2%, 1.007, 1.011 63.3%, 1.012 68.3%,
    0.998 84%, 1
  );
    --shimmer-spring-duration: 1.33s;
    --fallback-spring-easing: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --fallback-spring-duration: 0.6s;
}

@property --shimmer-shimmer {
    syntax: "<angle>";
    inherits: false;
    initial-value: 33deg;
}

@keyframes shimmer-shimmer {
    0% {
        --shimmer-shimmer: 0deg;
    }
    100% {
        --shimmer-shimmer: 360deg;
    }
}

@keyframes shimmer-shine {
    0% {
        opacity: 0;
    }
    15% {
        opacity: 1;
    }
    55% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

@keyframes shimmer-text {
    0% {
        background-position: 100% center;
    }
    100% {
        background-position: -100% center;
    }
}

/* Shimmer overlay */
.shimmer-shimmer {
    position: absolute;
    inset: calc(var(--inset, 40px) * -1);
    border-radius: inherit;
    pointer-events: none;
    mask-image: conic-gradient(
        from var(--shimmer-shimmer, 0deg),
        transparent 0%,
        transparent 20%,
        black 36%,
        black 45%,
        transparent 50%,
        transparent 70%,
        black 85%,
        black 95%,
        transparent 100%
    );
    mask-size: cover;
    mix-blend-mode: plus-lighter;
    animation: shimmer-shimmer 1s linear infinite both;
}

.fluency-tab:hover .shimmer-shimmer::before,
.fluency-tab:hover .shimmer-shimmer::after,
.fluency-tab.active .shimmer-shimmer::before,
.fluency-tab.active .shimmer-shimmer::after,
.fluency-mode-btn:hover .shimmer-shimmer::before,
.fluency-mode-btn:hover .shimmer-shimmer::after,
.fluency-mode-btn.active .shimmer-shimmer::before,
.fluency-mode-btn.active .shimmer-shimmer::after,
.fluency-control-btn:hover .shimmer-shimmer::before,
.fluency-control-btn:hover .shimmer-shimmer::after,
.fluency-purchase-btn:hover .shimmer-shimmer::before,
.fluency-purchase-btn:hover .shimmer-shimmer::after,
.recording-option-btn:hover .shimmer-shimmer::before,
.recording-option-btn:hover .shimmer-shimmer::after {
    opacity: 1;
    animation: shimmer-shine 1.2s ease-in 1 forwards;
}

.shimmer-shimmer::before,
.shimmer-shimmer::after {
    transition: all 0.5s ease;
    opacity: 0;
    content: "";
    border-radius: inherit;
    position: absolute;
    mix-blend-mode: color;
    inset: var(--inset, 40px);
    pointer-events: none;
}

.shimmer-shimmer::before {
    box-shadow: 0 0 calc(var(--inset, 40px) * 0.1)  2px hsl(var(--shimmer-glow-hue) 20% 95%),
        0 0 calc(var(--inset, 40px) * 0.18)  4px hsl(var(--shimmer-glow-hue) 20% 80%),
        0 0 calc(var(--inset, 40px) * 0.33)  4px hsl(var(--shimmer-glow-hue) 50% 70%),
        0 0 calc(var(--inset, 40px) * 0.66) 5px hsl(var(--shimmer-glow-hue) 100% 70%);
    z-index: -1;
}

.shimmer-shimmer::after {
    box-shadow: inset 0 0 0 1px hsl(var(--shimmer-glow-hue) 70% 95%),
        inset 0 0 2px 1px hsl(var(--shimmer-glow-hue) 100% 80%),
        inset 0 0 5px 2px hsl(var(--shimmer-glow-hue) 100% 70%);
    z-index: 2;
}

/* Shimmer text effect */
.shimmer-text {
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-color: var(--text-color);
    background-image: linear-gradient(120deg, var(--text-color), rgba(255, 255, 255, 1) 40%, rgba(230, 230, 255, 1) 50%, var(--text-color) 52%);
    background-repeat: no-repeat;
    background-size: 300% 300%;
    background-position: 0% center;
    transition: background-color 0.3s ease, background-image 0.3s ease;
}

.fluency-tab:hover .shimmer-text,
.fluency-tab.active .shimmer-text,
.fluency-mode-btn:hover .shimmer-text,
.fluency-mode-btn.active .shimmer-text,
.fluency-control-btn:hover .shimmer-text,
.fluency-purchase-btn:hover .shimmer-text {
    animation: shimmer-text .66s ease-in 1 both;
}

/* ===== Popover Container ===== */
.fluency-popover {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 1rem;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}


.fluency-popover.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* ===== Backdrop ===== */
.fluency-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
}

/* ===== Popover Content ===== */
.fluency-content {
    position: relative;
    width: min(90vw, 56.25rem);
    max-height: 90vh;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 1.5rem;
    border: 0.0625rem solid var(--border-color);
    overflow: hidden;
    box-shadow: 0 1.5625rem 3.125rem -0.75rem rgba(0, 0, 0, 0.5),
                inset 0 0.0625rem 0 rgba(255, 255, 255, 0.3);
    display: flex;
    flex-direction: column;
    z-index: 2;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.fluency-content::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(var(--overlay-color), var(--overlay-opacity));
    pointer-events: none;
    z-index: 1000;
    transition: background 0.3s ease;
    border-radius: 1.5rem;
}

/* ===== Header ===== */
.fluency-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.05);
    position: relative;
    z-index: 1001;
}

.fluency-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0;
    font-family: system-ui, -apple-system, sans-serif;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: color 0.3s ease;
}

.fluency-close-btn {
    width: 2.5rem;
    height: 2.5rem;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-color);
}

.fluency-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* ===== Tab Navigation ===== */
.fluency-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 2rem 0;
    background: rgba(255, 255, 255, 0.05);
    position: relative;
    z-index: 1001;
}

.fluency-tab {
    --inset: 40px;
    position: relative;
    isolation: isolate;
    padding: 0.75rem 1.5rem;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 0.66em 0.66em 0 0;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-color);
    opacity: 0.8;
    font-family: system-ui, -apple-system, sans-serif;
    transition: all var(--shimmer-spring-duration) var(--shimmer-spring-easing);
}

.fluency-tab:hover {
    transition-duration: calc(var(--shimmer-spring-duration)*0.5);
    background: rgba(255, 255, 255, 0.2);
}

.fluency-tab.active {
    background: rgba(255, 255, 255, 0.25);
    color: var(--text-color);
    opacity: 1;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

/* ===== Tab Content ===== */
.fluency-tab-content {
    flex: 1;
    overflow-y: auto;
    padding: 0; /* Remove padding - text container will handle it */
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid var(--border-color);
    /* Hide scrollbar for all browsers */
    -ms-overflow-style: none;
    scrollbar-width: none;
    position: relative;
    z-index: 1001;
}

/* Hide scrollbar for WebKit browsers (Chrome, Safari, Edge) */
.fluency-tab-content::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.fluency-panel {
    display: none;
}

.fluency-panel.active {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* ===== Reading Panel ===== */
.fluency-book-info {
    margin-bottom: 1.5rem;
    text-align: center;
}

.fluency-book-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0 0 0.5rem;
    font-family: Georgia, serif;
    transition: color 0.3s ease;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.fluency-narrator {
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.8;
    margin: 0;
    transition: color 0.3s ease;
    font-style: italic;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* ===== Mode Toggle ===== */
.fluency-mode-toggle {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.fluency-mode-btn {
    --inset: 40px;
    position: relative;
    isolation: isolate;
    padding: 0.75rem 2rem;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    border-radius: 0.66em;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    font-family: system-ui, -apple-system, sans-serif;
    color: var(--text-color);
    opacity: 0.9;
    transition: all var(--shimmer-spring-duration) var(--shimmer-spring-easing);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15),
                0 2px 4px rgba(0, 0, 0, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.fluency-mode-btn svg {
    flex-shrink: 0;
    stroke: var(--text-color);
    transition: stroke 0.3s ease;
}

.fluency-mode-btn:hover {
    transition-duration: calc(var(--shimmer-spring-duration)*0.5);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2),
                0 4px 8px rgba(0, 0, 0, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.fluency-mode-btn.active {
    background: rgba(74, 144, 226, 0.5);
    border-color: var(--border-color);
    color: var(--text-color);
    opacity: 1;
    box-shadow: 0 8px 20px rgba(74, 144, 226, 0.6),
                inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* ===== Dot Controls ===== */
.fluency-dot-controls-grid {
    display: grid;
    grid-template-columns: auto repeat(4, minmax(0, max-content)) auto auto;
    grid-template-rows: auto auto;
    gap: 0.25rem;
    margin-bottom: 2rem;
    padding-top: 1.5rem;
    justify-content: center;
    align-items: stretch;
    grid-auto-flow: column;
}

.fluency-dot-control-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    grid-row: 1 / 3;
}

/* First mode button (Listen First) - Column 1, Row 1 */
.fluency-dot-controls-grid > button:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
}

/* Second mode button (Your Turn) - Column 1, Row 2 */
.fluency-dot-controls-grid > button:nth-child(2) {
    grid-column: 1;
    grid-row: 2;
}

/* Last three buttons (Pause, Restart, Record) - Columns 6 & 7 */
/* Pause button - Column 6, Row 1 */
.fluency-dot-controls-grid > button:nth-last-child(3) {
    grid-column: 6;
    grid-row: 1;
}

/* Restart button - Column 7, Row 1 */
.fluency-dot-controls-grid > button:nth-last-child(2) {
    grid-column: 7;
    grid-row: 1;
}

/* Record button spans columns 6-7 in row 2 */
#recordBtn {
    grid-column: 6 / 8;
    grid-row: 2;
}

.fluency-dot-control {
    position: relative;
    width: 3em;
    height: 6em;
    margin: 0;
    cursor: pointer;
}

.fluency-dot-control canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.fluency-dot-control-label {
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 0.16rem;
    color: var(--text-color);
    opacity: 0.9;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.fluency-dot-control-value {
    margin-top: 0.04rem;
    color: #4a90e2;
    font-size: 1.2rem;
    font-weight: 600;
}

/* ===== Text Container (Auto-Scroll) ===== */
.fluency-text-container {
    flex: 1; /* Fill remaining space */
    max-height: 600px; /* Constrain height to force scrolling */
    overflow-y: scroll;
    overflow-x: hidden;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px); /* Add blur effect */
    -webkit-backdrop-filter: blur(10px); /* Safari support */
    border-radius: 0;
    border: none; /* Remove border for full width */
    border-top: 1px solid var(--border-color); /* Keep only top border */
    margin: 0; /* Remove all margins for full width */
    position: relative;
    width: 100%; /* Ensure full width */
    /* Hide scrollbar for all browsers */
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Hide scrollbar for WebKit browsers (Chrome, Safari, Edge) */
.fluency-text-container::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.fluency-text {
    font-size: 1.1rem;
    line-height: 1.6;
    font-family: Georgia, 'Times New Roman', serif;
    color: var(--text-color);
    text-shadow: 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.3);
    padding: 2rem; /* Padding on all sides */
    padding-bottom: 3rem; /* Small bottom padding so text doesn't run off */
    transition: color 0.3s ease;
}

/* Chapter heading style */
.fluency-text .chapter-heading {
    font-style: italic;
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1.2rem;
}

/* Paragraph formatting */
.fluency-text p {
    margin: 0 0 1rem 0;
    text-align: justify;
    text-indent: 2em; /* Indent first line of paragraphs */
}

/* First paragraph after heading should not be indented */
.fluency-text .chapter-heading + p {
    text-indent: 0;
}

/* ===== Word Highlighting ===== */
.fluency-word {
    display: inline;
}

.fluency-word--highlighted {
    /* Removed highlighting - text will just scroll */
}

/* ===== Playback Controls ===== */
.fluency-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.fluency-control-btn {
    --inset: 40px;
    position: relative;
    isolation: isolate;
    padding: 0.75rem 1.5rem;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    border-radius: 0.66em;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    font-family: system-ui, -apple-system, sans-serif;
    color: var(--text-color);
    opacity: 0.9;
    transition: all var(--shimmer-spring-duration) var(--shimmer-spring-easing);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15),
                0 2px 4px rgba(0, 0, 0, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.fluency-control-btn svg {
    flex-shrink: 0;
    stroke: var(--text-color);
    transition: stroke 0.3s ease;
}

.fluency-control-btn:hover {
    transition-duration: calc(var(--shimmer-spring-duration)*0.5);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2),
                0 4px 8px rgba(0, 0, 0, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* ===== Compact Control Buttons ===== */
.fluency-control-btn-compact {
    padding: 0.5rem 1.2rem;
    font-size: 0.9rem;
}

/* ===== Record Button Greenish Hue ===== */
#recordBtn,
#recordBtnMobile {
    background: rgba(76, 175, 80, 0.3);
    border-color: rgba(76, 175, 80, 0.4);
    opacity: 1;
}

#recordBtn:hover,
#recordBtnMobile:hover {
    background: rgba(76, 175, 80, 0.4);
    box-shadow: 0 8px 20px rgba(76, 175, 80, 0.4),
                0 4px 8px rgba(0, 0, 0, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* ===== Recording Button States ===== */
#recordBtn.recording,
#recordBtnMobile.recording {
    background: rgba(244, 67, 54, 0.3);
    border-color: rgba(244, 67, 54, 0.6);
    animation: recordingPulse 1.5s ease-in-out infinite;
}

#recordBtn.recording svg,
#recordBtnMobile.recording svg {
    stroke: #f44336;
    fill: rgba(244, 67, 54, 0.3);
}

@keyframes recordingPulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(244, 67, 54, 0.4),
                    0 2px 4px rgba(244, 67, 54, 0.3),
                    inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
    50% {
        box-shadow: 0 8px 20px rgba(244, 67, 54, 0.6),
                    0 4px 8px rgba(244, 67, 54, 0.5),
                    inset 0 1px 0 rgba(255, 255, 255, 0.4);
    }
}

/* ===== Timeline Scrubber ===== */
.fluency-timeline {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.fluency-time-display {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    font-family: system-ui, -apple-system, sans-serif;
    min-width: 3rem;
    text-align: center;
}

.fluency-timeline-scrubber {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.fluency-timeline-scrubber::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #4a90e2;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.fluency-timeline-scrubber::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #4a90e2;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.fluency-timeline-scrubber::-webkit-slider-thumb:hover {
    background: #357abd;
    transform: scale(1.1);
}

.fluency-timeline-scrubber::-moz-range-thumb:hover {
    background: #357abd;
    transform: scale(1.1);
}

/* ===== Volume Control ===== */
.fluency-volume-control {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.fluency-volume-label {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    font-family: system-ui, -apple-system, sans-serif;
    min-width: 4rem;
}

.fluency-volume-slider {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.fluency-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #4a90e2;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.fluency-volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #4a90e2;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.fluency-volume-slider::-webkit-slider-thumb:hover {
    background: #357abd;
    transform: scale(1.1);
}

.fluency-volume-slider::-moz-range-thumb:hover {
    background: #357abd;
    transform: scale(1.1);
}

.fluency-volume-value {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    font-family: system-ui, -apple-system, sans-serif;
    min-width: 3rem;
    text-align: right;
}

/* ===== Progress Bar ===== */
.fluency-progress {
    height: 4px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.fluency-progress-bar {
    height: 100%;
    background: #4a90e2;
    width: 0%;
    transition: width 0.2s ease;
}

/* ===== Quiz Panel ===== */
.fluency-quiz {
    max-width: 700px;
    margin: 0 auto;
}

.fluency-quiz-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    transition: color 0.3s ease;
    margin: 0 0 0.5rem;
    font-family: system-ui, -apple-system, sans-serif;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.fluency-quiz-subtitle {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.8);
    margin: 0 0 2rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.fluency-quiz-questions {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.fluency-question {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.5rem;
}

.fluency-question-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    transition: color 0.3s ease;
    margin: 0 0 1rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.fluency-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.fluency-option {
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
}

.fluency-option:hover {
    border-color: rgba(74, 144, 226, 0.6);
    background: rgba(255, 255, 255, 0.1);
}

.fluency-option.selected {
    border-color: rgba(74, 144, 226, 0.8);
    background: rgba(74, 144, 226, 0.2);
}

.fluency-option.correct {
    border-color: #4caf50;
    background: #e8f5e9;
}

.fluency-option.incorrect {
    border-color: #f44336;
    background: #ffebee;
}

/* ===== Quiz Results ===== */
.fluency-quiz-results {
    text-align: center;
    margin-top: 2rem;
    padding: 2rem;
    background: white;
    border-radius: 0.75rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.fluency-retry-btn {
    margin-top: 1rem;
    padding: 0.75rem 2rem;
    border: none;
    background: #4a90e2;
    color: white;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fluency-retry-btn:hover {
    background: #357abd;
}

/* ===== How to Use / Instructions Panel ===== */
.fluency-instructions {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

.fluency-instructions-title {
    font-size: 2rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 1rem;
    font-family: system-ui, -apple-system, sans-serif;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.fluency-instructions-subtitle {
    font-size: 1.15rem;
    color: rgba(255, 255, 255, 0.95);
    margin: 0 0 2.5rem;
    font-family: system-ui, -apple-system, sans-serif;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.fluency-instructions-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.fluency-instruction-item {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    color: #ffffff;
    font-size: 1.15rem;
    line-height: 1.8;
    transition: all 0.3s ease;
    position: relative;
    padding-left: 3rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.fluency-instruction-item::before {
    content: "●";
    position: absolute;
    left: 1.25rem;
    top: 2rem;
    color: #66BB6A;
    font-size: 1.4rem;
}

.fluency-instruction-item:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.35);
    transform: translateX(4px);
}

.fluency-instruction-item strong {
    color: #81C784;
    font-weight: 700;
    font-size: 1.2rem;
}

.fluency-sub-list {
    list-style: disc;
    margin-top: 1rem;
    margin-left: 1.5rem;
    padding-left: 0.5rem;
    color: rgba(255, 255, 255, 0.95);
}

.fluency-sub-list li {
    margin-bottom: 0.5rem;
    font-size: 1.05rem;
    line-height: 1.6;
}

/* Nested sub-sub-list for recording options */
.fluency-sub-sub-list {
    list-style: circle;
    margin-top: 0.75rem;
    margin-left: 1.5rem;
    padding-left: 0.5rem;
    color: rgba(255, 255, 255, 0.9);
}

.fluency-sub-sub-list li {
    margin-bottom: 0.4rem;
    font-size: 1rem;
    line-height: 1.5;
}

/* ===== Vocabulary Panel ===== */
.fluency-vocab {
    max-width: 700px;
    margin: 0 auto;
}

.fluency-vocab-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    transition: color 0.3s ease;
    margin: 0 0 0.5rem;
    font-family: system-ui, -apple-system, sans-serif;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.fluency-vocab-subtitle {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.8);
    margin: 0 0 2rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.fluency-vocab-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.fluency-vocab-item {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.5rem;
}

.fluency-vocab-word {
    font-size: 1.25rem;
    font-weight: 700;
    color: rgba(74, 144, 226, 0.9);
    margin: 0 0 0.5rem;
    font-family: Georgia, serif;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.fluency-vocab-definition {
    font-size: 1rem;
    color: var(--text-color);
    opacity: 0.9;
    margin: 0 0 1rem;
    transition: color 0.3s ease;
}

.fluency-vocab-example {
    font-size: 0.95rem;
    color: var(--text-color);
    opacity: 0.7;
    font-style: italic;
    padding-left: 1rem;
    border-left: 3px solid rgba(74, 144, 226, 0.6);
    transition: color 0.3s ease;
    margin: 0;
}

/* ===== Purchase CTA ===== */
.fluency-purchase {
    padding: 1.5rem 2rem;
    background: rgba(255, 255, 255, 0.05);
    border-top: 1px solid var(--border-color);
    text-align: center;
    position: relative;
    z-index: 1001;
}

.fluency-purchase-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    transition: color 0.3s ease;
    margin: 0 0 1rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.fluency-purchase-btns {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 0.75rem;
}

.fluency-purchase-btn {
    --inset: 40px;
    position: relative;
    isolation: isolate;
    padding: 0.75rem 1.5rem;
    background: #4a90e2;
    color: var(--text-color);
    text-decoration: none;
    border: 1px solid var(--border-color);
    border-radius: 0.66em;
    font-size: 0.95rem;
    font-weight: 500;
    font-family: system-ui, -apple-system, sans-serif;
    display: inline-block;
    transition: all var(--shimmer-spring-duration) var(--shimmer-spring-easing);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3),
                0 2px 4px rgba(0, 0, 0, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.fluency-purchase-btn:hover {
    transition-duration: calc(var(--shimmer-spring-duration)*0.5);
    background: #357abd;
    box-shadow: 0 8px 20px rgba(74, 144, 226, 0.5),
                0 4px 8px rgba(0, 0, 0, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.fluency-affiliate-disclosure {
    font-size: 0.75rem;
    color: var(--text-color);
    opacity: 0.6;
    margin: 0;
    transition: color 0.3s ease;
}

/* ===== Utility Classes ===== */
.fluency-popover .hidden {
    display: none !important;
}

/* ===== Traditional Controls (Mobile) ===== */
.fluency-traditional-controls {
    display: none;
    flex-direction: row; /* Changed from column to row for horizontal layout */
    gap: 0.5rem; /* Reduced gap for compact layout */
    margin-bottom: 1rem; /* Reduced margin */
    justify-content: space-between;
}

.fluency-traditional-control {
    display: flex;
    flex-direction: column;
    gap: 0.25rem; /* Reduced gap */
    padding: 0.5rem; /* Reduced padding for smaller size */
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    flex: 1; /* Equal width for all 4 columns */
    min-width: 0; /* Allow shrinking */
    text-align: center; /* Center labels */
}

.fluency-traditional-control label {
    font-size: 0.65rem; /* Smaller font for compact layout */
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    text-transform: uppercase;
    letter-spacing: 0.5px; /* Reduced letter spacing */
    white-space: nowrap; /* Prevent wrapping */
    overflow: hidden;
    text-overflow: ellipsis;
}

.fluency-traditional-control input[type="range"] {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    outline: none;
}

.fluency-traditional-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #4a90e2;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.fluency-traditional-control input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #4a90e2;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.fluency-traditional-control span {
    font-size: 0.75rem; /* Smaller value display */
    font-weight: 600;
    color: #4a90e2;
    text-align: center;
}

.fluency-mobile-controls {
    display: none;
}

.fluency-mobile-mode-toggle {
    display: none;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    /* Hide dot controls on mobile */
    .fluency-dot-controls-grid {
        display: none !important;
    }

    /* Show traditional controls on mobile */
    .fluency-traditional-controls {
        display: flex;
    }

    .fluency-mobile-controls {
        display: flex;
    }

    .fluency-mobile-mode-toggle {
        display: flex;
    }

    .fluency-content {
        width: 95vw;
        max-height: 95vh;
    }

    .fluency-header {
        padding: 1rem 1.5rem;
    }

    .fluency-title {
        font-size: 1.25rem;
    }

    .fluency-tabs {
        padding: 0.75rem 1rem;
        gap: 0.25rem;
    }

    .fluency-tab {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    .fluency-tab-content {
        padding: 1.5rem 1rem;
    }

    .fluency-text {
        font-size: 1rem;
        line-height: 1.8;
    }

    .fluency-mode-toggle {
        flex-direction: row; /* Changed to row for side-by-side layout */
        gap: 0.75rem; /* Reduced gap */
        margin-bottom: 1rem; /* Reduced margin to position closer to content */
    }

    .fluency-mobile-mode-toggle {
        order: 1; /* First: Mode toggle buttons (Listen First | Your Turn) */
        margin-bottom: 0.75rem;
    }

    .fluency-mobile-controls {
        order: 2; /* Second: Playback controls (Pause | Restart) */
        margin-bottom: 0.75rem;
    }

    .fluency-text-container {
        order: 3; /* Third: Reading text box */
    }

    .fluency-traditional-controls {
        order: 4; /* Fourth: Sliders at bottom */
        margin-top: 1rem; /* Add space above sliders */
        margin-bottom: 0.5rem; /* Reduce bottom margin */
    }

    /* Make reading panel a flex container for order to work */
    .fluency-panel[data-panel="reading"].active {
        display: flex;
        flex-direction: column;
    }

    .fluency-mode-btn {
        flex: 1; /* Equal width for both buttons */
        font-size: 0.85rem; /* Slightly smaller */
        padding: 0.75rem 1rem; /* Adjusted padding */
    }

    .fluency-purchase-btns {
        flex-direction: row; /* Changed to row for side-by-side layout */
        gap: 0.75rem; /* Reduced gap for mobile */
    }

    .fluency-purchase-btn {
        flex: 1; /* Equal width for both buttons */
        font-size: 0.85rem; /* Slightly smaller text */
        padding: 0.75rem 1rem; /* Adjusted padding */
    }
}

/* ===== Word-Level Highlighting & Interaction ===== */
.fluency-word {
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 2px 0;
    border-radius: 3px;
    position: relative;
}

.fluency-word:hover {
    background: rgba(74, 144, 226, 0.2);
    color: #4a90e2;
}

/* Selected word (clicked) */
.fluency-word-selected {
    background: rgba(255, 215, 0, 0.3);
    color: #ffd700;
    font-weight: 600;
}

/* ===== Word Definition Tooltip ===== */
.fluency-word-tooltip {
    position: fixed;
    z-index: 10001;
    min-width: 250px;
    max-width: 350px;
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid rgba(74, 144, 226, 0.6);
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5),
                0 0 20px rgba(74, 144, 226, 0.3);
    backdrop-filter: blur(10px);
    animation: tooltip-appear 0.3s ease-out;
}

@keyframes tooltip-appear {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.fluency-tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(74, 144, 226, 0.2);
    border-bottom: 1px solid rgba(74, 144, 226, 0.3);
    border-radius: 10px 10px 0 0;
}

.fluency-tooltip-header strong {
    font-size: 1.1rem;
    color: #4a90e2;
    font-weight: 700;
    text-transform: capitalize;
}

.fluency-tooltip-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.fluency-tooltip-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.fluency-tooltip-body {
    padding: 16px;
}

.fluency-tooltip-loading {
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
    padding: 10px 0;
}

.fluency-tooltip-part-of-speech {
    font-size: 0.85rem;
    color: #4a90e2;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.fluency-tooltip-definition {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.95);
    line-height: 1.6;
    margin-bottom: 12px;
}

.fluency-tooltip-example {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
    padding-left: 12px;
    border-left: 3px solid rgba(74, 144, 226, 0.5);
    margin-top: 8px;
}

.fluency-tooltip-error {
    color: rgba(255, 100, 100, 0.9);
    font-size: 0.9rem;
    text-align: center;
    padding: 10px 0;
}

/* ===== Recording Options Popover ===== */
.recording-options-popover {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10001;
    display: flex;
    justify-content: center;
    align-items: center;
}

.recording-options-popover.hidden {
    display: none;
}

.recording-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.recording-options-content {
    position: relative;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 20px;
    padding: 3rem;
    max-width: 500px;
    width: 90%;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.3),
        0 4px 16px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    z-index: 1;
    text-align: center;
    color: #ffffff;
}

.recording-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.3s ease;
}

.recording-close-btn:hover {
    color: #ffffff;
}

.recording-options-title {
    font-size: 2rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 0.5rem;
    text-align: center;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.recording-options-subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.8);
    margin: 0 0 2rem;
    text-align: center;
}

.recording-options-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.recording-option-btn {
    --inset: 40px;
    position: relative;
    isolation: isolate;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--shimmer-spring-duration) var(--shimmer-spring-easing);
    font-family: system-ui, -apple-system, sans-serif;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15),
                0 2px 4px rgba(0, 0, 0, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.recording-option-btn:hover {
    transition-duration: calc(var(--shimmer-spring-duration)*0.5);
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateX(4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2),
                0 4px 8px rgba(0, 0, 0, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.recording-option-btn svg {
    flex-shrink: 0;
}

/* ===== Recording Accordion Styles ===== */
.recording-accordion-item {
    width: 100%;
}

.recording-option-btn.accordion-trigger {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 1rem;
}

.accordion-chevron {
    margin-left: auto;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.recording-option-btn.accordion-trigger.expanded .accordion-chevron {
    transform: rotate(180deg);
}

.recording-accordion-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
    padding: 0 1rem;
}

.recording-accordion-panel.expanded {
    max-height: 300px;
    overflow-y: auto;
    padding: 1.5rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Custom scrollbar for accordion panels */
.recording-accordion-panel::-webkit-scrollbar {
    width: 8px;
}

.recording-accordion-panel::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.recording-accordion-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    transition: background 0.2s ease;
}

.recording-accordion-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ===== Compare Status Indicator ===== */
.compare-status {
    text-align: center;
    font-size: 0.95rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

/* ===== Compare Volume Controls (Compact Grid) ===== */
.volume-control-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.volume-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    margin-bottom: 0.25rem;
}

.dot-control-container {
    position: relative;
    width: 3.5em;
    height: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dot-control-container:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.25);
}

.dot-control-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Mobile Sliders (Hidden by Default) */
.volume-slider-controls {
    display: none;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
}

.volume-slider-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.volume-slider-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.volume-slider-label svg {
    color: rgba(255, 255, 255, 0.7);
}

.volume-slider-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.volume-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
    background: linear-gradient(135deg, #5ba3f5 0%, #4a90e2 100%);
    transform: scale(1.1);
}

.volume-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.volume-slider::-moz-range-thumb:hover {
    background: linear-gradient(135deg, #5ba3f5 0%, #4a90e2 100%);
    transform: scale(1.1);
}

.volume-value {
    min-width: 3rem;
    text-align: right;
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

/* Responsive: Show Mobile Sliders on Small Screens */
@media (max-width: 768px) {
    /* Hide desktop dot controls in compare grid */
    .compare-grid .volume-control-item {
        display: none;
    }

    /* Show mobile sliders */
    .volume-slider-controls {
        display: flex;
    }

    /* Adjust grid for mobile - single column layout */
    .audio-player-controls.compare-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }

    /* Reset grid positioning for mobile - auto flow */
    .compare-grid .volume-control-item:nth-child(1),
    .compare-grid .volume-control-item:nth-child(2),
    .compare-grid .play-pause-btn,
    .compare-grid #compareRewind,
    .compare-grid #compareForward,
    .compare-grid .compare-scrubber-row {
        grid-column: auto;
        grid-row: auto;
    }

    /* Stack playback buttons vertically on mobile */
    .audio-player-controls.playback-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }

    .playback-scrubber-row {
        grid-column: auto;
    }
}

/* ===== Audio Player Controls ===== */
.audio-player-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    background: linear-gradient(135deg, rgba(30, 30, 50, 0.6) 0%, rgba(20, 20, 35, 0.8) 100%);
    padding: 1.5rem;
    border-radius: 16px;
    flex-wrap: wrap;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4),
                inset 0 2px 0 rgba(255, 255, 255, 0.15);
}

/* Compact Grid Layout for Compare Mode */
.audio-player-controls.compare-grid {
    display: grid;
    grid-template-columns: auto auto auto;
    grid-template-rows: auto auto auto auto;
    gap: 0.5rem;
    align-items: stretch;
    padding: 1rem 1.5rem;
}

/* Volume controls span 3 rows */
.compare-grid .volume-control-item:nth-child(1) {
    grid-column: 1;
    grid-row: 1 / 4;
}

.compare-grid .volume-control-item:nth-child(2) {
    grid-column: 2;
    grid-row: 1 / 4;
}

/* Slim Control Buttons */
.compare-control-btn {
    padding: 0.5rem 0.8rem;
    font-size: 0.85rem;
    min-height: auto;
    height: auto;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

/* Play/Pause: Row 1, Column 3 - slim styling */
.compare-grid .play-pause-btn {
    grid-column: 3;
    grid-row: 1;
    padding: 0.5rem 0.8rem;
    min-width: auto;
    min-height: auto;
    background: rgba(76, 175, 80, 0.2);
    border-color: rgba(76, 175, 80, 0.4);
}

/* Rewind: Row 2, Column 3 */
.compare-grid #compareRewind {
    grid-column: 3;
    grid-row: 2;
}

/* Forward: Row 3, Column 3 */
.compare-grid #compareForward {
    grid-column: 3;
    grid-row: 3;
}

/* Scrubber: Row 4, spans all 3 columns */
.compare-scrubber-row {
    grid-column: 1 / -1;
    grid-row: 4;
    margin-top: 0.5rem;
}

/* ===== Playback Grid Layout (3 Columns) ===== */
.audio-player-controls.playback-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 0.5rem;
    align-items: stretch;
    padding: 1rem 1.5rem;
}

/* Slim buttons for playback panel */
.playback-control-btn {
    padding: 0.5rem 0.8rem;
    font-size: 0.85rem;
    min-height: auto;
    height: auto;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

/* Make Play/Pause button slim to match others */
.playback-grid .play-pause-btn {
    padding: 0.5rem 0.8rem;
    min-width: auto;
    min-height: auto;
    background: rgba(76, 175, 80, 0.2);
    border-color: rgba(76, 175, 80, 0.4);
}

/* Scrubber spans full width (all 3 columns) */
.playback-scrubber-row {
    grid-column: 1 / -1;
    margin-top: 0.5rem;
}

.audio-control-btn {
    --inset: 40px;
    position: relative;
    isolation: isolate;
    padding: 0.75rem 1.5rem;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    border-radius: 0.66em;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    font-family: system-ui, -apple-system, sans-serif;
    color: var(--text-color);
    opacity: 0.9;
    transition: all var(--shimmer-spring-duration) var(--shimmer-spring-easing);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15),
                0 2px 4px rgba(0, 0, 0, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.audio-control-btn svg {
    flex-shrink: 0;
    stroke: var(--text-color);
    transition: stroke 0.3s ease;
}

.audio-control-btn:hover {
    transition-duration: calc(var(--shimmer-spring-duration)*0.5);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2),
                0 4px 8px rgba(0, 0, 0, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.play-pause-btn {
    padding: 0.85rem;
    border-radius: 8px;
    min-width: 52px;
    min-height: 52px;
    background: rgba(76, 175, 80, 0.2);
    border-color: rgba(76, 175, 80, 0.4);
}

.play-pause-btn:hover {
    background: rgba(76, 175, 80, 0.3);
    box-shadow: 0 8px 20px rgba(76, 175, 80, 0.3),
                0 4px 8px rgba(0, 0, 0, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

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

/* Add shimmer effect to audio control buttons on hover */
.audio-control-btn:hover .shimmer-shimmer::before,
.audio-control-btn:hover .shimmer-shimmer::after {
    opacity: 1;
    animation: shimmer-shine 1.2s ease-in 1 forwards;
}

.audio-scrubber-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 200px;
}

.audio-scrubber {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.audio-scrubber::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #66BB6A;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.audio-scrubber::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 3px 10px rgba(102, 187, 106, 0.5);
}

.audio-scrubber::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #66BB6A;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.audio-scrubber::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 3px 10px rgba(102, 187, 106, 0.5);
}

.audio-time-display {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
    font-family: 'Courier New', monospace;
    min-width: 40px;
    text-align: center;
    flex-shrink: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .recording-options-content {
        padding: 2rem;
    }

    .recording-options-title {
        font-size: 1.5rem;
    }

    .recording-options-subtitle {
        font-size: 1rem;
    }

    .recording-option-btn {
        font-size: 1rem;
        padding: 1rem;
    }

    .audio-player-controls {
        gap: 0.5rem;
        padding: 0.75rem;
    }

    .audio-control-btn {
        padding: 0.5rem 0.7rem;
        font-size: 0.8rem;
    }

    .play-pause-btn {
        min-width: 40px;
        min-height: 40px;
        padding: 0.6rem;
    }

    .audio-scrubber-container {
        min-width: 150px;
        gap: 0.4rem;
    }

    .audio-time-display {
        font-size: 0.75rem;
        min-width: 35px;
    }

    .recording-accordion-panel.expanded {
        max-height: 250px;
    }
}

/* ===== Custom Confirmation Modal ===== */
.confirmation-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.confirmation-modal:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

.confirmation-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.confirmation-content {
    position: relative;
    z-index: 1;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 20px;
    padding: 2rem;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3),
                0 4px 16px rgba(0, 0, 0, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    text-align: center;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-20px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.confirmation-icon {
    margin: 0 auto 1.5rem;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 193, 7, 0.2);
    border: 2px solid rgba(255, 193, 7, 0.4);
    border-radius: 50%;
}

.confirmation-icon svg {
    stroke: #ffc107;
}

.confirmation-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 1rem;
}

.confirmation-message {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.5;
    margin-bottom: 2rem;
}

.confirmation-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.confirmation-btn {
    --inset: 40px;
    position: relative;
    isolation: isolate;
    padding: 0.75rem 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    border-radius: 0.66em;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    font-family: system-ui, -apple-system, sans-serif;
    color: rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
}

.confirmation-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Cancel Button (Keep Recording) - Green */
.confirmation-cancel {
    background: rgba(76, 175, 80, 0.2);
    border-color: rgba(76, 175, 80, 0.4);
}

.confirmation-cancel:hover {
    background: rgba(76, 175, 80, 0.3);
}

/* Confirm Button (Close Without Saving) - Red/Warning */
.confirmation-confirm {
    background: rgba(244, 67, 54, 0.2);
    border-color: rgba(244, 67, 54, 0.4);
}

.confirmation-confirm:hover {
    background: rgba(244, 67, 54, 0.3);
}

/* Shimmer Effect on Modal Buttons */
.confirmation-btn:hover .shimmer-shimmer::before,
.confirmation-btn:hover .shimmer-shimmer::after {
    opacity: 1;
    animation: shimmer-shine 1.2s ease-in 1 forwards;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .confirmation-content {
        padding: 1.5rem;
    }

    .confirmation-buttons {
        flex-direction: column;
    }

    .confirmation-btn {
        width: 100%;
    }
}
