/* Base Styles */
body, html {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: #2c2418;
    overflow-x: hidden;
}

body {
    background-color: #1a1310; /* Dark fallback */
    position: relative;
}

/* Full-screen Background */
#cafe-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    
    /* Solid color fallback for when images fail completely */
    background-color: #2c1810;
    
    /* Default to Spanish background - PNG fallback first */
    background-image: url('../img/bg-Spanish.png');
    
    /* Ensure these apply to whatever background-image is active */
    background-repeat: no-repeat;
    background-position: center center; /* Explicitly center horizontally and vertically */
    background-size: cover;             /* Scale to fill, maintain aspect ratio, crop if necessary */
    
    z-index: -1;
    transition: background-image 1.2s ease-in-out;
}

/* Foreground Layer */
#cafe-foreground {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Default to Spanish foreground - PNG fallback first */
    background-image: url('../img/bg-Spanish-front.png');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    z-index: 3; /* Higher than character (in #conversation-partner z-index 2), lower than UI popups */
    pointer-events: none; /* Allow clicks to pass through to elements behind it if needed */
    transition: background-image 1.2s ease-in-out;
}

/* Language-specific backgrounds - PNG fallbacks first */
#cafe-background.lang-english { background-image: url('../img/bg-English.png'); }
#cafe-background.lang-spanish { background-image: url('../img/bg-Spanish.png'); }
#cafe-background.lang-french { background-image: url('../img/bg-French.png'); }
#cafe-background.lang-german { background-image: url('../img/bg-German.png'); }
#cafe-background.lang-italian { background-image: url('../img/bg-Italian.png'); }
#cafe-background.lang-portuguese { background-image: url('../img/bg-Portuguese.png'); }
#cafe-background.lang-dutch { background-image: url('../img/bg-Dutch.png'); }
#cafe-background.lang-japanese { background-image: url('../img/bg-Japanese.png'); }
#cafe-background.lang-korean { background-image: url('../img/bg-Korean.png'); }
#cafe-background.lang-mandarinchinese { background-image: url('../img/bg-Mandarin Chinese.png'); }
#cafe-background.lang-russian { background-image: url('../img/bg-Russian.png'); }
#cafe-background.lang-arabic { background-image: url('../img/bg-Arabic.png'); }
#cafe-background.lang-hindi { background-image: url('../img/bg-Hindi.png'); }

/* Language-specific foregrounds - PNG fallbacks first */
#cafe-foreground.lang-english-front { background-image: url('../img/bg-English-front.png'); }
#cafe-foreground.lang-spanish-front { background-image: url('../img/bg-Spanish-front.png'); }
#cafe-foreground.lang-french-front { background-image: url('../img/bg-French-front.png'); }
#cafe-foreground.lang-german-front { background-image: url('../img/bg-German-front.png'); }
#cafe-foreground.lang-italian-front { background-image: url('../img/bg-Italian-front.png'); }
#cafe-foreground.lang-portuguese-front { background-image: url('../img/bg-Portuguese-front.png'); }
#cafe-foreground.lang-dutch-front { background-image: url('../img/bg-Dutch-front.png'); }
#cafe-foreground.lang-japanese-front { background-image: url('../img/bg-Japanese-front.png'); }
#cafe-foreground.lang-korean-front { background-image: url('../img/bg-Korean-front.png'); }
#cafe-foreground.lang-mandarinchinese-front { background-image: url('../img/bg-Mandarin Chinese-front.png'); }
#cafe-foreground.lang-russian-front { background-image: url('../img/bg-Russian-front.png'); }
#cafe-foreground.lang-arabic-front { background-image: url('../img/bg-Arabic-front.png'); }
#cafe-foreground.lang-hindi-front { background-image: url('../img/bg-Hindi-front.png'); }

