/* card-pages.css - COMPLETE REWRITE FOR PROPER LAYOUT */
.card-page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    overflow-anchor: none;	
}

/* ========== HERO SECTION ========== */
.card-hero {
    margin: 20px 0 40px;
}

.hero-content {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 40px;
    align-items: start;
}

.card-image-section {
    position: sticky;
    top: 100px;
    text-align: center;
}

.hero-card-image {
    width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    border: 1px solid rgba(212, 165, 116, 0.3);
}

.card-intro-section h1 {
    font-family: 'Cinzel', serif;
    font-size: 2.5rem;
    color: var(--mystic-gold);
    margin-bottom: 10px;
    line-height: 1.2;
}

.card-number {
    color: #b8a7d6;
    font-size: 1.1rem;
    margin-bottom: 10px;
    font-style: italic;
}

.card-tagline {
    font-size: 1.2rem;
    color: #e4c4ff;
    margin-bottom: 25px;
    line-height: 1.4;
}

.card-quick-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: 25px;
}

/* Hero sidebar - fills empty space on desktop */
.hero-sidebar {
    margin-top: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(212, 165, 116, 0.15);
    border-radius: 12px;
}

.hero-sidebar .sidebar-cta {
    margin-top: 0;
    background: none;
    border: none;
    padding: 0;
}

.hero-sidebar .ad-placeholder {
    min-height: 200px;
}

.stat {
    background: rgba(255,255,255,0.05);
    padding: 15px 10px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid rgba(212, 165, 116, 0.1);
}

.stat-label {
    display: block;
    font-size: 0.8rem;
    color: #9a8fb8;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.stat-value {
    display: block;
    font-size: 0.9rem;
    color: var(--mystic-gold);
    font-weight: 600;
}

/* ========== MAIN CONTENT GRID ========== */
.card-content-grid {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 40px;
    align-items: start;
    margin: 30px 0;
}

/* ========== SIDEBAR ========== */
.card-sidebar {
    position: sticky;
    top: 100px;
}

.meaning-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(212, 165, 116, 0.2);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    backdrop-filter: blur(10px);
}

.meaning-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.meaning-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.meaning-section h3 {
    color: var(--mystic-gold);
    margin-bottom: 12px;
    font-size: 1.1rem;
    font-family: 'Cinzel', serif;
}

.keywords {
    color: #e4c4ff;
    font-style: italic;
    margin-bottom: 15px;
    font-size: 0.95rem;
    line-height: 1.4;
}

.meaning-details p {
    margin-bottom: 8px;
    font-size: 0.9rem;
    line-height: 1.5;
    color: rgba(255,255,255,0.9);
}

.meaning-details strong {
    color: var(--mystic-gold);
}

/* ========== MAIN CONTENT ========== */
.card-main-content {
    min-height: auto;
}

.interpretation-section h2 {
    font-family: 'Cinzel', serif;
    color: var(--mystic-gold);
    font-size: 2rem;
    margin-bottom: 30px;
    text-align: center;
}

.content-block {
    margin-bottom: 35px;
    padding: 25px;
    background: rgba(255,255,255,0.02);
    border-radius: 12px;
    border: 1px solid rgba(212, 165, 116, 0.1);
}

.content-block h3 {
    color: #e4c4ff;
    margin-bottom: 15px;
    font-size: 1.3rem;
    font-family: 'Cinzel', serif;
}

.content-block p {
    line-height: 1.7;
    margin-bottom: 15px;
    color: rgba(255,255,255,0.9);
    font-size: 1rem;
}

.content-block strong {
    color: var(--mystic-gold);
}

.content-block em {
    color: #b8a7d6;
    font-style: italic;
}

.content-block a {
    color: var(--mystic-gold);
    text-decoration: none;
    border-bottom: 1px solid rgba(212, 165, 116, 0.4);
    transition: all 0.2s ease;
}

