/* ReAct Eye-tracking Application Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #1a1a1a;
    color: white;
    overflow: hidden;
    height: 100vh;
}

/* Global button and select font styling */
button, select {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Gaze point styling */
.gazePoint {
    position: fixed;
    width: 200px;
    height: 200px;
    border: 0;
    border-radius: 50%;
    pointer-events: none;
    z-index: 10000;
    transition: 0.2s ease-out;
    will-change: left, top, transform;
    box-shadow: 0 0 50px rgba(18, 69, 89, 0.5);
    display: none; /* Hidden by default until after calibration */
}

/* Eye Keyboard Application */
/* Eye Keyboard styles */
#eyeKeyboard {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1a1a1a;
    z-index: 100;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.app-header {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1001;
}

.app-title {
    color: white;
    font-size: 18px;
    font-weight: 500;
    margin: 0;
    transition: opacity 0.4s ease;
}

.app-title.fade-out {
    opacity: 0;
}

.app-title.fade-in {
    animation: titleFadeIn 0.4s ease-out;
}

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

.text-field {
    margin-top: 40px;
    margin-bottom: 30px;
    width: 100%;
    display: flex;
    justify-content: center;
}

.text-field input {
    width: 100%;
    height: 80px;
    font-size: 32px;
    font-weight: 600;
    padding: 0 30px;
    background: #1a1a1a;
    border: 2px solid #4a4a4a;
    border-radius: 8px;
    color: #ffffff;
    text-align: center;
}

.text-field input:focus {
    outline: none;
    border-color: #124559;
}

.keyboard-content {
    width: 100%;
    height: 81%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.keyboard-grid {
    width: 100%;
    height: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 0px;
}

.key-button {
    background: #2a2a2a;
    border: 2px solid #4a4a4a;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: bold;
    color: #ffffff;
    text-align: center;
    line-height: 1.2;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    flex: 1 1 calc(50% - 2px);
    min-height: calc(33.33% - 3px);
}

/* Text wrapper for proper z-index layering above circle loaders */
.key-button .text-wrapper,
.sub-key-button .text-wrapper,
.back-button .text-wrapper {
    position: relative;
    z-index: 20;
    pointer-events: none;
}

/* Special z-index for speaker/pause button content */
#speakerPauseButton > *:not(.progress-bar):not(.progress-circle) {
    position: relative;
    z-index: 20;
}

.key-button.selecting {
    border-color: #124559;
    box-shadow: 0 0 20px rgba(18, 69, 89, 0.5);
}

/* Gaze selection progress bar - slider style */
.key-button .progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, rgba(18, 69, 89, 0.5), rgba(18, 69, 89, 0.8));
    transition: width 0.1s linear;
    border-radius: 12px;
}

/* Inactive progress bars with reduced opacity */
.key-button .progress-bar:not(.active) {
    background: linear-gradient(90deg, rgba(18, 69, 89, 0.2), rgba(18, 69, 89, 0.3));
}

/* Circular progress loader */
.key-button .progress-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 150px;
    height: 150px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    display: block;
    opacity: 0;
    transition: opacity 0.2s ease;
    --progress-angle: 0deg;
    background: conic-gradient(
        from 0deg,
        rgba(18, 69, 89, 0.9) 0deg,
        rgba(18, 69, 89, 0.9) var(--progress-angle),
        rgba(18, 69, 89, 0.1) var(--progress-angle),
        rgba(18, 69, 89, 0.1) 360deg
    );
    z-index: 1; /* Behind text */
}

.key-button .progress-circle.active {
    display: block !important;
    opacity: 1 !important;
}

/* Hide slider when circle mode is active */
body[data-loader-type="circle"] .progress-bar {
    display: none !important;
}

/* Show circle when circle mode is active for all button types */
body[data-loader-type="circle"] .progress-circle {
    display: block !important;
    opacity: 0.1 !important; /* Show with very low opacity by default */
}

/* Specific rules for each button type in circle mode */
body[data-loader-type="circle"] .key-button .progress-circle {
    display: block !important;
    opacity: 0.1 !important;
}

body[data-loader-type="circle"] .sub-key-button .progress-circle {
    display: block !important;
    opacity: 0.1 !important;
}

body[data-loader-type="circle"] .back-button .progress-circle {
    display: block !important;
    opacity: 0.1 !important;
}

body[data-loader-type="circle"] .tts-button .progress-circle {
    display: block !important;
    opacity: 0.1 !important;
}

/* Ensure active circles are visible in circle mode */
body[data-loader-type="circle"] .progress-circle.active {
    display: block !important;
    opacity: 1 !important; /* Full opacity when active */
}

/* Specific active rules for each button type */
body[data-loader-type="circle"] .key-button .progress-circle.active {
    display: block !important;
    opacity: 1 !important;
}

body[data-loader-type="circle"] .sub-key-button .progress-circle.active {
    display: block !important;
    opacity: 1 !important;
}

body[data-loader-type="circle"] .back-button .progress-circle.active {
    display: block !important;
    opacity: 1 !important;
}

body[data-loader-type="circle"] .tts-button .progress-circle.active {
    display: block !important;
    opacity: 1 !important;
}

