/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* Remove tap highlight on mobile */
    -webkit-tap-highlight-color: transparent;
}

:root {
    /* Mystical Color Palette */
    --primary-dark: #0a0a0f;
    --secondary-dark: #1a1a2e;
    --accent-purple: #6b46c1;
    --accent-gold: #fbbf24;
    --accent-silver: #e5e7eb;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --text-muted: #9ca3af;
    --border-color: #374151;
    --glow-color: #a855f7;
    
    /* Typography */
    --font-display: 'Cinzel', serif;
    --font-body: 'Inter', sans-serif;
    
    /* Spacing - Compact by default */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 0.75rem;
    --space-lg: 1rem;
    --space-xl: 1.5rem;
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 20px rgba(168, 85, 247, 0.3);
}

body {
    font-family: var(--font-body);
    background: 
        linear-gradient(135deg, rgba(10, 10, 15, 0.6) 0%, rgba(26, 26, 46, 0.6) 100%),
        url('images/guanyin2.jpg') center center / cover no-repeat fixed;
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Prevent text size adjustment on mobile */
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
    /* Improve touch scrolling on iOS */
    -webkit-overflow-scrolling: touch;
}

/* App Container */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Mode Toggle */
.mode-toggle {
    display: flex;
    gap: var(--space-xs);
    background: var(--primary-dark);
    border-radius: var(--radius-lg);
    padding: 0.25rem;
    border: 1px solid var(--border-color);
    margin: var(--space-sm) auto var(--space-md);
    width: fit-content;
}

.mode-btn {
    padding: var(--space-xs) var(--space-md);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.mode-btn.active {
    background: var(--accent-purple);
    color: var(--text-primary);
    box-shadow: var(--shadow-glow);
}

.mode-btn:hover:not(.active) {
    color: var(--text-primary);
    background: rgba(107, 70, 193, 0.2);
}

.mode-btn:active {
    transform: scale(0.98);
}

/* Main Content Areas */
.oracle-mode,
.music-mode {
    flex: 1;
    display: none;
    padding: var(--space-sm) var(--space-md);
    padding-top: 25vh;
}

.oracle-mode.active,
.music-mode.active {
    display: block;
}

/* Oracle Mode Styles */
.oracle-container {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.greeting {
    margin-bottom: var(--space-lg);
}

.greeting .presenter {
    font-family: var(--font-display);
    font-size: 0.9rem;
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-bottom: var(--space-xs);
}

.greeting h1 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    margin-bottom: var(--space-md);
    color: var(--text-primary);
    letter-spacing: 0.05em;
}

.greeting h2 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    margin-bottom: var(--space-sm);
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-purple));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.greeting .description {
    margin-bottom: var(--space-md);
}

.greeting .description p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
    text-align: center;
    padding: 0 var(--space-md);
}

/* Social Sidebar */
.social-sidebar {
    position: fixed;
    right: var(--space-lg);
    top: 80px;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    z-index: 100;
}

.social-sidebar .social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: rgba(10, 10, 15, 0.9);
    border: 2px solid var(--accent-purple);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    position: relative;
}

.social-sidebar .social-link::after {
    content: attr(title);
    position: absolute;
    right: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: rgba(10, 10, 15, 0.95);
    color: var(--text-primary);
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    border: 1px solid var(--accent-purple);
    backdrop-filter: blur(10px);
}

.social-sidebar .social-link:hover::after {
    opacity: 1;
}

.social-sidebar .social-link:hover {
    background: rgba(107, 70, 193, 0.5);
    box-shadow: var(--shadow-glow);
    transform: scale(1.1);
    border-color: var(--accent-gold);
}

.social-sidebar .social-link:active {
    transform: scale(1.05);
}

.social-sidebar .social-link svg {
    flex-shrink: 0;
}

.greeting .mantra {
    font-size: 0.95rem;
    color: var(--accent-gold);
    margin-top: var(--space-sm);
}

.greeting p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.4;
}

.greeting br {
    display: none;
}

/* Question Section */
.question-section {
    margin-bottom: var(--space-md);
}

.input-container {
    position: relative;
    margin-bottom: var(--space-sm);
}

#question-input {
    width: 100%;
    padding: var(--space-sm);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: rgba(26, 26, 46, 0.8);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    resize: none;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