.content-block a:hover {
    color: #f0d89a;
    border-bottom-color: var(--mystic-gold);
}

/* ========== TECHNICAL METHODOLOGY ACCORDION ========== */
.technical-methodology {
    margin-top: 40px;
    border-top: 1px solid rgba(212, 165, 116, 0.2);
    padding-top: 30px;
}

.technical-methodology summary {
    cursor: pointer;
    color: rgba(255,255,255,0.5);
    font-size: 0.85rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    padding: 10px 0;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.technical-methodology summary::-webkit-details-marker {
    display: none;
}

.technical-methodology summary::before {
    content: '▸';
    transition: transform 0.2s ease;
}

.technical-methodology[open] summary::before {
    transform: rotate(90deg);
}

.technical-methodology summary:hover {
    color: rgba(255,255,255,0.7);
}

.technical-methodology .tech-content {
    margin-top: 20px;
    padding: 25px;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.9rem;
    line-height: 1.7;
    color: rgba(255,255,255,0.7);
}

.technical-methodology .tech-content h4 {
    color: rgba(255,255,255,0.9);
    font-size: 0.95rem;
    margin: 20px 0 10px 0;
    font-weight: 600;
}

.technical-methodology .tech-content h4:first-child {
    margin-top: 0;
}

.technical-methodology .tech-content p {
    margin-bottom: 12px;
}

.technical-methodology .tech-content ul {
    margin: 10px 0 15px 20px;
}

.technical-methodology .tech-content li {
    margin-bottom: 6px;
}

.technical-methodology .tech-content code {
    background: rgba(255,255,255,0.1);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85em;
}

.technical-methodology .tech-content a {
    color: var(--mystic-gold);
    text-decoration: none;
}

.technical-methodology .tech-content a:hover {
    text-decoration: underline;
}

/* ========== AD SLOTS ========== */
.ad-slot {
    margin: 30px 0;
    text-align: center;
}

.ad-leaderboard {
    grid-column: 1 / -1;
}

.ad-sidebar, .ad-in-content, .ad-content-bottom {
    background: rgba(255,255,255,0.02);
    border: 2px dashed rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 20px;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}

.ad-content-bottom {
    min-height: 90px;
}

.ad-leaderboard .ad-placeholder {
    min-height: 90px;
}

/* ========== THEMATIC AD PLACEHOLDERS ========== */
.ad-placeholder.thematic-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 25px 20px;
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.08), rgba(75, 0, 130, 0.12));
    border: 1px solid rgba(212, 165, 116, 0.15);
    border-radius: 12px;
    text-align: center;
    gap: 8px;
}

.ad-leaderboard .thematic-placeholder {
    flex-direction: row;
    gap: 20px;
    min-height: 90px;
    padding: 20px 40px;
}

.placeholder-symbol {
    font-size: 2.5rem;
    color: rgba(212, 165, 116, 0.7);
    line-height: 1;
}

.ad-leaderboard .placeholder-symbol {
    font-size: 2rem;
}

.placeholder-quote {
    font-style: italic;
    color: rgba(228, 196, 255, 0.85);
    font-size: 1rem;
    line-height: 1.5;
    max-width: 400px;
}

.ad-leaderboard .placeholder-quote {
    font-size: 1.1rem;
    max-width: 500px;
}

.placeholder-attribution {
    font-size: 0.85rem;
    color: rgba(184, 167, 214, 0.7);
}

.placeholder-text {
    color: rgba(212, 165, 116, 0.9);
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    font-weight: 600;
}

.placeholder-subtext {
    color: rgba(228, 196, 255, 0.7);
    font-size: 0.95rem;
    letter-spacing: 0.5px;
}

.placeholder-note {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
    margin-top: 5px;
}

/* ========== CARD STATS TEASER ========== */
.card-stats-teaser {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(212, 165, 116, 0.2);
    border-radius: 12px;
    padding: 30px;
    margin: 25px 0;
    min-height: 120px;
}