/* Calibration points */
.anyCalibrationPoint {
    position: fixed;
    width: 40px;
    height: 40px;
    background: #00ff88;
    border: 3px solid #ffffff;
    border-radius: 50%;
    cursor: pointer;
    z-index: 500;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.8);
    animation: calibrationPulse 2s infinite ease-in-out;
    transform: translate(-50%, -50%);
}

/* Automatic calibration dot */
.auto-calibration-dot {
    position: fixed;
    width: 50px;
    height: 50px;
    background: #ff4444; /* Start with red color */
    border: none; /* Remove border */
    border-radius: 50%;
    z-index: 600;
    box-shadow: 0 0 30px rgba(255, 68, 68, 0.8);
    transform: translate(-50%, -50%);
    transition: all 0.75s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Growth animation when at corner with "puffing" effect */
.auto-calibration-dot.at-corner {
    animation: puffAtCorner 1.2s ease-out forwards;
}

/* Shrink animation before moving */
.auto-calibration-dot.shrinking {
    animation: shrinkBeforeMove 0.3s ease-in forwards;
}

@keyframes puffAtCorner {
    0% { 
        transform: translate(-50%, -50%) scale(1); 
        background: #ff4444;
        box-shadow: 0 0 30px rgba(255, 68, 68, 0.8);
    }
    100% { 
        transform: translate(-50%, -50%) scale(2); 
        background: #00ff88;
        box-shadow: 0 0 50px rgba(0, 255, 136, 1);
    }
}

@keyframes shrinkBeforeMove {
    0% { 
        transform: translate(-50%, -50%) scale(2); 
        background: #00ff88;
        box-shadow: 0 0 50px rgba(0, 255, 136, 1);
    }
    100% { 
        transform: translate(-50%, -50%) scale(1); 
        background: #ff4444;
        box-shadow: 0 0 30px rgba(255, 68, 68, 0.8);
    }
}

/* Light theme adjustment for auto calibration dot */
body.light-theme .auto-calibration-dot {
    background: #cc3333;
    box-shadow: 0 0 30px rgba(204, 51, 51, 0.8);
}

body.light-theme .auto-calibration-dot.at-corner {
    animation: puffAtCornerLight 1.2s ease-out forwards;
}

body.light-theme .auto-calibration-dot.shrinking {
    animation: shrinkBeforeMoveLight 0.3s ease-in forwards;
}

@keyframes puffAtCornerLight {
    0% { 
        transform: translate(-50%, -50%) scale(1); 
        background: #cc3333;
        box-shadow: 0 0 30px rgba(204, 51, 51, 0.8);
    }
    100% { 
        transform: translate(-50%, -50%) scale(2); 
        background: #00aa44;
        box-shadow: 0 0 50px rgba(0, 170, 68, 1);
    }
}

@keyframes shrinkBeforeMoveLight {
    0% { 
        transform: translate(-50%, -50%) scale(2); 
        background: #00aa44;
        box-shadow: 0 0 50px rgba(0, 170, 68, 1);
    }
    100% { 
        transform: translate(-50%, -50%) scale(1); 
        background: #cc3333;
        box-shadow: 0 0 30px rgba(204, 51, 51, 0.8);
    }
}

@keyframes calibrationPulse {
    0% { 
        transform: translate(-50%, -50%) scale(1); 
        opacity: 1;
        box-shadow: 0 0 20px rgba(0, 255, 136, 0.8);
    }
    50% { 
        transform: translate(-50%, -50%) scale(1.15); 
        opacity: 0.9;
        box-shadow: 0 0 30px rgba(0, 255, 136, 1);
    }
    100% { 
        transform: translate(-50%, -50%) scale(1); 
        opacity: 1;
        box-shadow: 0 0 20px rgba(0, 255, 136, 0.8);
    }
}

/* Board styles */
.finalBoard {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 26, 0.95);
    z-index: 1000;
    display: none;
}

.bodyCenter {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.instructionBoard {
    background: rgba(26, 26, 26, 0.95);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: none;
    animation: boardFadeIn 0.4s ease-out;
    padding: 15px;
}

.instructionBoard.fade-out {
    animation: boardFadeOut 0.4s ease-in;
}

.instructionBoard.calibration-start {
    animation: calibrationBoardFadeOut 0.5s ease-in;
}

@keyframes boardFadeIn {
    from {
        opacity: 0;
        transform: scale(1.02);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes boardFadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.98);
    }
}

@keyframes calibrationBoardFadeOut {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.95);
    }
}

.title {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 20px;
    color: #ffffff;
}

.subtitle {
    font-size: 20px;
    font-weight: 400;
    margin-bottom: 30px;
    color: #ecf0f1;
    max-width: 600px;
}

.loading-status {
    font-size: 26px;
    font-weight: 400;
    margin-bottom: 15px;
    color: #ecf0f1;
    max-width: 600px;
}

.privacy-note {
    font-size: 16px;
    font-weight: 400;
    margin-bottom: 10px;
    color: inherit;
    max-width: 600px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.instructions {
    font-size: 16px;
    color: #bdc3c7;
    margin-bottom: 20px;
}

.finalBoardButton {
    background: #2a2a2a;
    border: 2px solid #4a4a4a;
    color: white;
    padding: 20px 60px;
    border-radius: 12px;
    font-size: 24px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
    margin-top: 30px;
    position: relative;
    overflow: hidden;
}

/* Auto-calibration progress bar for Start Calibration button */
.finalBoardButton .auto-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, rgba(18, 69, 89, 0.3), rgba(18, 69, 89, 0.6));
    transition: width 0.1s linear;
    border-radius: 10px;
    z-index: 1;
}

