/* General Styles */
html,
body {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

body {
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #2e2e2e;
    font-family: Arial, sans-serif;
    color: white;
    overflow: hidden;
    /* Prevent scroll issues on mobile */
}

/* Game Container */
cb-game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    background-size: contain;
}

/* Center Area */
cb-center-area {
    position: absolute;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 9.4rem;
    height: 13.75rem;
    /* rotate: -90deg; */
}

/* Card */
.cb-card {
    display: block;
    width: 100%;
    height: 100%;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    background-image: var(--card-image);
}

.cb-card {
    transform-origin: center center;
    /* Ensures rotation happens around the card center */
    display: block;
    width: 6.25rem;
    height: 8.68rem;
    border-radius: .5rem !important;
}

@media (max-height: 768px) {
    .cb-card {
        width: 5rem;
        height: 6.944rem;
    }
}

@media (max-width: 768px) {
    .cb-card {
        width: 4.5rem;
        height: 6.2496rem;
    }
}

@media (max-height: 500px) {
    .cb-card {
        width: 3.6rem;
        height: 5rem;
    }
}

@media (max-width: 500px) {
    .cb-card {
        width: 4.5rem;
        height: 6.2496rem;
    }
}

.cb-card.played {
    position: absolute !important;
    scale: 1 !important;
}




/* Player Areas */
cb-player-area {
    position: absolute;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 6.25rem;
    height: 2.5rem;
    text-align: center;
    font-size: .75rem;
    /* Smaller font for better fit */

    .cb-card {
        z-index: var(--index) !important;
    }
}

cb-bid-tracker {
    position: absolute;
    background-color: white;
    color: black;
    padding: .25rem;
    font-size: 1rem;
    border-radius: 5px;
    border: .25rem solid black;
    display: none;
    z-index: 1000000;
}

cb-bid-tracker.bidsMet {
    background-color: rgb(69, 194, 38);
}


/* Player Area Positions */
#top-player {
    top: 5%;
    left: 50%;
    transform: translateX(-50%);

    .cb-card {
        left: calc(var(--index) * 40%);
    }

    cb-bid-tracker {
        left: 22rem;
        width: 4rem;
    }

    @media (max-height: 768px) {
        .cb-card {
            left: calc(var(--index) * 6% + 45%);
        }

        cb-bid-tracker {
            left: 56vw;
        }
    }

    @media (max-height: 500px) {
        .cb-card {
            left: calc(var(--index) * 8% + 45%);
        }

        cb-bid-tracker {
            left: 65vw;
        }
    }

    @media (max-width: 768px) {
        .cb-card {
            left: calc(var(--index) * 8% + 38%);
        }

        cb-bid-tracker {
            left: 65vw;
        }
    }
}

#right-player {
    right: 5%;
    top: 50%;
    transform: translateY(-50%);
    writing-mode: vertical-rl;
    text-orientation: mixed;
    /* Vertical text for right and left players */
    width: 2.5rem;
    height: 6.25rem;

    .cb-card {
        bottom: calc(var(--index) * 40%);
    }

    cb-bid-tracker {
        right: 5.7rem;
        top: 17.8rem;
        height: 4rem;
        rotate: 180deg;
    }

    @media (max-height: 768px) {
        .cb-card {
            bottom: calc(var(--index) * 35% + -3%)
        }

        cb-bid-tracker {
            right: -1rem;
            top: 46vh;
        }
    }

    @media (max-height: 500px) {
        .cb-card {
            bottom: calc(var(--index) * 20% + 29%);
        }

        cb-bid-tracker {
            right: -1rem;
            top: 36vh;
        }
    }

    @media (max-width: 768px) {
        .cb-card {
            bottom: calc(var(--index) * 30% + 10%);
        }

        cb-bid-tracker {
            right: -1rem;
            top: 36vh;
        }
    }

    @media (max-width: 400px) {
        cb-bid-tracker {
            right: 3.5rem;
            top: 27.5vh;
        }
    }

    @media (max-height: 400px) {
        cb-bid-tracker {
            right: 3rem;
            top: 38.5vh;
        }
    }
}