.stats-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    color: rgba(255, 255, 255, 0.6);
}

.stats-loading .loading-symbol {
    font-size: 2.5rem;
    color: rgba(212, 165, 116, 0.5);
    animation: pulse-fade 2s ease-in-out infinite;
}

.stats-loading .loading-text {
    font-style: italic;
    font-size: 0.95rem;
}

@keyframes pulse-fade {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

.card-stats-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

.stats-aggregate,
.stats-personal {
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    border: 1px solid rgba(212, 165, 116, 0.1);
}

.stats-aggregate h4,
.stats-personal h4 {
    color: rgba(212, 165, 116, 0.9);
    font-family: 'Cinzel', serif;
    margin-bottom: 15px;
    font-size: 1rem;
}

.stats-number {
    font-size: 2rem;
    font-weight: 700;
    color: #e4c4ff;
    display: block;
    margin-bottom: 5px;
}

.stats-label {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

.stats-insight {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-style: italic;
    font-size: 0.9rem;
    color: rgba(184, 167, 214, 0.9);
}

.card-cta-actions {
    margin-top: 25px;
}

/* Explore Arcana button styled as link */
.explore-arcana-btn {
    display: inline-flex;
    text-decoration: none;
    background: linear-gradient(135deg, rgba(75, 50, 120, 0.9), rgba(45, 30, 80, 0.95));
    border: 1px solid rgba(212, 165, 116, 0.4);
    color: #fff;
}

.explore-arcana-btn:hover {
    background: linear-gradient(135deg, rgba(90, 60, 140, 0.95), rgba(55, 35, 95, 0.98));
    border-color: rgba(212, 165, 116, 0.6);
    color: #fff;
}

.explore-arcana-btn .btn-text {
    color: #fff;
}

/* ========== STATS CONTENT (New layered display) ========== */
.stats-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    border: 1px solid rgba(212, 165, 116, 0.1);
    transition: all 0.3s ease;
}

.stat-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(212, 165, 116, 0.2);
}

.stat-item .stat-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    width: 35px;
    text-align: center;
}

.stat-item .stat-text {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.4;
}

.stat-item .stat-text strong {
    color: #e4c4ff;
}

/* Personal stats - highlight */
.stat-item.personal-stat {
    background: rgba(228, 196, 255, 0.08);
    border-color: rgba(228, 196, 255, 0.2);
}

/* Ranking stat */
.stat-item.ranking-stat {
    background: rgba(212, 165, 116, 0.08);
    border-color: rgba(212, 165, 116, 0.2);
}

/* Fallback state */
.stats-content.stats-fallback {
    text-align: center;
    padding: 20px;
}

.stats-content.stats-fallback .stat-item {
    justify-content: center;
    background: none;
    border: none;
}