.finalBoardButton span {
    position: relative;
    z-index: 2;
}

.finalBoardButton:hover {
    border-color: #124559;
    background: #3a3a3a;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(18, 69, 89, 0.3);
}

.finalBoardButton:active {
    animation: buttonPress 0.2s ease-out;
}

.finalBoardButton:disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    background: #1a1a1a !important;
    border-color: #2a2a2a !important;
    transform: none !important;
    box-shadow: none !important;
}

body.light-theme .finalBoardButton:disabled {
    background: #f5f5f5 !important;
    border-color: #e0e0e0 !important;
    color: #999 !important;
}

@keyframes buttonPress {
    0% {
        transform: translateY(-2px) scale(1);
    }
    50% {
        transform: translateY(0) scale(0.98);
    }
    100% {
        transform: translateY(-2px) scale(1);
    }
}

/* Calibration start button fade animation */
.calibration-start-fade {
    animation: calibrationStartFade 0.6s ease-out;
}

@keyframes calibrationStartFade {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.3;
        transform: scale(0.95);
    }
    100% {
        opacity: 0;
        transform: scale(0.9);
    }
}

/* Calibration Face Preview */
.calibration-face-preview {
    position: relative;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 6px solid #666;
    overflow: hidden;
    margin: 0 0 20px;
    transition: border-color 0.3s ease;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calibration-face-preview.face-detected {
    border-color: #4CAF50;
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.3);
}

.calibration-face-preview.face-detected-not-centered {
    border-color: #FF9800;
    box-shadow: 0 0 20px rgba(255, 152, 0, 0.3);
}

.calibration-face-preview.no-face {
    border-color: #f44336;
    box-shadow: 0 0 20px rgba(244, 67, 54, 0.3);
}

#calibrationFaceCanvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.face-status-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #666;
    opacity: 0.7;
    pointer-events: none;
    transition: opacity 0.3s ease;
    display: none;
}

.calibration-face-preview.face-detected .face-status-indicator {
    opacity: 0;
}

.face-icon {
    width: 40px;
    height: 40px;
}

/* Light theme adjustments */
body.light-theme .calibration-face-preview {
    border-color: #999;
    background: #f0f0f0;
}

body.light-theme .calibration-face-preview.face-detected {
    border-color: #4CAF50;
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.3);
}

body.light-theme .calibration-face-preview.face-detected-not-centered {
    border-color: #FF9800;
    box-shadow: 0 0 20px rgba(255, 152, 0, 0.3);
}

body.light-theme .calibration-face-preview.no-face {
    border-color: #f44336;
    box-shadow: 0 0 20px rgba(244, 67, 54, 0.3);
}

body.light-theme .face-status-indicator {
    color: #666;
}

/* Loader - Enhanced animated version (KEEP THIS!) */
.loader-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 26, 0.95);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.6s ease-out;
    animation: loaderFadeIn 0.4s ease-out;
}

.loader-container.fade-out {
    opacity: 0;
    pointer-events: none;
    animation: loaderFadeOut 0.4s ease-in;
}

@keyframes loaderFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(2px);
    }
}

@keyframes loaderFadeOut {
    from {
        opacity: 1;
        backdrop-filter: blur(2px);
    }
    to {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
}

.loader {
    border: 4px solid rgba(18, 69, 89, 0.2);
    border-top: 4px solid #124559;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: loaderSpin 1s linear infinite;
    margin: 20px auto;
    position: relative;
}

.loader::before {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    border: 2px solid rgba(89, 131, 146, 0.1);
    border-top: 2px solid rgba(89, 131, 146, 0.5);
    border-radius: 50%;
    animation: loaderSpin 2s linear infinite reverse;
}

.loader::after {
    content: '';
    position: absolute;
    top: 6px;
    left: 6px;
    right: 6px;
    bottom: 6px;
    border: 2px solid rgba(174, 195, 176, 0.2);
    border-top: 2px solid rgba(174, 195, 176, 0.8);
    border-radius: 50%;
    animation: loaderSpin 0.5s linear infinite;
}

@keyframes loaderSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Hidden elements */
.invisible {
    position: absolute;
    top: -9999px;
    left: -9999px;
    opacity: 0;
    pointer-events: none;
}

/* Info banner */
.infoBanner {
    background: #e74c3c;
    color: white;
    padding: 30px;
    border-radius: 10px;
    font-size: 18px;
    max-width: 500px;
    text-align: center;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
}

/* Calibration status */
#calibrationStatus {
    font-size: 14px;
    max-width: 300px;
}

/* Sub-keyboard styles - identical to main keyboard */
.sub-keyboard-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1a1a1a;
    z-index: 1000;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.sub-keyboard-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.sub-keys {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
    gap: 4px;
    padding: 0px;
}

.sub-key-button {
    background: #2a2a2a;
    border: 2px solid #4a4a4a;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: bold;
    color: #ffffff;
    text-align: center;
    line-height: 1.2;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* Ensure text content is above progress loaders in sub-keys */
.sub-key-button > *:not(.progress-bar):not(.progress-circle) {
    position: relative;
    z-index: 10;
}

.sub-key-button.selecting {
    border-color: #124559;
    box-shadow: 0 0 20px rgba(18, 69, 89, 0.5);
}

.sub-key-button .progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, rgba(18, 69, 89, 0.5), rgba(18, 69, 89, 0.8));
    transition: width 0.1s linear;
    border-radius: 12px;
}

