/* Premium Mystical CSS styling for Aether Tarot */

/* ----------------------------------------------------
   CSS Variables & Design Tokens
   ---------------------------------------------------- */
:root {
    --bg-dark: #0d0a15;
    --bg-gradient: linear-gradient(135deg, #0d0a15 0%, #161129 100%);
    --bg-glass: rgba(26, 20, 42, 0.7);
    --border-glass: rgba(212, 175, 55, 0.15);
    
    /* Elegant Tarot Gold Colors */
    --gold-light: #f3e5ab;
    --gold: #d4af37;
    --gold-dark: #aa841c;
    --gold-glow: rgba(212, 175, 55, 0.4);
    
    /* Text colors */
    --text-primary: #f0e6ff;
    --text-secondary: #bbaec9;
    --text-muted: #7f7093;
    
    /* Typography scale */
    --font-serif: 'Cinzel Decorative', Georgia, serif;
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ----------------------------------------------------
   Reset & Base Layout
   ---------------------------------------------------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* Disable highlight on mobile touch */
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 16px;
    user-select: none; /* Lock user selection for gaming feel */
}

/* ----------------------------------------------------
   Responsive Layout Core
   ---------------------------------------------------- */
#app-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--bg-gradient);
}

#phaser-container {
    width: 100%;
    height: 100%;
    max-width: 800px;
    max-height: 1400px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.9);
    z-index: 1;
}

/* ----------------------------------------------------
   UI Overlays Common
   ---------------------------------------------------- */
.overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    max-width: 800px;
    max-height: 1400px;
    z-index: 10;
    display: none;
    flex-direction: column;
    pointer-events: auto;
}

.overlay-hud {
    position: absolute;
    top: 6%;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 720px;
    z-index: 8;
    pointer-events: auto;
}

.active-flex {
    display: flex !important;
}

.font-cinzel {
    font-family: var(--font-serif);
    letter-spacing: 0.1em;
}

/* ----------------------------------------------------
   Preloader Style
   ---------------------------------------------------- */
#preloader {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--bg-dark);
    z-index: 99;
    transition: opacity 0.5s ease;
}

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

.mystical-symbol {
    font-size: 4rem;
    color: var(--gold);
    animation: pulseGlow 2.5s infinite ease-in-out;
    margin-bottom: 20px;
}

#loading-text {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    letter-spacing: 2px;
    color: var(--text-secondary);
}

/* ----------------------------------------------------
   Utility Control Buttons (Top Bar)
   ---------------------------------------------------- */
.top-controls {
    position: absolute;
    top: 20px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 30px;
    z-index: 12;
}

.control-btn {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--gold);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
}

.control-btn:hover, .control-btn:active {
    border-color: var(--gold);
    box-shadow: 0 0 10px var(--gold-glow);
    transform: scale(1.05);
}

#lang-toggle {
    width: auto;
    padding: 0 15px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.85rem;
}

.muted {
    opacity: 0.6;
}

/* ----------------------------------------------------
   Main Menu Overlay
   ---------------------------------------------------- */
#menu-container {
    background: radial-gradient(circle at center, rgba(22, 17, 41, 0.4) 0%, rgba(13, 10, 21, 0.85) 100%);
    padding: 100px 30px 40px 30px;
    justify-content: flex-start;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Custom Scrollbar for Menu Container */
#menu-container::-webkit-scrollbar {
    width: 6px;
}
#menu-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}
#menu-container::-webkit-scrollbar-thumb {
    background: var(--gold-dark);
    border-radius: 3px;
}
#menu-container::-webkit-scrollbar-thumb:hover {
    background: var(--gold);
}

.menu-header {
    text-align: center;
    margin-top: 30px;
}

.menu-header h1 {
    font-size: 2.5rem;
    color: var(--gold);
    text-shadow: 0 0 15px var(--gold-glow);
    margin-bottom: 8px;
}

.menu-header p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

.gold-line {
    width: 80px;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--gold) 50%, transparent 100%);
    margin: 20px auto 0 auto;
}

.spreads-section {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 20px;
    margin-top: 40px;
}