/* WebP enhancement for supported browsers */
@supports (background-image: url('../img/bg-Spanish.webp')) {
    /* Default backgrounds upgrade to WebP */
    #cafe-background {
        background-image: url('../img/bg-Spanish.webp');
    }
    #cafe-foreground {
        background-image: url('../img/bg-Spanish-front.webp');
    }
    
    /* Language-specific backgrounds upgrade to WebP */
    #cafe-background.lang-english { background-image: url('../img/bg-English.webp'); }
    #cafe-background.lang-spanish { background-image: url('../img/bg-Spanish.webp'); }
    #cafe-background.lang-french { background-image: url('../img/bg-French.webp'); }
    #cafe-background.lang-german { background-image: url('../img/bg-German.webp'); }
    #cafe-background.lang-italian { background-image: url('../img/bg-Italian.webp'); }
    #cafe-background.lang-portuguese { background-image: url('../img/bg-Portuguese.webp'); }
    #cafe-background.lang-dutch { background-image: url('../img/bg-Dutch.webp'); }
    #cafe-background.lang-japanese { background-image: url('../img/bg-Japanese.webp'); }
    #cafe-background.lang-korean { background-image: url('../img/bg-Korean.webp'); }
    #cafe-background.lang-mandarinchinese { background-image: url('../img/bg-Mandarin Chinese.webp'); }
    #cafe-background.lang-russian { background-image: url('../img/bg-Russian.webp'); }
    #cafe-background.lang-arabic { background-image: url('../img/bg-Arabic.webp'); }
    #cafe-background.lang-hindi { background-image: url('../img/bg-Hindi.webp'); }
    
    /* Language-specific foregrounds upgrade to WebP */
    #cafe-foreground.lang-english-front { background-image: url('../img/bg-English-front.webp'); }
    #cafe-foreground.lang-spanish-front { background-image: url('../img/bg-Spanish-front.webp'); }
    #cafe-foreground.lang-french-front { background-image: url('../img/bg-French-front.webp'); }
    #cafe-foreground.lang-german-front { background-image: url('../img/bg-German-front.webp'); }
    #cafe-foreground.lang-italian-front { background-image: url('../img/bg-Italian-front.webp'); }
    #cafe-foreground.lang-portuguese-front { background-image: url('../img/bg-Portuguese-front.webp'); }
    #cafe-foreground.lang-dutch-front { background-image: url('../img/bg-Dutch-front.webp'); }
    #cafe-foreground.lang-japanese-front { background-image: url('../img/bg-Japanese-front.webp'); }
    #cafe-foreground.lang-korean-front { background-image: url('../img/bg-Korean-front.webp'); }
    #cafe-foreground.lang-mandarinchinese-front { background-image: url('../img/bg-Mandarin Chinese-front.webp'); }
    #cafe-foreground.lang-russian-front { background-image: url('../img/bg-Russian-front.webp'); }
    #cafe-foreground.lang-arabic-front { background-image: url('../img/bg-Arabic-front.webp'); }
    #cafe-foreground.lang-hindi-front { background-image: url('../img/bg-Hindi-front.webp'); }
}

/* Main Layout */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
    position: relative;
}

/* Corner Controls */
#corner-controls {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    z-index: 100;
}

#button-container {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

#corner-controls .icon-btn {
    margin-bottom: 0;
}

#status-indicators {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 0.85em;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    margin-top: 8px;
    background-color: rgba(0, 0, 0, 0.4);
    padding: 3px 8px;
    border-radius: 4px;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    max-width: 150px;
    text-align: right;
    opacity: 0.9;
    transition: opacity 0.2s ease;
}

#status-indicators:hover {
    opacity: 1;
}

.status-indicator {
    margin: 2px 0;
    display: block;
    font-size: 0.85em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Icon Button Styling */
.icon-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: rgba(43, 43, 43, 0.9); /* More opaque fallback for older browsers */
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    position: relative;
}

/* Fallback for browsers that don't support backdrop-filter */
@supports not (backdrop-filter: blur(5px)) {
    .icon-btn {
        background-color: rgba(43, 43, 43, 0.95);
    }
    
    #status-indicators {
        background-color: rgba(0, 0, 0, 0.8);
    }
    
    #settings-panel {
        background-color: rgba(20, 16, 13, 0.95);
    }
    
    #controls-section {
        background-color: rgba(20, 16, 13, 0.85);
    }
    
    .floating-message {
        background-color: rgba(230, 240, 233, 0.9) !important;
    }
    
    .floating-message.user-speaking {
        background-color: rgba(242, 232, 217, 0.9) !important;
    }
    
    .message {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
    
    .user-message {
        background-color: rgba(242, 232, 217, 0.9);
    }
    
    .ai-message {
        background-color: rgba(230, 240, 233, 0.9);
    }
}

