@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    font-family: Arial, sans-serif;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    
}

*,
*::before,
*::after {
  box-sizing: border-box; 
}

.topheader {
    width: 100%;
    background-color: rgba(255, 255, 255, 0);
    padding: 10px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.topheader h1, .topheader .time-left {
    background-color: rgba(255, 255, 255, 0.5);
    width: 100%;
    padding: 5px 0;
    margin: 5px 0;
}

.time-left {
    margin: 30px;
    padding: 30px;
    display: flex;
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 90%; 
    margin: auto;
}

.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); /* More responsive grid */
    gap: 10px;
    max-height: 80vh; /* Limits the height to 80% of the viewport height */
    width: 100%;
    padding: 10px;
}

.images-grid img {
    max-width: 200px;
    max-height: 100%;
    border: 1px solid transparent;
    border-radius: 3px; /* Adjust the value to get the desired roundness */
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    
    
    width: 100%;
    align-self: center;
    justify-self: center;
}

img.selected {
    border: 1px solid gray;
}

.incorrect {
    border: 1px solid red;
}

.duplicate {
    transition: background-color 0.3s;
    display: inline-block;
    /*padding: 5px;*/
    /*border: 1px solid #000;*/
}

.correct {
    background-color: green;
}

#result-bottom-field {
    padding: 5px;
    margin-top: 5px;
    background-color: rgba(255, 255, 255, 0.5);
}

button {
    padding: 10px;
    font-size: 16px;
    cursor: pointer;
}

#result-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

.overlay-content {
    background-color: #fff;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    width: 80%;
    max-width: 600px;
}

.hidden {
    display: none !important;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s 0.3s, opacity 0.3s ease-in-out;
}

.notification {
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 2px;
    padding: 16px;
    position: fixed;
    z-index: 1;
    left: 50%;
    bottom: 30px;
    transform: translateX(-50%);
    box-shadow: 0px 4px 16px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    visibility: hidden;
    opacity: 0;
    transition: visibility linear 0.3s, opacity 0.3s linear;
}

.notification-show {
    visibility: visible;
    opacity: 1;
    transition: visibility 0s linear, opacity 0.3s linear;
}

.disable-clicks {
    pointer-events: none;
}

.birthday-message {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    text-align: center;
    background-color: #fff;
    padding: 10px 0;
}


.main-container {
    min-height: calc(100vh + 58.5px);  /* Use at least 100% of the viewport height */
    display: flex;
    flex-direction: column; /* Vertical stacking */
    justify-content: space-between; /* Stretch to occupy height */

}


.bottom-footer {
    text-align: center;
    background-color: #fff; /* Ensures visibility against any background */
    padding: 10px 0;
    width: 100%; /* Full width */
    position: sticky;
    bottom: 0; /* Stick to the bottom */
    box-shadow: 0 -2px 4px rgba(0,0,0,0.1); /* Visual separation from content */

}
.additional2-content {
    padding: 20px;
    text-align: center; /* Centers text and inline elements inside the div */
    background: #aaaaaaaa; /* Just for better visibility */
    color: #ffffff; /* Ensures text is visible against the dark background */
    width: 100%; /* Takes the full width to maintain consistent layout */
    display: flex; /* Using flex to center content */
    flex-direction: column; /* Stack children vertically */
    align-items: center; /* Center children horizontally */
    justify-content: center; /* Center children vertically */
}

@media (max-width: 600px) {
    .images-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); /* Adjust for smaller screens */
        margin-top: -10%;
        max-height: unset !important;
        grid-auto-rows: 60px !important;
        
    }
    .images-grid img {
      max-height: 75% !important;
    }
    
    .topheader, .time-left {
        padding: 5px;
    }
}

/*To avoid abrupt changes when resizing, consider adding CSS transitions to the grid elements and the game container:*/
.game-container, .images-grid img {
    transition: height 0.3s ease-in-out, width 0.3s ease-in-out;
    transition: border 0.1s;
}

#easy-button {
    padding: 10px 20px;
    font-size: 16px;
    color: white;
    background-color: green;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin: 10px;
}

#easy-button.disabled {
    background-color: lightgrey;
    cursor: not-allowed;
}

.result-button {

    padding: 10px 20px;
        font-size: 16px;
        color: white;
        border: none;
        border-radius: 5px;
        cursor: pointer;
        margin: 10px;
}
.result-button.share {
    background-color: green;
}
.result-button.replay {
    background-color: steelblue;
}



