html {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
    background-color: #1a1a3a;
    width: 100%;
    height: 100%;
    overflow: visible;
    transform: translate(0, 0); /* For shake animation */
}

.hint {
    animation: hintPulse 0.5s infinite alternate;
    border: 3px solid #ffff00;
    box-shadow: 0 0 10px #ffff00, 0 0 20px #ffff00;
    background-color: rgba(255, 255, 0, 0.2);
}

@keyframes highScoreAnimation {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
    80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
}

@keyframes hintPulse {
    from { 
        opacity: 1;
        box-shadow: 0 0 5px #ffff00, 0 0 5px #ffff00;
    }
    to { 
        opacity: 0.6;
        box-shadow: 0 0 10px #ffff00, 0 0 10px #ffff00;
    }
}

.big-play-button {
    margin: 10px;
}

.score-pop {
    position: absolute;
    font-size: 18px;
    color: gold;
    font-weight: bold;
    pointer-events: none;
    animation: scorePop 2s ease-out forwards;
    z-index: 2;
}

.flush {
    font-size: 16px;
    color: #00ced1;
    margin-left: 5px;
}

.score-pop .multiplier {
    font-size: 24px;
    color: cyan;
    margin-left: 5px;
}

.combo {
    font-size: 16px;
    color: #ff4500;
    margin-left: 5px;
}

@keyframes scorePop {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    50% { transform: translateY(-30px) scale(1.2); opacity: 1; }
    100% { transform: translateY(-50px) scale(1); opacity: 0; }
}

#sound-button {
    font-size: 24px;
    color: white;
    cursor: pointer;
    padding: 5px 10px;
    background-color: #4a4a7a;
    border-radius: 5px;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    position: absolute;
    top: 10px;
    right: 60px;
    border: none;
}

#sound-button:hover {
    background-color: #6a6aa0;
}

#combo-display {
    position: absolute;
    bottom: 30px;
    left: 10px;
    width: 60px;
    height: 50px;
    padding-top: 18px;
    color: white;
    font-size: 14px;
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    text-align: center;
    background-color: #ff4500;
    transition: color 0.3s ease;
    display: none;
}

#combo-display:not([style*="display: none"]) {
    animation: pulse 1s ease-in-out infinite, glow 1s ease-in-out infinite;
}

#combo-display.combo-x2 { background-color: #444444; }
#combo-display.combo-x3 { background-color: #ffd700; }
#combo-display.combo-x4 { background-color: #ff4500; }
#combo-display.combo-x5 { background-color: #ff0000; }
#combo-display.combo-x6 { background-color: #00ced1; }
#combo-display.combo-x7 { background-color: #00ff00; }
#combo-display.combo-x8 { background-color: #0000ff; }
#combo-display.combo-x9 { background-color: #800080; }
#combo-display.combo-x10 { background-color: #ff00ff; }

#game-container {
    text-align: center;
    position: relative;
    width: 100%;
    height: 100%;
    overflow: visible;
    z-index: 1;
}

#header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 10px;
    z-index: 20;
    background-color: rgba(26, 26, 58, 0.8);
}

#info-button {
     font-size: 20px;
    color: white;
    cursor: pointer;
  
    background-color: #4a4a7a;
    border-radius: 5px;
    width: 35px;
    height: 35px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    position: absolute;
    top: 10px;
    right: 25px;
    border: none;
}



#fullscreen-button {
    display: none !important;
}
#info-button:hover {
    background-color: #6a6aa0;
}

#score {
    position: fixed;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 18px;
    color: #fff;
    z-index: 20;
}

#highest-score {
    position: fixed;
    top: 10px;
    left: 15%;
    transform: translateX(-50%);
    font-size: 18px;
    color: #EECA00;
    z-index: 20;
}

#highest-score::before {
    content: "ðŸ‘‘";
    display: inline-block;
    margin-right: 2px;
}

.card.joker {
    background-color: #f0f0f0;
    border: 2px solid #ff00ff;
    color: #ff00ff;
}

.card.joker .suit.wildcard {
    font-size: 36px;
    color: #ff00ff;
}