.icon-btn:hover {
    background-color: rgba(72, 72, 72, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.icon-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.icon-btn i {
    font-size: 20px;
}

/* Button state styling */
.icon-btn .status-disconnected,
.icon-btn .status-connecting,
.icon-btn .status-connected,
.icon-btn .status-active {
    display: none;
}

.icon-btn.disconnected {
    background-color: rgba(231, 76, 60, 0.7); /* Red for disconnected */
    border-color: rgba(231, 76, 60, 0.3);
}

.icon-btn.disconnected:hover {
    background-color: rgba(231, 76, 60, 0.9);
}

.icon-btn.connected {
    background-color: rgba(241, 196, 15, 0.7); /* Yellow for connected */
    border-color: rgba(241, 196, 15, 0.3);
}

.icon-btn.connected:hover {
    background-color: rgba(241, 196, 15, 0.9);
}

.icon-btn.active {
    background-color: rgba(46, 204, 113, 0.7); /* Green for active recording */
    border-color: rgba(46, 204, 113, 0.3);
    animation: pulse 1.5s infinite;
}

.icon-btn.active:hover {
    background-color: rgba(46, 204, 113, 0.9);
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(46, 204, 113, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(46, 204, 113, 0);
    }
}

.icon-btn.disconnected .status-disconnected,
.icon-btn.connecting-phase .status-connecting,
.icon-btn.connected .status-connected,
.icon-btn.active .status-active {
    display: block;
}

#connection-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    position: absolute;
    top: 3px;
    right: 3px;
    background-color: #e74c3c;
    transition: background-color 0.3s ease;
}

#connection-indicator.connected {
    background-color: #f1c40f; /* Yellow when just connected */
}

#connection-indicator.active {
    background-color: #2ecc71; /* Green when actively recording */
}

/* Header */
header {
    text-align: center;
    margin-bottom: 20px;
    position: relative;
}

header h1 {
    margin-bottom: 0.25em;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    font-size: 2.5rem;
    letter-spacing: 1px;
}

header p {
    color: #f3e9d9;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
    margin-top: 0;
    font-size: 1.1rem;
}

/* Controls Wrapper */
.controls-wrapper {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 5;
}

/* Button Styles */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

#toggle-settings-btn:hover {
    background-color: rgba(127, 140, 141, 0.9);
}

.btn-primary {
    background-color: rgba(52, 152, 219, 0.7);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
    background-color: rgba(52, 152, 219, 0.9);
}

/* Settings Panel */
#settings-panel {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 320px;
    background-color: rgba(20, 16, 13, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.35s ease-in-out;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #f3e9d9;
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    transform: translateY(-10px);
}

#settings-panel.expanded {
    max-height: 500px;
    padding: 20px;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #f3e9d9;
}

.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    box-sizing: border-box;
    background-color: rgba(20, 16, 13, 0.5);
    color: #f3e9d9;
}

.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: rgba(52, 152, 219, 0.7);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.3);
}

/* Controls Section */
#controls-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
    background-color: rgba(20, 16, 13, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#status-indicators {
    margin-top: 10px;
}

#status-indicators .status-indicator {
    margin-right: 15px;
    font-style: italic;
    color: #f3e9d9;
}

.toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.toggles label {
    font-size: 0.9em;
    display: flex;
    align-items: center;
    cursor: pointer;
    color: #f3e9d9;
}

.toggles input[type="checkbox"] {
    margin-right: 8px;
}

/* Error Message */
.message-area {
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 4px;
    border: 1px solid transparent;
}

.error-message {
    background-color: rgba(248, 215, 218, 0.7);
    color: #721c24;
    border-color: rgba(245, 198, 203, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* Character Placeholder */
#conversation-partner {
    position: fixed;
    top: 34%;
    left: 42%;
    transform: translate(-50%, -50%);
    width: 350px;
    height: 660px;
    z-index: 2;
    margin-top: 5%;
}

#characterImage {
    /* width: 100%;  */
    height: 100%; /* Make image responsive within the container */
    object-fit: contain; /* Ensures the whole image is visible */
    transition: opacity 0.7s ease-in-out; /* CSS transition for fade effect */
}