/* Arcade/Retro Leaderboard Styles */
.arcade-text {
    font-family: 'Press Start 2P', cursive;
    color: #00ff00;
    text-shadow: 0 0 1px #00ff00, 0 0 3px #00ff00;
    margin: 10px 0;
}

.timer-text {
    font-size: 14px;
    color: #ffff00;
    text-shadow: 0 0 10px #ffff00;
}

#leaderboard-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.leaderboard-modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #0f0f1e 100%);
    border: 4px solid #00ff00;
    border-radius: 10px;
    padding: 30px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 0 30px #00ff00, inset 0 0 30px rgba(0, 255, 0, 0.1);
}

.arcade-input {
    font-family: 'Press Start 2P', cursive;
    background-color: #000;
    color: #00ff00;
    border: 2px solid #00ff00;
    padding: 15px;
    font-size: 16px;
    width: 100%;
    max-width: 300px;
    margin: 20px auto;
    text-align: center;
    box-shadow: 0 0 10px #00ff00;
    outline: none;
}

.arcade-input::placeholder {
    color: #00ff0088;
}

.modal-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 20px;
}

.arcade-button {
    font-family: 'Press Start 2P', cursive;
    background-color: #00ff00;
    color: #000;
    border: none;
    padding: 15px 30px;
    font-size: 14px;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.3s;
    box-shadow: 0 0 20px #00ff00;
}

.arcade-button:hover {
    background-color: #00cc00;
    transform: scale(1.05);
    box-shadow: 0 0 30px #00ff00;
}

.arcade-button.cancel {
    background-color: #ff0000;
    box-shadow: 0 0 20px #ff0000;
}

.arcade-button.cancel:hover {
    background-color: #cc0000;
    box-shadow: 0 0 30px #ff0000;
}

#leaderboard-display {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.leaderboard-display-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #0f0f1e 100%);
    border: 4px solid #00ff00;
    border-radius: 10px;
    padding: 30px;
    text-align: center;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 0 30px #00ff00, inset 0 0 30px rgba(0, 255, 0, 0.1);
}

.arcade-list {
    list-style: none;
    padding: 0;
    margin: 20px 0;
    font-family: 'Press Start 2P', cursive;
    color: #00ff00;
    text-align: left;
}

.arcade-list li {
    padding: 15px;
    margin: 10px 0;
    background-color: rgba(0, 255, 0, 0.1);
    border: 2px solid #00ff00;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.arcade-list .rank {
    color: #ffff00;
    min-width: 40px;
}

.arcade-list .name {
    flex-grow: 1;
    margin: 0 20px;
}

.arcade-list .score {
    color: #ff00ff;
    text-shadow: 0 0 10px #ff00ff;
}

.result-button.leaderboard {
    background-color: #9c27b0;
}

/* Responsive arcade styles */
@media (max-width: 600px) {
    .arcade-text {
        font-size: 12px;
    }
    
    .arcade-button {
        font-size: 10px;
        padding: 10px 20px;
    }
    
    .arcade-list li {
        font-size: 8px;
        padding: 10px;
    }
}

/* Animated Leaderboard Button */
.animated-leaderboard-button {
    font-family: 'Press Start 2P', cursive;
    font-size: 16px;
    padding: 20px 40px;
    margin: 20px auto;
    display: block;
    background: linear-gradient(45deg, #ff00ff, #00ffff, #ff00ff);
    background-size: 300% 300%;
    color: #fff;
    border: 3px solid #fff;
    border-radius: 10px;
    cursor: pointer;
    text-transform: uppercase;
    box-shadow: 0 0 20px #ff00ff, 0 0 40px #00ffff, 0 0 60px #ff00ff;
    animation: gradientShift 3s ease infinite, pulse 1.5s ease-in-out infinite;
    transition: transform 0.2s, box-shadow 0.2s;
}

.animated-leaderboard-button:hover {
    transform: scale(1.1);
    box-shadow: 0 0 30px #ff00ff, 0 0 60px #00ffff, 0 0 90px #ff00ff;
}

.animated-leaderboard-button:active {
    transform: scale(0.95);
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 20px #ff00ff, 0 0 40px #00ffff, 0 0 60px #ff00ff;
    }
    50% {
        box-shadow: 0 0 30px #ff00ff, 0 0 60px #00ffff, 0 0 90px #ff00ff;
    }
}

@media (max-width: 600px) {
    .animated-leaderboard-button {
        font-size: 10px;
        padding: 15px 30px;
    }
}