.card.frozen {
    background-color: #e0f7ff;
    border: 2px solid #00b7eb;
    box-shadow: 0 0 10px rgba(0, 183, 235, 0.8);
    position: relative;
    overflow: hidden;
}

.card.frozen::before {
    content: '*';
    position: absolute;
    top: 1px;
    left: 1px;
    font-size: 36px;
    color: #00b7eb;
    text-shadow: 0 0 5px rgba(0, 183, 235, 0.8);
    z-index: 2;
    animation: spin 2s linear infinite;
}

.card.frozen::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 1;
    pointer-events: none;
}

.card.crack {
    background-color: #FFF;
    border: 2px solid #555;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}

.card.crack::after {
    opacity: 1;
}

.card.crack::before {
    content: '';
}

/* Ensure cracked cards don’t inherit frozen pseudo-elements */
.card:not(.frozen)::before,
.card:not(.frozen)::after {
    content: none !important;
    background: none !important;
    opacity: 0 !important;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#grid {
    display: grid;
    grid-template-columns: repeat(6, 60px);
    grid-gap: 0;
    background-color: #2a2a5a;
    padding: 0;
    border-radius: 5px;
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

.grid-cell {
    width: 60px;
    height: 90px;
    background: radial-gradient(circle at center, #3a3a6a, #2a2a5a);
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid #4a4a7a;
    position: relative;
    z-index: 11;
}

.card {
    width: 50px;
    height: 80px;
    background-color: white;
    border: 2px solid #000;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    font-weight: bold;
    user-select: none;
    cursor: move;
    padding: 5px;
    position: relative;
    transition: opacity 0.2s;
    pointer-events: auto;
}

.card .suit {
    font-size: 36px;
    line-height: 1;
    font-weight: bold;
}

.card.fixed {
    cursor: default;
    pointer-events: none;
}

.red { color: red; }
.black { color: black; }

#card-deck {
    display: flex;
    justify-content: center;
    gap: 3px;
    padding: 10px;
    position: absolute;
    bottom: 0px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    padding-right: 60px;
	margin-left:25px;
}

#tutorial-hand {
    position: absolute;
    width: 40px;
    height: 40px;
    background: url('hand-cursor.png') no-repeat center;
    background-size: contain;
    z-index: 1000;
    pointer-events: none;
    display: none;
}
#tutorial-hand-hint {
    position: absolute;
    width: 40px;
    height: 40px;
    background: url('hand-cursor.png') no-repeat center;
    background-size: contain;
    z-index: 1000;
    pointer-events: none;
    display: none;
}
.tutorial-text {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #000;
    color: white;
    padding: 1px;
    border-radius: 5px;
    z-index: 1001;
    display: none;
    text-align: center;
    width: 90%;
    max-width: 400px;
}

#tutorial-understood {
    background-color: #4a4a7a;
    color: white;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
    border-radius: 5px;
    margin-top: 5px;
}

#tutorial-understood:hover {
    background-color: #6a6aa0;
}

@keyframes moveRow {
    0% { left: calc(50% - 180px); top: 95px; opacity: 1; }
    20% { left: calc(50% - 120px); top: 95px; }
    40% { left: calc(50% - 20px); top: 95px; }
    50% { left: calc(50% + 20px); top: 185px; opacity: 1; }
    70% { left: calc(50% - 100px); top: 185px; }
    90% { left: calc(50% - 160px); top: 185px; }
    100% { opacity: 0; }
}

@keyframes moveColumn {
    0% { left: calc(50% - 180px); top: 575px; opacity: 1; }
    20% { left: calc(50% - 180px); top: 485px; }
    40% { left: calc(50% - 180px); top: 395px; }
    50% { left: calc(50% - 120px); top: 125px; opacity: 1; }
    70% { left: calc(50% - 120px); top: 215px; }
    90% { left: calc(50% - 120px); top: 305px; }
    100% { opacity: 0; }
}