#bottom-player {
    bottom: 5%;
    left: 50%;
    transform: translateX(-50%);

    .cb-card {
        left: calc(var(--index) * 40%);
        cursor: not-allowed;
    }


    cb-bid-tracker {
        right: 22rem;
        width: 4rem;
    }

    @media (max-height: 768px) {
        .cb-card {
            left: calc(var(--index) * 6% + 44%);
        }

        cb-bid-tracker {
            right: 56vw;
        }
    }

    @media (max-height: 500px) {
        .cb-card {
            left: calc(var(--index) * 8% + 44%);
        }

        cb-bid-tracker {
            right: 65vw;
        }
    }

    @media (max-width: 768px) {
        .cb-card {
            left: calc(var(--index) * 8% + 38%);
        }

        cb-bid-tracker {
            right: 65vw;
        }
    }


    .cb-card.playable:not(.allplayable):not(.played) {
        bottom: .937rem;
        transition: 1s ease;
    }

    @media (min-width: 768px) or (max-height: 768px) {
        .cb-card:not(.played):hover {
            scale: 1.2 !important;
            transition: .2s ease !important;
        }
    }


    /* Highlight playable cards */
    .cb-card.playable:not(.played) {
        cursor: pointer;
        /* position: relative !important; */
        background-color: rgb(255, 238, 0);
        box-shadow: 0 0 1.25rem rgba(255, 230, 0, 0.8),
            0 0 1.875rem rgba(255, 230, 0, 0.6);
    }
}

#left-player {
    left: 5%;
    top: 50%;
    transform: translateY(-50%);
    writing-mode: vertical-rl;
    text-orientation: mixed;
    width: 2.5rem;
    height: 6.25rem;

    .cb-card {
        top: calc(var(--index) * 40%);
    }

    cb-bid-tracker {
        left: 5.7rem;
        bottom: 17.8rem;
        height: 4rem;
    }

    @media (max-width: 768px) or (max-height: 768px) {
        cb-bid-tracker {
            left: -1rem;
            bottom: 32vh;
        }
    }

    @media (max-height: 768px) {
        .cb-card {
            top: calc(var(--index) * 35% + 52%);
        }

        cb-bid-tracker {
            left: -1rem;
            bottom: 38vh;
        }
    }

    @media (max-height: 500px) {
        .cb-card {
            top: calc(var(--index) * 20% + 52%);
        }

        cb-bid-tracker {
            left: -1rem;
            bottom: 32vh;
        }
    }

    @media (max-width: 768px) {
        .cb-card {
            top: calc(var(--index) * 30% + 52%);
        }
    }

    @media (max-width: 400px) {
        cb-bid-tracker {
            left: 3.5rem;
            bottom: 22.5vh;
        }
    }

    @media (max-height: 400px) {
        cb-bid-tracker {
            left: 3rem;
            bottom: 32.5vh;
        }
    }
}

#left-player,
#right-player {
    .cb-card {
        writing-mode: horizontal-bt;
        margin: -1.9375rem 0;
    }
}

@media (max-width: 768px) {
    #top-player {
        top: 8%;
    }

    #bottom-player {
        bottom: 8%;
    }
}

@media (max-height: 768px) {
    #top-player {
        top: 13%;
    }

    #bottom-player {
        bottom: 13%;
    }
}


cb-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* additional styles for the modal */
}

cb-modal {
    background-color: #ffffff;
    border: 1px solid #cccccc;
    padding: 1.25rem;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 .625rem #cccccc;
    border-radius: .625rem;
    z-index: 1000;
}


cb-slider-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

cb-slider-labels {
    display: flex;
    justify-content: space-between;
    width: 18.75rem;
    margin-bottom: .625rem;
}

cb-slider-labels span {
    font-size: .75rem;
    color: #333;
}

cb-slider {
    width: 18.75rem;
}

cb-slider-submit {
    display: block;
    width: 6.25rem;
    height: 2.5rem;
    background-color: #007bff;
    border-color: #333;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    border-radius: 5px;
    font-size: 1.25rem;
}

.modal__trigger {
    position: absolute;
    left: .625rem;
    top: .625rem;
    font-size: 1.25rem;
    cursor: pointer;
}

#showSettings {
    left: 3rem;
}

cb-setting-design-options {
    width: 100%;
    display: flex;
    justify-content: left;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
    justify-content: center;
}

.designOption {
    width: 3rem;
    height: 4rem;
    cursor: pointer;
}

