* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    font-family: Arial, sans-serif;
    overflow: hidden;
}

#game-container {
    position: relative;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
    max-width: 100vw;
    max-height: 100vh;
}

#gameCanvas {
    display: block;
    border: 3px solid #fff;
    border-radius: 8px;
    max-width: 100%;
    max-height: 100vh;
    object-fit: contain;
}

#loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 24px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* Fullscreen Styles */
#fullscreenBtn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #667eea;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s;
    z-index: 999;
}

#fullscreenBtn:hover {
    background: #667eea;
    color: white;
    transform: scale(1.1);
}

#fullscreenBtn:active {
    transform: scale(0.95);
}

.fullscreen-icon {
    pointer-events: none;
}

/* Fullscreen Mode Styles */
body.fullscreen {
    background: #000;
}

body.fullscreen #game-container {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw;
    max-height: 100vh;
    box-shadow: none;
}

body.fullscreen #gameCanvas {
    width: 100% !important;
    height: 100% !important;
    border: none;
    border-radius: 0;
}

/* Hide UI elements in fullscreen */
body.fullscreen #userProfile,
body.fullscreen #showLeaderboard,
body.fullscreen #offlineIndicator {
    opacity: 0.7;
}

/* Mobile Fullscreen Adjustments */
@media (max-width: 768px) {
    #fullscreenBtn {
        bottom: 80px;
        right: 15px;
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
    
    #game-container {
        width: 100vw;
        height: 100vh;
    }
    
    #gameCanvas {
        width: 100%;
        height: 100%;
        border-radius: 0;
    }
    
    body {
        overflow: hidden;
    }
}

/* Landscape Mode for Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    #game-container {
        width: 100vw;
        height: 100vh;
    }
    
    #gameCanvas {
        width: auto;
        height: 100vh;
        max-width: 100vw;
    }
}

/* Authentication Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    max-width: 400px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h2 {
    text-align: center;
    color: #667eea;
    margin-bottom: 20px;
    font-size: 28px;
}

.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s;
}

.tab-btn:hover {
    background: #f0f0f0;
}

.tab-btn.active {
    background: #667eea;
    color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.tab-content input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.tab-content input:focus {
    outline: none;
    border-color: #667eea;
}

.auth-btn {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.auth-btn:hover {
    background: #5568d3;
}

.auth-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Google Sign-In Button */
.google-btn {
    width: 100%;
    padding: 12px;
    background: white;
    color: #444;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

.google-btn:hover {
    background: #f8f8f8;
    border-color: #ccc;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.google-btn:active {
    background: #f0f0f0;
}

.google-btn svg {
    flex-shrink: 0;
}

/* Auth Divider */
.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 20px 0;
    color: #999;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #ddd;
}

.auth-divider span {
    padding: 0 10px;
    font-size: 14px;
}

.tab-content p {
    text-align: center;
    color: #666;
    margin-bottom: 15px;
    line-height: 1.5;
}

.error-message {
    color: #e74c3c;
    text-align: center;
    margin-top: 15px;
    font-size: 14px;
    min-height: 20px;
}

.loading-spinner {
    text-align: center;
    color: #667eea;
    font-weight: bold;
    padding: 20px;
}

/* User Profile */
#userProfile {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 10px 20px;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 100;
}

#userName {
    font-weight: bold;
    color: #667eea;
}

#signoutBtn {
    padding: 6px 15px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

#signoutBtn:hover {
    background: #c0392b;
}

/* Leaderboard */
.leaderboard-content {
    max-width: 600px;
    max-height: 80vh;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 32px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
}

.close-btn:hover {
    color: #333;
}

.refresh-btn {
    width: 100%;
    padding: 10px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 15px;
    font-weight: bold;
    transition: background 0.3s;
}

.refresh-btn:hover {
    background: #229954;
}

.leaderboard-list {
    max-height: 400px;
    overflow-y: auto;
}

.leaderboard-entry {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
}

.leaderboard-entry:hover {
    background: #f8f9fa;
}

.leaderboard-entry.current-user {
    background: #e8f4f8;
    font-weight: bold;
    border-left: 4px solid #667eea;
}

.leaderboard-entry.fake-entry {
    opacity: 0.7;
}