@keyframes moveSameNumber {
    0% { left: calc(50% - 170px); top: 150px; opacity: 1; }
    25% { left: calc(50% - 110px); top: 150px; }
    50% { left: calc(50% - 50px); top: 150px; }
    75% { left: calc(50% + 10px); top: 150px; }
    100% { opacity: 0; }
}

@keyframes explode {
    0% { transform: scale(1) rotate(0deg); opacity: 1; }
    20% { transform: scale(1.1) rotate(10deg); opacity: 1; }
    40% { transform: scale(1.05) rotate(-10deg); opacity: 0.9; }
    60% { transform: scale(1.1) rotate(15deg); opacity: 0.7; }
    80% { transform: scale(0.8) rotate(-5deg); opacity: 0.4; }
    100% { transform: scale(0) rotate(0deg); opacity: 0; }
}

.explode {
    animation: explode 0.6s ease-out forwards;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
}

.popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow: scroll;
}

.popup-content {
    background-color: white;
    margin: 5% auto;
    padding: 10px;
    border: 1px solid #888;
    width: 90%;
    max-width: 320px;
    border-radius: 5px;
    text-align: left;
    box-sizing: border-box;
    overflow: hidden;
}

.popup-content h3 {
    font-size: 14px;
    margin: 5px 0;
    color: #333;
}

.popup-content > p {
    font-size: 12px;
    margin: 5px 0;
}

.rule-example {
    display: flex;
    align-items: center;
    margin: 3px 0;
}

.rule-example .card {
    width: 40px;
    height: 50px;
    font-size: 16px;
    padding: 1px;
    margin: 2px;
    border-radius: 2px;
    border: 1px solid #000;
}

.rule-example .card .suit {
    font-size: 15px;
    line-height: 1;
}

.rule-example p {
    margin: 0 0 0 5px;
    font-size: 14px;
    color: #333;
}

#rules-restart {
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
    border-radius: 3px;
    margin-bottom: 10px;
    display: block;
    width: 100%;
    font-size: 16px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: background-color 0.2s ease, transform 0.2s ease;
    text-align: center;
}

#rules-restart:hover {
    background-color: #c0392b;
    transform: scale(1.05);
}

#close-popup {
    background-color: #4a4a7a;
    color: white;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
    border-radius: 3px;
    margin-top: 5px;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: background-color 0.2s ease, transform 0.2s ease;
    width: 100%;
}

#close-popup:hover {
    background-color: #6a6aa0;
    transform: scale(1.05);
}

#game-over-popup .popup-content {
    max-width: 400px;
    text-align: center;
}

#game-over-popup h2 {
    margin: 0 0 10px;
    color: #333;
}

#game-over-popup p {
    margin: 0 0 20px;
    font-size: 18px;
    color: #333;
}

#restart-button {
    background-color: #4a4a7a;
    color: white;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    border-radius: 5px;
    font-size: 16px;
}

#restart-button:hover {
    background-color: #6a6aa0;
}

.particle {
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: #ffd700;
    border-radius: 50%;
    pointer-events: none;
    z-index: 3;
    animation: particleBurst 0.8s ease-out forwards;
}

@keyframes particleBurst {
    0% { transform: scale(1) translate(0, 0); opacity: 1; }
    100% { transform: scale(0.5) translate(var(--x), var(--y)); opacity: 0; }
}

#refresh-button {
    position: absolute;
    bottom: 30px;
    right: 10px;
    width: 50px;
    height: 50px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    background-color: #00C300;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease, background-color 0.2s ease;
    border-radius: 50%;
    overflow: hidden;
    padding: 5px;
}

#refresh-button:hover {
    background-color: #00a300;
    transform: scale(1.1);
}

.refresh-cards {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2px;
    transform-origin: center;
    margin-top: 7px;
}

.refresh-cards .menu-card {
    width: 15px;
    height: 30px;
    background-color: white;
    border: 1px solid #000;
    border-radius: 3px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 8px;
    font-weight: bold;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.refresh-cards .menu-card .suit {
    font-size: 12px;
    line-height: 1;
}

.refresh-cards .menu-card .red { color: red; }
.refresh-cards .menu-card .black { color: black; }

#refresh-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

#refresh-popup .popup-content {
    background-color: white;
    margin: 20% auto;
    margin-top: 60%;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 300px;
    border-radius: 5px;
    text-align: center;
}

