:root {
    /* These values will be overridden by config.js */
    --primary-color: #FF0000;
    --secondary-color: #000000;
    --tertiary-color: #FFFFFF;
    --background-color: #333333;
    --font-family: 'Press Start 2P', cursive;
    
    /* These values are not in config.js but can be adjusted here */
    --pixel-border: 4px solid var(--secondary-color);
    --base-font-size: 16px;
    --button-size: 44px;
    --spacing-unit: 1rem;
    --transition-speed: 0.3s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-family);
}

body {
    background-color: var(--secondary-color);
    color: var(--tertiary-color);
    overflow-x: hidden;
    -webkit-tap-highlight-color: rgba(255, 0, 0, 0.3); /* Custom tap highlight color */
    touch-action: manipulation; /* Disable double-tap to zoom */
    position: relative;
}

/* Floating background particles */
.bg-particle {
    position: fixed;
    width: 10px;
    height: 10px;
    background-color: rgba(255, 255, 255, 0.3); /* Increased opacity */
    border-radius: 50%;
    pointer-events: none;
    z-index: 1; /* Increased z-index to be above background but below content */
    animation: float-up 15s linear infinite;
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.5); /* Added glow effect */
}

@keyframes float-up {
    0% {
        transform: translateY(100vh) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 0.8;
        transform: translateY(90vh) scale(1);
    }
    90% {
        opacity: 0.8;
        transform: translateY(10vh) scale(1);
    }
    100% {
        transform: translateY(0) scale(0);
        opacity: 0;
    }
}

.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-y: auto;
    /* Ensure content is visible on mobile browsers */
    padding-top: env(safe-area-inset-top, 20px);
}

.screen.active {
    display: flex;
}

/* Loading Screen */
.loading-content {
    text-align: center;
    width: 80%;
    max-width: 600px;
}

.loading-content h1 {
    margin-bottom: 40px;
    font-size: 28px;
    color: var(--primary-color);
    text-shadow: 3px 3px 0 var(--secondary-color);
}

.progress-container {
    height: 30px;
    background-color: var(--background-color);
    border: var(--pixel-border);
    margin-bottom: 15px;
    position: relative;
}

#progress-bar {
    height: 100%;
    width: 0;
    background-color: var(--primary-color);
    transition: width 0.2s;
    position: relative;
    overflow: hidden;
}

#progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    animation: progress-shine 1.5s infinite;
}

@keyframes progress-shine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

#loading-text {
    font-size: 16px;
    margin-top: 10px;
}

/* Main Invitation Screen */
.invitation-container {
    width: 100%;
    max-width: 800px;
    background-color: var(--background-color);
    border: var(--pixel-border);
    padding: 30px;
    text-align: center;
    margin: 20px auto;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

/* Subtle sparkle effect for invitation container */
.invitation-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 1px, transparent 1px); /* Much more subtle dots */
    background-size: 30px 30px; /* Larger spacing between dots */
    pointer-events: none;
    animation: sparkle 30s linear infinite; /* Slower animation */
    z-index: 1;
    opacity: 0.5; /* Lower overall opacity */
}

/* Remove the second sparkle layer to reduce visual noise */

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

.header {
    margin-bottom: 30px;
}

.header h1 {
    font-size: 32px;
    color: var(--primary-color);
    margin-bottom: 10px;
    text-shadow: 3px 3px 0 var(--secondary-color);
    animation: text-pulse 2s infinite alternate;
}

.header h2 {
    font-size: 24px;
    color: var(--tertiary-color);
    text-shadow: 2px 2px 0 var(--secondary-color);
}

@keyframes text-pulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.05); }
}

.profile-section {
    margin-bottom: 30px;
}

.profile-pic {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    border: var(--pixel-border);
    object-fit: cover;
    background-color: var(--tertiary-color);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    transition: transform var(--transition-speed);
}

.profile-pic:hover, 
.profile-pic:active {
    transform: scale(1.05);
}

.party-details {
    margin-bottom: 30px;
}

