/* Game End Modal */
.game-end-modal {
    display: none;
    position: fixed;
    z-index: 10002;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px); /* Safari support */
    animation: fadeIn 0.2s ease-in;
    -webkit-transform: translateZ(0); /* Force hardware acceleration */
    transform: translateZ(0);
    -moz-transform: translateZ(0); /* Firefox specific */
    will-change: transform, opacity; /* Optimize for Firefox mobile */
}

.game-end-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-end-modal-content {
    background-color: white;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
    position: relative;
    z-index: 10003;
    -webkit-transform: translateZ(0); /* Force hardware acceleration */
    transform: translateZ(0);
    -moz-transform: translateZ(0); /* Firefox specific */
}

.game-end-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 2px solid #eee;
}

.game-end-modal-header h2 {
    margin: 0;
    color: #333;
    font-size: 1.5rem;
}

.game-end-modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.game-end-modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.game-end-modal-body {
    padding: 24px;
}

.game-end-message {
    text-align: center;
    margin-bottom: 24px;
}

.game-end-message h3 {
    margin: 0 0 12px 0;
    color: #333;
    font-size: 1.5rem;
    font-weight: 600;
}

.game-end-message.won h3 {
    color: #28a745;
}

.game-end-message.lost h3 {
    color: #dc3545;
}

.game-end-price {
    text-align: center;
    margin-bottom: 24px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
}

.game-end-price-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 12px;
}

.game-end-price-column {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.game-end-price-label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 8px;
}

.game-end-price-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: #f6782c;
}

.game-end-price-indicator {
    font-size: 0.9rem;
    color: #28a745;
    font-weight: 600;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #ddd;
}

.game-end-stats {
    margin-bottom: 24px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.game-end-stats h4 {
    margin: 0 0 16px 0;
    color: #333;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
}

.game-end-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.game-end-stat-item {
    text-align: center;
    padding: 12px;
    background: white;
    border-radius: 6px;
}

.game-end-stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #f6782c;
    margin-bottom: 4px;
}

.game-end-stat-label {
    font-size: 0.85rem;
    color: #666;
}

.game-end-share {
    margin-bottom: 24px;
    padding-top: 24px;
    border-top: 2px solid #eee;
}

.game-end-support-message {
    text-align: center;
    margin-bottom: 24px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
}

.game-end-support-message p {
    margin: 0 0 8px 0;
    color: #666;
    font-size: 0.95rem;
    line-height: 1.5;
}

.game-end-support-message p:last-of-type {
    margin-bottom: 12px;
}

.game-end-support-button {
    display: inline-block;
    padding: 12px 24px;
    background: #f6782c;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s;
    cursor: pointer;
}

.game-end-support-button:hover {
    background: #e5681c;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.game-end-share h4 {
    margin: 0 0 16px 0;
    color: #333;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
}

.game-end-share-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.game-end-share-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 12px;
    border: 2px solid transparent;
    border-radius: 8px;
    background: #333;
    color: white;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 48px;
}

.game-end-share-button i {
    font-size: 1.2rem;
}

.game-end-share-button .share-button-icon-img {
    width: 1.2rem;
    height: 1.2rem;
    object-fit: contain;
    display: inline-block;
}

/* Hide text on all screen sizes, show only icons */
.game-end-share-button span {
    display: none;
}

.game-end-share-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    opacity: 0.9;
}

.game-end-share-button.share-reddit {
    background: #ff4500;
    color: white;
}

.game-end-share-button.share-reddit:hover {
    background: #e63900;
}

.game-end-share-button.share-twitter {
    background: #1da1f2;
    color: white;
}

.game-end-share-button.share-twitter:hover {
    background: #0d8bd9;
}

.game-end-share-button.share-facebook {
    background: #1877f2;
    color: white;
}

.game-end-share-button.share-facebook:hover {
    background: #1565c0;
}

.game-end-share-button.share-whatsapp {
    background: #25d366;
    color: white;
}

.game-end-share-button.share-whatsapp:hover {
    background: #20ba5a;
}

.game-end-share-button.share-sms {
    background: #34c759;
    color: white;
}

.game-end-share-button.share-sms:hover {
    background: #2ba848;
}

.game-end-share-button.share-linkedin {
    background: #0077b5;
    color: white;
}

.game-end-share-button.share-linkedin:hover {
    background: #005885;
}

.game-end-share-button.share-telegram {
    background: #0088cc;
    color: white;
}

.game-end-share-button.share-telegram:hover {
    background: #006ba3;
}

.game-end-share-button.share-messenger {
    background: #0084ff;
    color: white;
}

.game-end-share-button.share-messenger:hover {
    background: #0066cc;
}

.game-end-share-button.share-instagram {
    background: #e4405f;
    color: white;
}

.game-end-share-button.share-instagram:hover {
    background: #d31e40;
}