/* Inactive progress bars with reduced opacity */
.sub-key-button .progress-bar:not(.active) {
    background: linear-gradient(90deg, rgba(18, 69, 89, 0.2), rgba(18, 69, 89, 0.3));
}

/* Circular progress loader for sub-keys */
.sub-key-button .progress-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100px;
    height: 100px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    display: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    --progress-angle: 0deg;
    background: conic-gradient(
        from 0deg,
        rgba(18, 69, 89, 0.9) 0deg,
        rgba(18, 69, 89, 0.9) var(--progress-angle),
        rgba(18, 69, 89, 0.1) var(--progress-angle),
        rgba(18, 69, 89, 0.1) 360deg
    );
    z-index: 1; /* Behind text */
}

.sub-key-button .progress-circle.active {
    display: block !important;
    opacity: 1 !important;
}

.back-button {
    background: #3a3a3a;
    border: 2px solid #5a5a5a;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    color: #ffffff;
    text-align: center;
    line-height: 1.2;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    grid-column: 1 / -1;
}

.back-button.selecting {
    border-color: #124559;
    box-shadow: 0 0 20px rgba(18, 69, 89, 0.5);
}

.back-button .progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, rgba(18, 69, 89, 0.5), rgba(18, 69, 89, 0.8));
    transition: width 0.1s linear;
    border-radius: 12px;
}

/* Inactive progress bars with reduced opacity */
.back-button .progress-bar:not(.active) {
    background: linear-gradient(90deg, rgba(18, 69, 89, 0.2), rgba(18, 69, 89, 0.3));
}

/* Circular progress loader for back button */
.back-button .progress-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100px;
    height: 100px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    display: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    --progress-angle: 0deg;
    background: conic-gradient(
        from 0deg,
        rgba(18, 69, 89, 0.9) 0deg,
        rgba(18, 69, 89, 0.9) var(--progress-angle),
        rgba(18, 69, 89, 0.1) var(--progress-angle),
        rgba(18, 69, 89, 0.1) 360deg
    );
    z-index: 1; /* Behind text */
}

.back-button .progress-circle.active {
    display: block !important;
    opacity: 1 !important;
}

/* Light theme styles */
body.light-theme {
    background: #f5f5f5;
    color: #333;
}

body.light-theme #eyeKeyboard {
    background: #f5f5f5;
}

body.light-theme .sub-keyboard-grid {
    background: #f5f5f5;
}

body.light-theme .app-title {
    color: #333;
}

body.light-theme .text-field {
    margin-top: 40px;
}

body.light-theme .text-field input {
    background: #ffffff;
    border-color: #d0d0d0;
    color: #333;
}

body.light-theme .text-field input:focus {
    border-color: #124559;
}

body.light-theme .anyCalibrationPoint {
    background: #00aa44;
    box-shadow: 0 0 20px rgba(0, 170, 68, 0.8);
    animation: calibrationPulseLightTheme 2s infinite ease-in-out;
}

@keyframes calibrationPulseLightTheme {
    0% { 
        transform: translate(-50%, -50%) scale(1); 
        opacity: 1;
        box-shadow: 0 0 20px rgba(0, 170, 68, 0.8);
    }
    50% { 
        transform: translate(-50%, -50%) scale(1.15); 
        opacity: 0.9;
        box-shadow: 0 0 30px rgba(0, 170, 68, 1);
    }
    100% { 
        transform: translate(-50%, -50%) scale(1); 
        opacity: 1;
        box-shadow: 0 0 20px rgba(0, 170, 68, 0.8);
    }
}

body.light-theme .key-button,
body.light-theme .sub-key-button {
    background: #ffffff;
    border-color: #d0d0d0;
    color: #333;
}

body.light-theme .key-button.selecting,
body.light-theme .sub-key-button.selecting {
    border-color: #124559;
    box-shadow: 0 0 20px rgba(18, 69, 89, 0.3);
}

body.light-theme .back-button {
    background: #e0e0e0;
    border-color: #c0c0c0;
    color: #333;
}

body.light-theme .back-button.selecting {
    border-color: #124559;
    box-shadow: 0 0 20px rgba(18, 69, 89, 0.3);
}

/* Light theme circle loaders - much lighter for visibility with dark text */
body.light-theme .key-button .progress-circle,
body.light-theme .sub-key-button .progress-circle,
body.light-theme .back-button .progress-circle,
body.light-theme .tts-button .progress-circle {
    background: conic-gradient(
        from 0deg,
        rgba(18, 69, 89, 0.35) 0deg,
        rgba(18, 69, 89, 0.35) var(--progress-angle),
        rgba(18, 69, 89, 0.05) var(--progress-angle),
        rgba(18, 69, 89, 0.05) 360deg
    ) !important;
}

body.light-theme label {
    color: #666 !important;
}

body.light-theme .instructionBoard {
    background: rgba(245, 245, 245, 0.95);
    animation: boardFadeIn 0.4s ease-out;
}