#refresh-popup h3 {
    margin: 0 0 15px;
    color: #333;
}

#refresh-yes, #refresh-no {
    background-color: #4a4a7a;
    color: white;
    border: none;
    padding: 8px 15px;
    cursor: pointer;
    border-radius: 5px;
    margin: 0 10px;
}

#refresh-yes:hover, #refresh-no:hover {
    background-color: #6a6aa0;
}

#main-menu {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: linear-gradient(135deg, #2c3e50, #3498db);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    text-align: center;
}

.stylized-title {
    font-family: 'Arial', sans-serif;
    font-size: 4rem;
    color: #fff;
    text-shadow: 3px 3px 5px rgba(0, 0, 0, 0.5);
    letter-spacing: 2px;
    animation: fadeIn 1s ease-in;
    margin: 20px 0;
}

.title-cards {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    margin-top: 55%;
}

.menu-card {
    width: 50px;
    height: 70px;
    background-color: white;
    border: 2px solid #000;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.menu-card .suit {
    font-size: 24px;
    line-height: 1;
}

.menu-card .red { color: red; }
.menu-card .black { color: black; }

.big-play-button {
    font-size: 2.5rem;
    padding: 20px 60px;
    margin-top: 20px;
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.big-play-button:hover {
    transform: scale(1.1);
    background-color: #c0392b;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes shake {
    0% { transform: translate(0, 0); }
    10% { transform: translate(-5px, 5px); }
    20% { transform: translate(5px, -5px); }
    30% { transform: translate(-5px, 5px); }
    40% { transform: translate(5px, -5px); }
    50% { transform: translate(-5px, 5px); }
    60% { transform: translate(5px, -5px); }
    70% { transform: translate(-5px, 5px); }
    80% { transform: translate(5px, -5px); }
    90% { transform: translate(-5px, 5px); }
    100% { transform: translate(0, 0); }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes glow {
    0% { box-shadow: 0 0 5px #ff4500, 0 0 10px #ff4500; }
    50% { box-shadow: 0 0 10px #ff4500, 0 0 20px #ff4500, 0 0 30px #ff4500; }
    100% { box-shadow: 0 0 5px #ff4500, 0 0 10px #ff4500; }
}

@media screen and (orientation: landscape) {
    #combo-display {
        position: fixed;
        right: 1.2vh;
        bottom: 1.2vh;
        top: auto;
        width: 13vh;
        height: 10vh;
        font-size: 3vh;
        transform: none;
        transition: color 0.3s ease;
        display: none;
    }

    #combo-display:not([style*="display: none"]) {
        animation: pulse 1s ease-in-out infinite, glow 1s ease-in-out infinite;
    }

    #game-container {
        display: flex;
        flex-direction: row;
        justify-content: center;
        align-items: stretch;
        height: 100vh;
        width: 76.5957vh;
        max-width: 100vw;
        max-height: 100vh;
        margin: 0 auto;
        padding: 0;
    }

    #header {
        width: 17.02vh;
        height: 100%;
        padding: 2.13vh 1.06vh;
        background-color: rgba(26, 26, 58, 0.9);
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        position: fixed;
        left: 0;
    }

    #sound-button {
        width: 10.5vh;
        height: 9vh;
        font-size: 3.83vh;
        margin-top: 14.5vh;
        position: fixed;
        right: 2.13vh;
    }
	#info-button{
		font-size: 24px;
    color: white;
    cursor: pointer;
    padding: 5px 10px;
    background-color: #4a4a7a;
    border-radius: 5px;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
		position:fixed;
		right:2.13vh;
	}
    #info-button, #fullscreen-button {
        width: 6.38vh;
        height: 6.38vh;
        font-size: 3.83vh;
        margin: 2.13vh 0;
    }

    #fullscreen-button {
        position: fixed;
        right: 2.13vh;
    }

    #score, #highest-score {
        font-size: 3.83vh;
        margin: 2.13vh 0;
        position: fixed;
        transform: none;
        left: 5%;
		margin-top:125px;
    }

    #highest-score {
		position:fixed;
        padding: 1.9vh;
        width: 15.38vh;
        height: 6.38vh;
		align-content: center;
		margin-top:70px;
    }

    #grid {
        display: grid;
        grid-template-columns: repeat(6, 12.77vh);
        grid-template-rows: repeat(6, 16.60vh);
        width: 76.60vh;
        height: 99.60vh;
        position: fixed;
        margin: 0 auto;
        border-radius: 1.06vh;
        top: 0.2vh;
        overflow: hidden;
    }

    .grid-cell {
        width: 12.77vh;
        height: 16.60vh;
        background-color: #3a3a6a;
        display: flex;
        justify-content: center;
        align-items: center;
        border: 0.21vh solid #4a4a7a;
        box-sizing: border-box;
    }

    .card {
        width: 12.77vh;
        height: 16.60vh;
        font-size: 2.98vh;
        border: 0.43vh solid #000;
        border-radius: 1.06vh;
        padding: 0.64vh;
    }

    .card .suit {
        font-size: 6.81vh;
    }

    .card.fixed {
        height: 85%;
    }

    .card.frozen {
        box-shadow: 0 0 2.13vh rgba(0, 183, 235, 0.8);
    }

    .card.frozen::before {
        font-size: 3.83vh;
        top: 1.06vh;
        left: 1.06vh;
    }

    .card.crack {
        box-shadow: 0 0 1.06vh rgba(0, 0, 0, 0.3);
    }

    #card-deck {
        width: 17.02vh;
        height: 100%;
        padding: 2.13vh 1.06vh;
        padding-right: 8.51vh;
        background-color: rgba(26, 26, 58, 0.9);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 50%;
        right: 5vw;
        left: auto;
        transform: translateY(-50%);
    }

    #tutorial-hand {
        width: 8.51vh;
        height: 8.51vh;
    }