#question-input:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: var(--shadow-glow);
}

#question-input::placeholder {
    color: var(--text-muted);
}

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-xs);
    padding: 0 var(--space-sm);
}

.char-count {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.voice-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: var(--space-xs);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.voice-btn:hover {
    border-color: var(--accent-purple);
    color: var(--accent-purple);
}

.voice-btn:active {
    background: rgba(107, 70, 193, 0.1);
}

.voice-btn.recording {
    border-color: #ef4444;
    color: #ef4444;
    animation: pulse 1s infinite;
}

/* Oracle Button */
.oracle-btn {
    position: relative;
    padding: var(--space-sm) var(--space-md);
    border: none;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-gold));
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
    min-width: 120px;
}

.oracle-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.oracle-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(168, 85, 247, 0.4);
}

.oracle-btn:not(:disabled):active {
    transform: translateY(0);
    box-shadow: 0 5px 15px rgba(168, 85, 247, 0.3);
}

.btn-glow {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s ease;
}

.oracle-btn:not(:disabled):hover .btn-glow {
    left: 100%;
}

/* Oracle Response */
.oracle-response {
    background: rgba(26, 26, 46, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    backdrop-filter: blur(10px);
    margin-top: var(--space-md);
}

.oracle-response.hidden {
    display: none;
}

.response-header h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    margin-bottom: var(--space-sm);
    color: var(--accent-gold);
}

/* Audio Player */
.audio-player-container {
    margin-bottom: var(--space-sm);
}

#oracle-audio,
#music-audio {
    width: 100%;
    margin-bottom: var(--space-sm);
    border-radius: var(--radius-md);
    background: var(--primary-dark);
    height: 40px;
}

.track-info {
    text-align: center;
    margin-bottom: var(--space-sm);
}

.track-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0;
}

.track-credits {
    color: var(--text-secondary);
    font-style: italic;
}

/* Audio Visualization */
.visualization {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 50px;
    margin: var(--space-sm) 0;
}

.wave-container {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    height: 60px;
}

.wave {
    width: 4px;
    background: linear-gradient(to top, var(--accent-purple), var(--accent-gold));
    border-radius: 2px;
    animation: wave 1.5s ease-in-out infinite;
}

.wave:nth-child(1) { animation-delay: 0s; height: 10px; }
.wave:nth-child(2) { animation-delay: 0.1s; height: 20px; }
.wave:nth-child(3) { animation-delay: 0.2s; height: 30px; }
.wave:nth-child(4) { animation-delay: 0.3s; height: 20px; }
.wave:nth-child(5) { animation-delay: 0.4s; height: 10px; }

/* Secondary Button */
.secondary-btn {
    background: transparent;
    border: 2px solid var(--accent-purple);
    color: var(--accent-purple);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.85rem;
}

.secondary-btn:hover {
    background: var(--accent-purple);
    color: var(--text-primary);
    box-shadow: var(--shadow-glow);
}

.secondary-btn:active {
    transform: scale(0.98);
}

/* Music Mode Styles */
.music-container {
    max-width: 1200px;
    margin: 0 auto;
}

.music-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
    gap: var(--space-md);
}

.music-header h2 {
    font-family: var(--font-display);
    font-size: 2rem;
    color: var(--accent-gold);
}

.music-controls {
    display: flex;
    gap: var(--space-md);
    align-items: center;
}

.search-input {
    padding: var(--space-sm);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: rgba(26, 26, 46, 0.8);
    color: var(--text-primary);
    min-width: 250px;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-purple);
}

.control-btn {
    background: var(--accent-purple);
    border: none;
    color: var(--text-primary);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    transition: all 0.3s ease;
}

.control-btn:hover {
    background: var(--accent-gold);
    transform: translateY(-1px);
}

.control-btn:active {
    transform: translateY(0);
}