body.light-theme .instructionBoard.fade-out {
    animation: boardFadeOut 0.4s ease-in;
}

body.light-theme .instructionBoard.calibration-start {
    animation: calibrationBoardFadeOut 0.5s ease-in;
}

body.light-theme .finalBoardButton {
    background: #ffffff;
    border-color: #d0d0d0;
    color: #333;
}

body.light-theme .finalBoardButton:hover {
    border-color: #124559;
    background: #f0f0f0;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(18, 69, 89, 0.2);
}

body.light-theme .finalBoardButton .auto-progress-bar {
    background: linear-gradient(90deg, rgba(18, 69, 89, 0.2), rgba(18, 69, 89, 0.4));
    border-radius: 10px;
}

body.light-theme .device-warning .warning-title {
    color: #333;
}

body.light-theme .device-warning .warning-subtitle {
    color: #333;
}

/* Light theme Safari warning */
body.light-theme .safari-warning .warning-title {
    color: #ffffff !important;
}

body.light-theme .safari-warning .warning-subtitle {
    color: #ffcccc !important;
}

body.light-theme #safariWarning.safari-warning {
    background: rgba(220, 20, 20, 0.95) !important;
    border: 2px solid #dc1414 !important;
}

body.light-theme .safari-back-button {
    background: #ffffff;
    color: #dc1414;
    border: 2px solid #ffffff;
}

body.light-theme .safari-back-button:hover {
    background: #f8f8f8;
}

/* TTS Overlay */
.tts-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.tts-content {
    text-align: center;
    color: white;
    background: rgba(42, 42, 42, 0.9);
    padding: 40px;
    border-radius: 20px;
    border: 2px solid #124559;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    min-width: 300px;
}

.tts-content-large {
    width: 70vw;
    height: 70vh;
    max-width: 800px;
    max-height: 600px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.tts-controls {
    display: flex;
    gap: 40px;
    margin-top: 40px;
    justify-content: center;
    align-items: center;
}

.tts-button {
    position: relative;
    background: rgba(42, 42, 42, 0.9);
    border: 2px solid #124559;
    border-radius: 20px;
    padding: 30px 40px;
    color: white;
    font-size: 24px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    min-width: 25vw;
    min-height: 25vh;
    width: 30vw;
    height: 30vh;
    justify-content: center;
    overflow: hidden;
}

/* Ensure text content is above progress loaders in TTS buttons */
.tts-button > *:not(.progress-bar):not(.progress-circle) {
    position: relative;
    z-index: 10;
}

.tts-button:hover {
    background: rgba(60, 60, 60, 0.9);
    border-color: #598392;
    transform: translateY(-2px);
}

.tts-button svg {
    opacity: 0.9;
    position: relative;
    z-index: 2;
}

.tts-button span {
    font-family: inherit;
    position: relative;
    z-index: 2;
}

.tts-animation {
    margin-bottom: 0;
}

.equalizer {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 4px;
    height: 60px;
}

.bar {
    width: 8px;
    height: 20px;
    background: linear-gradient(180deg, #124559 0%, #598392 100%);
    border-radius: 4px;
    transition: height 0.1s ease;
}

/* Animacja ładowania */
.bar.loading {
    animation: loading-pulse 1.2s ease-in-out infinite;
}

@keyframes loading-pulse {
    0%, 100% { 
        height: 20px; 
        opacity: 0.6;
    }
    50% { 
        height: 40px; 
        opacity: 1;
    }
}

/* Animacja mówienia */
.bar.speaking {
    animation: none;
    transition: height 0.15s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Light theme adaptations for TTS */
body.light-theme .tts-button {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    color: #333;
    border: 2px solid #e0e0e0;
}

body.light-theme .tts-button.selecting {
    border-color: #124559;
    box-shadow: 0 0 20px rgba(18, 69, 89, 0.3);
}

body.light-theme .tts-overlay {
    background: rgba(0, 0, 0, 0.7);
}

body.light-theme .language-select {
    background: #ffffff;
    color: #333;
    border-color: #d0d0d0;
}

/* Camera Selection Overlay */
.camera-selection-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    z-index: 2000;
    display: none !important; /* Ensure it's hidden by default */
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease-out;
}

.camera-selection-overlay.show {
    display: flex !important; /* Override hidden state when shown */
    opacity: 1;
}

.camera-selection-popup {
    background: rgba(42, 42, 42, 0.95);
    border: 2px solid #124559;
    border-radius: 10px;
    padding: 30px;
    text-align: center;
    color: white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    max-width: 500px;
    width: 90%;
}

.camera-selection-popup h2 {
    font-size: 28px;
    font-weight: 500;
    margin-bottom: 30px;
    color: #ffffff;
}

.camera-preview-container {
    display: flex;
    justify-content: center;
}

#cameraPreviewVideo {
    width: 100% !important;
    height: auto !important;
    border-radius: 0 !important;
    background: #000;
    transform: scaleX(-1); /* Mirror the video horizontally */
}

.camera-selection-controls {
    margin: 0;
}

.camera-selection-label {
    display: block;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #ffffff;
}

.camera-selection-select {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    background: rgba(42, 42, 42, 0.9);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.camera-selection-select:hover {
    border-color: #598392;
    background: rgba(52, 52, 52, 0.9);
}

.camera-selection-select:focus {
    outline: none;
    border-color: #598392;
    box-shadow: 0 0 10px rgba(89, 131, 146, 0.3);
}

.camera-confirm-button {
    background: linear-gradient(135deg, #124559 0%, #598392 100%);
    color: white;
    border: none;
    border-radius: 5px;
    padding: 18px 40px;
    font-size: 18px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
    min-width: 140px;
}

.camera-confirm-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(18, 69, 89, 0.4);
}

.camera-confirm-button:active {
    transform: translateY(0);
}

/* Light theme adaptations for camera selection */
body.light-theme .camera-selection-popup {
    background: rgba(255, 255, 255, 0.95);
    border-color: #d0d0d0;
    color: #333;
}

body.light-theme .camera-selection-popup h2 {
    color: #333;
}

body.light-theme .camera-selection-label {
    color: #333;
}

body.light-theme .camera-selection-select {
    background: #ffffff;
    color: #333;
    border-color: #d0d0d0;
}

body.light-theme .camera-selection-select:hover {
    border-color: #124559;
    background: #f8f9fa;
}

body.light-theme .language-select:hover {
    border-color: #4f46e5;
}

body.light-theme #speedSelect,
body.light-theme #languageSelect {
    background: #ffffff;
    color: #333;
    border-color: #d0d0d0;
}

body.light-theme #speedSelect:hover,
body.light-theme #languageSelect:hover {
    border-color: #4f46e5;
}

