.game-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 10px;
    width: 100%;
    box-sizing: border-box;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    margin-bottom: 20px;
}

.game-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.game-info h1 {
    margin: 0;
    font-size: 1.5em;
}

.timer {
    font-size: 1.2em;
    font-weight: 500;
    color: var(--secondary-color);
    background: rgba(255, 255, 255, 0.8);
    padding: 4px 12px;
    border-radius: 4px;
    min-width: 80px;
    text-align: center;
}

.game-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.game-area {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.puzzle-board {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.puzzle-grid {
    display: grid;
    grid-template-columns: repeat(var(--grid-size), 1fr);
    gap: 1px;
    background: #ddd;
    padding: 1px;
    aspect-ratio: 1;
}

.puzzle-slot {
    background: rgba(255,255,255,0.8);
    aspect-ratio: 1;
    border: 1px dashed #ccc;
    min-height: 50px;
    position: relative;
}

.puzzle-slot.correct {
    border: 2px solid #2ecc71;
}

.puzzle-slot.hover {
    background: rgba(200,200,200,0.5);
    border-style: solid;
    border-color: #3498db;
}

.puzzle-pieces {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    align-content: start;
    max-height: 80vh;
    overflow-y: auto;
    transition: background-color 0.2s;
    cursor: default;
}

.puzzle-pieces.hover {
    background-color: rgba(52, 152, 219, 0.1);
    border: 2px dashed #3498db;
    cursor: copy;
}

.puzzle-pieces .puzzle-piece {
    cursor: grab;
}

.puzzle-piece:active {
    cursor: grabbing;
}

.puzzle-piece.locked {
    cursor: not-allowed !important;
    box-shadow: 0 0 0 2px #2ecc71;
}

.puzzle-piece {
    aspect-ratio: 1;
    background-size: cover;
    border: 1px solid #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    cursor: grab;
    transition: transform 0.2s;
    position: relative;
    width: 100%;
    height: 100%;
}

.puzzle-piece:hover {
    transform: scale(1.05);
}

.puzzle-piece.dragging {
    opacity: 0.6;
    transform: scale(1.05);
    z-index: 1000;
}

@media (max-width: 768px) {
    .game-container {
        padding: 5px;
        overflow: hidden;
    }

    .game-area {
        grid-template-columns: 1fr;
        gap: 10px;
        width: 100%;
        margin: 0;
        padding: 0;
    }
    
    .game-header {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
    }
    
    .puzzle-board {
        padding: 5px;
        overflow: hidden;
        width: 100%;
        margin: 0;
        border-radius: 4px;
    }
    
    .puzzle-grid {
        max-width: 100%;
        width: 100%;
        aspect-ratio: 1;
        gap: 1px !important;
        padding: 1px !important;
        display: grid;
        grid-template-columns: repeat(var(--grid-size), 1fr);
        grid-template-rows: repeat(var(--grid-size), 1fr);
        background: #ddd;
        margin: 0;
        box-sizing: border-box;
    }
    
    .puzzle-slot {
        margin: 0 !important;
        padding: 0 !important;
        border-width: 1px !important;
        min-height: unset;
        height: 100%;
        aspect-ratio: 1;
        position: relative;
        background: white;
        box-sizing: border-box;
    }
    
    .puzzle-pieces {
        position: relative;
        grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
        gap: 3px;
        max-height: 35vh;
        padding: 8px 15px;
        margin: 0 10px;
        background: white;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 8px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    }

    .puzzle-piece {
        min-width: 45px;
        min-height: 45px;
        width: 100%;
        height: 100%;
        margin: 0;
       
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }

    .scroll-handle,
    .scroll-handle::after,
    .scroll-handle:active {
        display: none;
    }

    .game-controls {
        width: 100%;
        flex-wrap: wrap;
        justify-content: center;
    }

    .game-info {
        width: 100%;
        justify-content: space-between;
    }

    .game-info h1 {
        font-size: 1.2em;
    }

    .timer {
        font-size: 1.1em;
        padding: 3px 10px;
    }

    .btn-primary, .btn-secondary {
        padding: 8px 15px;
        font-size: 14px;
        min-width: unset;
    }

    @supports (-webkit-touch-callout: none) {
        .puzzle-grid {
            width: calc(100% - 2px);
        }
        
        .puzzle-pieces {
            width: calc(100% - 40px);
            margin: 0 auto;
        }
    }

    /* 10x10 modu için özel stiller */
    .puzzle-grid[style*="--grid-size: 10"] {
        gap: 0.5px !important;
        padding: 0.5px !important;
        width: 100% !important;
        max-width: 100%;
        margin: 0 auto;
    }

    .puzzle-grid[style*="--grid-size: 10"] .puzzle-slot {
        border-width: 0.5px !important;
        min-height: 0;
        min-width: 0;
        padding: 0 !important;
        margin: 0 !important;
    }

    .puzzle-grid[style*="--grid-size: 10"] .puzzle-piece {
        min-width: 35px;
        min-height: 35px;
    }

    /* Safari için özel düzeltme */
    @supports (-webkit-touch-callout: none) {
        .puzzle-grid[style*="--grid-size: 10"] {
            width: calc(100% - 1px) !important;
        }
    }

    /* 10x10 mod için parça kutucuğu düzenlemesi */
    .puzzle-grid[style*="--grid-size: 10"] ~ .puzzle-pieces {
        grid-template-columns: repeat(auto-fill, minmax(35px, 1fr));
        gap: 2px;
    }

    /* 10x10 mod için hover ve aktif durumlar */
    .puzzle-grid[style*="--grid-size: 10"] .puzzle-slot.hover {
        border-width: 1px !important;
    }

    .puzzle-grid[style*="--grid-size: 10"] .puzzle-slot.correct {
        border-width: 1px !important;
    }

    /* Küçük ekranlar için daha da optimize */
    @media (max-width: 360px) {
        .puzzle-pieces {
            padding: 8px 12px;
            margin: 0 8px;
        }

        .puzzle-piece {
            min-width: 40px;
            min-height: 40px;
        }

        .puzzle-grid[style*="--grid-size: 10"] ~ .puzzle-pieces {
            grid-template-columns: repeat(auto-fill, minmax(32px, 1fr));
        }

        .puzzle-grid[style*="--grid-size: 10"] .puzzle-piece {
            min-width: 32px;
            min-height: 32px;
        }
    }

    /* Sadece tamamlanma popup'ı için olan stiller */
    .completed-puzzle-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.8);
        display: flex;
        justify-content: center;
        align-items: center;
        z-index: 1000;
    }

    .completed-puzzle-container {
        background: white;
        padding: 15px;
        border-radius: 12px;
        width: 90%;
        max-height: 90vh;
        overflow-y: auto;
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    }

    /* Tamamlanmış puzzle görünümü için özel stiller */
    .puzzle-board.completed {
        padding: 10px;
        max-width: 100%;
    }

    /* Grid boyutuna göre özel ayarlamalar */
    /* 4x4 grid için */
    .puzzle-grid[style*="--grid-size: 4"].completed {
        gap: 2px;
    }

    /* 6x6 grid için */
    .puzzle-grid[style*="--grid-size: 6"].completed {
        gap: 1.5px;
    }

    /* 8x8 grid için */
    .puzzle-grid[style*="--grid-size: 8"].completed {
        gap: 1px;
    }

    /* 10x10 grid için */
    .puzzle-grid[style*="--grid-size: 10"].completed {
        gap: 0.5px;
    }

    .puzzle-grid.completed .puzzle-piece {
        min-width: 0;
        min-height: 0;
    }

    /* Tamamlanma mesajı ve butonlar */
    .completion-message {
        font-size: 18px;
        margin: 15px 0;
        color: #333;
    }

    .completion-time, 
    .best-score {
        font-size: 14px;
        margin: 8px 0;
        color: #666;
    }

    .button-group {
        display: flex;
        gap: 10px;
        justify-content: center;
        margin-top: 15px;
    }

    .restart-button, 
    .home-button {
        padding: 10px 20px;
        font-size: 14px;
        border-radius: 6px;
        border: none;
        cursor: pointer;
    }

    .restart-button {
        background: #4CAF50;
        color: white;
    }

    .home-button {
        background: #2196F3;
        color: white;
    }
}

