* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Comic Sans MS', 'Chalkboard SE', 'Arial Rounded MT Bold', cursive, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-x: hidden;
    overflow-y: auto;
    padding-bottom: calc(110px + env(safe-area-inset-bottom));
    /* Space for ad + safe area */
}

/* Ad Container */
#ad-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: calc(90px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
}

#ad-slot {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    overflow: visible;
}

#ad-slot iframe {
    display: block;
    margin: 0 auto;
    width: 100%;
    max-width: 468px;
    height: 60px !important;
    border: 0;
}

/* Language selector removed - now in menu */

/* Screens */
.screen {
    display: none;
    width: 100%;
    min-height: 100vh;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
}

.screen.active {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Menu Screen */
.menu-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    text-align: center;
    max-width: 500px;
    animation: fadeIn 0.5s ease-out;
}

/* Removed bounceIn animation - using fadeIn instead */

.game-title {
    font-size: 2em;
    color: #667eea;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.15);
    margin-bottom: 25px;
    font-weight: bold;
}

.menu-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.menu-btn {
    padding: 15px 30px;
    font-size: 1.2em;
    border: none;
    border-radius: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.menu-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.menu-btn:active {
    transform: translateY(-2px);
}

.menu-btn.secondary {
    background: linear-gradient(135deg, #4ecdc4 0%, #44a7a0 100%);
    box-shadow: 0 6px 20px rgba(78, 205, 196, 0.4);
}

.menu-btn.secondary:hover {
    box-shadow: 0 10px 30px rgba(78, 205, 196, 0.6);
}

/* Game Settings */
.game-settings {
    margin-bottom: 20px;
    padding: 20px;
    background: rgba(102, 126, 234, 0.08);
    border-radius: 15px;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-item label {
    font-weight: bold;
    color: #667eea;
    font-size: 0.9em;
}

.setting-item select {
    padding: 10px 12px;
    border-radius: 8px;
    border: 2px solid #667eea;
    font-size: 0.95em;
    font-weight: bold;
    cursor: pointer;
    background: white;
    width: 100%;
}

.checkbox-item {
    flex-direction: row;
    align-items: center;
    justify-content: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1em;
    cursor: pointer;
    font-weight: bold;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.include-ai-item {
    justify-content: center;
}

/* Sound Toggle Button */
.sound-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #4caf50 0%, #2e7d32 100%);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(76, 175, 80, 0.3);
    width: 100%;
}

.sound-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(76, 175, 80, 0.45);
}

.sound-toggle-btn:active {
    transform: translateY(0);
}

.sound-toggle-btn.muted {
    background: linear-gradient(135deg, #f44336 0%, #c62828 100%);
    box-shadow: 0 4px 10px rgba(244, 67, 54, 0.3);
}

.sound-toggle-btn.muted:hover {
    box-shadow: 0 6px 15px rgba(244, 67, 54, 0.45);
}

.sound-icon {
    font-size: 1.3em;
}

.sound-status {
    font-size: 0.9em;
    letter-spacing: 0.5px;
}


/* Theme and Bomb Row */
.theme-bomb-row {
    display: flex !important;
    flex-direction: row !important;
    gap: 10px;
    align-items: center;
}

/* Theme Selection Button */
.theme-select-btn {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid #667eea;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* Bomb Checkbox beside theme button */
.bomb-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 15px;
    background: linear-gradient(135deg, #e0e0e0 0%, #b0b0b0 100%);
    border-radius: 12px;
    border: 2px solid #999;
    cursor: pointer;
    transition: all 0.3s;
    gap: 5px;
    min-width: 60px;
    position: relative;
    opacity: 0.6;
}

.bomb-checkbox:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    opacity: 0.8;
}

.bomb-checkbox span {
    font-size: 1.5em;
    filter: grayscale(100%);
    transition: all 0.3s;
}

.bomb-checkbox input[type="checkbox"] {
    display: none;
}

/* When checked - Active state */
.bomb-checkbox input[type="checkbox"]:checked~span {
    filter: grayscale(0%);
    animation: bombPulse 0.3s ease-in-out;
}

.bomb-checkbox:has(input[type="checkbox"]:checked) {
    background: linear-gradient(135deg, #ff6b6b 0%, #c92a2a 100%);
    border-color: #c92a2a;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
    opacity: 1;
}

.bomb-checkbox:has(input[type="checkbox"]:checked):hover {
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.6);
}

/* Check indicator */
.bomb-checkbox::after {
    content: '✓';
    position: absolute;
    top: -5px;
    right: -5px;
    background: #4caf50;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 0.7em;
    font-weight: bold;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.bomb-checkbox:has(input[type="checkbox"]:checked)::after {
    display: flex;
    animation: checkPop 0.3s ease-in-out;
}

@keyframes bombPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

@keyframes checkPop {
    0% {
        transform: scale(0);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

.theme-select-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.theme-select-btn:active {
    transform: translateY(0);
}

.theme-icon {
    font-size: 1.5em;
}

.theme-label {
    font-size: 1em;
}

/* Theme Selection Screen */
.theme-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    max-width: 1200px;
    width: 95%;
    animation: fadeIn 0.5s ease-out;
    overflow: visible;
    max-height: none;
}

.theme-title {
    font-size: 2em;
    color: #667eea;
    text-align: center;
    margin-bottom: 30px;
    font-weight: bold;
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.theme-card {
    background: white;
    border: 3px solid #e0e0e0;
    border-radius: 15px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.theme-card:hover {
    transform: translateY(-5px);
    border-color: #667eea;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.theme-card:active {
    transform: translateY(-2px);
}

.theme-card.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.theme-preview {
    margin-bottom: 15px;
}

.preview-emoji {
    font-size: 3em;
    display: block;
    margin-bottom: 15px;
}

.preview-samples {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.preview-samples span {
    font-size: 1.8em;
    padding: 5px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 8px;
    transition: all 0.2s;
}

.theme-card:hover .preview-samples span {
    background: rgba(102, 126, 234, 0.15);
    transform: scale(1.1);
}

.theme-name {
    font-size: 1.3em;
    color: #667eea;
    margin: 10px 0;
    font-weight: bold;
}

.theme-count {
    font-size: 0.9em;
    color: #999;
    margin: 0;
}

/* Game Screen - Mobile First */
#game-screen {
    flex-direction: column;
    padding: 8px;
    max-width: 100%;
    margin: 0 auto;
    width: 100%;
    gap: 10px;
    overflow: visible;
    min-height: auto;
}

/* Landscape adjustments for game screen */
@media (orientation: landscape) {
    #game-screen {
        padding: 2px;
        gap: 4px;
    }

    .game-header-compact {
        padding: 3px 6px;
        margin-bottom: 4px;
    }
}

/* Compact Game Header - Mobile First */
.game-header-compact {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    background: rgba(255, 255, 255, 0.92);
    padding: 6px 10px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    gap: 8px;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
}

.btn-back {
    padding: 8px 15px;
    border: none;
    border-radius: 10px;
    background: #ff6b6b;
    color: white;
    font-size: 0.9em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-back:hover {
    transform: translateX(-3px);
    box-shadow: 0 3px 10px rgba(255, 107, 107, 0.4);
}

/* Compact Score Panel - Mobile First */
.game-info {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    flex: 1;
}

.score-panel-compact {
    display: flex;
    align-items: stretch;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 6px;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 4px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.score-panel-compact::-webkit-scrollbar {
    height: 4px;
}

.score-panel-compact::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 2px;
}

.score-panel-compact::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 2px;
}

.score-panel-compact::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.5);
}

.player-score.compact {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 10px;
    min-width: 80px;
    background: var(--player-gradient, linear-gradient(135deg, #667eea 0%, #764ba2 100%));
    border: 2px solid transparent;
    border-radius: 9px;
    color: white;
    font-weight: bold;
    font-size: 0.95em;
    transition: all 0.3s;
    flex-shrink: 0;
}

.player-score.compact.active {
    transform: scale(1.03);
    border-color: var(--player-color, #ffd54f);
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.2);
}

@keyframes glow {

    0%,
    100% {
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
    }

    50% {
        box-shadow: 0 0 20px rgba(255, 215, 0, 1);
    }
}

.player-icon {
    font-size: 1.05em;
}

.player-name {
    font-size: 0.7em;
    opacity: 0.9;
    letter-spacing: 0.4px;
}

.score {
    background: rgba(255, 255, 255, 0.3);
    padding: 2px 6px;
    border-radius: 8px;
    min-width: 28px;
    text-align: center;
    font-size: 0.9em;
}

.current-turn-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 100%;
}

.current-turn-compact {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8em;
    font-weight: bold;
    color: #667eea;
    transition: all 0.3s ease;
    background: rgba(76, 81, 191, 0.12);
    border-radius: 999px;
    padding: 3px 10px;
    border: 1px solid rgba(76, 81, 191, 0.25);
}

.current-turn-compact.ai-thinking {
    animation: aiPulse 1s ease-in-out infinite;
    color: #ff6b6b;
    font-size: 0.95em;
}

@keyframes aiPulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

.current-turn-label {
    font-size: 0.8em;
    opacity: 0.85;
}

#turn-player {
    font-size: 0.9em;
    color: #4c51bf;
}

.players-indicator {
    font-size: 0.7em;
    font-weight: bold;
    color: #4c51bf;
    background: rgba(102, 126, 234, 0.12);
    padding: 3px 9px;
    border-radius: 999px;
    letter-spacing: 0.45px;
    border: 1px solid rgba(102, 126, 234, 0.25);
}

.moves-counter-compact {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-weight: bold;
    color: #667eea;
    text-align: center;
}

.moves-counter-compact span {
    font-size: 1.2em;
    line-height: 1;
}

.moves-counter-compact small {
    font-size: 0.7em;
    opacity: 0.8;
}

/* Game Board - Mobile First Design */
.game-board {
    display: grid;
    gap: clamp(8px, 2vw, 16px);
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    perspective: 1000px;
    padding: clamp(40px, 8vw, 60px) clamp(12px, 3vw, 24px) clamp(110px, 12vw, 130px);
    margin-top: 0;
    position: relative;
    z-index: 5;
    overflow: visible;
}

/* Responsive card sizing */
.card {
    aspect-ratio: 1;
    position: relative;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.6s;
    width: 100%;
    height: auto;
    min-width: 0;
    min-height: 0;
    /* Make entire card clickable */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.card:hover:not(.flipped):not(.matched) {
    transform: scale(1.08);
}

.card:active {
    transform: scale(0.95);
}

.card.flipped {
    transform: rotateY(180deg);
}

.card.matched {
    animation: matchAnimation 0.6s ease-in-out;
    pointer-events: none;
}

@keyframes matchAnimation {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2) rotate(10deg);
    }
}

.card.wrong {
    animation: wrongAnimation 0.5s ease-in-out;
}

@keyframes wrongAnimation {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-10px);
    }

    75% {
        transform: translateX(10px);
    }
}

.card.bomb-explode {
    animation: bombExplode 0.8s ease-out;
}

@keyframes bombExplode {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.5) rotate(180deg);
    }

    100% {
        transform: scale(0) rotate(360deg);
        opacity: 0;
    }
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: clamp(8px, 1.5vw, 12px);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(1.5em, min(8vw, 6vh), 4em);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    /* Make card faces clickable */
    pointer-events: none;
}

