/* Modern CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    overflow: hidden;
}

/* Game Container Layout */
.game-container {
    height: 63.5vh;
    display: flex;
    flex-direction: column;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header Styles */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 25px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.game-title {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 2px;
}

.game-stats {
    display: flex;
    gap: 30px;
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.stat-value {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: #333;
}

/* Main Game Layout */
.game-main {
    display: flex;
    gap: 30px;
    flex: 1;
    min-height: 0;
}

/* Game Board Container */
.game-board-container {
    position: relative;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

#gameBoard {
    border: 3px solid #e0e0e0;
    border-radius: 8px;
    background: #f8f9fa;
    display: block;
}

/* Game Overlay */
.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    backdrop-filter: blur(5px);
}

.game-overlay.visible {
    display: flex;
}

.overlay-content {
    background: white;
    padding: 40px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 300px;
}

.overlay-content h2 {
    font-size: 2rem;
    margin-bottom: 15px;
    color: #333;
}

.overlay-content p {
    font-size: 1.1rem;
    margin-bottom: 25px;
    color: #666;
}

/* Sidebar Styles */
.game-sidebar {
    width: 280px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
}

.next-piece,
.word-found,
.game-settings,
.controls {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.next-piece h3,
.word-found h3,
.game-settings h3,
.controls h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Next Letter Display */
.next-letter-display {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-size: 2rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    margin: 0 auto;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

/* Word Found Animation */
.word-found {
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    pointer-events: none;
}

.word-found.visible {
    opacity: 1;
    transform: translateY(0);
}

.found-word {
    font-size: 1.5rem;
    font-weight: bold;
    color: #28a745;
    margin-bottom: 8px;
    letter-spacing: 2px;
}

.word-points {
    font-size: 1.2rem;
    color: #ffc107;
    font-weight: bold;
}

/* Settings */
.setting-item {
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
}

.setting-item:last-child {
    margin-bottom: 0;
}

.setting-item label {
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 5px;
    font-weight: 600;
}

.setting-item select {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    background: white;
    font-size: 0.9rem;
    color: #333;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.setting-item select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Controls */
.control-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.control-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.control-key {
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-weight: bold;
    border: 1px solid #ddd;
    min-width: 60px;
    text-align: center;
}

.control-desc {
    color: #666;
}

/* Buttons */
.game-button {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.game-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .game-container {
        padding: 10px;
    }
    
    .game-main {
        flex-direction: column;
        gap: 20px;
    }
    
    .game-sidebar {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
    }
    
    .next-piece,
    .word-found,
    .controls {
        min-width: 200px;
    }
    
    .game-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .game-stats {
        justify-content: center;
    }
    
    #gameBoard {
        width: 100%;
        height: auto;
    }
}

/* Animation Classes */
@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes wordPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

@keyframes letterDrop {
    0% {
        transform: translateY(-10px);
        opacity: 0.7;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes scoreIncrement {
    0% {
        transform: scale(1);
        color: #333;
    }
    50% {
        transform: scale(1.2);
        color: #28a745;
    }
    100% {
        transform: scale(1);
        color: #333;
    }
}

@keyframes levelUp {
    0%, 100% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.1) rotate(-2deg);
    }
    75% {
        transform: scale(1.1) rotate(2deg);
    }
}

@keyframes wordFound {
    0% {
        transform: translateY(10px) scale(0.8);
        opacity: 0;
    }
    50% {
        transform: translateY(-5px) scale(1.1);
        opacity: 1;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.word-animation {
    animation: wordPulse 0.6s ease-in-out;
}

.slide-down {
    animation: slideDown 0.3s ease-out;
}

.letter-drop {
    animation: letterDrop 0.2s ease-out;
}

.score-increment {
    animation: scoreIncrement 0.5s ease-out;
}

.level-up {
    animation: levelUp 0.8s ease-in-out;
}

.word-found-animation {
    animation: wordFound 0.5s ease-out;
}

/* Letter block styles for canvas rendering */
.letter-block {
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-weight: bold;
    text-align: center;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Game state indicators */
.paused-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 20px 40px;
    border-radius: 12px;
    font-size: 1.5rem;
    font-weight: bold;
    display: none;
}

.paused-indicator.visible {
    display: block;
}
