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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    color: #fff;
}

.game-wrapper {
    max-width: 1200px;
    width: 100%;
}

/* Start Screen */
.start-screen {
    background: rgba(26, 26, 46, 0.9);
    border-radius: 20px;
    padding: 40px;
    border: 3px solid #ff6b9d;
    box-shadow: 0 0 40px rgba(255, 107, 157, 0.3);
}

.game-title {
    font-size: 2.5rem;
    text-align: center;
    color: #ff6b9d;
    margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(255, 107, 157, 0.5);
}

.game-subtitle {
    text-align: center;
    font-size: 1.2rem;
    color: #c77dff;
    margin-bottom: 30px;
}

.section {
    margin: 30px 0;
}

.section h3 {
    color: #ff6b9d;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

/* Image Selection */
.image-select {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
}

.image-option {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid transparent;
    border-radius: 10px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.image-option:hover {
    transform: translateY(-5px);
    border-color: #c77dff;
}

.image-option.selected {
    border-color: #ff6b9d;
    background: rgba(255, 107, 157, 0.1);
}

.image-preview {
    width: 100%;
    height: 80px;
    border-radius: 8px;
    margin-bottom: 8px;
}

.image-option span {
    font-size: 0.9rem;
    color: #ccc;
}

/* Difficulty Selection */
.difficulty-select {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
}

.btn-difficulty {
    background: linear-gradient(135deg, #2a2a4a, #1a1a3a);
    border: 2px solid #c77dff;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: #fff;
}

.btn-difficulty:hover {
    transform: scale(1.05);
    border-color: #ff6b9d;
}

.btn-difficulty.selected {
    border-color: #ff6b9d;
    background: linear-gradient(135deg, #ff6b9d, #c77dff);
}

.diff-label {
    font-size: 1.1rem;
    font-weight: bold;
}

.diff-size {
    font-size: 0.9rem;
    opacity: 0.8;
}

.btn-start {
    display: block;
    width: 100%;
    max-width: 400px;
    margin: 30px auto;
    background: linear-gradient(135deg, #ff6b9d, #c77dff);
    color: #fff;
    font-size: 1.5rem;
    font-weight: bold;
    padding: 15px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 5px 20px rgba(255, 107, 157, 0.4);
}

.btn-start:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 107, 157, 0.6);
}

.rules {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 20px;
    margin-top: 30px;
}

.rules h3 {
    color: #ff6b9d;
    margin-bottom: 15px;
}

.rules ul {
    list-style: none;
}

.rules li {
    margin: 10px 0;
    padding-left: 25px;
    position: relative;
    color: #ccc;
}

.rules li::before {
    content: "🧩";
    position: absolute;
    left: 0;
}

/* Game Screen */
.game-screen {
    background: rgba(26, 26, 46, 0.9);
    border-radius: 20px;
    padding: 30px;
    border: 3px solid #ff6b9d;
}

.game-header {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(255, 107, 157, 0.3);
}

.stat {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: #c77dff;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: #ff6b9d;
}

/* Controls */
.game-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.btn-control {
    background: linear-gradient(135deg, #2a2a4a, #1a1a3a);
    border: 2px solid #c77dff;
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

.btn-control:hover {
    border-color: #ff6b9d;
    transform: translateY(-2px);
}

/* Puzzle Area */
.puzzle-container {
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: flex-start;
}

.puzzle-board {
    position: relative;
    background: rgba(255, 255, 255, 0.05);
    border: 3px solid #c77dff;
    border-radius: 10px;
}

.puzzle-pieces {
    display: grid;
    gap: 10px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    border: 2px solid rgba(199, 125, 255, 0.3);
    max-height: 600px;
    overflow-y: auto;
}

.puzzle-piece {
    cursor: grab;
    border-radius: 5px;
    transition: all 0.2s;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.puzzle-piece:active {
    cursor: grabbing;
}

.puzzle-piece:hover {
    transform: scale(1.05);
    border-color: #ff6b9d;
}

.puzzle-piece.placed {
    opacity: 0.3;
    cursor: not-allowed;
}

.board-slot {
    position: absolute;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    transition: all 0.3s;
}

.board-slot.hint {
    border-color: #ffd700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.board-slot.filled {
    border: none;
}

.board-piece {
    width: 100%;
    height: 100%;
    border-radius: 3px;
    animation: placepiece 0.3s ease-out;
}

@keyframes placepiece {
    0% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.board-piece.correct {
    border: 2px solid #00ff88;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.5);
}

/* Preview Modal */
.preview-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.preview-overlay.show {
    display: flex;
}

.preview-content {
    text-align: center;
}

.preview-content h3 {
    color: #ff6b9d;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.preview-image {
    max-width: 90vw;
    max-height: 70vh;
    border: 3px solid #ff6b9d;
    border-radius: 10px;
    margin-bottom: 20px;
}

.btn-close {
    background: linear-gradient(135deg, #ff6b9d, #c77dff);
    color: #fff;
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-close:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 157, 0.4);
}

/* Result Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1001;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, #2a2a4a, #1a1a3a);
    border: 3px solid #ff6b9d;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    max-width: 500px;
    box-shadow: 0 10px 40px rgba(255, 107, 157, 0.5);
}

.modal-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.modal-title {
    color: #ff6b9d;
    font-size: 2rem;
    margin-bottom: 15px;
}

.modal-message {
    color: #ccc;
    font-size: 1.1rem;
    margin-bottom: 25px;
}

.modal-stats {
    display: flex;
    gap: 30px;
    justify-content: center;
    margin: 25px 0;
}

.modal-stat {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.modal-stat-label {
    color: #c77dff;
    font-size: 0.9rem;
}

.modal-stat-value {
    color: #fff;
    font-size: 1.5rem;
    font-weight: bold;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn-primary,
.btn-secondary {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #ff6b9d, #c77dff);
    color: #fff;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 157, 0.4);
}

.btn-secondary {
    background: transparent;
    border: 2px solid #c77dff;
    color: #c77dff;
}

.btn-secondary:hover {
    border-color: #ff6b9d;
    color: #ff6b9d;
}

/* Mobile */
@media (max-width: 768px) {
    .game-title {
        font-size: 1.8rem;
    }
    
    .puzzle-container {
        flex-direction: column;
        align-items: center;
    }
    
    .puzzle-pieces {
        max-height: 300px;
        width: 100%;
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
    
    .game-header {
        flex-wrap: wrap;
    }
    
    .modal-stats {
        flex-direction: column;
        gap: 15px;
    }
}