body.light-theme .tts-content {
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    border-color: #124559;
}

/* Settings Toggle Button */
.settings-toggle-btn {
    background: #2a2a2a;
    border: 1px solid #4a4a4a;
    color: #bdc3c7;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 15px;
}

.settings-toggle-btn:hover {
    color: #ffffff;
    border-color: #124559;
    background: #3a3a3a;
}

/* Settings Popup */
.settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.settings-popup {
    background: #1f1f1f;
    border-radius: 12px;
    border: 1px solid #4a4a4a;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
    animation: popupFadeIn 0.3s ease-out;
    overflow-y: auto;
    margin: 20px;
}

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

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid #4a4a4a;
    background: #1f1f1f;
    border-radius: 12px 12px 0 0;
    flex-shrink: 0;
}

.settings-title {
    margin: 0;
    color: #ffffff;
    font-size: 18px;
    font-weight: 600;
}

.settings-close-btn {
    background: none;
    border: none;
    color: #bdc3c7;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.settings-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.settings-content {
    overflow-y: auto;
    padding: 20px;
    flex: 1;
    min-height: 0;
    background: #1f1f1f;
}

.settings-popup::-webkit-scrollbar {
    width: 8px;
}

.settings-popup::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.settings-popup::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.settings-popup::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.setting-item {
    color: #bdc3c7;
    font-size: 14px;
    margin-bottom: 0px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    text-align: left;
    padding: 4px;
}

.setting-item input[type="checkbox"] {
    margin-right: 8px;
    width: 16px;
    height: 16px;
    accent-color: #124559;
    cursor: pointer;
}

.setting-label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    width: 100%;
    color: #ecf0f1;
    font-size: 15px;
}

.setting-select {
    padding: 6px 8px;
    border-radius: 4px;
    border: 1px solid #4a4a4a;
    background: rgba(42, 42, 42, 0.8);
    color: #bdc3c7;
    font-size: 15px;
    width: 100%;
    margin-bottom: 4px;
    transition: border-color 0.2s ease;
    cursor: pointer;
}

.setting-select:hover {
    border-color: #124559;
}

.setting-select:focus {
    outline: none;
    border-color: #124559;
}

.setting-input {
    padding: 6px 8px;
    border-radius: 4px;
    border: 1px solid #4a4a4a;
    background: rgba(42, 42, 42, 0.8);
    color: #bdc3c7;
    font-size: 15px;
    width: 100%;
    margin-bottom: 4px;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.setting-input:hover {
    border-color: #124559;
}

.setting-input:focus {
    outline: none;
    border-color: #124559;
    background: rgba(42, 42, 42, 0.9);
}

.setting-input::placeholder {
    color: #7f8c8d;
    font-style: italic;
}

/* Light theme fixes for loader and settings */
body.light-theme .title {
    color: #333 !important;
}

body.light-theme .subtitle {
    color: #666 !important;
}

body.light-theme .loading-status {
    color: #000 !important;
}

body.light-theme .privacy-note {
    color: inherit !important;
}

body.light-theme .instructions {
    color: #777 !important;
}

body.light-theme .loader-container {
    background: rgba(245, 245, 245, 0.95);
}

body.light-theme .settings-toggle-btn {
    background: #ffffff;
    border-color: #d0d0d0;
    color: #666;
}

body.light-theme .settings-toggle-btn:hover {
    color: #333;
    border-color: #124559;
    background: #f8f9fa;
}

/* Light theme adjustments for settings popup */
body.light-theme .settings-popup {
    background: #ffffff;
    border-color: #dee2e6;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

body.light-theme .settings-header {
    border-bottom-color: #dee2e6;
    background: #ffffff;
}

body.light-theme .settings-title {
    color: #333333;
}

body.light-theme .settings-close-btn {
    color: #666666;
}

body.light-theme .settings-close-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #333333;
}

body.light-theme .settings-content {
    background: #ffffff;
}

body.light-theme .settings-popup::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

body.light-theme .settings-popup::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3);
}