/* Daha küçük ekranlar için ek optimizasyon */
@media (max-width: 480px) {
    .completed-puzzle-container {
        padding: 10px;
        width: 95%;
    }

    .puzzle-board.completed {
        padding: 5px;
    }

    /* Grid boyutuna göre özel ayarlamalar */
    .puzzle-grid[style*="--grid-size: 8"].completed,
    .puzzle-grid[style*="--grid-size: 10"].completed {
        gap: 0.5px;
    }

    .puzzle-grid.completed .puzzle-piece {
        border-width: 0.5px;
    }
}

/* Çok küçük ekranlar için */
@media (max-width: 360px) {
    .puzzle-board.completed {
        padding: 3px;
    }

    .puzzle-grid.completed {
        gap: 0.5px;
    }

    .puzzle-grid.completed .puzzle-piece {
        border-width: 0.25px;
    }

    .game-info h1 {
        font-size: 1.1em;
    }

    .timer {
        font-size: 1em;
        padding: 2px 8px;
        min-width: 70px;
    }

    .game-controls {
        gap: 6px;
    }
}

/* Genel olarak tüm ekranlar için 10x10 optimizasyonu */
.puzzle-grid[style*="--grid-size: 10"] {
    gap: 1px;
    padding: 1px;
}

.puzzle-grid[style*="--grid-size: 10"] .puzzle-slot {
    border-width: 0.5px;
}