.detail-item {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    font-size: 16px;
}

.icon {
    font-size: 24px;
    margin-right: 15px;
    color: var(--primary-color);
}

.icon i {
    animation: icon-bounce 2s infinite alternate;
}

@keyframes icon-bounce {
    0% { transform: translateY(0); }
    100% { transform: translateY(-5px); }
}

.location-details {
    flex-direction: column;
}

/* Scratch Card Styles */
#location-scratch-card {
    position: relative;
    width: 100%;
    max-width: 300px;
    height: 150px;
    margin: 15px auto 0;
    border: var(--pixel-border);
    overflow: hidden;
}

#scratch-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 10;
}

#location-reveal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--background-color);
    z-index: 5;
}

#scratch-instruction {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--tertiary-color);
    font-size: 14px;
    z-index: 15;
    text-align: center;
    pointer-events: none;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 10px;
    border-radius: 5px;
}

.location-options {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 10px;
}

.location-option {
    color: var(--tertiary-color);
    text-decoration: none;
    background-color: var(--primary-color);
    padding: 12px;
    border: 2px solid var(--secondary-color);
    transition: transform var(--transition-speed), background-color var(--transition-speed);
    display: block;
    width: 100%;
    text-align: center;
    border-radius: 4px;
    font-size: 14px;
}

.location-option:hover,
.location-option:active {
    transform: scale(1.05);
    background-color: #cc0000;
}

.location-options span {
    font-size: 14px;
    margin: 5px 0;
}

.countdown-section {
    margin-bottom: 30px;
}

.countdown-section h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
    font-size: 18px;
}

.countdown {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.countdown-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: var(--primary-color);
    border: var(--pixel-border);
    padding: 10px;
    width: 80px;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
    transition: transform var(--transition-speed);
}

.countdown-item:hover,
.countdown-item:active {
    transform: translateY(-5px);
}

.countdown-item span {
    font-size: 20px;
}

.countdown-item .label {
    font-size: 10px;
    margin-top: 5px;
}

.info-section {
    margin-bottom: 30px;
}

.info-section h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
    font-size: 18px;
}

.info-section ul {
    list-style-type: none;
    text-align: center;
}

.info-section li {
    margin-bottom: 10px;
    font-size: 14px;
    position: relative;
    padding-left: 20px;
}

.info-section li:before {
    content: ">";
    position: absolute;
    left: 0;
    color: var(--primary-color);
}

.rsvp-section {
    margin-bottom: 30px;
}

.rsvp-options {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.rsvp-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-color);
    color: var(--tertiary-color);
    text-decoration: none;
    padding: 15px 25px;
    font-size: 16px;
    border: var(--pixel-border);
    cursor: pointer;
    transition: transform var(--transition-speed), background-color var(--transition-speed), box-shadow var(--transition-speed);
    min-width: 200px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.rsvp-button i {
    margin-right: 10px;
    font-size: 20px;
}

.rsvp-button:hover,
.rsvp-button:active {
    transform: scale(1.05) translateY(-5px);
    background-color: #cc0000;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
}

.rsvp-button::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: translateX(-100%);
    transition: transform 0.6s;
}

.rsvp-button:hover::after,
.rsvp-button:active::after {
    transform: translateX(100%);
}

.games-section h3 {
    margin-bottom: 20px;
    color: var(--primary-color);
    font-size: 18px;
}

.game-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.game-button {
    background-color: var(--primary-color);
    color: var(--tertiary-color);
    border: var(--pixel-border);
    padding: 15px 20px;
    font-size: 14px;
    cursor: pointer;
    transition: transform var(--transition-speed), background-color var(--transition-speed), box-shadow var(--transition-speed);
    min-width: var(--button-size);
    min-height: var(--button-size);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.game-button i {
    margin-right: 8px;
}

.game-button:hover,
.game-button:active {
    transform: scale(1.05) translateY(-5px);
    background-color: #cc0000;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.4);
}

.game-button::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: translateX(-100%);
    transition: transform 0.6s;
}