body.light-theme .settings-popup::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.5);
}

body.light-theme .settings-footer {
    border-top-color: #dee2e6;
    background: #ffffff;
}

/* Settings footer */
.settings-footer {
    padding: 20px;
    border-top: 1px solid #333;
    background: #1f1f1f;
    border-radius: 0 0 12px 12px;
    flex-shrink: 0;
}

.settings-footer .finalBoardButton {
    width: 100%;
    margin-top: 0;
    padding: 15px 30px;
    font-size: 16px;
}

body.light-theme .setting-item {
    color: #666;
}

body.light-theme .setting-item input[type="checkbox"] {
    accent-color: #124559;
}

body.light-theme .setting-label {
    color: #495057;
}

body.light-theme .setting-select {
    background: rgba(255, 255, 255, 0.9);
    border-color: #d0d0d0;
    color: #333;
}

body.light-theme .setting-select:hover {
    border-color: #124559;
}

body.light-theme .setting-select:focus {
    border-color: #124559;
}

body.light-theme .setting-input {
    background: rgba(255, 255, 255, 0.9);
    border-color: #d0d0d0;
    color: #333;
}

body.light-theme .setting-input:hover {
    border-color: #124559;
}

body.light-theme .setting-input:focus {
    border-color: #124559;
    background: rgba(255, 255, 255, 1);
}

body.light-theme .setting-input::placeholder {
    color: #666;
}

/* App Logo Styles - based on landing page brand styles */
.app-brand, .instruction-brand, .welcome-brand {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 20px;
    justify-content: center;
}

/* Logo positioning for app screen - use app-header positioning */
.app-brand {
    position: relative;
    top: 0;
    left: 0;
    margin-bottom: 0;
    justify-content: flex-start;
    flex-wrap: nowrap;
    white-space: nowrap;
}

/* Logo positioning for instruction screens - top-left */
.instruction-brand {
    position: absolute;
    top: 20px;
    left: 20px;
    margin-bottom: 0;
    justify-content: flex-start;
}

/* Device compatibility warning */
.device-warning {
    background: #cabf000d;
    border: 1px solid#cabf00;
    border-radius: 8px;
    padding: 16px 20px;
    margin: 20px auto;
    max-width: 500px;
    width: 90%;
    color: #856404;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    position: relative;
    z-index: 10;
}

.device-warning .warning-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    color: #cabf00;
}

.device-warning .warning-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.device-warning .warning-title {
    font-size: 16px;
    font-weight: 700;
    color: #e2e2e2;
    margin-bottom: 2px;
}

.device-warning .warning-subtitle {
    font-size: 14px;
    font-weight: 500;
    color: #bdc3c7;
}

/* Device compatibility warnings styling */

/* Stan 1: Unsupported devices - popup overlay */
.unsupported-warning {
    background: rgba(255, 68, 68, 0.95) !important;
    border: 2px solid #ff4444 !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    padding: 24px;
    border-radius: 12px;
}

.unsupported-warning .warning-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
    text-align: center;
}

.unsupported-warning .warning-title {
    color: #ffffff !important;
    font-size: 20px;
    font-weight: 700;
}

.unsupported-warning .warning-subtitle {
    color: #ffcccc !important;
    font-size: 16px;
    line-height: 1.4;
}

.homepage-back-button {
    background: #ffffff;
    color: #ff4444;
    border: 2px solid #ffffff;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    margin-top: 8px;
}

.homepage-back-button:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Stan 2: Resolution warning - banner style (używa istniejący #deviceWarning) */
#deviceWarning.device-warning {
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid #ffc107;
    color: #856404;
}

/* Hide warning on smaller mobile devices */
@media (max-width: 480px) {
    .device-warning {
        font-size: 12px;
        padding: 12px 16px;
    }
    
    .device-warning .warning-title {
        font-size: 14px;
    }
    
    .device-warning .warning-subtitle {
        font-size: 12px;
    }
    
    .device-warning .warning-icon {
        width: 20px;
        height: 20px;
    }
}

/* Show warning prominently on large screens */
@media (min-width: 1900px) {
    .device-warning {
        background: #cabf000d;
        border: 1px solid#cabf00;
        padding: 18px 24px;
    }
    
    .device-warning .warning-title {
        font-size: 18px;
    }
    
    .device-warning .warning-subtitle {
        font-size: 15px;
    }
    
    .device-warning .warning-icon {
        width: 26px;
        height: 26px;
    }
}

.welcome-brand {
    position: absolute;
    top: 20px;
    left: 20px;
    margin-bottom: 0;
    justify-content: flex-start;
}

.app-product-logo, .instruction-product-logo, .welcome-product-logo {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 1.2rem;
    font-weight: 700;
    color: #124559;
}

/* White color for app screen on dark background */
.app-product-logo {
    color: white;
}

/* White/black color for instruction and welcome screen based on theme */
.instruction-product-logo {
    color: white;
}

.welcome-product-logo {
    color: white;
}

.app-audio-icon, .instruction-audio-icon, .welcome-audio-icon {
    color: #124559;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.app-audio-icon {
    color: white;
}

.instruction-audio-icon {
    color: white;
}

.welcome-audio-icon {
    color: white;
}

