/* Cinematic Enhancements - Premium Game Visuals */

/* Import Google Fonts for better typography */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Pirata+One&family=MedievalSharp&display=swap');

/* Global enhancements */
* {
    box-sizing: border-box;
}

body {
    background: 
        radial-gradient(ellipse at top, rgba(44, 62, 80, 0.8) 0%, rgba(44, 62, 80, 0.9) 50%, rgba(44, 62, 80, 1) 100%),
        linear-gradient(135deg, #2c3e50 0%, #34495e 25%, #2c3e50 50%, #34495e 75%, #2c3e50 100%);
    background-size: 400% 400%;
    animation: gradientShift 20s ease infinite;
    position: relative;
    overflow-x: hidden;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Floating particles container */
#particles-js {
    background: transparent;
}

/* Enhanced Welcome Modal */
.welcome-content {
    background: 
        linear-gradient(145deg, rgba(139, 105, 20, 0.1) 0%, rgba(191, 149, 63, 0.05) 100%),
        radial-gradient(ellipse at center, rgba(44, 62, 80, 0.95) 0%, rgba(52, 73, 94, 0.98) 100%);
    border: 3px solid transparent;
    background-clip: padding-box;
    position: relative;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* Wooden border effect */
.welcome-content::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    background: linear-gradient(45deg, 
        #8B6914 0%, #BF953F 25%, #FFD700 50%, #BF953F 75%, #8B6914 100%);
    background-size: 400% 400%;
    border-radius: 18px;
    z-index: -1;
    animation: goldenShimmer 4s ease infinite;
}

@keyframes goldenShimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Enhanced typography */
.welcome-title {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    background: linear-gradient(45deg, #FFD700, #BF953F, #FFD700);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: textShimmer 3s ease infinite;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.8));
    letter-spacing: 2px;
}

@keyframes textShimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Enhanced pirate decorations */
.pirate-decoration span {
    display: inline-block;
    font-size: 2em;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.6));
    animation: treasureBob 3s ease-in-out infinite;
}

.pirate-decoration span:nth-child(1) { animation-delay: 0s; }
.pirate-decoration span:nth-child(2) { animation-delay: 0.5s; }
.pirate-decoration span:nth-child(3) { animation-delay: 1s; }

@keyframes treasureBob {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    25% { transform: translateY(-8px) rotate(-5deg); }
    50% { transform: translateY(0px) rotate(0deg); }
    75% { transform: translateY(-4px) rotate(5deg); }
}

/* Enhanced speech bubble */
.speech-bubble {
    background: 
        linear-gradient(145deg, rgba(139, 105, 20, 0.2) 0%, rgba(191, 149, 63, 0.1) 100%),
        rgba(52, 73, 94, 0.95);
    border: 2px solid transparent;
    background-clip: padding-box;
    position: relative;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.speech-bubble::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #BF953F, #FFD700, #BF953F);
    border-radius: 22px;
    z-index: -1;
}

/* Enhanced captain avatar */
.captain-avatar {
    font-size: 4em;
    filter: drop-shadow(0 0 20px rgba(191, 149, 63, 0.8));
    animation: captainSway 4s ease-in-out infinite;
}

@keyframes captainSway {
    0%, 100% { transform: rotate(-2deg) scale(1); }
    25% { transform: rotate(2deg) scale(1.05); }
    50% { transform: rotate(-1deg) scale(1); }
    75% { transform: rotate(1deg) scale(1.05); }
}

/* Enhanced trial boxes */
.trial-box {
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

.trial-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shimmerSweep 3s infinite;
}

@keyframes shimmerSweep {
    0% { left: -100%; }
    100% { left: 100%; }
}

.free-trial {
    background: 
        linear-gradient(145deg, rgba(46, 204, 113, 0.15) 0%, rgba(39, 174, 96, 0.1) 100%),
        rgba(52, 73, 94, 0.8);
    border: 2px solid #2ecc71;
    box-shadow: 
        0 0 30px rgba(46, 204, 113, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.premium-upgrade {
    background: 
        linear-gradient(145deg, rgba(191, 149, 63, 0.15) 0%, rgba(139, 105, 20, 0.1) 100%),
        rgba(52, 73, 94, 0.8);
    border: 2px solid #BF953F;
    box-shadow: 
        0 0 30px rgba(191, 149, 63, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Enhanced premium price */
.premium-price {
    background: linear-gradient(45deg, #BF953F, #FFD700, #BF953F);
    background-size: 300% 300%;
    animation: priceGlow 2s ease infinite;
    color: #2c3e50;
    font-family: 'Cinzel', serif;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    box-shadow: 
        0 4px 20px rgba(191, 149, 63, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

@keyframes priceGlow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Enhanced buttons */
.treasure-button {
    font-family: 'Cinzel', serif;
    font-weight: 600;
    background: linear-gradient(45deg, #8B6914, #BF953F, #FFD700, #BF953F, #8B6914);
    background-size: 300% 300%;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
}

.treasure-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.treasure-button:hover::before {
    left: 100%;
}

.treasure-button:hover {
    background-position: 100% 50%;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(191, 149, 63, 0.5);
}

/* Card enhancements */
.card {
    perspective: 1000px;
    transition: all 0.3s ease;
    position: relative;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(191, 149, 63, 0.3);
}

.card-inner {
    transform-style: preserve-3d;
    transition: transform 0.6s ease;
}

.card.flipping .card-inner {
    transform: rotateY(180deg);
}

/* Floating coin animation */
.floating-coin {
    animation: coinFloat 8s linear infinite;
}

@keyframes coinFloat {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 0.8;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) rotate(360deg);
        opacity: 0;
    }
}

/* Treasure sparkle effects */
.treasure-sparkle {
    animation: sparkleGlow 0.8s ease-out forwards;
}

@keyframes sparkleGlow {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 1;
        box-shadow: 0 0 5px #FFD700;
    }
    50% {
        transform: scale(1.5) rotate(180deg);
        opacity: 1;
        box-shadow: 0 0 20px #FFD700;
    }
    100% {
        transform: scale(0) rotate(360deg);
        opacity: 0;
        box-shadow: 0 0 30px #FFD700;
    }
}

/* Enhanced game header */
.game-header {
    background: 
        linear-gradient(145deg, rgba(139, 105, 20, 0.1) 0%, rgba(191, 149, 63, 0.05) 100%),
        rgba(44, 62, 80, 0.9);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 2px solid rgba(191, 149, 63, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.game-header h1 {
    font-family: 'Cinzel', serif;
    background: linear-gradient(45deg, #FFD700, #BF953F);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.5));
}

/* Enhanced score panels */
.score-box {
    background: 
        linear-gradient(145deg, rgba(191, 149, 63, 0.1) 0%, rgba(139, 105, 20, 0.05) 100%),
        rgba(52, 73, 94, 0.8);
    border: 1px solid rgba(191, 149, 63, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.score-box:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(191, 149, 63, 0.2);
}

/* Enhanced inventory */
.inventory-slot {
    background: 
        linear-gradient(145deg, rgba(52, 73, 94, 0.8) 0%, rgba(44, 62, 80, 0.9) 100%);
    border: 2px solid rgba(191, 149, 63, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.inventory-slot::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(191, 149, 63, 0.1) 50%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.inventory-slot:hover::before {
    opacity: 1;
}

.inventory-slot:not(:has(.empty-slot-indicator)) {
    border-color: #BF953F;
    box-shadow: 0 0 15px rgba(191, 149, 63, 0.4);
    animation: inventoryGlow 2s ease-in-out infinite alternate;
}

@keyframes inventoryGlow {
    from { box-shadow: 0 0 15px rgba(191, 149, 63, 0.4); }
    to { box-shadow: 0 0 25px rgba(191, 149, 63, 0.6); }
}

/* Enhanced modals */
.modal.active {
    animation: modalFadeIn 0.4s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(8px);
    }
}

/* Enhanced control buttons */
.control-button {
    background: 
        linear-gradient(145deg, rgba(191, 149, 63, 0.8) 0%, rgba(139, 105, 20, 0.9) 100%);
    border: 1px solid rgba(191, 149, 63, 0.5);
    color: #2c3e50;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.control-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.3s ease;
}

.control-button:hover::before {
    left: 100%;
}

.control-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(191, 149, 63, 0.4);
}

/* Enhanced notification system */
.notification {
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(191, 149, 63, 0.3);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* Loading animations for better perceived performance */
.loading-shimmer {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Mobile enhancements */
@media (max-width: 768px) {
    .treasure-button {
        font-size: 1em;
        padding: 10px 20px;
    }
    
    .welcome-title {
        font-size: 1.6em;
    }
    
    .captain-avatar {
        font-size: 3em;
    }
    
    .pirate-decoration span {
        font-size: 1.5em;
    }
}

/* Accessibility enhancements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .welcome-content {
        border: 3px solid #FFD700;
        background: #000;
        color: #FFF;
    }
    
    .treasure-button {
        background: #FFD700;
        color: #000;
        border: 2px solid #FFF;
    }
}