.game-button:hover::after,
.game-button:active::after {
    transform: translateX(100%);
}

/* Game Screens */
.game-header {
    text-align: center;
    margin-bottom: 20px;
}

.game-header h2 {
    font-size: 24px;
    color: var(--primary-color);
    margin-bottom: 10px;
    text-shadow: 2px 2px 0 var(--secondary-color);
}

.game-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    font-size: 16px;
}

#robux-game-container,
#memory-game-container {
    width: 100%;
    max-width: 600px;
    height: 400px;
    background-color: var(--background-color);
    border: var(--pixel-border);
    margin: 0 auto 20px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
}

#memory-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 10px;
    padding: 20px;
    height: 100%;
}

.memory-card {
    background-color: var(--primary-color);
    border: 2px solid var(--secondary-color);
    cursor: pointer;
    transition: transform 0.3s;
    position: relative;
    transform-style: preserve-3d;
}

.memory-card.flipped {
    transform: rotateY(180deg);
}

/* Enhanced matched card styling */
.memory-card.matched {
    transform: rotateY(180deg);
    animation: match-success 0.5s ease-in-out;
    border: 2px solid gold;
    box-shadow: 0 0 10px gold;
}

.memory-card.matched .front {
    background-color: #00cc00; /* Green background for matched cards */
    color: var(--tertiary-color); /* White text */
}

@keyframes match-success {
    0% { transform: rotateY(180deg) scale(1); }
    50% { transform: rotateY(180deg) scale(1.2); }
    100% { transform: rotateY(180deg) scale(1); }
}

.memory-card .front,
.memory-card .back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.memory-card .front {
    background-color: var(--tertiary-color);
    transform: rotateY(180deg);
    font-size: 30px;
    color: var(--primary-color);
}

.memory-card .front i {
    font-size: 30px;
}

.memory-card .back {
    background-color: var(--primary-color);
}

.back-button {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px auto;
    background-color: var(--background-color);
    color: var(--tertiary-color);
    border: var(--pixel-border);
    padding: 12px 20px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color var(--transition-speed), transform var(--transition-speed), box-shadow var(--transition-speed);
    min-width: var(--button-size);
    min-height: var(--button-size);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
}

.back-button i {
    margin-right: 8px;
}

.back-button:hover,
.back-button:active {
    background-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.4);
}

.robux {
    position: absolute;
    width: 60px; /* Increased size for better touch targets */
    height: 60px;
    cursor: pointer;
    z-index: 5;
    transform-origin: center;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: balloon-float 3s infinite alternate;
}

