html {
    background-image: url(blankbackground.svg);
    background-repeat: no-repeat;
    background-position: absolute;
    background-attachment: fixed;
    background-size: cover;
}

@font-face {
    font-family: 'Nintendo-DS';
    src: url('Nintendo-DS-BIOS.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}


body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 40px;
    font-family: 'Nintendo-DS', sans-serif;
}

.h1-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 80px;
}

h1 {
    display: flex;
    align-items: center;
    border: 4px solid hwb(0 45% 55%);
    width: 500px;
    text-align: center;
    font-size: 44px;
    line-height: 50px;
    padding: 20px;
    background: linear-gradient(to bottom, #ffffff, #bbbbbb);
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.692);
}

h1 img {
    width: 128px;
    height: auto;
    margin-right: 10px;
}

.h1-text {
    flex-grow: 1;
    text-align: center;
}

#grid-container {
    display: grid;
    gap: 48px;
    justify-items: center;
}

.grid-item {
    position: relative;
    border: 4px solid hwb(0 45% 55%);
    padding: 12px;
    padding-bottom: 2px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s;
    background: linear-gradient(to bottom, #ffffff, #bbbbbb);
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 200px;
    height: 240px;
}

.grid-item::before,
.grid-item::after,
.grid-item .corner {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 10px solid #000000; /* Highlight color */
    opacity: 0;
    transition: opacity 0.2s;
}

.grid-item::before {
    top: -7px;
    left: -7px;
    border-top-left-radius: 10px;
    border-right: none;
    border-bottom: none;
}

.grid-item::after {
    bottom: -7px;
    right: -7px;
    border-bottom-right-radius: 10px;
    border-left: none;
    border-top: none;
}

.grid-item .top-right-corner {
    top: -7px;
    right: -7px;
    border-top-right-radius: 10px;
    border-left: none;
    border-bottom: none;
}

.grid-item .bottom-left-corner {
    bottom: -7px;
    left: -7px;
    border-bottom-left-radius: 10px;
    border-right: none;
    border-top: none;
}

.grid-item:hover::before,
.grid-item:hover::after,
.grid-item:hover .corner {
    opacity: 1;
    z-index: 2;
}

.grid-item:hover, #home:hover, #sort:hover {
    transform: scale(1.05);
}

h3 {
    padding-top: 4px;
    font-size: 18px;
    line-height: 0px;
}

.cover-image {
    max-width: 90%;
    max-height: 70%;
    border: 2px solid #474747;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.644);
    background-color: #797979;
    transition: transform 0.1s;
}

.cover-image:hover {
    transform: scale(1.05);
}

.hidden-images {
    display: none;
}

#home {
    top: 10%; 
    left: 15%; 
    cursor: pointer;
    transition: transform 0.2s;
}

#home button {
    background-size: cover;
    height: 100px;
    width: 100px;
    margin-right: 40px;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid hwb(0 45% 55%); 
    background-image: url(home.png);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.692);
}

#sort {
    top: 10%; 
    margin-left: 5%; 
    cursor: pointer;
    transition: transform 0.2s;
}

#sort button {
    background-size: cover;
    height: 100px;
    width: 100px;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid hwb(0 45% 55%); 
    background-image: url(sort.png);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.692);
}

.ribbon {
    position: absolute;
    color: rgb(0, 0, 0);
    font-size: 12px;
    font-weight: bold;
    padding: 5px 10px;
    text-align: center;
    top: 0;
    right: 0;
    border-radius: 0 6px 0 6px;
    font-size: medium;
}

.new-ribbon {
    background-color: rgb(0, 255, 0);
}

/* Popup styles */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.801);
    display: flex;
    justify-content: center;
    align-items: center;
    display: none;
}

.popup-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    border: 10px solid #797979;
    border-radius: 10px;
    background-color: #797979;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.644);
}

.popup-image {
    max-width: 90%;
    max-height: 100vh;
    display: block;
    margin: auto;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.644);
}

.popup-close {
    position: absolute;
    top: 5px;
    right: 1px;
    color: white;
    cursor: pointer;
    font-size: 48px;
}

.popup-nav {
    position: absolute;
    top: 10%;
    width: 50%;
    height: 90%;
}

.popup-nav.left {
    left: 0;
    cursor: url('left.cur'), w-resize;
}

.popup-nav.right {
    right: 0;
    cursor: url('right.cur'), e-resize;
}

/* Mobile styles */
@media (max-width: 767px) {
    body {
        margin: 20px;
    }

    .h1-container {
        margin-bottom: 40px;
    }

    h1 {
        border: 3px solid hwb(0 45% 55%);
        width: 100%;
        font-size: 18px;
        padding: 12px;
        margin-left: 0px;
        margin-right: 0px;
        line-height: 20px;
    }

    h1 img {
        width: 42px;
        margin-right: 5px;
    }

    #grid-container {
        gap: 6px;
    }

    .grid-item {
        width: 100px;
        height: 120px;
        padding: 6px;
        font-size: 12px;
    }
    
    h3 {
        padding-top: 0px;
        margin: 2px;
        font-size: 14px;
        font-weight: lighter;
        line-height: 10px;
    }

    #home, #home button {
        margin-right: 5px;
    }

    #sort, #sort button {
        margin-left: 5px;
        margin-right: 0px
    }
    
    #home button, #sort button {
        height: 60px;
        width: 60px;
    }

    .cover-image {
        max-width: 90px;
        max-height: 70px;
        margin-bottom: 6px;
    }

    .ribbon {
        font-size: 12px;
        padding: 4px;
    }

    .popup-close {
        font-size: 32px;
    }
}