.leaderboard-entry.fake-entry:hover {
    opacity: 0.85;
}

.entry-rank {
    width: 40px;
    color: #999;
    font-weight: bold;
}

.entry-name {
    flex: 1;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.entry-score {
    color: #667eea;
    font-weight: bold;
}

.you-badge {
    background: #667eea;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
}

.real-badge {
    font-size: 14px;
    opacity: 0.6;
}

/* Top 3 Rank Styling */
.leaderboard-entry.rank-1 {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    font-weight: bold;
}

.leaderboard-entry.rank-1 .entry-rank {
    color: #b8860b;
}

.leaderboard-entry.rank-2 {
    background: linear-gradient(135deg, #c0c0c0 0%, #e8e8e8 100%);
    font-weight: bold;
}

.leaderboard-entry.rank-2 .entry-rank {
    color: #696969;
}

.leaderboard-entry.rank-3 {
    background: linear-gradient(135deg, #cd7f32 0%, #e6a157 100%);
    font-weight: bold;
}

.leaderboard-entry.rank-3 .entry-rank {
    color: #8b4513;
}

.timestamp {
    text-align: center;
    color: #999;
    font-size: 12px;
    margin-top: 10px;
}

.leaderboard-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    padding: 12px 20px;
    background: #f39c12;
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s;
    z-index: 100;
}

.leaderboard-btn:hover {
    background: #e67e22;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Offline Indicator */
.offline-indicator {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #e74c3c;
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 100;
}

/* Responsive Design */
@media (max-width: 768px) {
    .modal-content {
        padding: 20px;
    }
    
    #userProfile {
        top: 10px;
        right: 10px;
        padding: 8px 15px;
        font-size: 14px;
    }
    
    .leaderboard-btn {
        top: 10px;
        left: 10px;
        padding: 10px 15px;
        font-size: 14px;
    }
}

/* Social Share Buttons */
.share-buttons {
    position: fixed;
    bottom: 80px;
    right: 20px;
    z-index: 999;
}

.share-btn {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    color: white;
}

.share-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.share-btn:active {
    transform: translateY(-1px);
}

.share-btn i {
    transition: transform 0.3s ease;
}

.share-btn:hover i {
    transform: scale(1.1);
}

.share-menu {
    position: absolute;
    bottom: 65px;
    right: 0;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 8px;
    min-width: 200px;
    animation: slideUp 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.share-option {
    width: 100%;
    padding: 12px 16px;
    background: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
    margin-bottom: 4px;
    color: #333;
}

.share-option:last-child {
    margin-bottom: 0;
}

.share-option i {
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.share-option:hover {
    transform: translateX(4px);
}

.share-option:active {
    transform: scale(0.97);
}

/* Brand-specific colors */
.twitter-btn {
    color: #1DA1F2;
}

.twitter-btn:hover {
    background: linear-gradient(135deg, #e8f5fe 0%, #d0ebff 100%);
    color: #1DA1F2;
}

.facebook-btn {
    color: #1877F2;
}

.facebook-btn:hover {
    background: linear-gradient(135deg, #e7f3ff 0%, #cce5ff 100%);
    color: #1877F2;
}

.whatsapp-btn {
    color: #25D366;
}

.whatsapp-btn:hover {
    background: linear-gradient(135deg, #e7f8f0 0%, #d0f0e0 100%);
    color: #25D366;
}

.reddit-btn {
    color: #FF4500;
}

.reddit-btn:hover {
    background: linear-gradient(135deg, #fff4e6 0%, #ffe8d0 100%);
    color: #FF4500;
}

.copy-btn {
    color: #667eea;
}

.copy-btn:hover {
    background: linear-gradient(135deg, #f0e6ff 0%, #e0d0ff 100%);
    color: #667eea;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .share-buttons {
        bottom: 140px;
        right: 15px;
    }
    
    .share-btn {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
    
    .share-menu {
        right: 0;
        min-width: 160px;
    }
    
    .share-option {
        padding: 10px 12px;
        font-size: 14px;
    }
}

/* Toast notification for copy link */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    animation: toastSlide 0.3s ease;
}

@keyframes toastSlide {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}