.stats-content .explore-link {
    display: inline-block;
    margin-top: 15px;
    color: var(--mystic-gold);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

.stats-content .explore-link:hover {
    color: #fff;
    text-decoration: underline;
}

@media (max-width: 768px) {
    .stat-item {
        padding: 12px 15px;
    }

    .stat-item .stat-icon {
        font-size: 1.3rem;
        width: 30px;
    }

    .stat-item .stat-text {
        font-size: 0.9rem;
    }
}

@media (max-width: 768px) {
    .ad-leaderboard .thematic-placeholder {
        flex-direction: column;
        gap: 12px;
        padding: 20px;
    }

    .card-stats-content {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .card-stats-teaser {
        padding: 20px;
    }
}

/* ========== RELATED CARDS ========== */
.related-cards {
    margin: 50px 0 30px;
    padding: 30px;
    background: rgba(138, 43, 226, 0.05);
    border: 1px solid rgba(212, 165, 116, 0.2);
    border-radius: 12px;
}

.related-cards h3 {
    color: var(--mystic-gold);
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.3rem;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.related-card {
    background: rgba(138, 43, 226, 0.1);
    border: 1px solid rgba(212, 165, 116, 0.2);
    border-radius: 8px;
    padding: 20px 15px;
    text-decoration: none;
    color: white;
    transition: all 0.3s ease;
    display: block;
    text-align: center;
}

.related-card:hover {
    background: rgba(138, 43, 226, 0.2);
    transform: translateY(-3px);
    border-color: rgba(212, 165, 116, 0.4);
}

.card-name {
    display: block;
    font-weight: 600;
    color: var(--mystic-gold);
    font-size: 1rem;
    margin-bottom: 5px;
}

.card-desc {
    display: block;
    font-size: 0.8rem;
    color: #b8a7d6;
}

/* ========== CTA SECTIONS ========== */
.sidebar-cta {
    background: rgba(255,215,0,0.1);
    border: 1px solid rgba(255,215,0,0.3);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    margin-top: 25px;
}

.sidebar-cta p {
    margin-bottom: 15px;
    color: rgba(255,255,255,0.9);
    font-size: 0.95rem;
}

.cta-button {
    background: linear-gradient(135deg, var(--mystic-gold), #b8936d);
    color: var(--cosmic-black);
    padding: 12px 25px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    display: inline-block;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255,215,0,0.4);
}

.final-cta {
    background: linear-gradient(135deg, rgba(107, 70, 193, 0.2), rgba(138, 43, 226, 0.2));
    border: 1px solid rgba(212, 165, 116, 0.3);
    border-radius: 15px;
    padding: 40px;
    text-align: center;
    margin: 50px 0 30px;
}

.final-cta h2 {
    color: var(--mystic-gold);
    font-size: 1.8rem;
    margin-bottom: 15px;
    font-family: 'Cinzel', serif;
}

.final-cta p {
    color: rgba(255,255,255,0.9);
    font-size: 1rem;
    margin-bottom: 25px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.cta-button-large {
    background: linear-gradient(135deg, var(--mystic-gold), #b8936d);
    color: var(--cosmic-black);
    padding: 15px 30px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    display: inline-block;
    transition: all 0.3s ease;
    font-size: 1rem;
    border: none;
    cursor: pointer;
}

.cta-button-large:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(255,215,0,0.4);
}

/* ========== MOBILE RESPONSIVE - COMPLETE OVERHAUL ========== */
@media (max-width: 768px) {
    .card-page-container {
        padding: 15px;
        margin: 0 auto;
    }
    
    /* Hero section - simple stacked layout */
    .hero-content {
        grid-template-columns: 1fr;
        gap: 25px;
        text-align: center;
    }
    
    .card-image-section {
        position: static;
        order: 1;
        margin: 0 auto;
        max-width: 280px;
    }
    
    .card-intro-section {
        order: 2;
    }
    
    .card-intro-section h1 {
        font-size: 2rem;
        margin-bottom: 8px;
    }
    
    .card-tagline {
        font-size: 1.1rem;
        margin-bottom: 20px;
    }
    
    .card-quick-stats {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-top: 20px;
    }

    /* Hide hero sidebar on mobile - content appears elsewhere */
    .hero-sidebar {
        display: none;
    }
    
    .stat {
        padding: 12px 8px;
    }
    
    /* Main content - simple stack */
    .card-content-grid {
        grid-template-columns: 1fr;
        gap: 25px;
        margin: 25px 0;
    }
    
    .card-sidebar {
        position: static;
        order: 3;
    }
    
    .card-main-content {
        order: 2;
    }
    
    .interpretation-section h2 {
        font-size: 1.6rem;
        margin-bottom: 25px;
    }
    
    .content-block {
        padding: 20px;
        margin-bottom: 25px;
    }
    
    .content-block h3 {
        font-size: 1.2rem;
    }
    
    /* Related cards - single column */
    .related-cards {
        padding: 25px 20px;
        margin: 35px 0 25px;
    }
    
    .related-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .related-card {
        padding: 15px 12px;
    }
    
    /* Final CTA */
    .final-cta {
        padding: 30px 20px;
        margin: 40px 0 25px;
    }
    
    .final-cta h2 {
        font-size: 1.5rem;
    }
    
    /* Ads */
    .ad-sidebar, .ad-in-content {
        min-height: 200px;
        padding: 15px;
    }
    
    /* Ensure no sticky behavior on mobile */
    .card-image-section,
    .card-sidebar {
        position: static !important;
    }
}

/* ========== ANIMATIONS ========== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-hero {
    animation: fadeInUp 0.6s ease-out;
}

.card-content-grid {
    animation: fadeInUp 0.8s ease-out 0.1s both;
}

.final-cta {
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

/* ========== SCROLL BEHAVIOR FIX ========== */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}




/* Card Mirror CTA Styles */
.card-mirror-actions {
    text-align: center;
    margin-top: 2rem;
}

.card-mirror-actions .cta-button-large {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    font-size: 1.2rem;
    background: linear-gradient(135deg, #8b0000, #2a0c45);
    border: 2px solid #d4a574;
    border-radius: 50px;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.card-mirror-actions .cta-button-large:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 0, 0, 0.3);
    background: linear-gradient(135deg, #a52a2a, #3a1c5f);
}

.card-mirror-actions .btn-icon {
    font-size: 1.5rem;
}

.card-mirror-actions .privacy-note {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

/* Card Mirror Results Styles */
.card-mirror-result {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

.card-mirror-result .composite-image {
    text-align: center;
}

.card-mirror-result .insight-text {
    background: rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
    border-radius: 10px;
    border-left: 4px solid #d4a574;
    font-style: italic;
    line-height: 1.6;
}

.card-mirror-result .share-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .card-mirror-result {
        grid-template-columns: 1fr;
    }
    
    .card-mirror-result .share-actions {
        flex-direction: column;
    }
}

/* ==============================================================================
   CARD MIRROR CSS FIXES - Add these to section-3-tarot-app/frontend/css/styles.css
   ============================================================================== */

/* Fix 1: Make the outer modal wrapper clickable to dismiss */
.cosmic-camera-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 1rem; /* Add padding so modal doesn't touch edges */
    overflow-y: auto; /* Allow scrolling of entire modal area */
}

/* Fix 2: Make the inner content box scrollable with max height */
.camera-interface {
    background: linear-gradient(135deg, 
        rgba(138, 43, 226, 0.15), 
        rgba(75, 0, 130, 0.25));
    border: 2px solid rgba(212, 165, 116, 0.3);
    border-radius: 20px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh; /* Limit height to 90% of viewport */
    overflow-y: auto; /* Make it scrollable */
    box-shadow: 0 0 50px rgba(138, 43, 226, 0.3);
    position: relative;
    /* Prevent clicks on inner content from closing modal */
}

/* Fix 3: Style the scrollbar */
.camera-interface::-webkit-scrollbar {
    width: 8px;
}

.camera-interface::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.camera-interface::-webkit-scrollbar-thumb {
    background: rgba(212, 165, 116, 0.5);
    border-radius: 4px;
}

.camera-interface::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 165, 116, 0.7);
}

/* Fix 4: Also fix the cosmic-mirror-modal class (used for results/processing) */
.cosmic-mirror-modal {
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.1), rgba(75, 0, 130, 0.1));
    border: 1px solid rgba(212, 165, 116, 0.3);
    border-radius: 20px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh; /* Limit height */
    overflow-y: auto; /* Make scrollable */
    text-align: center;
    position: relative;
    backdrop-filter: blur(20px);
    z-index: 20000;
}