#tutorial-hand-hint {
        width: 8.51vh;
        height: 8.51vh;
    }
    .tutorial-text {
        bottom: 2.13vh;
        right: 0;
        transform: none;
        padding: 2.13vh;
        border-radius: 1.06vh 0 0 1.06vh;
        width: 42.55vh;
        max-width: 42.55vh;
        box-sizing: border-box;
        font-size: 2.98vh;
        margin-left: -10.64vh;
    }

    .popup {
        background-color: rgba(0, 0, 0, 0.7);
    }

    .popup-content {
        margin: 2vh auto;
        padding: 2.13vh;
        border: 0.21vh solid #888;
        width: 80%;
        max-width: 50vh;
        border-radius: 1.06vh;
        box-shadow: 0 0 2.13vh rgba(0, 0, 0, 0.3);
    }

    .popup-content h3 {
        font-size: 2.5vh;
        margin: 1vh 0;
    }

    .popup-content > p {
        font-size: 2vh;
        margin: 1vh 0;
    }

    .rule-example {
        margin: 0.6vh 0;
    }

    .rule-example .card {
        width: 4.5vh;
        height: 7.5vh;
        font-size: 2.5vh;
        padding: 0.2vh;
        margin: 0.4vh;
        border-radius: 0.4vh;
        border: 0.2vh solid #000;
    }

    .rule-example .card .suit {
        font-size: 2vh;
    }

    .rule-example p {
        margin: 0 0 0 1vh;
        font-size: 2.8vh;
    }

    #rules-restart {
        padding: 1vh 2vh;
        font-size: 3.5vh;
        margin-bottom: 2vh;
        box-shadow: 0 0.4vh 0.8vh rgba(0, 0, 0, 0.3);
    }

    #close-popup {
        padding: 1vh 2vh;
        font-size: 2.5vh;
        margin-top: 1vh;
        box-shadow: 0 0.4vh 0.8vh rgba(0, 0, 0, 0.3);
    }

    #game-over-popup .popup-content {
        max-width: 63.83vh;
    }

    #refresh-button {
        right: 1.2vh;
        bottom: auto;
        top: 50%;
        transform: translateY(-50%);
        width: 13vh;
        height: 13vh;
        box-shadow: 0 0.8vh 1.6vh rgba(0, 0, 0, 0.3);
        padding: 1vh;
		position:fixed;
    }

    #refresh-button:hover {
        transform: translateY(-50%) scale(1.1);
    }

    .refresh-cards {
        gap: 0.4vh;
        margin-top: 3vh;
    }

    .refresh-cards .menu-card {
        width: 4vh;
        height: 6vh;
        font-size: 1.6vh;
        border: 0.2vh solid #000;
        border-radius: 0.6vh;
        box-shadow: 0 0.2vh 0.4vh rgba(0, 0, 0, 0.3);
    }

    .refresh-cards .menu-card .suit {
        font-size: 2.4vh;
    }

    #refresh-popup .popup-content {
        margin: 15vh auto;
        padding: 4.26vh;
        width: 63.83vh;
        max-width: 63.83vh;
        border-radius: 1.06vh;
    }

    #refresh-yes, #refresh-no {
        padding: 1.70vh 3.19vh;
        font-size: 2.98vh;
        margin: 0 2.13vh;
    }

    
  

    /* Adjusted animations for landscape mode */
    @keyframes moveRow {
        0% { left: calc(50% - 38.31vh); top: 8.51vh; opacity: 1; } /* Left edge of first cell */
        20% { left: calc(50% - 25.54vh); top: 8.51vh; } /* Second cell */
        40% { left: calc(50% - 12.77vh); top: 8.51vh; } /* Third cell */
        50% { left: calc(50% + 12.77vh); top: 25.11vh; opacity: 1; } /* Move to second row */
        70% { left: calc(50% - 12.77vh); top: 25.11vh; } /* Back to third cell */
        90% { left: calc(50% - 25.54vh); top: 25.11vh; } /* Second cell */
        100% { opacity: 0; }
    }

    @keyframes moveColumn {
        0% { left: calc(50% - 38.31vh); top: 91.91vh; opacity: 1; } /* Bottom of first column */
        20% { left: calc(50% - 38.31vh); top: 75.31vh; } /* Fifth row */
        40% { left: calc(50% - 38.31vh); top: 58.71vh; } /* Fourth row */
        50% { left: calc(50% - 25.54vh); top: 8.51vh; opacity: 1; } /* Move to top of second column */
        70% { left: calc(50% - 25.54vh); top: 25.11vh; } /* Second row */
        90% { left: calc(50% - 25.54vh); top: 41.71vh; } /* Third row */
        100% { opacity: 0; }
    }

    @keyframes moveSameNumber {
        0% { left: calc(50% - 38.31vh); top: 8.51vh; opacity: 1; } /* First cell */
        25% { left: calc(50% - 25.54vh); top: 8.51vh; } /* Second cell */
        50% { left: calc(50% - 12.77vh); top: 8.51vh; } /* Third cell */
        75% { left: calc(50%); top: 8.51vh; } /* Fourth cell */
        100% { opacity: 0; }
    }

    .stylized-title {
        font-size: 4rem;
    }

    .menu-card {
        width: 50px;
        height: 70px;
        font-size: 16px;
    }

    .menu-card .suit {
        font-size: 24px;
    }

    .big-play-button {
        font-size: 2.5rem;
        padding: 20px 60px;
    }

    .title-cards {
        margin-top: 10%;
    }
}

