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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

h1 {
    text-align: center;
    color: white;
    margin-bottom: 30px;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.screen {
    display: none;
    background: white;
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.screen.active {
    display: block;
}

.upload-section {
    text-align: center;
    margin-bottom: 30px;
}

.upload-btn {
    display: inline-block;
    background: #667eea;
    color: white;
    padding: 15px 40px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.1em;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.upload-btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.upload-btn input {
    display: none;
}

.preview-container {
    margin-top: 30px;
    text-align: center;
}

.preview-container.hidden {
    display: none;
}

#imagePreview {
    max-width: 100%;
    max-height: 400px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
}

.difficulty-section {
    text-align: center;
}

.difficulty-section.hidden {
    display: none;
}

.difficulty-section h2 {
    color: #333;
    margin-bottom: 25px;
    font-size: 1.8em;
}

.difficulty-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
}

.difficulty-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.difficulty-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.difficulty-btn.selected {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    transform: scale(1.05);
}

.start-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 15px 50px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.2em;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

.start-btn:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.6);
}

.start-btn.hidden {
    display: none;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.action-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s;
}

.action-btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

.timer {
    font-size: 1.3em;
    font-weight: bold;
    color: #333;
}

.game-area {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.puzzle-board {
    background: #f0f0f0;
    border: 3px dashed #999;
    border-radius: 10px;
    position: relative;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.1);
}

.pieces-container {
    background: #fafafa;
    border: 2px solid #ddd;
    border-radius: 10px;
    padding: 20px;
    min-height: 200px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-content: flex-start;
    overflow-y: auto;
    max-height: 600px;
}

.puzzle-piece {
    cursor: move;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: all 0.2s;
    background-size: cover !important;
    position: absolute;
}

.puzzle-piece:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    z-index: 10;
}

.puzzle-piece.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.puzzle-piece.correct {
    border-color: #4CAF50;
    cursor: default !important;
}

.drop-zone {
    position: absolute;
    border: 2px dashed transparent;
    transition: all 0.3s;
}

.drop-zone.drag-over {
    background: rgba(102, 126, 234, 0.2);
    border-color: #667eea;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    max-width: 90%;
    max-height: 90%;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.modal-content img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 10px;
}

.close {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 35px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: #000;
}

.modal-content.congrats {
    text-align: center;
    padding: 50px;
}

.modal-content.congrats h2 {
    color: #4CAF50;
    font-size: 2.5em;
    margin-bottom: 20px;
}

.modal-content.congrats p {
    font-size: 1.3em;
    margin: 10px 0;
    color: #333;
}

@media (max-width: 768px) {
    h1 {
        font-size: 1.8em;
    }
    
    .screen {
        padding: 20px;
    }
    
    .game-header {
        flex-direction: column;
    }
    
    .game-area {
        flex-direction: column;
    }
    
    .difficulty-buttons {
        flex-direction: column;
    }
}