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

body {
    font-family: 'Arial', sans-serif;
    background: #2F5233;
    overflow: hidden;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

#game-container {
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 0;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Force proper centering - override Phaser's incorrect margin calculations */
#game-container canvas {
    display: block !important;
    margin: 0 auto !important;
    position: relative !important;
    max-width: 100%;
    max-height: 100%;
}

/* Mobile optimizations - maximize viewport usage */
@media (max-width: 768px) {
    body {
        /* Remove any default margins/padding on mobile */
        margin: 0;
        padding: 0;
        /* Prevent address bar from affecting viewport */
        height: 100vh;
        height: -webkit-fill-available;
        overflow: hidden;
    }
    
    #game-container {
        /* Ensure full viewport on mobile */
        width: 100vw;
        height: 100vh;
        height: -webkit-fill-available; /* iOS Safari fix */
        /* Remove any padding/margins */
        margin: 0;
        padding: 0;
    }
    
    #game-container canvas {
        /* On mobile, canvas should fill available space */
        width: 100vw !important;
        height: 100vh !important;
        height: -webkit-fill-available !important; /* iOS Safari fix */
        max-width: 100vw !important;
        max-height: 100vh !important;
        object-fit: contain;
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    #game-container {
        height: -webkit-fill-available;
    }
    
    #game-container canvas {
        height: -webkit-fill-available !important;
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.auth-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.auth-modal.active {
    display: flex;
}

.modal-content, .auth-modal-content {
    background: linear-gradient(135deg, #D2B48C 0%, #8B7355 100%);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    max-width: 400px;
    width: 90%;
    border: 3px solid #8B6F47;
}

.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.auth-button {
    width: 100%;
    padding: 12px;
    background: #D4A574;
    border: 2px solid #8B6F47;
    border-radius: 8px;
    color: #3E2723;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Arial', sans-serif;
}

.auth-button:hover {
    background: #B8956A;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.auth-button:active {
    transform: translateY(0);
}

.auth-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-button {
    flex: 1;
    padding: 10px;
    background: #8B7355;
    border: 2px solid #6B5D52;
    border-radius: 8px;
    color: #F5F5DC;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
}

.tab-button.active {
    background: #D4A574;
    border-color: #8B6F47;
    color: #3E2723;
    font-weight: bold;
}

.tab-button:hover {
    background: #B8956A;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.auth-form h2 {
    color: #3E2723;
    margin-bottom: 20px;
    text-align: center;
    font-size: 24px;
}

.auth-form input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 2px solid #6B5D52;
    border-radius: 8px;
    background: #F5F5DC;
    color: #3E2723;
    font-size: 16px;
}

.auth-form input:focus {
    outline: none;
    border-color: #D4A574;
    box-shadow: 0 0 10px rgba(212, 165, 116, 0.3);
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: #D4A574;
    border: 2px solid #8B6F47;
    border-radius: 8px;
    color: #3E2723;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary:hover {
    background: #B8956A;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

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

.error-message {
    color: #8B0000;
    font-size: 14px;
    margin-top: 10px;
    text-align: center;
    min-height: 20px;
}

/* CSS Placeholders for Sticks */
.stick-placeholder {
    width: 64px;
    height: 64px;
    position: relative;
    display: inline-block;
}

.stick-oak {
    background: linear-gradient(135deg, #8B6F47 0%, #6B5D52 100%);
    border-radius: 4px;
    transform: rotate(45deg);
    width: 50px;
    height: 8px;
    margin: 28px 7px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.stick-birch {
    background: linear-gradient(135deg, #F5F5DC 0%, #E8DCC4 100%);
    border-radius: 4px;
    transform: rotate(45deg);
    width: 50px;
    height: 8px;
    margin: 28px 7px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: 1px solid #D3D3D3;
}

.stick-cherry {
    background: linear-gradient(135deg, #8B0000 0%, #6B0000 100%);
    border-radius: 4px;
    transform: rotate(45deg);
    width: 50px;
    height: 8px;
    margin: 28px 7px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.stick-pine {
    background: linear-gradient(135deg, #2F5233 0%, #1F3521 100%);
    border-radius: 4px;
    transform: rotate(45deg);
    width: 50px;
    height: 8px;
    margin: 28px 7px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.stick-maple {
    background: linear-gradient(135deg, #CD7F32 0%, #A66F2A 100%);
    border-radius: 4px;
    transform: rotate(45deg);
    width: 50px;
    height: 8px;
    margin: 28px 7px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.stick-aspen {
    background: linear-gradient(135deg, #D3D3D3 0%, #B8B8B8 100%);
    border-radius: 4px;
    transform: rotate(45deg);
    width: 50px;
    height: 8px;
    margin: 28px 7px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Power-up sticks */
.stick-golden {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    border-radius: 4px;
    transform: rotate(45deg);
    width: 50px;
    height: 8px;
    margin: 28px 7px;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    animation: glow 2s ease-in-out infinite;
}

.stick-crystal {
    background: linear-gradient(135deg, #88CCFF 0%, #66AAFF 100%);
    border-radius: 4px;
    transform: rotate(45deg);
    width: 50px;
    height: 8px;
    margin: 28px 7px;
    box-shadow: 0 0 10px rgba(136, 204, 255, 0.5);
    opacity: 0.8;
}

.stick-enchanted {
    background: linear-gradient(135deg, #9966FF 0%, #7744DD 100%);
    border-radius: 4px;
    transform: rotate(45deg);
    width: 50px;
    height: 8px;
    margin: 28px 7px;
    box-shadow: 0 0 10px rgba(153, 102, 255, 0.5);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 10px rgba(255, 215, 0, 0.5); }
    50% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.8); }
}

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

/* Selection glow */
.stick-selected {
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.8) !important;
    transform: rotate(45deg) scale(1.1) !important;
    transition: all 0.2s;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .modal-content {
        padding: 20px;
        max-width: 90%;
    }
    
    .auth-form h2 {
        font-size: 20px;
    }
    
    .stick-placeholder {
        width: 48px;
        height: 48px;
    }
    
    .stick-oak, .stick-birch, .stick-cherry, .stick-pine, .stick-maple, .stick-aspen,
    .stick-golden, .stick-crystal, .stick-enchanted {
        width: 38px;
        height: 6px;
        margin: 21px 5px;
    }
}

