/* General Styles */
.homepage {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    padding-top: 70px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-image: url('/images/background_stars.jpg');
    background-size: cover;
    background-position: center;
    color: #fff;
}

.custom-table {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-template-rows: repeat(2, auto);
    align-content: space-evenly;
    column-gap: 15px;
    width: 100%;
    padding: 0 15px;
    margin: 0;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    min-height: 100%;
}

.custom-cell {
    aspect-ratio: 1 / 1;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 20px;
    background-color: rgba(255, 255, 255, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
}

.custom-cell img {
    max-width: 100%;
    height: auto !important;
    max-height: 75%;
    object-fit: contain;
    transition: transform 0.3s ease;
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.5));
}

.custom-cell:hover {
    transform: scale(1.05);
    background-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
}

.custom-cell:hover img {
    transform: scale(1.1);
}

.category-name {
    color: white;
    font-size: clamp(16px, 2vw, 28px);
    font-weight: bold;
    margin-top: 5px;
    text-align: center;
    transition: transform 0.3s ease, margin-top 0.3s ease;
}

.custom-cell:hover .category-name {
    transform: scale(1.3);
    margin-top: 35px;
}

.yellow-star {
    color: yellow;
    font-size: 1em;
    margin: 0 10px;
    text-shadow: 0 0 5px rgba(255, 255, 0, 0.8);
}

.section.middle {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 15px;
    text-align: center;
    margin: 0;
    height: 100%;
}

.random-title {
    font-family: 'Lobster', cursive;
    font-size: 2em;
    cursor: pointer;
    position: relative;
    margin-bottom: 8px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.personality-image {
    width: 100%;
    max-width: 240px;
    height: auto;
    aspect-ratio: 1/1;
    object-fit: contain;
    background-color: transparent;
    transition: transform 0.3s ease;
    border: 3px solid rgba(255, 255, 255, 0.8);
    padding: 5px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.5));
}

.personality-image:hover {
    transform: scale(1.02);
}

.personality-preview {
    text-align: center;
    margin: 8px auto;
    position: relative;
}

.personality-preview h3 a {
    color: #fff;
    text-decoration: none;
    font-family: 'Lobster', cursive;
    font-size: 1.3em;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.random-category-links {
    margin-top: 10px;
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    align-items: center;
    max-width: 100%;
}

.random-category-links a {
    display: flex;
    justify-content: center;
    margin: 0;
    padding: 0;
}

img {
    height: 400px;
    display: block;
    margin: 20px auto;
    object-fit: contain;
}

.category-table {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin: 10px auto;
}

.category-cell {
    width: 5vw;
    height: 5vw;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.category-cell img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Mobile */
@media (max-width: 768px) {
    .homepage {
        padding-top: 70px;
    }

    .main-content {
        display: flex;
        flex-direction: column;
        gap: 20px;
        padding: 10px;
    }

    .custom-table {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: auto;
        gap: 10px;
        padding: 10px;
    }

    .section.middle {
        width: 100%;
        margin-top: 20px;
        order: 2;
    }

    .personality-image {
        max-width: 250px;
    }
}

/* Laptop */
@media (min-width: 769px) and (max-width: 1600px) {
    .main-content {
        display: flex;
        gap: 15px;
        align-items: stretch;
        padding: 15px;
        max-width: 1400px;
        margin: 0 auto;
    }

    .custom-table {
        flex: 65;
    }

    .section.middle {
        flex: 35;
        padding: 8px;
    }

    .personality-image {
        max-width: 200px;
    }

    .personality-preview {
        margin: 5px auto;
    }

    .personality-preview h3 a {
        font-size: 1.1em;
    }

    .random-title {
        font-size: 1.6em;
        margin-bottom: 5px;
    }

    .category-table {
        margin-top: 5px;
    }
}

/* Large Screen */
@media (min-width: 1601px) {
    .main-content {
        display: flex;
        gap: 30px;
        align-items: stretch;
        padding: 20px;
        max-width: 1600px;
        margin: 0 auto;
    }

    .custom-table {
        flex: 1;
    }

    .section.middle {
        flex: 1;
        max-width: 600px;
        margin-left: auto;
        margin-right: auto;
    }
}