html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    display: flex;

    background-color: #999;
    color: #fafafa;

    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#left-section {
    width: 33.33%;
    height: 100%;
    border: 5px solid black;
    box-sizing: border-box;

    display: flex;
    flex-direction: column;

    font-size: 3vh;
    font-weight: 512;

    background-color: #121212;
}

#center-section {
    width: 50%;
    height: 100%;
    box-sizing: border-box;

    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

#inventory, #upgrades {
    width: 100%;
    height: 50%;

    min-height: 120px;
    max-height: calc(100% - 120px);

    border-bottom: 2.5px solid black;

    box-sizing: border-box;
    resize: vertical; 
    overflow: auto;
    flex-shrink: 0;

    display: grid;
    grid-template-rows: auto 1fr;
}

.inventory-text, .upgrades-text {
    margin: 0;
    padding: 8px;

    font-size: 0.85rem;
    letter-spacing: 0.1em;
    text-align: center;
}

#inventory-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-content: start;

    gap: 8px;
    padding: 8px;
}

#upgrades {
    width: 100%;
    min-height: 120px;

    flex: 1;
    border-top: 2.5px solid black;
    box-sizing: border-box;
    overflow: auto;
}

#card {
    aspect-ratio: 2 / 3;
    width: clamp(190px, 30vw, 340px);
    max-width: calc(100% - 24px);
    max-height: 60vh;
    margin: 16px;
    padding: 12px;

    border: 3px solid #888888;
    border-radius: 24px;
    box-sizing: border-box;

    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: flex;
    align-self: center;

    background-color: #202020;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.card-content {
    position: relative;
    z-index: 1;

    padding: clamp(16px, 2vw, 26px);
    border-radius: 15px;

    box-sizing: border-box;

    display: flex;
    flex: 1;
    min-height: 0;
    flex-direction: column;
    align-items: flex-start;

    background: linear-gradient(155deg, rgba(14, 18, 31, 0.35), rgba(14, 18, 31, 0.9));
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.75);
}

.card-name {
    margin: 16px 0 8px;

    color: #ffffff;

    font-size: clamp(1.5rem, 4vh, 2.5rem);
    font-weight: 750;
    line-height: 1.05;
}

.card-rarity {
    order: -1;
    margin: 0;

    color: var(--rarity-color, #ffffff);

    font-size: 0.8rem;
    font-weight: bold;

    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.card-category {
    margin: 0;
    padding: 5px 10px;

    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;

    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 600;
}

.card-desc {
    margin: auto 0 0;
    padding-top: 18px;

    color: #ffffff;

    font-size: clamp(0.95rem, 2.2vh, 1.15rem);
    line-height: 1.5;
}

.inventory-card {
    aspect-ratio: 2 / 3;
    min-width: 0;
    padding: 4px;

    border: 1px solid #888888;
    border-radius: 10px;
    box-sizing: border-box;

    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: flex;

    background-color: #202020;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
}

.inventory-card-content {
    position: relative;
    z-index: 1;

    padding: 8px;
    border-radius: 6px;

    box-sizing: border-box;

    display: flex;
    flex: 1;
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
    overflow: hidden;

    background: linear-gradient(155deg, rgba(14, 18, 31, 0.35), rgba(14, 18, 31, 0.9));
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.75);
}

.inventory-card-name {
    margin: 8px 0 5px;

    color: #ffffff;

    font-size: clamp(0.65rem, 1vw, 0.9rem);
    font-weight: 700;
    line-height: 1.1;
}

.inventory-card-rarity {
    order: -1;
    margin: 0;

    color: var(--rarity-color, #ffffff);

    font-size: clamp(0.45rem, 0.7vw, 0.6rem);
    font-weight: bold;

    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.inventory-card-category {
    margin: 0;
    padding: 3px 6px;

    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;

    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    font-size: clamp(0.5rem, 0.75vw, 0.65rem);
}

.inventory-card-desc {
    margin: auto 0 0;
    padding-top: 8px;

    overflow: hidden;

    color: #ffffff;

    font-size: clamp(0.5rem, 0.7vw, 0.6rem);
    line-height: 1.3;

    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
}

#card::before {
    position: absolute;
    z-index: 0;
    inset: 0;
    content: "";

    background: linear-gradient(180deg, rgba(20, 20, 20, 0.1) 5%, rgba(20, 20, 20, 0.25) 40%, rgba(20, 20, 20, 0.8) 100%);
    pointer-events: none;
}

#roll_btn {
    align-self: center;

    margin: 10px;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 10vh;

    cursor: pointer;

    background-color: royalblue;
    border: 5px solid black;
    border-radius: 18px;
    height: 15%;
    width: 70%;

    transition: transform 0.1s ease-in-out, background-color 0.1s ease-in-out;
}

#roll_btn:hover {
    transform: scale(1.05);
    background-color: blue;
}

#roll_btn:active {
    transform: scale(0.95);
    background-color: darkblue;
}

@media (max-width: 700px) {
    html, body {
        min-height: 100%;
        height: auto;
        flex-direction: column;
    }

    #left-section {
        width: 100%;
        height: 32vh;
        min-height: 180px;
    }

    #inventory-cards {
        gap: 6px;
        padding: 6px;
    }

    .inventory-card-content {
        padding: 6px;
    }

    #center-section {
        width: 100%;
        height: 68vh;
        min-height: 400px;
        justify-content: flex-end;
    }

    #card {
        width: min(78vw, 300px);
        max-height: 55vh;
        border-radius: 20px;
    }

    .card-content {
        padding: 16px;
    }
}