* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: #333;
}

/* 2. Enhanced Main Header */

.main-header {
    text-align: center;
    padding: 1.5rem 1rem;
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 10;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.main-title {
    font-weight: 300;
    font-size: 2rem;
    letter-spacing: -1px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tagline-enhanced {
    color: #666;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
}

h1 { font-weight: 300; font-size: 2rem; letter-spacing: -1px; }
/* p.tagline { color: #666; font-size: 0.9rem; } */

.content-container {
    display: flex;
    gap: 1.5rem;
    padding: 1.5rem;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    flex-grow: 1;
    align-items: flex-start;
}

.input-section {
    flex: 0 0 420px;
    background-color: white;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.07);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 100px;
    transition: all 0.3s ease;
}

.result-section {
    flex: 1;
    min-width: 0;
}

.option-tabs { display: flex; margin-bottom: 1.5rem; border-bottom: 1px solid #eee; }
.option-tab { background: none; border: none; padding: 0.8rem 1.5rem; font-size: 1rem; cursor: pointer; position: relative; color: #888; transition: all 0.3s ease; }
.option-tab.active { color: #333; font-weight: 500; }
.option-tab.active::after { content: ''; position: absolute; bottom: -1px; left: 0; width: 100%; height: 2px; background-color: #333; }
.option-content { display: none; flex-direction: column; flex-grow: 1; }
.option-content.active { display: flex; flex-direction: column; }

.upload-area { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 2rem; border: 2px dashed #ddd; border-radius: 15px; cursor: pointer; transition: all 0.3s ease; flex-grow: 1; margin-bottom: 1.5rem; }
.upload-area:hover { border-color: #aaa; background-color: #fafafa; }
.upload-icon { width: 50px; height: 50px; margin-bottom: 1rem; color: #888; stroke-width: 1.5; }

.record-section { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem 1rem; border: 2px dashed #ddd; border-radius: 15px; flex-grow: 1; margin-bottom: 1.5em; }
.record-icon { width: 50px; height: 50px; margin-bottom: 1rem; color: #888; stroke-width: 1.5; }
.record-text { text-align: center; } 
.record-buttons { display: flex; justify-content: center; gap: 1rem; width: 100%; }

button { background-color: #333; color: white; border: none; padding: 0.8rem 1.8rem; border-radius: 30px; font-size: 1rem; cursor: pointer; transition: all 0.3s ease; }
button:disabled { background-color: #ccc; cursor: not-allowed; transform: none; box-shadow: none; }
button:not(:disabled):hover { background-color: #555; transform: translateY(-2px); box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1); }

#stopButton.recording { background-color: #ff3b30; }
#stopButton.recording:hover { background-color: #e02b20; }
.elapsed-timer { font-size: 1.5rem; font-weight: 300; margin-top: 1rem; color: #555; font-family: 'Courier New', Courier, monospace; }
#spectrogramCanvas { width: 100%; max-width: 300px; height: 150px; margin-top: 1rem; background-color: #000; border-radius: 8px; border: 1px solid #ddd; }

.result-placeholder, #processingStatus { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 400px; padding: 2rem; background-color: #fff; border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.07); }
.placeholder-icon i { width: 80px; height: 80px; color: #ccc; margin-bottom: 1.5rem; stroke-width: 1; }
.result-placeholder h3 { font-size: 1.5rem; margin-bottom: 1rem; color: #888; font-weight: 500; }
.result-placeholder p { color: #aaa; max-width: 350px; }
.processing-content { display: none; align-items: center; justify-content: center; }
.processing-content.active { display: flex; }
.status-text { font-size: 1.2rem; font-weight: 500; color: #333; display: flex; align-items: center; flex-direction: column; gap: 1rem; }
.status-text > div:first-child { display: flex; align-items: center; gap: 0.75rem; }
.recording-indicator { width: 12px; height: 12px; border-radius: 50%; background-color: #ff3b30; animation: pulse 1.5s infinite; }
.analyzing-spinner { width: 20px; height: 20px; border: 3px solid rgba(99, 102, 241, 0.2); border-top-color: #6366f1; border-radius: 50%; animation: spin 1s linear infinite; }

#trackInfoContainer {
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.06);
    margin-bottom: 1.5rem;
}
.section-title { font-size: 1.1rem; font-weight: 600; color: #333; margin-bottom: 1rem; }
.song-info { display: flex; align-items: center; gap: 1rem; }
#audio-player-container { flex-grow: 1; }
#audio-player-container .audio-preview { width: 100%; }
.song-details { flex-shrink: 0; text-align: right; }
.song-details h4 { font-size: 1rem; font-weight: 500; margin: 0; }
.song-details p { color: #666; font-size: 0.85rem; margin: 0.2rem 0 0; }

.accordion { width: 100%; display: flex; flex-direction: column; gap: 1.5rem; }
.accordion-item { background-color: #fff; border-radius: 12px; box-shadow: 0 8px 25px rgba(0,0,0,0.06); overflow: hidden; }

.accordion-header { 
    width: 100%; 
    background: none;
    border: none; 
    padding: 1.25rem 1.5rem; 
    font-size: 1.1rem; 
    font-weight: 600; 
    color: #333; 
    cursor: pointer; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    text-align: left; 
}

button.accordion-header:hover {
    border-radius: 10px; 
    background-color: #fafafa;
}

.accordion-icon { color: #888; transition: transform 0.3s ease; width: 20px; height: 20px;}
.accordion-header.active .accordion-icon { transform: rotate(180deg); color: #6366f1; }

.accordion-content { max-height: 0; overflow: hidden; padding: 0; transition: max-height 0.4s ease-out, padding 0.4s ease-out; }

.accordion-content .mood-result,
.accordion-content .narrative-container {
    padding: 1.5rem; /* Standardize padding */
}

.mood-explaination{
    padding-top: 0;
}
.mood-explaination .ai-attribution{
    margin-top: 0;
}

.mood-chart-list { display: flex; flex-direction: column; gap: 0.75rem; }
.mood-bar { display: flex; align-items: center; gap: 1rem; padding: 0.5rem; border-radius: 8px; transition: background-color 0.3s ease; margin: 0 -0.5rem; }
.mood-bar.is-primary-mood { background-color: rgba(99, 102, 241, 0.08); }
.mood-bar-label { flex: 0 0 120px; display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; }
.mood-bar.is-primary-mood .mood-bar-label { font-weight: 600; }
.mood-bar-emoji { font-size: 1.2rem; }
.mood-bar-progress-wrapper { flex-grow: 1; height: 8px; background-color: #eee; border-radius: 4px; overflow: hidden; }
.mood-bar-progress-value { height: 100%; background-color: #a9aaff; border-radius: 4px; transition: width 1s ease-out; }
.mood-bar.is-primary-mood .mood-bar-progress-value { background-color: #6366f1; }
.mood-bar-percentage { flex: 0 0 50px; text-align: right; font-size: 0.9rem; font-weight: 500; color: #555; }
.mood-bar.is-primary-mood .mood-bar-percentage { font-weight: 600; }

/* ADDED: Styling for the Gemini attribution text */
.gemini-attribution {
    text-align: right;
    margin-top: 1.5rem;
    font-size: 0.8rem;
    color: #999;
    font-style: italic;
}

/* FIXED: Consolidated all footer styles here */
footer {
    text-align: center;
    color: #888;
    font-size: 0.8rem;
    padding: 2rem 1.5rem;
    background-color: rgba(255, 255, 255, 0.8);
    margin-top: 1rem;
}

.footer-links {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.footer-link {
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    transition: all 0.3s ease;
}
.footer-link:hover {
    color: #333;
    background-color: #f0f0f0;
}

#footerUpdates.footer-link {
    display: inline-flex;
    align-items: center;
}

.update-indicator-dot {
    width: 8px;
    height: 8px;
    background-image: linear-gradient(135deg, #6366f1, #d946ef);
    border-radius: 50%;
    margin-right: 7px;
}

.composer-button {
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.composer-button:hover {
    transform: translateY(-2px);
    color: #333;
}

.music-note {
    display: inline-block;
    transition: transform 0.4s ease;
}

.composer-button:hover .music-note:first-child {
    transform: translateY(-3px) rotate(-10deg);
    color: #e45f7a;
}

.composer-button:hover .music-note:last-child {
    transform: translateY(-3px) rotate(10deg);
    color: #e45f7a;
}

.coffee-button {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(45deg, #FFEFB5, #FFF8DC);
    color: #777;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    text-decoration: none;
}

.coffee-button:hover {
    background: linear-gradient(45deg, #FFEBB5, #FFED99);
    color: #555;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.coffee-icon {
    transition: transform 0.3s ease;
    width: 20px;
    height: 20px;
}

.coffee-button:hover .coffee-icon {
    animation: wiggle 1s ease;
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0); }
    25% { transform: rotate(-10deg); }
    50% { transform: rotate(0); }
    75% { transform: rotate(10deg); }
}

/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow-y: auto;
    padding: 2rem 1rem;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: white;
    border-radius: 15px;
    max-width: 700px;
    margin: 3rem auto;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    color: #aaa;
    transition: color 0.2s ease;
}

.close-modal:hover {
    color: #333;
}

.modal-content h2 {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #eee;
    font-weight: 500;
    font-size: 1.4rem;
    margin: 0;
}

.modal-body {
    padding: 1rem 2rem 2rem 2rem;
}

.how-to-step {
    display: flex;
    margin-bottom: 2rem;
    align-items: flex-start;
}

.step-number {
    width: 40px;
    height: 40px;
    background-color: #333;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-right: 1.5rem;
    flex-shrink: 0;
}

.step-content h3 { margin: 0 0 0.5rem 0; font-weight: 600; }
.step-content p { margin: 0; color: #666; line-height: 1.6; }

.mood-info {
    display: flex;
    margin-bottom: 2rem;
    align-items: flex-start;
}
.mood-info:last-child { margin-bottom: 0; }

.mood-info-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 1.5rem;
    flex-shrink: 0;
}
.mood-info-icon.energetic { background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 99%, #fecfef 100%); }
.mood-info-icon.melancholic { background: linear-gradient(135deg, #a1c4fd 0%, #c2e9fb 100%); }
.mood-info-icon.peaceful { background: linear-gradient(135deg, #d4fc79 0%, #96e6a1 100%); }
.mood-info-icon.joyful { background: linear-gradient(135deg, #f6d365 0%, #fda085 100%); }

.mood-info-content h3 { margin: 0 0 0.5rem 0; font-weight: 600; }
.mood-info-content p { margin: 0 0 0.8rem 0; color: #666; line-height: 1.6; }
.mood-info-content p:last-child { margin-bottom: 0; }

/* ADDED: Styling for the new Updates Modal */
.update-item {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #eee;
}
.update-item:last-child {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}
.update-date {
    font-size: 0.85rem;
    color: #888;
    margin: 0 0 0.25rem 0;
}
.update-title {
    font-weight: 600;
    margin: 0 0 0.75rem 0;
    font-size: 1.1rem;
}
.update-list {
    list-style-type: '✓  ';
    padding-left: 1.5rem;
    color: #555;
    line-height: 1.6;
}
.update-list li {
    margin-bottom: 0.5rem;
}

.modal-attribution {
    text-align: center;
    font-size: 0.8rem;
    color: #888;
    line-height: 1.5;
}

/* ADDED: Styles for the new Image Result Container */
#imageResultContainer {
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.06);
    margin-bottom: 1.5rem;
}

.image-wrapper {
    position: relative;
    width: 100%;
    background-color: #f0f2f5;
    border-radius: 8px;
    min-height: 200px; /* Placeholder height while loading */
    display: block; /* Changed from flex to block */
    overflow: visible; /* Changed to visible to prevent cropping */
}

/* When image is loaded, remove min-height */
.image-wrapper.has-image {
    min-height: 0;
    background-color: transparent;
}

/* Center the loader when no image */
.image-wrapper:not(.has-image) {
    display: flex;
    align-items: center;
    justify-content: center;
}

#generatedImage {
    display: none; /* Hidden by default, shown by JS when loaded */
    width: 100%;
    height: auto;
    border-radius: 8px;
    vertical-align: middle;
    object-fit: contain; /* Ensure full image is visible */
    background-color: transparent;
}

.image-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: #555;
    font-size: 1rem;
}

/* --- ADDED: Styling for the new Imagen Prompt Text --- */
.image-prompt-text, .narrative-container {
    font-size: 0.9rem;
    color: #666;
    text-align: center;
    padding: 0.5rem 1rem 1.5rem 1rem;
    font-style: italic;
    border-bottom: 1px solid #eee;
    line-height: 1.5;
}

.image-container-padding {
    padding: 1.5rem;
}

#movedResultsContainer {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.ai-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    margin-left: 0.5rem;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.ai-badge-icon {
    width: 12px;
    height: 12px;
}

.accordion-title-with-ai {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ai-processing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: #667eea;
    font-weight: 400;
}

.ai-sparkle {
    width: 12px;
    height: 12px;
    animation: sparkle 2s ease-in-out infinite;
}

@keyframes sparkle {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

/* 4. Enhanced Attribution Styling */
.ai-attribution {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.75rem;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    font-size: 0.8rem;
    color: #64748b;
}

.ai-attribution-icon {
    width: 16px;
    height: 16px;
    color: #667eea;
}

/* 5. Fix the Visual Interpretation Attribution */
.image-attribution-fixed {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.75rem;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    font-size: 0.8rem;
    color: #64748b;
    position: relative;
    z-index: 1;
    font-style: italic;
    min-height: 44px;
}

/* 6. Mobile responsiveness for AI elements */
@media (max-width: 768px) {
    .main-title {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .ai-badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
        margin-left: 0;
        margin-top: 0.25rem;
    }
    
    .tagline-enhanced {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .accordion-title-with-ai {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
}

/* 7. Update existing gemini-attribution to new style */
.gemini-attribution {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.75rem;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    font-size: 0.8rem;
    color: #64748b;
    text-align: center;
    font-style: normal;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 1024px) {
    .content-container { flex-direction: column; }
    .input-section { position: static; width: 100%; flex: auto; }
    .result-section { width: 100%; }
}

@media (min-width: 1024px) {
    .content-container {
        grid-template-columns: 420px 1fr;
        display: grid;
        align-items: flex-start;
    }
    
    .input-section {
        position: sticky;
        top: 100px;
    }
}
@media (max-width: 480px) {
    body { font-size: 14px; }
    h1 { font-size: 1.6rem; }
    .content-container, .input-section, .result-section, #trackInfoContainer, .modal-content { padding: 1rem; }
    .mood-bar-label { flex-basis: 100px; }
    .footer-links { flex-direction: column; gap: 0.8rem; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(1.2); } 100% { opacity: 1; transform: scale(1); } }