/* Fix 5: Style scrollbar for cosmic-mirror-modal too */
.cosmic-mirror-modal::-webkit-scrollbar {
    width: 8px;
}

.cosmic-mirror-modal::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.cosmic-mirror-modal::-webkit-scrollbar-thumb {
    background: rgba(212, 165, 116, 0.5);
    border-radius: 4px;
}

.cosmic-mirror-modal::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 165, 116, 0.7);
}

/* Fix 6: Reduce video height on smaller screens */
#cosmic-video,
#card-mirror-video {
    width: 100%;
    height: 240px; /* Reduced from 300px */
    object-fit: cover;
    transform: scaleX(-1); /* Mirror effect */
    display: block;
}

/* Fix 7: Mobile optimizations - even more compact */
@media (max-width: 768px) {
    .camera-interface,
    .cosmic-mirror-modal {
        padding: 1rem;
        margin: 0.5rem;
        max-height: 95vh; /* Use more of the screen on mobile */
    }
    
    #cosmic-video,
    #card-mirror-video {
        height: 200px; /* Even smaller on mobile */
    }
    
    .camera-title {
        font-size: 1.3rem; /* Smaller title on mobile */
        margin: 0.5rem 0;
    }
    
    .camera-instruction {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }
    
    .lens-selector {
        padding: 0.75rem;
        margin: 1rem 0;
    }
    
    .selector-controls {
        flex-direction: column;
    }
    
    .camera-controls {
        flex-direction: column;
    }
    
    .magical-btn {
        width: 100%;
        padding: 0.75rem 1rem;
    }
}