.card-face::before,
.card-face::after {
    pointer-events: none;
}

.card-front {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    border: clamp(2px, 0.4vw, 4px) solid #fff;
}

.card-front::after {
    content: '?';
    font-size: clamp(0.5em, 4vw, 0.7em);
    color: #667eea;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

.card-back {
    background: linear-gradient(135deg, #fff 0%, #f0f0f0 100%);
    border: clamp(2px, 0.4vw, 4px) solid #667eea;
    transform: rotateY(180deg);
}

/* Result Screens */
.result-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 30px;
    padding: 50px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 600px;
    position: relative;
    overflow: hidden;
    animation: resultSlideIn 0.8s ease-out;
}

@keyframes resultSlideIn {
    from {
        transform: translateY(-100vh) rotate(-180deg);
        opacity: 0;
    }

    to {
        transform: translateY(0) rotate(0);
        opacity: 1;
    }
}

.result-title {
    font-size: 2.5em;
    margin-bottom: 20px;
    animation: titleBounce 1s ease-in-out infinite;
}

.result-title.lost {
    color: #ff4757;
}

@keyframes titleBounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.result-message {
    font-size: 1.4em;
    color: #667eea;
    margin-bottom: 30px;
}

.final-stats {
    background: rgba(102, 126, 234, 0.1);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 30px;
    font-size: 1.2em;
    font-weight: bold;
}

.final-stats p {
    margin: 10px 0;
    color: #667eea;
}

/* Confetti Animation */
.confetti {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    overflow: hidden;
}

.confetti::before,
.confetti::after {
    content: '🎉';
    position: absolute;
    font-size: 3em;
    animation: confettiFall 3s linear infinite;
}

.confetti::before {
    left: 20%;
    animation-delay: 0s;
}

.confetti::after {
    left: 80%;
    animation-delay: 1.5s;
}

@keyframes confettiFall {
    0% {
        top: -10%;
        transform: rotate(0deg);
    }

    100% {
        top: 110%;
        transform: rotate(360deg);
    }
}

/* Explosion Animation */
.explosion {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
}

.explosion::before {
    content: '💥';
    position: absolute;
    font-size: 5em;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    animation: explosionBurst 1.5s ease-out infinite;
}

@keyframes explosionBurst {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0.8;
    }

    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

/* Mobile First Responsive Design - Progressive Enhancement */

/* Tablet Portrait and Up (600px+) */
@media (min-width: 600px) {
    .game-board {
        gap: clamp(10px, 1.8vw, 18px);
        padding: clamp(50px, 7vw, 60px) clamp(16px, 3.5vw, 28px) clamp(120px, 11vw, 140px);
    }

    .card-face {
        font-size: clamp(2.5em, min(7vw, 5.5vh), 4.5em);
        border-radius: clamp(10px, 1.8vw, 14px);
    }

    .settings-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .checkbox-item {
        grid-column: 1 / -1;
    }
}

/* Tablet Landscape and Up (768px+) */
@media (min-width: 768px) {
    .game-board {
        gap: clamp(12px, 2vw, 20px);
        padding: clamp(55px, 6vw, 65px) clamp(20px, 4vw, 32px) clamp(125px, 10vw, 145px);
    }

    .card-face {
        font-size: clamp(3em, min(6.5vw, 6vh), 5em);
        border-radius: clamp(12px, 1.5vw, 16px);
    }

    .menu-container {
        padding: 40px;
    }

    .game-title {
        font-size: 2.5em;
    }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
    .game-board {
        gap: clamp(14px, 2.5vw, 24px);
        padding: clamp(60px, 5vw, 70px) clamp(24px, 5vw, 40px) clamp(130px, 9vw, 150px);
    }

    .card-face {
        font-size: clamp(3.5em, min(6vw, 6.5vh), 6em);
        border-radius: clamp(14px, 1.2vw, 18px);
    }

    .game-title {
        font-size: 3em;
    }

    .menu-container {
        padding: 50px;
    }
}

/* Large Desktop (1280px+) */
@media (min-width: 1280px) {
    .game-board {
        gap: clamp(16px, 3vw, 28px);
        padding: clamp(65px, 4vw, 75px) clamp(28px, 6vw, 48px) clamp(135px, 8vw, 155px);
    }

    .card-face {
        font-size: clamp(4.5em, min(5.5vw, 7vh), 7em);
        border-radius: clamp(16px, 1vw, 20px);
    }
}

/* Extra Large Desktop (1600px+) */
@media (min-width: 1600px) {
    .game-board {
        gap: clamp(18px, 3.5vw, 32px);
        padding: clamp(70px, 3.5vw, 80px) clamp(32px, 7vw, 56px) clamp(140px, 7vw, 160px);
    }

    .card-face {
        font-size: clamp(5.5em, min(5vw, 7.5vh), 8em);
        border-radius: clamp(18px, 0.9vw, 22px);
    }
}

/* Small Mobile (max-width: 480px) */
@media (max-width: 480px) {
    .game-board {
        gap: clamp(6px, 2vw, 10px);
        padding: clamp(30px, 7vw, 45px) clamp(8px, 2.5vw, 14px) clamp(105px, 13vw, 125px);
    }

    .card-face {
        font-size: clamp(1.2em, min(10vw, 8vh), 2.5em);
        border-radius: clamp(5px, 1.5vw, 8px);
    }

    .card-front::after {
        font-size: clamp(0.4em, 5vw, 0.6em);
    }
}

/* Mobile Ad Adjustments */
@media (max-width: 600px) {
    .game-board {
        gap: clamp(6px, 1.8vw, 12px);
        padding: clamp(35px, 6vw, 50px) clamp(10px, 2.5vw, 18px) clamp(110px, 12vw, 130px);
    }

    .card-face {
        font-size: clamp(1.5em, min(9vw, 7vh), 3em);
        border-radius: clamp(6px, 1.2vw, 10px);
    }

    body {
        padding-bottom: calc(95px + env(safe-area-inset-bottom));
    }

    #ad-container {
        height: calc(85px + env(safe-area-inset-bottom));
        padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    }

    #ad-slot iframe {
        max-width: 100%;
    }
}