.section-title {
    font-family: var(--font-serif);
    font-size: 1.2rem;
    text-align: center;
    color: var(--gold-light);
    letter-spacing: 2px;
    margin-bottom: 5px;
    opacity: 0.9;
}

.spread-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    backdrop-filter: blur(10px);
}

.spread-card:hover, .spread-card:active {
    border-color: var(--gold);
    box-shadow: 0 0 15px var(--gold-glow);
    transform: translateY(-2px);
    background: rgba(35, 27, 56, 0.85);
}

.spread-icon {
    font-size: 1.5rem;
    color: var(--gold);
    width: 60px;
    text-align: center;
    text-shadow: 0 0 8px var(--gold-glow);
}

.spread-info h3 {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    color: var(--gold-light);
    margin-bottom: 5px;
}

.spread-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* ----------------------------------------------------
   HUD HUD Interface
   ---------------------------------------------------- */
.hud-container {
    text-align: center;
    background: rgba(13, 10, 21, 0.8);
    border: 1px solid var(--border-glass);
    border-radius: 30px;
    padding: 15px 30px;
    backdrop-filter: blur(8px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.hud-text {
    font-size: 1rem;
    letter-spacing: 1px;
    color: var(--text-primary);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.hud-btn {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    border: none;
    color: var(--bg-dark);
    font-weight: bold;
    font-size: 0.9rem;
    padding: 12px 35px;
    border-radius: 25px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
    transition: all 0.3s ease;
}

.hud-btn:hover, .hud-btn:active {
    box-shadow: 0 4px 20px var(--gold-glow);
    transform: scale(1.03);
}

/* ----------------------------------------------------
   Reading Overlay Drawer (Slide-up Sheet)
   ---------------------------------------------------- */
.overlay-drawer {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 50%; /* Covers half screen in portrait, leaves Phaser canvas visible */
    max-width: 800px;
    background: var(--bg-glass);
    border-top: 2px solid var(--gold);
    border-radius: 20px 20px 0 0;
    z-index: 15;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(20px);
    box-shadow: 0 -10px 40px rgba(0,0,0,0.8);
    animation: slideUp 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
    pointer-events: auto;
}

.drawer-header {
    text-align: center;
    padding: 15px 15px 5px 15px;
    position: relative;
}

.drawer-handle {
    width: 40px;
    height: 4px;
    background: var(--text-muted);
    border-radius: 2px;
    margin: 0 auto 10px auto;
}

.drawer-header h2 {
    font-size: 1.4rem;
    color: var(--gold);
    text-shadow: 0 0 10px var(--gold-glow);
}

.drawer-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px 30px;
    /* Smooth iOS kinetic scrolling */
    -webkit-overflow-scrolling: touch;
}

.drawer-footer {
    padding: 8px 30px 62px 30px; /* Padded to clear the 50px ad banner at the bottom */
    display: flex;
    justify-content: center;
}

body.premium-mode .drawer-footer {
    padding: 8px 30px 12px 30px; /* Revert to normal padding when premium is active (ad banner hidden) */
}

.footer-btn {
    background: transparent;
    border: 1px solid var(--gold);
    color: var(--gold);
    font-weight: 500;
    font-size: 0.82rem;
    padding: 8px 24px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.footer-btn:hover, .footer-btn:active {
    background: var(--gold);
    color: var(--bg-dark);
    box-shadow: 0 0 15px var(--gold-glow);
}

/* ----------------------------------------------------
   Reading Accordions & Card Segment Elements
   ---------------------------------------------------- */
.reading-card-segment {
    margin-bottom: 25px;
    padding: 15px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    transition: all 0.4s ease;
}

.active-segment {
    border-color: rgba(212, 175, 55, 0.3);
    background: rgba(212, 175, 55, 0.05);
    box-shadow: inset 0 0 15px rgba(212, 175, 55, 0.05);
}

.segment-position {
    font-family: var(--font-serif);
    font-size: 0.9rem;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 5px;
}

.segment-card-title {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.segment-markov-text {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 15px;
    text-align: justify;
}

.segment-markov-text strong {
    color: var(--gold-light);
}

.segment-details-accordion {
    padding-top: 15px;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.segment-details-accordion p {
    margin-bottom: 10px;
}

.segment-details-accordion p strong {
    color: var(--gold);
}

.accordion-sub-section {
    margin-top: 10px;
}

.accordion-title {
    display: block;
    color: var(--gold);
    font-weight: 500;
    margin-bottom: 5px;
}

.accordion-sub-section ul {
    list-style: none;
    padding-left: 10px;
}

.accordion-sub-section li {
    position: relative;
    margin-bottom: 4px;
    line-height: 1.4;
    padding-left: 12px;
}

.accordion-sub-section li::before {
    content: "✦";
    position: absolute;
    left: 0;
    top: 0;
    color: var(--gold-dark);
    font-size: 0.7rem;
}

.reading-divider {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(212,175,55,0.2) 50%, transparent 100%);
    margin: 20px 0;
}

/* Custom Scrollbar */
.drawer-body::-webkit-scrollbar {
    width: 6px;
}

.drawer-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.drawer-body::-webkit-scrollbar-thumb {
    background: var(--gold-dark);
    border-radius: 3px;
}

.drawer-body::-webkit-scrollbar-thumb:hover {
    background: var(--gold);
}

/* ----------------------------------------------------
   Animations
   ---------------------------------------------------- */
@keyframes pulseGlow {
    0%, 100% {
        opacity: 0.6;
        transform: scale(0.98);
        text-shadow: 0 0 10px rgba(212, 175, 55, 0.2);
    }
    50% {
        opacity: 1;
        transform: scale(1.02);
        text-shadow: 0 0 25px rgba(212, 175, 55, 0.7);
    }
}

@keyframes slideUp {
    from {
        transform: translate(-50%, 100%);
    }
    to {
        transform: translate(-50%, 0);
    }
}

/* ----------------------------------------------------
   Media Queries & Platform Adjustments
   ---------------------------------------------------- */

/* Landscape Mode Fallback or wide screens */
@media (min-width: 800px) {
    #app-container {
        background-color: #050409;
    }
    
    #phaser-container, .overlay {
        border-left: 1px solid var(--border-glass);
        border-right: 1px solid var(--border-glass);
    }
}

/* Tall/Narrow Screen Layout Scaling (e.g. iPhone SE / smaller androids) */
@media (max-height: 600px) {
    .menu-header h1 {
        font-size: 2rem;
    }
    
    .spread-card {
        padding: 12px;
        gap: 15px;
    }
    
    .spread-icon {
        font-size: 1.2rem;
        width: 40px;
    }
}

/* Capacitor/Cordova webview optimizations for Android/iOS */
body.cordova, body.capacitor {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

/* Phaser Canvas Scaling & Quality Optimization */
#phaser-container canvas {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: auto;
    -ms-interpolation-mode: bicubic;
}

/* Ad Banner Mock Container */
#ad-banner-container {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 800px;
    height: 50px;
    background: rgba(13, 10, 21, 0.95);
    border-top: 1px solid var(--border-glass);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    letter-spacing: 1px;
}

#ad-banner-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ad-badge {
    background: var(--gold-dark);
    color: var(--bg-dark);
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: bold;
}