.game-end-share-button.share-discord {
    background: #5865f2;
    color: white;
}

.game-end-share-button.share-discord:hover {
    background: #4752c4;
}

.game-end-share-button.share-email {
    background: #ea4335;
    color: white;
}

.game-end-share-button.share-email:hover {
    background: #d33b2c;
}

.game-end-share-button.share-bluesky {
    background: #00a8ff;
    color: white;
}

.game-end-share-button.share-bluesky:hover {
    background: #0088cc;
}

.game-end-share-button.share-threads {
    background: #000000;
    color: white;
}

.game-end-share-button.share-threads:hover {
    background: #333333;
}

.game-end-share-button.share-line {
    background: #00c300;
    color: white;
}

.game-end-share-button.share-line:hover {
    background: #00a000;
}

.game-end-share-button.share-viber {
    background: #665cac;
    color: white;
}

.game-end-share-button.share-viber:hover {
    background: #554a8c;
}

.game-end-share-button.share-clipboard {
    background: #6c757d;
    color: white;
}

.game-end-share-button.share-clipboard:hover {
    background: #5a6268;
}

.game-end-footer {
    text-align: center;
    padding-top: 16px;
    border-top: 2px solid #eee;
}

.game-end-reopen-button {
    display: inline-block;
    padding: 10px 20px;
    background: #f6782c;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.game-end-reopen-button:hover {
    background: #e5681c;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

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

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .game-end-modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .game-end-modal-header h2 {
        font-size: 1.2rem;
    }

    .game-end-message h3 {
        font-size: 1.2rem;
    }

    .game-end-price {
        padding: 12px;
        margin-bottom: 16px;
    }

    .game-end-price-columns {
        gap: 12px;
        margin-bottom: 8px;
    }

    .game-end-price-label {
        font-size: 0.8rem;
        margin-bottom: 6px;
    }

    .game-end-price-value {
        font-size: 1.2rem;
    }

    .game-end-price-indicator {
        font-size: 0.8rem;
        margin-top: 6px;
        padding-top: 6px;
    }

    .game-end-stats {
        padding: 16px;
        margin-bottom: 16px;
    }

    .game-end-stats h4 {
        font-size: 1rem;
        margin-bottom: 12px;
    }

    .game-end-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .game-end-stat-item {
        padding: 10px;
    }

    .game-end-stat-value {
        font-size: 1.1rem;
        margin-bottom: 2px;
    }

    .game-end-stat-label {
        font-size: 0.75rem;
    }

    .game-end-support-message {
        padding: 12px;
        margin-bottom: 16px;
    }

    .game-end-support-message p {
        font-size: 0.85rem;
    }

    .game-end-support-button {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .game-end-share h4 {
        font-size: 1rem;
        margin-bottom: 12px;
    }

    .game-end-share-buttons {
        flex-direction: row;
        justify-content: center;
        gap: 8px;
    }

    .game-end-share-button {
        width: auto;
        min-width: 48px;
        padding: 12px;
        gap: 0;
    }

    .game-end-share-button i {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .game-end-modal-content {
        width: 98%;
    }

    .game-end-modal-header {
        padding: 16px 20px;
    }

    .game-end-modal-header h2 {
        font-size: 1.1rem;
    }

    .game-end-modal-body {
        padding: 16px;
    }

    .game-end-message {
        margin-bottom: 16px;
    }

    .game-end-message h3 {
        font-size: 1.1rem;
    }

    .game-end-price {
        padding: 10px;
        margin-bottom: 12px;
    }

    .game-end-price-columns {
        gap: 8px;
        margin-bottom: 6px;
    }

    .game-end-price-label {
        font-size: 0.75rem;
    }

    .game-end-price-value {
        font-size: 1rem;
    }

    .game-end-price-indicator {
        font-size: 0.75rem;
        margin-top: 4px;
        padding-top: 4px;
    }

    .game-end-stats {
        padding: 12px;
        margin-bottom: 12px;
    }

    .game-end-stats h4 {
        font-size: 0.9rem;
        margin-bottom: 10px;
    }

    .game-end-stat-item {
        padding: 8px;
    }

    .game-end-stat-value {
        font-size: 1rem;
    }

    .game-end-stat-label {
        font-size: 0.7rem;
    }

    .game-end-share {
        margin-bottom: 16px;
        padding-top: 16px;
    }

    .game-end-support-message {
        padding: 10px;
        margin-bottom: 12px;
    }

    .game-end-support-message p {
        font-size: 0.8rem;
        margin-bottom: 6px;
    }

    .game-end-support-button {
        padding: 10px 16px;
        font-size: 0.85rem;
    }

    .game-end-share h4 {
        font-size: 0.9rem;
        margin-bottom: 10px;
    }

    .game-end-share-button {
        min-width: 44px;
        padding: 10px;
    }

    .game-end-share-button i {
        font-size: 1.1rem;
    }
}