/* Fix 8: Very small screens (iPhone SE, etc) */
@media (max-width: 375px) {
    .camera-interface,
    .cosmic-mirror-modal {
        padding: 0.75rem;
        max-height: 98vh;
    }
    
    #cosmic-video,
    #card-mirror-video {
        height: 180px;
    }
    
    .oracle-symbol {
        font-size: 2rem;
    }
}



/* ========== CARD MIRROR RESULTS REDESIGN ========== */
.card-mirror-result {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin: 2rem 0;
    text-align: center;
}

.card-mirror-result .composite-image {
    order: 1; /* Image first */
}

.card-mirror-result .composite-image img {
    max-width: 100%;
    max-height: 60vh; /* Much larger image */
    width: auto;
    height: auto;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.6);
    border: 2px solid rgba(212, 165, 116, 0.4);
}

.card-mirror-result .card-insight {
    order: 2; /* Text second */
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.card-mirror-result .insight-text {
    background: rgba(0,0,0,0.3);
    padding: 2rem;
    border-radius: 15px;
    line-height: 1.7;
    font-size: 1.1rem;
    border-left: 4px solid #d4a574;
    text-align: left;
    font-style: italic;
}

.card-mirror-result .share-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.card-mirror-result .share-actions .magical-btn.primary {
    width: 100%;
    padding: 1.2rem;
    background: linear-gradient(135deg, #8a2be2, #4b0082);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.card-mirror-result .share-actions .magical-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(138, 43, 226, 0.4);
}

.card-mirror-result .share-actions .magical-btn.secondary {
    width: 100%;
    padding: 1rem;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.card-mirror-result .share-actions .magical-btn.secondary:hover {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.3);
}

/* Make the modal wider for the new layout */
.cosmic-mirror-modal[style*="max-width: 700px"] {
    max-width: 800px !important; /* Wider modal */
}

/* Mobile responsive */
@media (max-width: 768px) {
    .card-mirror-result .composite-image img {
        max-height: 50vh; /* Slightly smaller on mobile */
    }
    
    .card-mirror-result .insight-text {
        padding: 1.5rem;
        font-size: 1rem;
    }
    
    .cosmic-mirror-modal[style*="max-width: 700px"] {
        max-width: 95% !important;
        margin: 1rem;
    }
}

/* Death card specific styling */
.card-mirror-result .oracle-symbol {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.card-mirror-result h2 {
    background: linear-gradient(135deg, #d4a574, #8a2be2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 1rem 0;
    font-family: 'Cinzel', serif;
    font-size: 2rem;
}

/* Add a subtle caption below the image */
.composite-image::after {
    content: "Your death card mirror";
    display: block;
    margin-top: 0.5rem;
    color: rgba(255,255,255,0.6);
    font-size: 0.9rem;
    font-style: italic;
}


/* ========== COSMIC MIRROR MODAL STYLES ========== */
.cosmic-camera-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 1rem;
    overflow-y: auto;
}

.cosmic-mirror-modal {
    background: linear-gradient(135deg, 
        rgba(138, 43, 226, 0.15), 
        rgba(75, 0, 130, 0.25));
    border: 2px solid rgba(212, 165, 116, 0.3);
    border-radius: 20px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 0 50px rgba(138, 43, 226, 0.3);
    position: relative;
    backdrop-filter: blur(20px);
    text-align: center;
}

.oracle-symbol {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.camera-title {
    color: #d4a574;
    font-family: 'Cinzel', serif;
    font-size: 1.8rem;
    margin: 1rem 0;
}

.camera-instruction {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

/* Camera video and controls */
.crystal-viewfinder {
    position: relative;
    margin: 1.5rem 0;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
}

#cosmic-video {
    width: 100%;
    height: 240px;
    object-fit: cover;
    transform: scaleX(-1);
    display: block;
}

.viewfinder-frame {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid rgba(212, 165, 116, 0.5);
    pointer-events: none;
}

/* Camera controls */
.camera-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.magical-btn {
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.3), rgba(75, 0, 130, 0.4));
    border: 1px solid rgba(212, 165, 116, 0.4);
    border-radius: 25px;
    padding: 0.75rem 1.5rem;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.magical-btn:hover {
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.5), rgba(75, 0, 130, 0.6));
    border-color: rgba(212, 165, 116, 0.7);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(138, 43, 226, 0.3);
}

.magical-btn.primary {
    background: linear-gradient(135deg, #8a2be2, #4b0082);
    border-color: #d4a574;
}

.magical-btn.primary:hover {
    background: linear-gradient(135deg, #9a3bf2, #5b1092);
    box-shadow: 0 5px 20px rgba(138, 43, 226, 0.4);
}

/* Lens selector */
.lens-selector {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(212, 165, 116, 0.2);
    border-radius: 12px;
    padding: 1rem;
    margin: 1rem 0;
}

.selector-label {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.selector-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.magical-select {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(212, 165, 116, 0.3);
    border-radius: 8px;
    padding: 0.5rem;
    color: white;
    flex: 1;
}

.selector-hint {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

/* Error states */
.camera-error {
    background: rgba(220, 53, 69, 0.2);
    border: 1px solid rgba(220, 53, 69, 0.5);
    border-radius: 8px;
    padding: 1rem;
    color: #f8d7da;
    margin-top: 1rem;
}

/* Loading spinner */
.cosmic-spinner {
    margin: 2rem auto;
    width: 60px;
    height: 60px;
    border: 4px solid rgba(212, 165, 116, 0.2);
    border-top: 4px solid #d4a574;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Mobile responsive */
@media (max-width: 768px) {
    .cosmic-mirror-modal {
        padding: 1rem;
        margin: 0.5rem;
        max-height: 95vh;
    }
    
    #cosmic-video {
        height: 200px;
    }
    
    .camera-title {
        font-size: 1.4rem;
    }
    
    .camera-controls {
        flex-direction: column;
    }
    
    .magical-btn {
        width: 100%;
        justify-content: center;
    }
    
    .selector-controls {
        flex-direction: column;
    }
}


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

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

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 3px solid rgba(138, 43, 226, 0.2);
    border-top-color: #FFD700;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

.loading-text {
    color: #FFD700;
    font-size: 1.3rem;
    font-family: 'Cinzel', serif;
}