/* Premium Modals & Buttons */
.premium-btn {
    background: linear-gradient(135deg, #ffd700 0%, #aa841c 100%) !important;
    color: var(--bg-dark) !important;
    border: none !important;
    font-weight: bold !important;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4) !important;
}

.premium-btn:hover {
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.8) !important;
    transform: scale(1.05);
}

/* Modal styling for Mock IAP Store */
.iap-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 400px;
    background: var(--bg-glass);
    border: 2px solid var(--gold);
    border-radius: 16px;
    padding: 30px;
    z-index: 200;
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    backdrop-filter: blur(25px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.9);
    animation: fadeIn 0.3s ease;
}

.iap-modal h3 {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    color: var(--gold);
    margin-bottom: 15px;
}

.iap-modal p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 25px;
}

.iap-modal-buttons {
    display: flex;
    gap: 15px;
    width: 100%;
}

.iap-modal-buttons button {
    flex: 1;
    padding: 12px;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.iap-cancel {
    background: transparent;
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
}

.iap-cancel:hover {
    background: rgba(255, 255, 255, 0.05);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translate(-50%, -48%); }
    to { opacity: 1; transform: translate(-50%, -50%); }
}

/* Premium Promo Card inside the menu */
.premium-promo-card {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.08) 0%, rgba(26, 20, 42, 0.8) 100%);
    border: 1px solid rgba(212, 175, 55, 0.3);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.1), inset 0 0 15px rgba(212, 175, 55, 0.05);
    border-radius: 14px;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin: 15px 0 25px 0;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    animation: goldGlowPulse 4s infinite ease-in-out;
    transition: all 0.4s ease;
    flex-shrink: 0;
}