@media screen and (orientation: portrait) {
    .stylized-title {
        font-size: 3rem;
    }

    .menu-card {
        width: 40px;
        height: 60px;
        font-size: 14px;
    }

    .menu-card .suit {
        font-size: 20px;
    }

    .big-play-button {
        font-size: 2rem;
        padding: 15px 50px;
    }
}

/* Tiny screens (very old devices) - under 480px */



@media screen and (max-height: 900px) and (orientation: portrait) {
   #grid {
        grid-template-columns: repeat(6, 63px);
		left:40%;
		transform: translateX(-60%);
        top: 60px;
        width: 252px; /* 6 columns × 42px */
    }
    
    .grid-cell {
        width: 63px;
        height: 83px;
    }
    
    .card {
        width: 61px;
        height: 80px;
        font-size: 18px;
        padding: 2px;
    }
    
    
    .card .suit {
        font-size: 24px;
    }
    
    /* Make UI more compact */
    #score, #highest-score {
        font-size: 16px;
    }
    
    #card-deck {
        gap: 2px;
    }
    
    /* Smaller buttons */
    #refresh-button {
        width: 45px;
        height: 45px;
    }
       #combo-display {
        width: 60px;
        height: 40px;
		   margin-top:5px;
    }
    .refresh-cards .menu-card {
        width: 13px;
        height: 20px;
    }
	.refresh-cards{
		margin-top:9px;
	}
    
    .refresh-cards .menu-card .suit {
        font-size: 8px;
    }
}

