:root {
    --bg-main: linear-gradient(145deg, #1e2b2c 0%, #0f1a1b 100%);
    --text-main: #f6e9c7;
    --panel-bg: #2d3a3b;
    --card-bg: #f5f0e6;
    --accent: #ffb703;
    --modal-bg: #1e2b2c;
    --container-bg: rgba(255, 255, 255, 0.08);
    --table-text: #fff;
    --top-player: #ffb70350;
}

body.light-mode {
    --bg-main: linear-gradient(145deg, #ffa585 0%, #ffeda0 100%);
    --text-light: #ffa585;
    --text-main: #790645;
    --panel-bg: #9F86C0;
    --card-bg: #ffffff;
    --accent: #3E2A35;
    --modal-bg: #ffffff;
    --container-bg: rgba(255, 255, 255, 0.7);
    --table-text: #000;
    --top-player: #79064580;
}

body {
    background: var(--bg-main);
    min-height: 100vh;
    margin: 0;
    font-family: 'Segoe UI', 'Poppins', system-ui, sans-serif;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
}

main {
    max-width: 500px;
    margin: 0 auto;
    display: none;
}

a {
    text-decoration: none;
}

/* /////////////////////////////////////////////////////////////////////////// */
/* ////////////////////////Header Start/////////////////////////////////////// */
/* /////////////////////////////////////////////////////////////////////////// */

h1,
h2 {
    font-size: 2.6rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.7);
    margin-bottom: 0.5rem;
    display: flex;
    gap: 0.4rem;
    color: var(--text-main);
}

h3 {
    color: var(--text-main);
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.7);
    text-decoration: underline;
}

p,
ul li,
pre {
    color: var(--table-text);
}

#play {
    width: 250px;
    height: 50px;
    margin-bottom: 4px;
}

#leaderboard {
    height: 50px;
    width: 196px;
}

#htp {
    height: 50px;
    width: 50px;
}

.button {
    position: relative;
    background-color: transparent;
    cursor: pointer;
    overflow: hidden;
    color: var(--accent);
    border: 2px solid var(--accent);
    transition: all 1s ease-in-out;
    font-size: 1.5rem;
    font-weight: bolder;
}

.button::after {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    transition: all 1s ease-in-out;
    background-color: var(--accent);
    visibility: hidden;
    height: 10px;
    width: 10px;
    z-index: -1;
}

.button:hover {
    color: var(--text-light);
    box-shadow: inset 1px 1px 1px 1px #1e2b2c;
}

#htp:hover {
    box-shadow: inset -1px 1px 1px 1px #1e2b2c;
}

.button:hover::after {
    visibility: visible;
    transform: scale(100) translateX(2px);
}

.toggle {
    position: absolute;
    right: 10px;
    bottom: 110px;
    background: transparent;
    border: none;
    padding: 1rem;
    font-size: 2rem;
    cursor: pointer;
}

.toggle-leader {
    bottom: 15px;
}

/* /////////////////////////////////////////////////////////////////////////// */
/* //////////////////////////Header End/////////////////////////////////////// */
/* /////////////////////////////////////////////////////////////////////////// */
/* //////////////////////////Cards Start////////////////////////////////////// */
/* /////////////////////////////////////////////////////////////////////////// */