/* Landscape Orientation Adjustments */
@media (orientation: landscape) {
    .game-board {
        gap: clamp(6px, 1.5vw, 14px);
        padding: clamp(10px, 2.5vw, 25px) clamp(10px, 2.5vw, 20px) clamp(90px, 9vw, 110px);
    }

    .card-face {
        font-size: clamp(1.8em, min(4.5vw, 6vh), 4.5em);
    }

    .card-front::after {
        font-size: clamp(0.5em, min(2vw, 2.5vh), 1em);
    }

    .card-front,
    .card-back {
        border-width: clamp(1px, 0.15vw, 2px);
    }

    .game-header-compact {
        padding: 2px 5px;
        margin-bottom: 3px;
        font-size: 0.8em;
    }

    .game-header-compact .moves-counter-compact {
        font-size: 0.75em;
    }

    .player-score.compact {
        padding: 4px 8px;
        min-width: 65px;
        font-size: 0.85em;
    }
}

/* Large Landscape (width > 1024px) */
@media (orientation: landscape) and (min-width: 1024px) {
    .game-board {
        gap: clamp(8px, 2vw, 18px);
        padding: clamp(12px, 3vw, 30px) clamp(12px, 3vw, 24px) clamp(90px, 9vw, 110px);
    }

    .card-face {
        font-size: clamp(2.2em, min(5vw, 7vh), 5.5em);
    }

    .card-front::after {
        font-size: clamp(0.6em, min(2.2vw, 3vh), 1.2em);
    }
}