.app-powered-by, .instruction-powered-by, .welcome-powered-by {
    font-size: 0.9rem;
    font-weight: 400;
    color: #bdc3c7;
    margin: 0 4px;
}

.app-powered-by {
    color: white;
    white-space: nowrap;
}

.instruction-powered-by {
    color: white;
}

.welcome-powered-by {
    color: white;
}

.app-realeye-logo, .instruction-realeye-logo, .welcome-realeye-logo {
    height: 22px;
    width: auto;
    object-fit: contain;
}

/* Use inverted logo for app screen dark background */
.app-realeye-logo {
    content: url('/realeye-logotype-inverted-sm.png');
}

/* Use inverted logo for dark backgrounds */
.instruction-realeye-logo {
    content: url('/realeye-logotype-inverted-sm.png');
}

.welcome-realeye-logo {
    content: url('/realeye-logotype-inverted-sm.png');
}

/* Light theme adaptations for logos */
body.light-theme .app-powered-by,
body.light-theme .instruction-powered-by,
body.light-theme .welcome-powered-by {
    color: #666;
}

body.light-theme .app-powered-by {
    color: #333;
}

body.light-theme .app-product-logo {
    color: #333;
}

body.light-theme .app-audio-icon {
    color: #124559;
}

/* Use regular logo for light backgrounds */
body.light-theme .app-realeye-logo {
    content: url('/realeye-logotype-sm.png');
}

body.light-theme .instruction-powered-by {
    color: #333;
}

body.light-theme .welcome-powered-by {
    color: #333;
}

body.light-theme .instruction-product-logo {
    color: #333;
}

body.light-theme .welcome-product-logo {
    color: #333;
}

body.light-theme .instruction-audio-icon {
    color: #124559;
}

body.light-theme .welcome-audio-icon {
    color: #124559;
}

/* Use regular logo for light backgrounds */
body.light-theme .instruction-realeye-logo {
    content: url('/realeye-logotype-sm.png');
}

body.light-theme .welcome-realeye-logo {
    content: url('/realeye-logotype-sm.png');
}

/* Adjust app header positioning for the new logo structure */
.app-header {
    position: absolute;
    top: 20px;
    left: 20px;
    min-width: 300px;
    z-index: 1001;
}

/* Remove old app-title styles that are no longer needed */
.app-title {
    display: none;
}

/* Lucide icon placeholder (will be replaced by actual icons when Lucide loads) */
[data-lucide="audio-lines"]:before {
    content: "🔊";
    font-size: 16px;
}

/* TTS Button Progress Bar */
.tts-button .progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, rgba(18, 69, 89, 0.3), rgba(18, 69, 89, 0.5));
    transition: width 0.1s linear;
    border-radius: 20px;
    z-index: 1;
}

/* Inactive TTS progress bars with reduced opacity */
.tts-button .progress-bar:not(.active) {
    background: linear-gradient(90deg, rgba(18, 69, 89, 0.15), rgba(18, 69, 89, 0.25));
}

/* Circular progress loader for TTS buttons */
.tts-button .progress-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 130px;
    height: 130px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    display: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    --progress-angle: 0deg;
    background: conic-gradient(
        from 0deg,
        rgba(18, 69, 89, 0.9) 0deg,
        rgba(18, 69, 89, 0.9) var(--progress-angle),
        rgba(18, 69, 89, 0.1) var(--progress-angle),
        rgba(18, 69, 89, 0.1) 360deg
    );
    z-index: 1;
}

.tts-button .progress-circle.active {
    display: block !important;
    opacity: 1 !important;
}

.tts-button svg {
    position: relative;
    z-index: 2;
}

.tts-button span {
    position: relative;
    z-index: 2;
}

.tts-button.selecting {
    border-color: #124559;
    box-shadow: 0 0 20px rgba(18, 69, 89, 0.4);
}

/* Language Selector Styles */
.language-selector {
    position: relative;
    display: inline-block;
    font-family: 'Outfit', sans-serif;
}

.language-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    min-width: 120px;
}

.language-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.language-flag {
    font-size: 16px;
    line-height: 1;
}

.language-name {
    flex: 1;
    text-align: left;
}

.language-arrow {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.language-toggle:hover .language-arrow {
    transform: rotate(180deg);
}

.language-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    min-width: 140px;
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1003;
}

.language-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.language-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: white;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.language-option:last-child {
    border-bottom: none;
}

.language-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.language-option:first-child {
    border-top-left-radius: 7px;
    border-top-right-radius: 7px;
}

.language-option:last-child {
    border-bottom-left-radius: 7px;
    border-bottom-right-radius: 7px;
}

/* Light theme adjustments for language selector */
.light-theme .language-toggle {
    background: rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.2);
    color: #333;
}

.light-theme .language-toggle:hover {
    background: rgba(0, 0, 0, 0.15);
    border-color: rgba(0, 0, 0, 0.3);
}

.light-theme .language-dropdown {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.light-theme .language-option {
    color: #333;
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

.light-theme .language-option:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* Mobile styles */
@media (max-width: 768px) {
    /* Hide "powered by RealEye" text and logo on mobile devices */
    .app-powered-by,
    .instruction-powered-by,
    .welcome-powered-by,
    .app-realeye-logo,
    .instruction-realeye-logo,
    .welcome-realeye-logo {
        display: none;
    }
}
