:root {
    --bg-color: #121212;
    --text-color: #ffffff;
    --card-bg: #1e1e1e;
    --card-border: #333333;
    --invert: 100%;
}
body.light {
    --bg-color: #f4f4f4;
    --text-color: #000000;
    --card-bg: #ffffff;
    --card-border: #cccccc;
    --invert: 0%;
}

html, body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    background: var(--bg-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    font-family: sans-serif;
    margin: 0;
}

#app {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    box-sizing: border-box;
    padding: 10px;
}

#theme-toggle {
    position: absolute;
    right: 20px;
    top: 10px;
    padding: 0.5rem 1rem;
    background-color: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--card-border);
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
}

#gameoverScreen {
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;

    position: absolute;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 50;
    visibility: visible;
    opacity: 1;
    padding: 20px;
    overflow-y: auto;
    width: 100vw;
    height: 100vh;
}

#gameoverMessage {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0;
    color: var(--text-color);
}

#newCrownDisplay {
    color: var(--text-color);
    display: none;
}

#restartButton {
    padding: 0.75rem 1.5rem;
    background-color: #059669;
    border-radius: 0.5rem;
    font-size: 1.5rem;
    font-weight: 600;
    transition: background-color 150ms;
}

#restartButton:hover {
    background-color: #047857;
}

#chosenCards {
    display: flex;
    justify-content: space-between;
    flex-direction: row;
    flex-wrap: wrap;

    border: var(--card-border) 8px solid;
    border-radius: 15px;
    width: min(400px, 70%);
    max-height: 400px;
}

#cardChoicesCont {
    background: var(--card-bg);
    border-radius: 20px;
    display: inline-flex;
    flex-direction: column;
    
    max-width: 95vw;
    padding: 10px;
    margin-top: 10px;
    align-self: center;
}

#cardChoices {
    display: inline-grid;
    grid-template-columns: repeat(auto-fill, 100px);
    grid-auto-columns: 100px;
    max-width: 95vw;
    width: max-content;
    align-self: center;
}

#sortOptions {
    position: relative;
    margin-left: auto;
    margin-right: 10px;
    display: flex;
    flex-direction: row;
    color: #fff;
    align-items: center;
}

#sortDropDown {
    position: relative;
    color: var(--text-color);
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s;
    float: right;
}

#sortFlipButton {
    width: 40px;
    height: 40px;
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
}

#sortFlipButton img {
    width: 40px;
    height: 40px;
    filter: invert(var(--invert));
}

.triangle {
    width: 0px;
    height: 0px;
    border-style: solid;
    border-width: 0 12.5px 25px 12.5px;
    border-color: transparent transparent #ffffff transparent;
    transform: rotate(0deg);
    width: 25px;
    height: 25px;
    transform: translate(-50px, -50px);
}

#c {
    height: 65vh;
    width: auto;
    aspect-ratio: 432 / 768; 
    border: 2px solid black;
    border-radius: 8px;
    background: #088c36;
    max-width: 100%;
}

.card {
    --border-width: 2px;
    --bevel-size: 20px;

    flex: 0 1 100px;
    max-width: 100px;
    aspect-ratio: 100 / 125;

    position: relative;
    
    image-rendering: pixelated;
    background-color: var(--card-bg);
    border-radius: 5px;
    border: #000000 solid 2px;
    text-align: center;
    color: var(--text-color);

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 5px;
    box-sizing: border-box;
    max-height: 125px;
}
.card.selected {
    transform: scale(1.1);
    border-color: #34d399;
    box-shadow: 0 0 20px rgba(52, 211, 153, 0.7);
}
.card.disabled {
    opacity: 0.2;
}
.card img {
    width: 100%;
    height: 80%;
    object-fit: contain;
    image-rendering: pixelated;
}

/*.common .rare .epic {
    border: none;
    background-image: url("../Imgs/Basic_Border.png");
    filter: drop-shadow(0 0 10px rgba(11, 138, 212, 0.8));
}

.common {
    border: none;
    background-image: url("../Imgs/Basic_Border.png");
    background-size: cover;
}

.legendary {
    border: none;
    background-image: url("../Imgs/Legendary_Border.png");
    background-size: 100% 100%;
    font-size: 10px;
}
.legendary img {
    max-width: 80%;
    max-height: 60%;
}*/

#playerUI {
    color: var(--text-color);
    margin-top: 10px;
    width: 100%;
    max-width: 432px; 
}

#elixirBarOuter {
    border-radius: 5px;
    overflow: hidden;
    background-color: var(--card-bg);
    border: #960096 3px solid;
    height: 25px;
    width: 100%;
    position: relative;
}

#elixirBar {
    position: absolute;
    background-color: #df00df;
    z-index: 1;
}

#elixirBarGrey {
    position: absolute;
    background-color: #aaaaaa69;
}

.divider-line {
    position: absolute;
    top: 0;
    width: 1px;
    height: 100%;
    background: rgba(176, 176, 176, 0.769);
    pointer-events: none;
    z-index: 2;
}

#cardBar {
    display: flex;
    flex-direction: row;
    gap: 5px;
    flex-grow: 1;
    justify-content: space-evenly;
    min-width: 0;
}

/*Options menu button*/
#optionsMenu {
    color: var(--text-color);
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 8px 12px;
    border-radius: 6px;
    position: fixed;
    top: 10px;
    left: 10px;
    cursor: pointer;
    z-index: 52;
    user-select: none;
    display: none;
}

/*Menu Panel*/
#optionsMenuInner {
    display: none;
    position: absolute;
    top: 40px;
    left: 0;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 15px;
    width: 250px;
    z-index: 52;
    color: var(--text-color);
}

#totalCrownDisplay {
    margin: 0;
    position: fixed;
    top: 10px;
    left: 140px;
    color: white;
    z-index: 52;
    font-size: 25px;
}

#optionsMenuInner h3 {
    margin-top: 0;
}

#optionsMenuInner input[type="range"] {
    width: 100%;
}

#cardUI {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    gap: 8px;
    width: 100%;
    justify-content: center;
    box-sizing: border-box;
}

#nextCard {
    flex: 0 0 50px;
    height: 61px;
    font-size: 7px;
}

#multiplayerMenu {
    position: fixed;
    top: 60px;
    left: 10px;
    z-index: 10;
    background: var(--card-bg);
    padding: 15px;
    border-radius: 12px;
    text-align: left;
    border: 1px solid var(--card-border);
    z-index: 51;
    max-width: 200px;
    overflow: hidden;
}

#status {
    font-size: 0.8em;
    margin-top: 10px;
    color: #94a3b8;
}

button {
    padding: 8px 12px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s;
}

.btn-host {
    background: #10b981;
    color: white;
}
.btn-join {
    background: #3b82f6;
    color: white;
}

@media (orientation: portrait) {
    #playerUI {
        max-width: 100vw;
    }
    #chosenCards .card {
        max-width: calc(100% / 4);
    }
}

@media (orientation: landscape) {
    #playerUI {
        max-width: auto;
        width: calc(65vh * (432/768));
    }l
    #c {
        max-height: 70vh; 
        width: auto;
    }
}