/* Game Modal Styles */
.game-modal {
    display: block; /* Changed from 'none' to always be in document flow */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    background-color: #f4f4f4;

    /* Initial position - off screen at bottom */
    transform: translateY(100%);

    /* Smooth transition for sliding effect */
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.game-modal.open {
    transform: translateY(0); /* Slide up to visible position */
}

/* Include all the styles from game.html here */
.game-modal .game-fullpage {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.game-modal .game-title-overlay {
    position: absolute;
    top: 15px;
    left: 0;
    right: 0;
    text-align: center;
    z-index: 10;
}

.game-modal #modal-game-title {
    display: inline-block;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 18px;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.game-modal .power-button {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 48px;
    height: 48px;
    background-color: rgba(0, 0, 0, 0.4);
    color: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 100;
    cursor: move;
    transition: all 0.3s ease;
    overflow: hidden;
    backdrop-filter: blur(2px);
    touch-action: none;
}

.game-modal .power-button::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0) 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.game-modal .power-button:hover {
    transform: scale(1.1);
    background-color: rgba(0, 0, 0, 0.6);
    color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.game-modal .power-button:active::before {
    opacity: 0.4;
    animation: pulse 0.3s ease-out;
}

.game-modal .power-button.dragging {
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
}

@keyframes pulse {
    0% {
        transform: scale(0.5);
        opacity: 0.8;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.game-modal .power-button svg {
    width: 24px;
    height: 24px;
    z-index: 2;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3));
}

.game-modal .exit-dialog {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(33, 37, 41, 0.95);
    padding: 20px;
    color: white;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 200;
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.3);
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
}

.game-modal .exit-dialog.show {
    transform: translateY(0);
}

.game-modal .exit-dialog-content {
    text-align: center;
}

.game-modal .exit-dialog h3 {
    margin-bottom: 15px;
    font-size: 18px;
}

.game-modal .exit-dialog p {
    margin-bottom: 20px;
    font-size: 14px;
    opacity: 0.8;
}

.game-modal .exit-dialog-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.game-modal .exit-dialog-button {
    padding: 10px 25px;
    border-radius: 25px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    outline: none;
}

.game-modal .stay-button {
    background-color: #6c757d;
    color: white;
}

.game-modal .exit-button {
    background-color: #dc3545;
    color: white;
}

.game-modal .exit-dialog-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.game-modal .ad-container {
    margin: 15px 0;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    text-align: center;
    min-height: 90px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-modal .ad-container p {
    margin: 0;
    font-size: 12px;
    color: #adb5bd;
}

.game-modal #modal-game-content {
    width: 100%;
    height: 100%;
    border: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* Enhanced Loading Screen with Game Thumbnail */
.game-modal .loading-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #f8f8f8;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 5;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow: hidden;
}

.game-modal .loading-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
}

.game-modal .loading-screen .loading-container {
    background-color: rgba(0, 0, 0, 0.7);
    padding: 20px 30px;
    border-radius: 15px;
    text-align: center;
    max-width: 300px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.game-modal .loading-screen .loader {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin: 0 auto 15px auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.game-modal .loading-screen p {
    margin: 0;
    font-size: 16px;
    color: white;
    font-weight: bold;
}

.game-modal .game-error {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #f8f8f8;
    padding: 20px;
    text-align: center;
}

.game-modal .game-error .error-icon {
    font-size: 48px;
    color: #d9534f;
    margin-bottom: 20px;
}

.game-modal .game-error h3 {
    color: #d9534f;
    margin-bottom: 20px;
}

.game-modal .game-error p {
    margin-bottom: 20px;
    max-width: 400px;
}

.game-modal .game-error .error-btn {
    display: inline-block;
    margin-top: 10px;
    padding: 10px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.game-modal .game-error .error-btn:hover {
    background-color: #45a049;
}

.game-modal .info-button {
    position: absolute;
    bottom: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 20;
    transition: all 0.3s ease;
}

.game-modal .info-button:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.game-modal .info-panel {
    position: absolute;
    bottom: 70px;
    right: 15px;
    width: 300px;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    border-radius: 10px;
    padding: 15px;
    z-index: 20;
    transform: translateY(20px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.game-modal .info-panel.visible {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.game-modal .info-panel h3 {
    margin-bottom: 10px;
    font-size: 16px;
}

.game-modal #modal-game-description, .game-modal #modal-game-instructions {
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 10px;
}

.game-modal .blur-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 150;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.game-modal .blur-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Add body scroll lock style */
body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}