#characterImage.fade-out {
    opacity: 0;
}

#characterImage.fade-in {
    opacity: 1;
}

.character-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    opacity: 0.7;
}

.character-head {
    width: 200px;
    height: 200px;
    background-color: rgba(208, 191, 169, 0.8);
    border-radius: 50%;
    position: relative;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    margin-bottom: -30px;
    z-index: 1;
}

.character-body {
    width: 320px;
    height: 400px;
    background-color: rgba(161, 143, 120, 0.8);
    border-radius: 60px 60px 0 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Conversation Container */
#conversation-container {
    flex: 1;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    position: relative;
    z-index: 3;
}

.conversation-log {
    min-height: 300px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 15px;
    border-radius: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) rgba(0, 0, 0, 0.1);
}

.conversation-log::-webkit-scrollbar {
    width: 6px;
}

.conversation-log::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.conversation-log::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

/* Message Styling */
.message {
    margin-bottom: 15px;
    padding: 12px;
    border-radius: 8px;
    position: relative;
    border: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.user-message {
    background-color: rgba(242, 232, 217, 0.7); /* Warm cream color */
    margin-left: 30px;
    margin-right: 60px;
}

.ai-message {
    background-color: rgba(230, 240, 233, 0.7); /* Soft mint green */
    margin-right: 30px;
    margin-left: 60px;
}

.message .text {
    margin-bottom: 5px;
    font-size: 1.05em;
}

.message .text:last-child {
    margin-bottom: 0;
}

.message .native-text {
    font-weight: bold; /* Make native text stand out slightly */
    color: #2c2c2c;
}

.message .romanized-text,
.message .english-translation {
    font-size: 0.9em;
    color: #444;
    padding-left: 10px;
    margin-top: 5px;
}

/* Ambient Controls */
#ambient-controls {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 10;
}

/* Visibility classes for toggles */
.romanized-text.hidden,
.english-translation.hidden {
    display: none;
}

/* Media Queries */
@media (max-width: 768px) {
    .app-container {
        padding: 15px;
    }

    #settings-panel {
        width: 280px;
    }
    
    #conversation-display {
        bottom: 40px;
    }
    
    #latest-message {
        max-width: 90%;
    }
    
    #conversation-history {
        width: 90%;
    }

    #conversation-partner {
        width: 150px;
        height: 200px;
        right: 5%;
        bottom: 15%;
    }
    
    .user-message {
        margin-left: 15px;
        margin-right: 30px;
    }
    
    .ai-message {
        margin-right: 15px;
        margin-left: 30px;
    }
}

@media (max-width: 480px) {
    #corner-controls {
        top: 10px;
        right: 10px;
    }

    #button-container {
        gap: 8px;
    }

    #status-indicators {
        font-size: 0.75em;
        max-width: 120px;
        margin-top: 6px;
    }

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

    #settings-panel {
        width: 90%;
        left: 5%;
        top: 90px;
        box-sizing: border-box;
    }
    
    #settings-panel.expanded {
        padding: 15px;
    }
    
    #conversation-display {
        bottom: 0px !important;
        padding: 0 !important;
    }
    
    #latest-message {
        max-width: 95%;
        margin-bottom: 10px;
    }
    
    .floating-message .native-text {
        font-size: 1.0em;
    }
    
    #toggle-history-btn {
        display: none !important; /* Hide on mobile - Added !important for testing */
    }
    
    #conversation-history {
        width: 95%;
    }
    
    #conversation-partner {
        width: 280px;
        height: 420px;
        opacity: 1;
        right: 24%;
        bottom: 24%;
        top: auto;
        left: auto;
        transform: none;
        margin: 0;
    }
    
    .character-head {
        width: 50px;
        height: 50px;
    }
    
    .character-body {
        width: 60px;
        height: 80px;
    }

    #latest-message .romanized-text,
    #latest-message .english-translation {
        font-size: 0.8em;
    }
}

/* Immersive Conversation Display */
#conversation-display {
    position: fixed;
    bottom: 60px;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 5;
    padding: 0 20px;
}