/* Extra Large Landscape (width > 1280px) */
@media (orientation: landscape) and (min-width: 1280px) {
    .game-board {
        gap: clamp(10px, 2.5vw, 22px);
        padding: clamp(15px, 3.5vw, 35px) clamp(15px, 3.5vw, 28px) clamp(90px, 9vw, 110px);
    }

    .card-face {
        font-size: clamp(2.5em, min(5.5vw, 8vh), 6.5em);
    }

    .card-front::after {
        font-size: clamp(0.7em, min(2.5vw, 3.5vh), 1.4em);
    }
}

/* Small Landscape (height < 600px) */
@media (orientation: landscape) and (max-height: 600px) {
    .game-board {
        gap: clamp(4px, 1vw, 10px);
        padding: clamp(8px, 2vw, 20px) clamp(8px, 2vw, 16px) clamp(85px, 8vw, 105px);
    }

    .card-face {
        font-size: clamp(1.2em, min(3.5vw, 4.5vh), 3em);
    }

    .card-front::after {
        font-size: clamp(0.4em, min(1.5vw, 2vh), 0.7em);
    }

    .card-front,
    .card-back {
        border-width: 1px;
    }

    .game-header-compact {
        padding: 2px 4px;
        margin-bottom: 3px;
        font-size: 0.75em;
    }

    .game-header-compact .moves-counter-compact {
        font-size: 0.7em;
    }

    .player-score.compact {
        padding: 4px 8px;
        min-width: 70px;
        font-size: 0.9em;
    }
}

