/* UI */
body {
    text-align: center;
    background-color: #fef9ee;
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

#leaderboard-text {
    background-color: white;
    border-radius: 5px;
    padding: 10px;
    margin-bottom: 10px;
}

#pause-content {
    display: grid;
    gap: 20px;
}

#credits-text {
    color: white;
}

a {
    color: white;
}

.hidden {
    display: none;
}

#legend-button {
    margin-bottom: 20px;
}

#logo {
    width: 100%;
    max-width: 350px;
    display: block;
    margin: auto;
}

#timer {
    font-family: 'Courier New', Courier, monospace;
    color: #6dc973;
    background-color: #111;
    border-radius: 5px;
    border: #6dc973 1px solid;
    letter-spacing: 5px;
    width: fit-content;
    text-align: center;
    height: auto;
    margin: 0 auto;
    position: relative;
    padding-left: 5px;
}

#legend div span {
    position: relative;
    top: -25px;
}

#legend img {
    max-width: 100%;
    display: block;
}

#new-record {
    background-color: rgba(109, 201, 115, 0.5);
    color: black;
    padding: 5px 10px;
    border-radius: 5px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    margin-left: 20px;
}

#leaderboard {
    margin-top: 20px;
}

.border-green {
    border-top: 5px ridge #6ac670;
    padding-top: 5px;
}

#leaderboard .border-green {
    margin-top: 10px;
}

#legend img {
    margin-left: 25%;
    width: 35px;
}

.with-border {
    border: 1px solid;
}

#floating {
    position: fixed;
    top: 10px;
    right: 40px;
    display: ruby;
}

#floating button {
    width: 35px;
    height: 30px;
    border-radius: 30%;
}

#player-name {
    border: 2px solid black;
    border-radius: 5px;
    padding: 10px 12px;
    font-size: 15px;
    color: #555;
    cursor: default;
}

#player-name:disabled {
    background: #f8f9fa;
}

.restart, #pause-content button, #pause-button, #start-button, #clear-button, #sound-button {
    font-size: initial;
}

#player-buttons {
    display: flex;
    flex-direction: column;
}

.btn-3d {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: #fff3f3;
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 0 #2e7d32, 0 4px 10px rgba(0,0,0,0.3);
    position: relative;
    padding: 10px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn-3d:disabled {
    background: #e9ecef;
    color: #6c757d;
    box-shadow: 0 3px 0 #ced4da, 0 4px 8px rgba(0,0,0,0.1);
    top: 0;
    opacity: 1;
}

#clear-button {
    margin-top: 10px;
    margin-bottom: 10px;
}

/* Grid */
.cell {
    height: 35px;
    width: 35px;
    border: 1px solid black;
}

.row {
    display: flex;
}

.cell img {
    height: inherit;
}

#container {
    width: fit-content;
    height: auto;
    margin: 0 auto;
    position: relative;
}

.cell.gold {
    background-color: gold;
}

#extralife {
    width: fit-content;
    text-align: center;
    height: auto;
    margin: 10px auto;
    border-radius: 10px;
    padding: 5px;
}

.blink {
    animation: blink-animation 1s steps(2, start) infinite;
}

/* Define the blinking keyframes */
@keyframes blink-animation {
    0% {
        visibility: visible;
    }
    50% {
        visibility: hidden;
    }
    100% {
        visibility: visible;
    }
}

.blink-bg {
    animation: blinkBackground 0.7s infinite;
}

@keyframes blinkBackground {
    0%, 100% {
        background-color: transparent; /* or your default background */
        color: white;
        border-color: white;
    }
    50% {
        background-color: #ff6c6c; /* or any color you want */
        color: white;
        border-color: white;
    }
}

/* Pad buttons */
#action-buttons {
    position: fixed;
    bottom: 70px;
    right: 20px;
    z-index: 10;
    display: flex;
    gap: 15px;
}

#action-buttons button {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    font-size: 1.5em;
    border: 2px solid grey;
    background-color: rgba(100, 100, 100, 0.6);
    color: white;
    user-select: none; /* Prevent text selection */
    -webkit-user-select: none; /* Safari */
    -ms-user-select: none; /* IE 10+ */
}

#action-buttons button:active {
    background-color: rgba(200, 200, 200, 0.5);
}

#dpad-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 150px;
    height: 150px;
    z-index: 10;
    user-select: none;
    -webkit-user-select: none; /* Safari */
    -moz-user-select: none; /* Firefox */
    -ms-user-select: none; /* IE */
    transform: scale(1.2);
    transform-origin: bottom left;
}

.dpad-button {
    position: absolute;
    width: 50px;
    height: 50px;
    background-color: rgba(100, 100, 100, 0.7);
    border: 1px solid #555;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    box-sizing: border-box;
}

#dpad-up {
    top: 0;
    left: 50px;
    border-radius: 10px 10px 0 0;
}

#dpad-down {
    bottom: 0;
    left: 50px;
    border-radius: 0 0 10px 10px;
}

#dpad-left {
    top: 50px;
    left: 0;
    border-radius: 10px 0 0 10px;
}

#dpad-right {
    top: 50px;
    right: 0;
    border-radius: 0 10px 10px 0;
}

.dpad-button:active {
    background-color: rgba(180, 180, 180, 0.8);
}

/* Styles for screens 600px and wider */
@media (min-width: 600px) {
    body {
        padding: 10px;
    }
}

@media (max-width: 360px) {
    body {
        font-size: smaller;
    }
}

main {
    margin-top: 10px;
}

@media (orientation: landscape) and (max-width: 1024px) {
    body {
        display: flex;
        flex-direction: row;
    }

    header {
        order: 1;
        flex-direction: column;
        align-items: center;
        width: 50%;
    }

    main {
        order: 2;
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        margin-top: 0;
    }

    footer {
        order: 3;
        width: 50%;
        align-items: center;

        #leaderboard {
            margin-top: 50px;
        }

        #legend img {
            width: 25px;
        }
    }

    #button-a {
        width: 120px!important;
        height: 120px!important;
    }
}