.robux i {
    font-size: 45px;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

@keyframes balloon-float {
    0% { transform: translateY(0) rotate(-3deg); }
    50% { transform: translateY(-10px) rotate(0deg); }
    100% { transform: translateY(-5px) rotate(3deg); }
}

/* Responsive Design with Multiple Breakpoints */
@media (max-width: 1024px) {
    :root {
        --base-font-size: 15px;
    }
    
    .invitation-container {
        max-width: 700px;
        padding: 25px;
    }
    
    .header h1 {
        font-size: 28px;
    }
    
    .header h2 {
        font-size: 22px;
    }
}

@media (max-width: 768px) {
    :root {
        --base-font-size: 14px;
        --pixel-border: 3px solid var(--secondary-color);
    }
    
    .header h1 {
        font-size: 24px;
    }
    
    .header h2 {
        font-size: 18px;
    }
    
    .countdown-item {
        width: 60px;
        padding: 8px;
    }
    
    .countdown-item span {
        font-size: 16px;
    }
    
    .rsvp-button {
        padding: 12px 20px;
        font-size: 14px;
        min-width: 160px;
    }
    
    .game-buttons {
        gap: 10px;
    }
    
    .game-button {
        padding: 12px 16px;
        font-size: 12px;
    }
    
    #robux-game-container,
    #memory-game-container {
        height: 350px;
    }
    
    #memory-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(4, 1fr);
        gap: 8px;
    }
    
    .profile-pic {
        width: 140px;
        height: 140px;
    }
    
    .invitation-container {
        padding: 20px;
    }
    
    .game-stats {
        gap: 15px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    :root {
        --base-font-size: 12px;
        --pixel-border: 2px solid var(--secondary-color);
    }
    
    .screen {
        padding-top: 50px; /* Additional padding for mobile browsers */
        align-items: flex-start; /* Align content to the top */
    }
    
    .loading-content h1 {
        font-size: 20px;
    }
    
    .header h1 {
        font-size: 20px;
    }
    
    .header h2 {
        font-size: 16px;
    }
    
    .profile-pic {
        width: 120px;
        height: 120px;
    }
    
    .countdown {
        gap: 8px;
    }
    
    .countdown-item {
        width: 50px;
        padding: 6px;
    }
    
    .countdown-item span {
        font-size: 14px;
    }
    
    .countdown-item .label {
        font-size: 8px;
    }
    
    .rsvp-options {
        flex-direction: column;
        gap: 10px;
    }
    
    .rsvp-button {
        width: 100%;
    }
    
    .game-buttons {
        flex-direction: column;
        gap: 15px;
    }
    
    .game-button {
        width: 100%;
    }
    
    #robux-game-container,
    #memory-game-container {
        height: 300px;
    }
    
    #memory-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(6, 1fr);
        gap: 6px;
        padding: 10px;
    }
    
    .invitation-container {
        padding: 15px;
        margin: 10px auto;
    }
    
    .detail-item {
        font-size: 14px;
    }
    
    .icon {
        font-size: 20px;
        margin-right: 10px;
    }
    
    .game-stats {
        flex-direction: column;
        gap: 5px;
        font-size: 12px;
    }
    
    .game-header h2 {
        font-size: 18px;
    }
    
    #location-scratch-card {
        height: 120px;
    }
}

/* Landscape orientation adjustments for mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .screen {
        align-items: flex-start;
        padding-top: 30px; /* Increased padding for better visibility */
    }
    
    .invitation-container {
        margin: 10px auto;
        padding: 15px;
    }
    
    .profile-section {
        margin-bottom: 15px;
    }
    
    .profile-pic {
        width: 100px;
        height: 100px;
    }
    
    .countdown-section, 
    .info-section, 
    .rsvp-section {
        margin-bottom: 15px;
    }
    
    #robux-game-container,
    #memory-game-container {
        height: 250px;
    }
}

/* Enhanced Animations */
@keyframes pixel-fade {
    0% { opacity: 0; }
    50% { opacity: 1; }
    100% { opacity: 0; }
}

.pixel-animation {
    animation: pixel-fade 1s infinite;
}

@keyframes fa-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.fa-bounce {
    display: inline-block;
    animation: fa-bounce 1s infinite;
}

/* Touch-specific styles */
@media (hover: none) {
    /* Styles for touch devices */
    .rsvp-button:active,
    .game-button:active,
    .back-button:active,
    .location-option:active {
        transform: scale(0.95);
        transition: transform 0.1s;
    }
    
    /* Add active state visual feedback */
    .active-touch {
        background-color: #cc0000 !important;
        transform: scale(0.95) !important;
    }
}

/* Particle effect for game success */
.particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    opacity: 1;
    z-index: 100;
}

/* Balloon pop particles - multiple colors */
.particle.red { background-color: #ff5555; }
.particle.blue { background-color: #5555ff; }
.particle.green { background-color: #55ff55; }
.particle.yellow { background-color: #ffff55; }
.particle.purple { background-color: #ff55ff; }

/* Confetti animation for matched cards */
.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    opacity: 1;
    pointer-events: none;
    z-index: 100;
}

.confetti.square {
    width: 8px;
    height: 8px;
    background-color: gold;
    transform: rotate(45deg);
}

.confetti.rectangle {
    width: 12px;
    height: 6px;
    background-color: #ff5555;
}

.confetti.circle {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #5555ff;
}

.confetti.triangle {
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 10px solid #55ff55;
}