.designOption.active {
    border: .1rem solid black;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: .5rem;
    background-color: #ddd;
    border-radius: .25rem;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    background-color: #007bff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}

.hidden {
    display: none;
}


/* Responsive Design */
@media (max-width: 768px) or (max-height: 768px) {
    cb-center-area {
        width: 7.5rem;
        height: 11.25rem;
    }

    cb-player-area {
        width: 5rem;
        height: 1.875rem;
        font-size: .625rem;
    }

    #top-player,
    #bottom-player {
        width: 60%;
    }

    #right-player,
    #left-player {
        width: auto;
    }
}

@media (max-width: 480px) or (max-height: 480px) {
    cb-center-area {
        width: 6.25rem;
        height: 9.375rem;
    }

    cb-player-area {
        width: 4.375rem;
        height: 1.5625rem;
        font-size: .5rem;
    }
}


* {
    box-sizing: border-box;
}

body {
    line-height: 1.5;
    font-family: 'Lato';
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

h1,
h2,
h3,
p {
    font-weight: 300;
    margin: 0 0 1.4rem 0;
}

h1,
h2,
h3 {
    line-height: 1.3;
}

/**
   * Material Modal CSS
   */
.modal {
    will-change: visibility, opacity;
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    visibility: hidden;
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    /* transition-delay: $modal-delay; */
}

.modal--active {
    visibility: visible;
    opacity: 1;
}

.modal--align-top {
    align-items: flex-start;
}

.modal__bg {
    background: transparent;
}

.modal__dialog {
    max-width: 37.5rem;
    padding: 1.2rem;
}

.modal__content {
    will-change: transform, opacity;
    position: relative;
    padding: 2.4rem;
    background: white;
    background-clip: padding-box;
    box-shadow: 0 .75rem .9375rem 0 rgba(0, 0, 0, 0.25);
    opacity: 1;
    color: black;
    transition: all 0.25s cubic-bezier(0.23, 1, 0.32, 1);
}

@media (max-width: 768px) or (max-height: 768px) {
    .modal__dialog {
        max-width: 80vw;
        padding: 1.4rem;
    }

    .modal__content {
        padding: .4rem;
    }
}

@media (max-width: 629px) or (max-height: 629px) {

    cb-scoreboard-header,
    cb-scoreboard-row cb-scoreboard-cell {
        padding: .625rem .2rem !important;
    }
}

@media (max-width: 533px) or (max-height: 533px) {
    .modal__dialog {
        max-width: 100vw;
        padding: 0;
    }

    .modal__content {
        padding: .4rem;
    }


}

.modal__content--active {
    opacity: 1;
}

.modal__close {
    z-index: 1100;
    cursor: pointer;
}

#modal__temp {
    will-change: transform, opacity;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ffebee;
    transform: none;
    opacity: 1;
    transition: opacity 0.1s ease-out, transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

.modal__close {
    position: absolute;
    top: 0;
    right: 0;
    margin: 1.2rem;
    padding: 0.6rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 50%;
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

.modal__close svg {
    width: 1.5rem;
    fill: #fff;
    pointer-events: none;
    vertical-align: top;
}

.modal__close:hover {
    background: rgba(0, 0, 0, 0.6);
}

cb-scoreboard {
    display: table;
    max-width: 37.5rem;
    margin: 0 auto;
    border-collapse: collapse;
}

cb-scoreboard-row {
    display: table-row;
}

cb-scoreboard-cell {
    display: table-cell;
    text-align: center;
    padding: .625rem;
    font-size: .875rem;
    border: 1px solid #ddd;
}

cb-scoreboard-row:nth-child(even) cb-scoreboard-cell {
    background-color: #f9f9f9;
}

cb-scoreboard-row:nth-child(odd) cb-scoreboard-cell {
    background-color: #fff;
}

cb-scoreboard-header,
cb-scoreboard-row cb-scoreboard-cell:nth-child(1) {
    display: table-cell;
    text-align: center;
    padding: .625rem;
    font-size: .875rem;
    font-weight: bold;
    background-color: #f0f0f0;
    border: none;
}

cb-scoreboard-row cb-scoreboard-cell:nth-child(1) {
    min-width: 6.25rem;
    text-align: left;
}