/* Global Reset and Fullscreen White Background */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: white;
    overflow: hidden;
    font-family: 'Arial', sans-serif;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Game Container */
.game-container {
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

/* Canvas Styling */
#gameCanvas {
    width: 360px;
    height: 640px;
    border: 3px solid rgba(255, 255, 255, 0.8);
    border-radius: 15px;
    background-color: white;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Start Screen */
.start-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
    padding: 20px;
    box-sizing: border-box;
}

.start-content {
    max-width: 500px;
    animation: fadeInUp 1s ease-out;
}

.start-title {
    font-size: 3.5rem;
    font-weight: bold;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.start-subtitle {
    font-size: 1.3rem;
    margin-bottom: 30px;
    opacity: 0.9;
    font-weight: 300;
}

.start-features {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 40px;
}

.feature-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.1rem;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease, background 0.3s ease;
}

.feature-item:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.2);
}

.feature-icon {
    font-size: 1.5rem;
}

.start-button {
    background: linear-gradient(45deg, #ff6b6b, #ffa500);
    color: white;
    border: none;
    padding: 18px 40px;
    font-size: 1.4rem;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(255, 107, 107, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 auto 20px;
    position: relative;
    overflow: hidden;
}

.start-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 25px rgba(255, 107, 107, 0.4);
    background: linear-gradient(45deg, #ff5252, #ff9500);
}

.start-button:active {
    transform: translateY(-1px);
}

.start-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.start-button:hover::before {
    left: 100%;
}

.button-text {
    z-index: 1;
    position: relative;
}

.button-icon {
    z-index: 1;
    position: relative;
    font-size: 1.2rem;
}

.start-instructions {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-top: 10px;
}

/* Alphabet Selection Screen */
.alphabet-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    text-align: center;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
}

.alphabet-content {
    max-width: 800px;
    width: 100%;
    animation: fadeInUp 0.8s ease-out;
}

.alphabet-title {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.alphabet-subtitle {
    font-size: 1.2rem;
    margin-bottom: 30px;
    opacity: 0.9;
    font-weight: 300;
}

.alphabet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 15px;
    margin-bottom: 40px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.letter-button {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 15px;
    font-size: 2.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
}

.letter-button:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
}

.letter-button:active {
    transform: translateY(-2px) scale(1.02);
}

.letter-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.letter-button:hover::before {
    left: 100%;
}

.alphabet-controls {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.control-button {
    background: linear-gradient(45deg, #ff6b6b, #ffa500);
    color: white;
    border: none;
    padding: 15px 25px;
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 40px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 15px rgba(255, 107, 107, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.control-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 107, 107, 0.4);
}

.control-button.back-btn {
    background: linear-gradient(45deg, #8b5cf6, #a78bfa);
    box-shadow: 0 6px 15px rgba(139, 92, 246, 0.3);
}

.control-button.back-btn:hover {
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.4);
}

.control-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.control-button:hover::before {
    left: 100%;
}

.button-icon {
    font-size: 1.2rem;
}

/* Loading Indicator */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #333;
}

.loading-text {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 20px;
    color: #333;
}

.loading-bar {
    width: 300px;
    height: 6px;
    background-color: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
}

.loading-progress {
    height: 100%;
    background-color: #4CAF50;
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 3px;
}

/* Instructions */
.instructions {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 12px 20px;
    border-radius: 12px;
    text-align: center;
    color: #333;
    font-size: 14px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    z-index: 10;
    max-width: 280px;
}

.instructions p {
    margin: 5px 0;
}

.current-letter-display {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    text-align: center;
}

.current-letter-display h3 {
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 16px;
    font-weight: bold;
    text-shadow: none;
}

/* Navigation Toolbar */
.navigation-toolbar {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 12px 20px;
    border-radius: 25px;
    display: flex;
    gap: 12px;
    align-items: center;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    z-index: 15;
}

.toolbar-btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 10px 14px;
    font-size: 12px;
    font-weight: bold;
    border-radius: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 70px;
    justify-content: center;
}

.toolbar-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
    background: linear-gradient(45deg, #5a67d8, #6b46c1);
}

.toolbar-btn.secondary {
    background: linear-gradient(45deg, #8b5cf6, #a78bfa);
    box-shadow: 0 3px 10px rgba(139, 92, 246, 0.3);
}

.toolbar-btn.secondary:hover {
    box-shadow: 0 5px 15px rgba(139, 92, 246, 0.4);
    background: linear-gradient(45deg, #7c3aed, #8b5cf6);
}



/* Drawing Area Indicator */
.drawing-area {
    position: absolute;
    width: 280px;
    height: 400px;
    border: 2px dashed #ccc;
    pointer-events: none;
    z-index: 5;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #gameCanvas {
        width: 90vw;
        height: calc(90vw * 640 / 360);
        max-height: 90vh;
    }
    
    .instructions {
        font-size: 12px;
        padding: 10px 15px;
        max-width: 250px;
    }
    
    .current-letter-display h3 {
        font-size: 14px;
    }
    
    .navigation-toolbar {
        bottom: 15px;
        padding: 10px 15px;
        gap: 8px;
        border-radius: 20px;
    }
    
    .toolbar-btn {
        padding: 8px 10px;
        font-size: 11px;
        min-width: 60px;
        gap: 4px;
    }
    
    .toolbar-btn span:last-child {
        display: none;
    }
    
    .start-title {
        font-size: 2.5rem;
    }
    
    .start-subtitle {
        font-size: 1.1rem;
    }
    
    .start-button {
        padding: 15px 30px;
        font-size: 1.2rem;
    }
    
    .feature-item {
        font-size: 1rem;
        padding: 8px 16px;
    }
    
    .start-features {
        gap: 12px;
        margin-bottom: 30px;
    }
    
    .alphabet-title {
        font-size: 2rem;
    }
    
    .alphabet-subtitle {
        font-size: 1rem;
    }
    
    .alphabet-grid {
        grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
        gap: 10px;
        padding: 15px;
    }
    
    .letter-button {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }
    
    .control-button {
        padding: 12px 20px;
        font-size: 1rem;
    }
    
    .alphabet-controls {
        gap: 15px;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

.fade-out {
    animation: fadeOut 0.5s ease-out;
}

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

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

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

/* Pointer cursor for drawing */
.drawing-cursor {
    cursor: crosshair;
}

/* Hide scrollbars */
::-webkit-scrollbar {
    display: none;
}

html {
    -ms-overflow-style: none;
    scrollbar-width: none;
}