.flip-card,
.front-card,
.back-card,
.deal,
.deck,
.deck-cards {
    width: 8vw;
    min-width: 90px;
    max-width: 120px;
    aspect-ratio: 5/7;
    border-radius: 1.2rem;
    box-shadow: 0 15px 25px rgba(0, 0, 0, 0.5), inset 0 -3px 0 rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-weight: 800;
    border: 2px solid #d4b87a;
    background: radial-gradient(circle at 20% 20%, #fff6e6, #e7d7b8);
    z-index: 3;
}

.flip-card {
    position: relative;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.front-card,
.back-card {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
}

.back-card {
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    padding: 0;
}

.front-card,
.deck-cards,
.deal {
    background: linear-gradient(115deg, #e8dbbd 0%, #c9aa5e 50%, #e8dbbd 100%);
    position: relative;
    overflow: hidden;
}

.front-card::before,
.deck-cards::before,
.deal::before {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(45deg,
            rgba(255, 215, 0, 0.1) 0px,
            rgba(255, 215, 0, 0.1) 2px,
            transparent 2px,
            transparent 12px);
}

.front-card::after,
.deck-cards::after,
.deal::after {
    content: "⚜";
    font-size: 4rem;
    color: rgba(255, 217, 0, 0.74);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);

}

.card-value {
    position: absolute;
    font-size: xx-large;
}


.cards[data-locked="true"] {
    pointer-events: none;
    opacity: 0.7;
}

.higher,
.lower {
    flex: 1;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.higher {
    border-top-left-radius: 1.2rem;
    border-top-right-radius: 1.2rem;
    color: transparent;
}

.lower {
    border-bottom-left-radius: 1.2rem;
    border-bottom-right-radius: 1.2rem;
    color: transparent;
}

.higher:hover {
    background: linear-gradient(to bottom, rgba(76, 175, 80, 0.7), rgba(76, 175, 80, 0.2));
    color: #000;
}

.back-card:has(.higher:hover) {
    border-color: #8bc34a;
    box-shadow: 0 0 35px #4caf50, 0 10px 25px black;

}

.lower:hover {
    background: linear-gradient(to top, rgba(244, 67, 54, 0.7), rgba(244, 67, 54, 0.2));
    color: #000;
}

.back-card:has(.lower:hover) {
    box-shadow: 0 0 35px #f44336, 0 10px 25px black;
    border-color: #e57373;
}

.e-flip {
    transform: scaleX(-1);
}

.hot {
    animation: burn 3s ease-out infinite;
    border-radius: 1.2rem;
}

.extra-hot {
    animation: burner 1s ease-out infinite;
    border-radius: 1.2rem;
}

@keyframes burn {
    0% {
        color: #ff826e;
        box-shadow:
            0 0 5px 0 #ffb703,
            0 0 5px 0 #ffb703;
    }

    100% {
        color: black;
        background: white;
        box-shadow:
            0 0px 40px 10px rgba(255, 130, 10, 0),
            0 0px 30px 10px rgba(230, 30, 10, 0),
            0 0px 10px 0 rgba(255, 255, 10, 0);
    }
}

@keyframes burner {
    0% {
        color: #ff826e;
        box-shadow:
            0 0 5px 5px #d90429,
            0 0 5px 0 #f08080;
    }

    100% {
        color: black;
        background: white;
        box-shadow:
            0 0px 40px 10px rgba(255, 130, 10, 0),
            0 0px 30px 10px rgba(230, 30, 10, 0),
            0 0px 10px 0 rgba(255, 255, 10, 0);
    }
}

/* /////////////////////////////////////////////////////////////////////////// */
/* ///////////////////////////Cards End/////////////////////////////////////// */
/* /////////////////////////////////////////////////////////////////////////// */
/* ////////////////////////container Start//////////////////////////////////// */
/* /////////////////////////////////////////////////////////////////////////// */

.container {
    max-width: 650px;
    min-width: 320px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(16px);
    border-radius: 3.5rem;
    padding: 1rem 1.8rem 2.2rem;
    box-shadow: 0 30px 50px rgba(0, 0, 0, 0.6), inset 0 1px 1px rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 auto 1rem;
    position: relative;
    z-index: 2;
}

.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    justify-items: center;
    align-items: center;
    max-height: 540px;
    margin: 0 0 2rem 0;
    min-width: 320px;
}

/* /////////////////////////////////////////////////////////////////////////// */
/* ///////////////////////////Score Panel///////////////////////////////////// */
/* /////////////////////////////////////////////////////////////////////////// */

.panel {
    width: 90%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--panel-bg);
    border-radius: 4rem;
    padding: 0.8rem 2rem;
    margin: 0.75rem 0 1.8rem;
    box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.5), 0 8px 18px rgba(0, 0, 0, 0.4);
    color: #fae7b3;
    font-weight: bold;
    flex-wrap: wrap;
}

.form-control {
    position: relative;
    display: flex;
    justify-content: center;
}

.form-control input {
    background-color: transparent;
    border: 0;
    border-bottom: 2px #fff solid;
    display: block;
    padding: 15px 0;
    font-size: 18px;
    color: var(--text-main);
    margin-right: 1rem;
}

.form-control input:focus,
.form-control input:valid {
    outline: 0;
    border-bottom-color: #ffb703;
}

.form-control label {
    position: absolute;
    top: 15px;
    left: 0;
    pointer-events: none;
}

.form-control label span {
    display: inline-block;
    font-size: 18px;
    color: #fff;
    transition: 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.form-control input:focus+label span,
.form-control input:valid+label span {
    color: #ffb703;
    transform: translateY(-30px);
}

#endText {
    margin-bottom: 3rem;
    text-align: left;
}

.modal-btn {
    height: 45px;
    min-width: 110px;
    border-radius: 0.75rem;
    cursor: pointer;
    border: 2px solid #ffb703;
    background: transparent;
    color: #ffb703;
    font-size: 1rem;
    font-weight: bold;
    margin-top: 0.5rem;
}