@media screen and (min-width: 700px) and (max-height: 900px) and (orientation: portrait) {
	#grid {
        grid-template-columns: repeat(6, 75px);
		left:42%;
		transform: translateX(-60%);
        top: 60px;
        width: 282px; /* 6 columns × 42px */
    }
    
    .grid-cell {
        width: 75px;
        height: 105px;
    }
    
    .card {
        width: 73px;
        height: 100px;
        font-size: 18px;
        padding: 2px;
    }
    
    .card .suit {
        font-size: 24px;
    }
    
    /* Make UI more compact */
    #score, #highest-score {
        font-size: 16px;
    }
	
	
    
    #card-deck {
        gap: 2px;
    }
    
    /* Smaller buttons */
    #refresh-button {
        width: 40px;
        height: 40px;
    }
       #combo-display {
        width: 60px;
        height: 40px;
		   margin-top:5px;
    }
    .refresh-cards .menu-card {
        width: 12px;
        height: 20px;
    }
    
    .refresh-cards .menu-card .suit {
        font-size: 8px;
    }
}

@media screen and (max-height: 800px) and (orientation: portrait) {
    #grid {
        grid-template-columns: repeat(6, 55px);
		left:45.5%;
		transform: translateX(-60%);
        top: 60px;
        width: 252px; /* 6 columns × 42px */
    }
    
    .grid-cell {
        width: 55px;
        height: 80px;
    }
    
    .card {
        width: 53px;
        height: 73px;
        font-size: 18px;
        padding: 2px;
    }
    
    .card .suit {
        font-size: 24px;
    }
    
    /* Make UI more compact */
    #score, #highest-score {
        font-size: 16px;
    }
    
    #card-deck {
        gap: 2px;
    }
    
    /* Smaller buttons */
    #refresh-button {
        width: 40px;
        height: 40px;
    }
       #combo-display {
        width: 60px;
        height: 40px;
		   margin-top:5px;
    }
    .refresh-cards .menu-card {
        width: 12px;
        height: 20px;
    }
    
    .refresh-cards .menu-card .suit {
        font-size: 8px;
    }
}


/* Tiny screens (very old devices) - under 480px */
@media screen and (max-height: 640px) and (orientation: portrait) {
    #grid {
        grid-template-columns: repeat(6, 50px);
		left:50%;
		transform: translateX(-60%);
        top: 60px;
        width: 252px; /* 6 columns × 42px */
    }
    
    .grid-cell {
        width: 50px;
        height: 75px;
    }
    
    .card {
        width: 47px;
        height: 69px;
        font-size: 18px;
        padding: 2px;
    }
    
    .card .suit {
        font-size: 28px;
    }
    
    /* Make UI more compact */
    #score, #highest-score {
        font-size: 16px;
    }
    
    #card-deck {
        gap: 2px;
    }
    
    /* Smaller buttons */
    #refresh-button {
        width: 40px;
        height: 40px;
    }
       #combo-display {
        width: 60px;
        height: 40px;
		   margin-top:5px;
    }
    .refresh-cards .menu-card {
        width: 12px;
        height: 20px;
    }
    
    .refresh-cards .menu-card .suit {
        font-size: 8px;
    }
}