.completed-puzzle-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.completed-puzzle-container {
    background: white;
    padding: 30px;
    border-radius: 16px;
    text-align: center;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
}

.completed-puzzle-frame {
    position: relative;
    border: 4px solid #4CAF50;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
}

.completed-puzzle-frame img {
    width: 100%;
    height: auto;
    display: block;
}

.completed-puzzle-frame::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(0deg, transparent 98%, rgba(255,255,255,0.2) 100%),
        linear-gradient(90deg, transparent 98%, rgba(255,255,255,0.2) 100%);
    background-size: calc(100% / var(--grid-size)) calc(100% / var(--grid-size));
    pointer-events: none;
}

.completion-message {
    font-size: 24px;
    color: #333;
    margin: 20px 0;
    font-weight: bold;
}

.completion-time {
    font-size: 18px;
    color: #666;
    margin: 10px 0;
}

.restart-button {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 1.1em;
    cursor: pointer;
    transition: background 0.3s;
}

.restart-button:hover {
    background: #45a049;
}

.puzzle-board.completed {
    padding: 20px;
    background: white;
    border: 4px solid #4CAF50;
    border-radius: 12px;
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.3);
    margin: 0 auto 20px;
    max-width: 800px;
}

.puzzle-grid.completed {
    display: grid;
    gap: 1px;
    background: rgba(255, 255, 255, 0.8);
    padding: 1px;
    aspect-ratio: 1;
}

.puzzle-piece.completed {
    aspect-ratio: 1;
    background-size: cover;
    border: 1px solid rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
}

.button-group {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.home-button {
    background: #3498db;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 1.1em;
    cursor: pointer;
    transition: background 0.3s;
}

.home-button:hover {
    background: #2980b9;
}

/* Müzik kontrolleri için yeni stiller */
.music-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.1);
    padding: 6px 12px;
    border-radius: 50px;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
}

.music-controls:hover {
    background: rgba(0, 0, 0, 0.2);
}

#toggleMusic {
    width: auto;
    height: auto;
    padding: 6px 12px;
    border-radius: 4px;
    border: none;
    background: var(--secondary-color);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
}

#toggleMusic:hover {
    background: #2980b9;
}

#toggleMusic i {
    transition: all 0.2s ease;
}

#toggleMusic.playing {
    background: #e74c3c;
}

#toggleMusic.playing:hover {
    background: #c0392b;
}

.volume-control {
    position: relative;
    width: 80px;
    height: 28px;
    display: flex;
    align-items: center;
}

#volumeSlider {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.3);
    outline: none;
    transition: all 0.3s ease;
}

#volumeSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

#volumeSlider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

/* Mobil uyumluluk */
@media (max-width: 768px) {
    .music-controls {
        padding: 4px 10px;
    }

    #toggleMusic {
        padding: 4px 10px;
        font-size: 12px;
    }

    .volume-control {
        width: 60px;
    }
}

/* Çok küçük ekranlar için */
@media (max-width: 360px) {
    .music-controls {
        padding: 3px 8px;
    }

    #toggleMusic {
        padding: 3px 8px;
        font-size: 11px;
    }

    .volume-control {
        width: 50px;
    }
} 