/* Track List */
.track-list {
    display: grid;
    gap: var(--space-sm);
    margin-bottom: var(--space-xl);
    max-height: 500px;
    overflow-y: auto;
    padding-right: var(--space-sm);
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.track-item {
    background: rgba(26, 26, 46, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.track-item:hover {
    border-color: var(--accent-purple);
    background: rgba(107, 70, 193, 0.1);
}

.track-item:active {
    background: rgba(107, 70, 193, 0.2);
}

.track-item.playing {
    border-color: var(--accent-gold);
    background: rgba(251, 191, 36, 0.1);
}

.track-info-item {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.track-number {
    color: var(--accent-gold);
    font-weight: 600;
    font-size: 0.875rem;
    min-width: 2rem;
    flex-shrink: 0;
}

.track-name {
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
}

.track-duration {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-left: auto;
    flex-shrink: 0;
}

/* Music Player */
.music-player {
    background: rgba(26, 26, 46, 0.8);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 10px;
    backdrop-filter: blur(10px);
    margin-bottom: var(--space-md);
    position: sticky;
    top: 0;
    z-index: 10;
}

.music-player audio {
    width: 100%;
    height: 36px;
    margin-bottom: 0;
}

.now-playing {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.now-playing-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.now-playing-credits {
    color: var(--text-secondary);
    font-style: italic;
    font-size: 0.8rem;
    margin: 0;
}

/* Oracle Actions */
.oracle-actions {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
    align-items: center;
    margin-top: var(--space-md);
    flex-wrap: wrap;
}

.oracle-donation-text {
    text-align: center;
    margin-top: var(--space-xs);
    padding: var(--space-xs);
}

.oracle-donation-text p {
    color: var(--text-secondary);
    font-style: italic;
    margin: 0;
    font-size: 0.8rem;
    opacity: 0.8;
}

/* Donation Sections */
.donation-section,
.oracle-donation {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.donation-text {
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin-bottom: 6px;
    font-style: italic;
}

.donation-buttons {
    display: flex;
    justify-content: center;
    gap: var(--space-md);
}

.donate-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, var(--accent-gold), #f59e0b);
    color: var(--primary-dark);
    padding: 5px 10px;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.2);
}

.donate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(251, 191, 36, 0.3);
    background: linear-gradient(135deg, #f59e0b, var(--accent-gold));
}

.donate-btn.primary {
    background: linear-gradient(135deg, var(--accent-gold), #fbbf24);
    font-weight: 600;
    padding: var(--space-sm) var(--space-md);
    font-size: 0.85rem;
    box-shadow: 0 4px 15px rgba(251, 191, 36, 0.3);
}

.donate-btn.primary:hover {
    background: linear-gradient(135deg, #fbbf24, var(--accent-gold));
    box-shadow: 0 6px 20px rgba(251, 191, 36, 0.4);
    transform: translateY(-3px);
}

.donate-btn:active {
    transform: translateY(0);
}

.donate-btn svg {
    width: 16px;
    height: 16px;
}

/* Donation Modal */
.donation-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.donation-modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(10px);
}

.modal-content {
    position: relative;
    background: var(--primary-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.modal-header h3 {
    color: var(--accent-gold);
    font-size: 1.5rem;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(107, 70, 193, 0.2);
    color: var(--accent-purple);
}

.modal-body p {
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
    text-align: center;
}

.donation-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
}

.donation-option {
    background: rgba(26, 26, 46, 0.6);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.donation-option:hover {
    border-color: var(--accent-purple);
    background: rgba(107, 70, 193, 0.1);
    transform: translateY(-2px);
}

.donation-option:active {
    transform: translateY(0);
    background: rgba(107, 70, 193, 0.2);
}

.donation-option.featured {
    border-color: var(--accent-gold);
    background: rgba(251, 191, 36, 0.1);
}

.donation-option.featured:hover {
    border-color: var(--accent-gold);
    background: rgba(251, 191, 36, 0.2);
}

.donation-option.featured:active {
    background: rgba(251, 191, 36, 0.3);
}

.option-amount {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.option-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.option-badge {
    position: absolute;
    top: -1px;
    right: -1px;
    background: var(--accent-gold);
    color: var(--primary-dark);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 0 var(--radius-lg) 0 var(--radius-md);
}

/* Custom Amount Option */
.custom-option {
    grid-column: span 2;
    padding: var(--space-lg) var(--space-xl);
}

.custom-amount-input {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-md);
    position: relative;
}

.currency-symbol {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--accent-gold);
    margin-right: 0.5rem;
}

#custom-amount {
    background: rgba(26, 26, 46, 0.8);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 600;
    padding: var(--space-sm) var(--space-md);
    text-align: center;
    width: 120px;
    transition: all 0.3s ease;
}

#custom-amount:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(107, 70, 193, 0.2);
}

#custom-amount::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

.custom-donate-btn {
    background: linear-gradient(135deg, var(--accent-purple), #8b5cf6);
    color: var(--text-primary);
    border: none;
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-lg);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: var(--space-sm);
    width: 100%;
}

.custom-donate-btn:hover {
    background: linear-gradient(135deg, #8b5cf6, var(--accent-purple));
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(107, 70, 193, 0.3);
}

.custom-donate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Responsive Modal */
@media (max-width: 768px) {
    .donation-options {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }
    
    .custom-option {
        grid-column: span 1;
    }
    
    .modal-content {
        margin: var(--space-md);
        width: calc(100% - 2rem);
    }
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 15, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.loading-overlay.hidden {
    display: none;
}

.loading-spinner {
    text-align: center;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--accent-purple);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--space-md);
}

.loading-spinner p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Animations */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes wave {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(2); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes gentle-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Gentle shake animation for empty question submission */
.gentle-shake {
    animation: gentle-shake 0.5s ease-in-out;
}

/* Responsive Design */
@media (max-width: 768px) {
    .oracle-mode,
    .music-mode {
        padding: var(--space-lg) var(--space-md);
        padding-bottom: 80px; /* Extra space for fixed social sidebar at bottom */
    }
    
    .greeting h1 {
        font-size: 1.25rem;
    }
    
    .greeting h2 {
        font-size: 2rem;
    }
    
    .greeting .description p {
        font-size: 0.8rem;
        text-align: center;
        padding: 0;
    }
    
    .greeting .presenter {
        font-size: 0.75rem;
    }
    
    .greeting .mantra {
        font-size: 0.85rem;
    }
    
    /* Move social sidebar to bottom on mobile */
    .social-sidebar {
        position: fixed;
        right: auto;
        left: 50%;
        top: auto;
        bottom: var(--space-md);
        transform: translateX(-50%);
        flex-direction: row;
        gap: var(--space-md);
        z-index: 1001; /* Above everything else */
    }
    
    .social-sidebar .social-link {
        width: 44px;
        height: 44px;
    }
    
    .social-sidebar .social-link::after {
        right: 50%;
        top: auto;
        bottom: calc(100% + 8px);
        transform: translateX(50%);
    }
    
    .mode-toggle {
        margin: var(--space-md) auto;
    }
    
    .mode-btn {
        font-size: 0.875rem;
        padding: var(--space-sm) var(--space-lg);
    }
    
    #question-input {
        font-size: 16px; /* Prevents iOS zoom on focus */
        padding: var(--space-md);
    }
    
    .music-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .music-header h2 {
        font-size: 1.5rem;
        margin-bottom: var(--space-md);
    }
    
    .music-controls {
        flex-direction: column;
    }
    
    .search-input {
        min-width: auto;
        width: 100%;
        font-size: 16px; /* Prevents iOS zoom on focus */
    }
    
    .control-btn {
        width: 100%;
        justify-content: center;
    }
    
    .oracle-btn {
        min-width: auto;
        width: 100%;
        padding: var(--space-md);
        font-size: 1rem;
    }
    
    .track-item {
        padding: var(--space-md) var(--space-sm);
    }
    
    .track-number {
        font-size: 0.75rem;
        min-width: 1.5rem;
    }
    
    .track-name {
        font-size: 0.875rem;
    }
    
    .track-duration {
        font-size: 0.75rem;
    }
    
    .track-list {
        max-height: 50vh;
    }
    
    /* Audio controls sizing */
    audio {
        width: 100%;
        height: 40px;
    }
    
    .audio-player-container,
    .music-player {
        padding: 8px;
        position: sticky;
        top: 0;
        margin-bottom: var(--space-sm);
    }
    
    .music-player audio {
        height: 32px;
    }
    
    .now-playing {
        margin-top: 4px;
        gap: 6px;
    }
    
    .now-playing-title {
        font-size: 0.85rem;
    }
    
    .now-playing-credits {
        font-size: 0.7rem;
    }
    
    .donation-section {
        margin-top: 6px;
        padding-top: 6px;
    }
    
    .donation-text {
        font-size: 0.7rem;
        margin-bottom: 4px;
    }
    
    .donate-btn {
        padding: 4px 8px;
        font-size: 0.7rem;
    }
    
    .donate-btn svg {
        width: 10px;
        height: 10px;
    }
    
    .track-info,
    .now-playing {
        padding: var(--space-md) 0;
    }
    
    .track-title,
    .now-playing-title {
        font-size: 1rem;
    }
    
    .track-credits,
    .now-playing-credits {
        font-size: 0.875rem;
    }
    
    .oracle-actions {
        flex-direction: column;
        gap: var(--space-sm);
    }
    
    .secondary-btn,
    .donate-btn {
        width: 100%;
        padding: var(--space-md);
        font-size: 0.875rem;
    }
    
    .modal-header h3 {
        font-size: 1.25rem;
    }
    
    .donation-option {
        padding: var(--space-md);
    }
    
    .option-amount {
        font-size: 1.5rem;
    }
    
    .option-label {
        font-size: 0.875rem;
    }
    
    /* Better touch targets */
    button,
    .track-item,
    .social-link {
        min-height: 44px; /* Apple's recommended minimum touch target */
    }
    
    /* Voice button on mobile */
    .voice-btn {
        padding: var(--space-sm);
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus Styles */
button:focus,
input:focus,
textarea:focus {
    outline: 2px solid var(--accent-purple);
    outline-offset: 2px;
}

/* Custom Scrollbar */
.track-list::-webkit-scrollbar {
    width: 6px;
}

.track-list::-webkit-scrollbar-track {
    background: var(--primary-dark);
    border-radius: 3px;
}

.track-list::-webkit-scrollbar-thumb {
    background: var(--accent-purple);
    border-radius: 3px;
}

.track-list::-webkit-scrollbar-thumb:hover {
    background: var(--accent-gold);
}

/* ========================================
   Slideshow Player
   ======================================== */

/* When slideshow is active, hide everything else */
body.slideshow-active .mode-toggle,
body.slideshow-active .greeting,
body.slideshow-active .social-sidebar,
body.slideshow-active .quatrain-index {
    display: none !important;
}

body.slideshow-active .app-container {
    padding: 0;
}

body.slideshow-active .oracle-mode {
    padding: 0;
}

body.slideshow-active .oracle-container {
    padding: 0;
    max-width: none;
}

body.slideshow-active .oracle-response {
    padding: 0;
}

.slideshow-container {
    width: 100%;
}

.slideshow-viewport {
    position: relative;
    width: 100vw;
    height: calc(100vh - 100px);
    height: calc(100dvh - 100px);
    margin-left: calc(-50vw + 50%);
    background: #000;
    overflow: hidden;
}

.slideshow-viewport .slide {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 2s ease-in-out;
    transform: scale(1.0);
    transform-origin: center center;
    will-change: transform, opacity;
}

.slideshow-viewport .slide.active {
    opacity: 1;
}

.beat-flash {
    position: absolute;
    inset: 0;
    background: rgb(255, 200, 100);
    opacity: 0;
    pointer-events: none;
    z-index: 5;
    will-change: opacity;
}

.slideshow-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2rem 1.5rem 1.25rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    opacity: 1;
    transition: opacity 1.5s ease;
    pointer-events: none;
}

.slideshow-overlay.faded {
    opacity: 0;
}

.slideshow-title {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 400;
    color: #fff;
    letter-spacing: 0.04em;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

.slideshow-credits {
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

/* Slideshow toggle button */
.slideshow-toggle {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 20;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: background 0.3s, color 0.3s, opacity 0.3s;
    opacity: 0.6;
    -webkit-tap-highlight-color: transparent;
}

.slideshow-toggle:hover,
.slideshow-toggle:active {
    background: rgba(0, 0, 0, 0.7);
    color: rgba(255, 255, 255, 0.95);
    opacity: 1;
}

/* When images are off, show the wave viz inside the slideshow viewport */
.slideshow-viewport.images-off .slide {
    opacity: 0 !important;
}

.slideshow-viewport.images-off {
    background: var(--bg-primary, #0a0a0f);
}

.slideshow-viewport .inline-wave-container {
    display: none;
    position: absolute;
    inset: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    z-index: 5;
}

.slideshow-viewport.images-off .inline-wave-container {
    display: flex;
}

.inline-wave-container .inline-track-title {
    font-family: var(--font-display, 'Cinzel', serif);
    font-size: 1.6rem;
    color: var(--accent-gold, #c9a84c);
    text-align: center;
    padding: 0 1rem;
}

.inline-wave-container .inline-track-credits {
    font-family: var(--font-body, 'Inter', sans-serif);
    font-size: 0.85rem;
    color: var(--text-muted, #888);
}

.inline-wave-container .wave-container {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    height: 60px;
}

.inline-wave-container .wave {
    width: 4px;
    background: linear-gradient(to top, var(--accent-purple, #7b2d8e), var(--accent-gold, #c9a84c));
    border-radius: 2px;
    animation: wave 1.5s ease-in-out infinite;
}

.inline-wave-container .wave:nth-child(1) { animation-delay: 0s; height: 10px; }
.inline-wave-container .wave:nth-child(2) { animation-delay: 0.1s; height: 20px; }
.inline-wave-container .wave:nth-child(3) { animation-delay: 0.2s; height: 30px; }
.inline-wave-container .wave:nth-child(4) { animation-delay: 0.3s; height: 20px; }
.inline-wave-container .wave:nth-child(5) { animation-delay: 0.4s; height: 10px; }

/* Mobile slideshow adjustments */
@media (max-width: 600px) {
    .slideshow-viewport {
        height: calc(100vh - 80px);
        height: calc(100dvh - 80px);
    }

    .slideshow-toggle {
        top: 8px;
        right: 8px;
    }

    .inline-wave-container .inline-track-title {
        font-size: 1.2rem;
    }
}

/* Quatrain text (poem + interpretation below slideshow) */
.quatrain-text {
    max-width: 900px;
    margin: 1.5rem auto;
    padding: 1.5rem 2rem;
    text-align: left;
    display: none;
}

.quatrain-poem {
    font-family: var(--font-display);
    font-size: 1.15rem;
    color: var(--accent-gold);
    line-height: 2;
    margin: 0 0 1.25rem;
    padding: 0;
    border: none;
    white-space: pre-line;
    font-style: italic;
}

@media (max-width: 600px) {
    .quatrain-poem {
        font-size: 1rem;
    }

    .quatrain-text {
        padding: 1rem 1.25rem;
    }
}

/* Shared oracle audio player */
.oracle-audio-container {
    max-width: 900px;
    margin: var(--space-md) auto 0;
}

.oracle-audio-container audio {
    width: 100%;
    height: 36px;
    border-radius: var(--radius-sm);
}

@media (max-width: 600px) {
    .slideshow-title {
        font-size: 1.2rem;
    }

    .slideshow-overlay {
        padding: 1.5rem 1rem 1rem;
    }
}

/* ========================================
   The 100 Quatrains Index (Footer)
   ======================================== */

.quatrain-index {
    border-top: 1px solid var(--border-color);
    background: rgba(10, 10, 15, 0.85);
    padding: var(--space-xl) var(--space-lg);
}

.quatrain-index-inner {
    max-width: 800px;
    margin: 0 auto;
}

.quatrain-index h2 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--accent-gold);
    text-align: center;
    margin-bottom: var(--space-sm);
    letter-spacing: 0.05em;
}

.quatrain-index-description {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: var(--space-xl);
    line-height: 1.5;
}

.quatrain-list {
    columns: 2;
    column-gap: 2rem;
    padding-left: 2.5rem;
    list-style-position: outside;
}

.quatrain-list li {
    font-family: var(--font-body);
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: 0.2rem 0;
    break-inside: avoid;
    line-height: 1.4;
}

.quatrain-list li::marker {
    color: var(--text-muted);
    font-size: 0.7rem;
}

@media (max-width: 600px) {
    .quatrain-list {
        columns: 1;
    }
}

/* Donation redirect message */
.donation-redirect-msg {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 15, 0.85);
    transition: opacity 0.6s ease;
}
.donation-redirect-msg.fade-out {
    opacity: 0;
}
.donation-redirect-inner {
    text-align: center;
    font-family: var(--font-display);
    color: var(--accent-gold);
    font-size: 1.25rem;
    max-width: 28rem;
    padding: 2rem;
    line-height: 1.6;
}
