/* Spelling Space Game Styles */

/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background-color: #f0f2f5;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

/* Game Container */
.game-container {
    background-color: #ffffff;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 500px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    position: relative;
    overflow: hidden;
}

/* Game Title */
.game-title {
    text-align: center;
    color: #333;
    font-size: 2rem;
    margin-bottom: 10px;
    font-weight: 700;
}

/* Word Display Area */
.word-display-container {
    background-color: #f8f9fa;
    border-radius: 15px;
    padding: 15px;
    min-height: 60px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.05);
    margin-bottom: 10px;
    position: relative;
    gap: 10px;
}

#word-display {
    font-size: 2rem;
    font-weight: 600;
    color: #333;
    text-align: center;
    flex: 1;
    min-height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: visible;
    white-space: normal;
    word-break: break-word;
}

/* Control Buttons */
.control-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.buttons-container {
    display: flex;
    gap: 10px;
}

.control-btn {
    border: none;
    border-radius: 12px;
    padding: 12px 20px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.backspace-btn {
    background-color: #ff9500;
    color: white;
}

.enter-btn {
    background-color: #34c759;
    color: white;
    padding: 12px 30px;
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.control-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Score Container */
.score-container {
    text-align: left;
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
}

/* Message Display */
.message-display {
    position: absolute;
    left: 50%;
    transform: translateX(-50%); /* Centers it horizontally */
    text-align: center;
    font-size: 1.2rem;
    padding: 6px 10px;
    border-radius: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
    white-space: nowrap;
}

.message-display.success {
    background-color: rgba(52, 199, 89, 0.2);
    color: #34c759;
    font-weight: 600;
}

.message-display.error {
    background-color: rgba(255, 59, 48, 0.2);
    color: #ff3b30;
}

.message-display.info {
    background-color: rgba(0, 122, 255, 0.2);
    color: #007aff;
}

/* Letters Grid */
.letters-grid-container {
    margin-top: 5px;
}

.letters-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.letter-ball {
    aspect-ratio: 1/1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
    user-select: none;
}

.letter-ball:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.letter-ball:active {
    transform: translateY(1px) scale(0.98);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.letter-ball.selected {
    opacity: 0.4;
    transform: scale(0.9);
    cursor: not-allowed;
    box-shadow: none;
}

/* Confetti Canvas */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    display: none;
}

/* Animations */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes success-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); background-color: rgba(52, 199, 89, 0.2); }
    100% { transform: scale(1); }
}

.success-pulse {
    animation: success-pulse 0.5s ease-in-out;
}

/* Responsive Design */
@media (max-width: 500px) {
    .game-container {
        border-radius: 0;
        height: 100vh;
        max-width: 100%;
        padding: 15px;
    }
    
    .game-title {
        font-size: 1.8rem;
    }
    
    #word-display {
        font-size: 1.8rem;
    }
    
    .letter-ball {
        font-size: 1.2rem;
    }
    
    .control-btn {
        padding: 10px 15px;
        font-size: 1rem;
    }
    
    .enter-btn {
        padding: 10px 20px;
    }
}

@media (max-width: 350px) {
    .letters-grid {
        gap: 8px;
    }
    
    .letter-ball {
        font-size: 1rem;
    }
}

/* iOS Calculator-inspired Design Adjustments */
@media (max-height: 700px) {
    .game-container {
        gap: 10px;
    }
    
    .word-display-container {
        padding: 10px;
        min-height: 50px;
    }
    
    #word-display {
        min-height: 30px;
    }
    
    .control-buttons {
        margin-bottom: 5px;
    }
    
    .score-container {
        margin-bottom: 5px;
    }

}

/* Portrait vs Landscape Adjustments */
@media (orientation: landscape) and (max-height: 500px) {
    .game-container {
        flex-direction: row;
        flex-wrap: wrap;
        height: auto;
        max-height: 100vh;
    }
    
    .game-title {
        width: 100%;
        margin-bottom: 5px;
    }
    
    .word-display-container {
        width: 60%;
        margin-right: 10px;
    }
    
    .control-buttons {
        width: calc(40% - 10px);
        flex-direction: column;
    }
    
    .letters-grid-container {
        width: 100%;
    }
}