/* Very Small Landscape (height < 500px) */
@media (orientation: landscape) and (max-height: 500px) {
    .game-board {
        gap: clamp(3px, 0.8vw, 8px);
        padding: clamp(6px, 1.5vw, 18px) clamp(6px, 1.5vw, 12px) clamp(80px, 7vw, 100px);
    }

    .card-face {
        font-size: clamp(1em, min(3vw, 3.5vh), 2.5em);
    }

    .card-front::after {
        font-size: clamp(0.35em, min(1.2vw, 1.5vh), 0.6em);
    }

    .card-front,
    .card-back {
        border-width: 1px;
    }

    .game-header-compact {
        padding: 2px 4px;
        margin-bottom: 2px;
        font-size: 0.7em;
    }

    .game-header-compact .moves-counter-compact {
        font-size: 0.65em;
    }

    .player-score.compact {
        padding: 3px 6px;
        min-width: 60px;
        font-size: 0.8em;
    }
}

/* Portrait Orientation Adjustments */
@media (orientation: portrait) and (max-width: 768px) {
    .game-board {
        gap: clamp(5px, 1.3vw, 9px);
        padding: clamp(40px, 7vw, 55px) clamp(8px, 2vw, 14px) clamp(115px, 12vw, 135px);
    }

    .card-face {
        font-size: clamp(1.8em, 9vw, 3.2em);
    }
}