/* Latest message styling */
#latest-message {
    max-width: 80%;
    min-width: 50%;
    margin-bottom: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.floating-message {
    position: relative;
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: opacity 0.5s, transform 0.5s;
    opacity: 0;
    transform: translateY(20px);
    overflow: hidden;
}

.floating-message.visible {
    opacity: 1;
    transform: translateY(0);
}

.floating-message.ai-speaking {
    background-color: rgba(230, 240, 233, 0.55);
}

.floating-message.user-speaking {
    background-color: rgba(242, 232, 217, 0.55);
}

/* Text styling within the latest message */
.floating-message .native-text {
    font-size: 1.3em;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.4;
    color: #2c2c2c;
}

.floating-message .romanized-text,
.floating-message .english-translation {
    font-size: 1em;
    color: #444;
    margin-top: 5px;
    line-height: 1.4;
    padding-left: 10px;
}

/* History toggle button */
#toggle-history-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgba(43, 43, 43, 0.6);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.25);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    margin-bottom: 10px;
    z-index: 6;
}

#toggle-history-btn:hover {
    background-color: rgba(72, 72, 72, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
}

#toggle-history-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

#toggle-history-btn i {
    font-size: 16px;
}

/* Conversation history (expandable) */
#conversation-history {
    width: 80%;
    height: 0;
    overflow: hidden;
    opacity: 0;
    transition: height 0.4s ease, opacity 0.4s ease;
    margin-bottom: 20px;
}

#conversation-history.expanded {
    height: 400px;
    opacity: 1;
}

.conversation-log {
    height: 100%;
    overflow-y: auto;
    padding: 0;
    background-color: transparent;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) rgba(0, 0, 0, 0.1);
}

.conversation-log::-webkit-scrollbar {
    width: 6px;
}

.conversation-log::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.conversation-log::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

/* Message Styling for conversation log */
.message {
    margin-bottom: 20px;
    padding: 15px 20px;
    border-radius: 12px;
    position: relative;
    border: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    text-align: center;
}

.user-message {
    background-color: rgba(242, 232, 217, 0.55);
}

.ai-message {
    background-color: rgba(230, 240, 233, 0.55);
}

/* Text within history messages */
.message .text.native-text {
    font-size: 1.3em;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.4;
    color: #2c2c2c;
}

.message .text.romanized-text,
.message .text.english-translation {
    font-size: 1em;
    color: #444;
    margin-top: 5px;
    line-height: 1.4;
    padding-left: 10px;
}

/* Suggestion Feature Styling */
#suggestion-trigger-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
}

#show-suggestion-btn {
    /* Styling is mostly inherited from .icon-btn */
    /* Specific adjustments if needed */
    background-color: rgba(241, 196, 15, 0.7); /* Yellow, like a lightbulb moment */
}

#show-suggestion-btn:hover {
    background-color: rgba(241, 196, 15, 0.9);
}

#suggested-response-display {
    top: 60px; /* Move it up a bit on mobile if settings panel is shorter or to give space */
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    max-width: 87%; /* Match latest-message max-width on mobile */
    z-index: 90; /* Below corner controls, above conversation display if it overlaps */
    /* It already has .floating-message and .user-speaking for base style */
    /* Ensure it's visually distinct or clearly a suggestion */

    /* visibility and opacity will be controlled by JS */
}

#suggested-response-display .native-text {
    font-size: 1.0em; /* Match latest-message native text size */
}

#suggested-response-display .romanized-text,
#suggested-response-display .english-translation {
    font-size: 0.8em; /* Match latest-message translation text size */
}

/* New styles for connecting-phase */
#start-stop-button.connecting-phase {
    background-color: #f0ad4e; /* Example: Bootstrap warning yellow */
    /* Add other styles for the button in this state if needed */
}


#connection-indicator.connecting-phase {
    background-color: #f0ad4e; /* Example: Bootstrap warning yellow */
    box-shadow: 0 0 8px #f0ad4e, 0 0 12px #f0ad4e, 0 0 16px #f0ad4e;
}

/* Fallback for when images completely fail to load */
.images-failed #cafe-background {
    background: linear-gradient(135deg, #2c1810 0%, #3d2317 50%, #2c1810 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

.images-failed #cafe-foreground {
    background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.1) 50%, rgba(0,0,0,0.3) 100%);
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
} 