.premium-promo-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -50%;
    width: 200%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.1), transparent);
    transform: skewX(-25deg);
    animation: goldShineSweep 6s infinite ease-in-out;
    pointer-events: none;
}

@keyframes goldGlowPulse {
    0%, 100% {
        box-shadow: 0 0 15px rgba(212, 175, 55, 0.05), inset 0 0 15px rgba(212, 175, 55, 0.02);
        border-color: rgba(212, 175, 55, 0.25);
    }
    50% {
        box-shadow: 0 0 25px rgba(212, 175, 55, 0.2), inset 0 0 25px rgba(212, 175, 55, 0.1);
        border-color: rgba(212, 175, 55, 0.55);
    }
}

@keyframes goldShineSweep {
    0% { left: -100%; }
    20%, 100% { left: 100%; }
}

.premium-badge-emblem {
    position: relative;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.emblem-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px dashed rgba(212, 175, 55, 0.6);
    border-radius: 50%;
    animation: rotateRing 12s linear infinite;
}

.emblem-star {
    position: absolute;
    color: var(--gold-light);
    font-size: 1.1rem;
    text-shadow: 0 0 8px var(--gold-glow);
    animation: pulseStar 2s infinite ease-in-out;
}

.emblem-crown {
    position: absolute;
    font-size: 0.75rem;
    top: 9px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

@keyframes rotateRing {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes pulseStar {
    0%, 100% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.15); opacity: 1; }
}

.premium-promo-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: left;
    margin-left: 15px;
    margin-right: 15px;
}

.premium-promo-card .premium-btn {
    padding: 8px 18px !important;
    font-size: 0.8rem !important;
    border-radius: 18px !important;
    flex-shrink: 0;
    margin-left: auto;
}

.premium-promo-info h3 {
    font-family: var(--font-serif);
    font-size: 0.95rem;
    color: var(--gold-light);
    letter-spacing: 1px;
    margin-bottom: 2px;
    line-height: 1.1;
    text-shadow: 0 0 8px rgba(212, 175, 55, 0.3);
    white-space: nowrap;
}

.premium-promo-info p {
    font-family: var(--font-sans);
    font-size: 0.72rem;
    color: var(--text-secondary);
    line-height: 1.2;
}

/* Active State Styles */
.premium-active {
    background: linear-gradient(135deg, rgba(144, 128, 192, 0.1) 0%, rgba(26, 20, 42, 0.9) 100%);
    border: 1px solid rgba(144, 128, 192, 0.4);
    box-shadow: 0 0 20px rgba(144, 128, 192, 0.1);
    animation: purpleGlowPulse 4s infinite ease-in-out;
}

.premium-active .emblem-ring {
    border-color: rgba(144, 128, 192, 0.7);
    animation-duration: 20s;
}

.premium-active .premium-promo-info h3 {
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
}

@keyframes purpleGlowPulse {
    0%, 100% {
        box-shadow: 0 0 15px rgba(144, 128, 192, 0.05);
        border-color: rgba(144, 128, 192, 0.3);
    }
    50% {
        box-shadow: 0 0 25px rgba(144, 128, 192, 0.2);
        border-color: rgba(144, 128, 192, 0.6);
    }
}

/* Crown button top navigation styling override */
#remove-ads-btn {
    border-color: rgba(212, 175, 55, 0.4) !important;
    background: var(--bg-glass) !important;
    color: var(--gold) !important;
    box-shadow: none !important;
}

#remove-ads-btn:hover {
    border-color: var(--gold) !important;
    box-shadow: 0 0 10px var(--gold-glow) !important;
}