.modal-btn:hover {
    color: #0f1a1b;
    background-color: #ffb703;
}

.score-modal {
    position: relative;
}

.restart-button {
    cursor: pointer;
    border: none;
    background: #ffb703;
    color: #0f1a1b;
    width: 75px;
    height: 75px;
    border-radius: 50%;
    overflow: hidden;
    position: absolute;
    font-weight: 600;
    right: 20px;
    top: 20px;
}

.button__text {
    position: absolute;
    inset: 0;
    animation: text-rotation 8s linear infinite;

    >span {
        position: absolute;
        transform: rotate(calc(19deg * var(--index)));
        inset: -10px;
    }
}

.restart-button:hover {
    background: #0f1a1b;
    color: #ffb703;
    box-shadow: 1px 1px 1px 1px #ffb703;
    transform: scale(1.05);
}

@keyframes text-rotation {
    to {
        rotate: 360deg;
    }
}

.end-score {
    width: 100%;
    display: flex;
    justify-content: space-between;
}

/* ///////////////////////////////////////////////////////////////////////////////// */
/* ///////////////////////////////////Modal///////////////////////////////////////// */
/* ///////////////////////////////////////////////////////////////////////////////// */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 999;
}

.modal.active {
    display: flex;
}

.modal-box {
    background: var(--modal-bg);
    padding: 2rem 3rem;
    border-radius: 1.5rem;
    text-align: center;
    color: var(--text-main);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
}

.restart-btn {
    margin-top: 1rem;
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: 0.8rem;
    cursor: pointer;
}

.container.correct {
    box-shadow: 0 0 40px rgba(76, 175, 80, 0.6);
}

.container.wrong {
    box-shadow: 0 0 40px rgba(244, 67, 54, 0.6);
    animation: shake 0.4s ease;
}

@keyframes shake {
    0% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-6px);
    }

    40% {
        transform: translateX(6px);
    }

    60% {
        transform: translateX(-4px);
    }

    80% {
        transform: translateX(4px);
    }

    100% {
        transform: translateX(0);
    }
}

/* ///////////////////////////////////////////////////////////////////////////////// */
/* ////////////////////////////Leaderboard////////////////////////////////////////// */
/* ///////////////////////////////////////////////////////////////////////////////// */

.top-player {
    background: var(--top-player);
}

td:nth-child(n+3) {
    text-align: right;
}

thead {
    position: sticky;
    top: 0;
    background: var(--panel-bg);
}

#leaderboardModal .modal-box {
    position: relative;
}

#closeLeaderboard {
    position: absolute;
    background-color: #d90429;
    right: 1rem;
    top: 1rem;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 24px;
}

#closeLeaderboard:hover {
    cursor: pointer;
    background-color: #e57373;
    box-shadow: inset 1px 1px 1px 1px #000;
}

.table {
    width: 100%;
    color: var(--table-text);
    border: 1px solid var(--table-text);
}

.modal-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#submitStatus {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #ffb703;
    opacity: 0;
    transition: 0.3s ease;
}

#submitStatus.show {
    opacity: 1;
}

.form-control input.invalid {
    border-bottom-color: #f44336;
    box-shadow: 0 2px 0 #f44336;
}


.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin: 2rem 0;
}

.pagination button {
    padding: 0.7rem 1.2rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#leaderboardModal a {
    border: 2px solid var(--accent);
    color: var(--accent);
    padding: 1rem;
}

#leaderboardModal a:hover {
    background-color: var(--accent);
    color: var(--text-main);
}

table {
    margin-bottom: 2rem;
}

.leader-header {
    width: 100%;
    background-color: var(--panel-bg);
    box-shadow: 0 5px 10px #000;
    margin-bottom: 1rem;
}

nav {
    display: flex;
    justify-content: center;
    width: 100%;
}

.nav {
    width: 100%;
    max-width: 1080px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    position: relative;
}

.site-id {
    margin: 0;
    padding: 1rem 0;
    font-size: 1.5rem;
}

.nav ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav ul li {
    display: flex;
}

.nav ul li a {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem 1.25rem;
    color: var(--table-text);
    font-weight: bold;
    transition: 0.2s;
}

.nav ul li a:hover {
    color: var(--accent);
    border-bottom: 2px solid var(--accent);
    background: linear-gradient(360deg,
            var(--accent) 0%,
            var(--panel-bg) 30%);
}

.menu {
    display: none;
    background: none;
    border: none;
    color: var(--table-text);
    font-size: 2rem;
    cursor: pointer;
}

/* MOBILE */

@media only screen and (max-width: 700px) {

    .nav {
        flex-wrap: wrap;
        padding: 0 1rem;
    }

    .menu {
        display: block;
    }

    .nav ul {
        width: 100%;
        flex-direction: column;
        overflow: hidden;

        max-height: 0;
        transition: max-height 0.3s ease;

        background-color: var(--panel-bg);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .nav ul.open {
        max-height: 500px;
    }

    .nav ul li {
        width: 100%;
    }

    .nav ul li a {
        width: 100%;
        justify-content: flex-start;
        padding: 1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    .nav ul li a:hover {
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        background: rgba(255, 255, 255, 0.05);
    }

    .site-id {
        font-size: 1.2rem;
    }
}

.ad-space {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.ad {
    width: 300px;
    height: 250px;
    border: 2px dotted rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.03);
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

.ad-1 {
    left: 2rem;
}

.ad-2 {
    right: 2rem;
}

.leader-con {
    display: flex;
    justify-content: space-between;
    padding: 0 2rem;
}

.banner-ad {
    width: 728px;
    height: 90px;
    border: 2px dotted rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.03);
}


.main {
    max-width: 1080px;
    margin: 0 auto;
}

/* contact */

.support-form {
    width: min(1000px, 95%);
    margin: 2rem auto;
    padding: 1.5rem;
    background: var(--panel-bg);
    border-radius: 16px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.35);

    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 1rem;
}

.form-sub,
.form-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-sub {
    justify-content: flex-start;
}

.form-info {
    min-height: 100%;
}

.support-form input,
.support-form select,
.support-form textarea,
.support-form button {
    width: 100%;
    border: none;
    outline: none;
    border-radius: 10px;
    padding: 0.9rem 1rem;
    font-size: 1rem;
    box-sizing: border-box;
}

/* INPUTS */
.support-form input,
.support-form select,
.support-form textarea {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border: 2px solid transparent;
    transition: 0.2s ease;
}

/* PLACEHOLDER */
.support-form input::placeholder,
.support-form textarea::placeholder {
    color: var(--text-main);
}

/* FOCUS */
.support-form input:focus,
.support-form select:focus,
.support-form textarea:focus {
    border-color: #5ea1ff;
    background: rgba(255, 255, 255, 0.12);
}

/* TEXTAREA */
.support-form textarea {
    resize: vertical;
    min-height: 250px;
    flex: 1;
}

/* BUTTON ROW */
.support-form>div:last-child {
    grid-column: 1 / -1;

    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* BUTTON */
#submitBtn {
    cursor: pointer;
    font-weight: 700;
    background: linear-gradient(135deg, #4f8cff, #6ea8ff);
    color: white;
    transition: 0.2s ease;
}

#submitBtn:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
}

#submitBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* MESSAGE */
.form-message {
    display: none;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    font-size: 0.95rem;
    white-space: pre-line;
}

.form-message.error {
    display: block;
    background: rgba(247, 0, 0, 0.685);
    border: 1px solid rgba(255, 70, 70, 0.4);
    color: #ffb3b3;
}

.form-message.success {
    display: block;
    background: rgba(60, 200, 120, 0.15);
    border: 1px solid rgba(60, 200, 120, 0.4);
    color: #b7ffd1;
}

/* MOBILE */
@media (max-width: 750px) {

    .support-form {
        grid-template-columns: 1fr;
    }

    .support-form textarea {
        min-height: 180px;
    }

}

/* footer */

footer {
    height: 100px;
    width: 100%;
    margin: auto auto 0 auto;
    background-color: var(--panel-bg);
}

.footer {
    max-width: 1080px;
    display: flex;
    justify-content: space-between;
    margin: 0 auto;
    margin-top: 1rem;
}

footer h2 {
    margin: 0;
}

footer div a {
    display: flex;
    color: (var(--text-main));
}

footer div a:hover {
    color: var(--accent);
}

.overlay {
    position: absolute;
    color: #000;
    background-color: red;
    border-radius: 1.2rem;
    border: 2px solid #e76005;
    z-index: 4;
    opacity: 1;
    font-size: 1.5rem;
    font-style: italic;
    font-weight: bold;
}

/* ///////////////////////////////////////////////////////////////////////////////// */
/* //////////////////////Just Works Better Like This//////////////////////////////// */
/* ///////////////////////////////////////////////////////////////////////////////// */

.higher::before {
    content: '👆';
}

.higher::after {
    content: '👆';
}

.lower::after {
    content: '👇';
}

.lower::before {
    content: "👇";
}