/* Sayı Bulmaca Game Styles */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap');

.game-container {
    font-family: 'Poppins', sans-serif !important;
    position: relative;
    max-width: 700px !important; /* Slightly narrower for a more focused layout */
    margin: 30px auto !important;
    border: 1px solid rgba(139, 92, 246, 0.15) !important;
    box-shadow: 0 20px 40px rgba(139, 92, 246, 0.08) !important;
}

.game-header {
    text-align: center;
    margin-bottom: 2rem;
}

.game-title {
    font-size: 2.5rem !important;
    font-weight: 800 !important;
    margin: 0 0 0.5rem 0 !important;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.game-subtitle {
    color: #64748b;
    font-size: 1rem;
    margin: 0;
    font-weight: 500;
}

/* Controls & Stats */
.game-controls {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    background: #f8fafc;
    padding: 1.25rem;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
}

@media(min-width: 576px) {
    .game-controls {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

.mode-selector {
    display: flex;
    background: #e2e8f0;
    border-radius: 9999px;
    padding: 4px;
    width: fit-content;
    margin: 0 auto;
}

.mode-btn {
    background: transparent;
    border: none;
    outline: none;
    color: #475569;
    padding: 8px 18px;
    border-radius: 9999px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
}

.mode-btn.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    box-shadow: 0 4px 10px rgba(139, 92, 246, 0.25);
}

.stats-panel {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.stat-box {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 8px 14px;
    min-width: 90px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 2px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.stat-label {
    font-size: 0.7rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-weight: 600;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    margin-left: 0 !important; /* Reset default stat-value margin if any */
}

/* Board styling */
.board-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    margin: 1.5rem 0;
}

.board {
    position: relative;
    width: 100%;
    max-width: 380px;
    aspect-ratio: 1 / 1;
    background: #0f172a; /* Slate 900 */
    border-radius: 20px;
    padding: 8px;
    box-sizing: border-box;
    box-shadow: inset 0 8px 24px rgba(0, 0, 0, 0.5), 
                0 15px 30px rgba(139, 92, 246, 0.15);
    border: 4px solid #1e293b;
    overflow: hidden;
}

.board[data-grid="3"] .tile {
    width: 33.3333%;
    height: 33.3333%;
}

.board[data-grid="4"] .tile {
    width: 25%;
    height: 25%;
}

.tile {
    position: absolute;
    top: 0;
    left: 0;
    padding: 6px;
    box-sizing: border-box;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.25, 1, 0.5, 1);
    will-change: transform;
}

.tile-content {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.85rem;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35),
                inset 0 2px 4px rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.15s ease;
    user-select: none;
}

.board[data-grid="4"] .tile-content {
    font-size: 1.5rem;
    border-radius: 10px;
}

.tile:hover .tile-content {
    transform: scale(1.03);
    box-shadow: 0 6px 15px rgba(236, 72, 153, 0.4),
                inset 0 2px 4px rgba(255, 255, 255, 0.3);
    filter: brightness(1.08);
}

.tile:active .tile-content {
    transform: scale(0.96);
}

/* Solved tile correct style */
.tile-correct .tile-content {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3),
                inset 0 2px 4px rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.15);
}

.tile-correct:hover .tile-content {
    box-shadow: 0 6px 15px rgba(16, 185, 129, 0.5),
                inset 0 2px 4px rgba(255, 255, 255, 0.3);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
    margin-bottom: 2rem;
}

#sound-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #475569 !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    cursor: pointer;
    transition: all 0.2s;
}

#sound-btn:hover {
    background: #e2e8f0;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.08);
}

.game-instructions {
    background: #f8fafc;
    border-radius: 16px;
    padding: 1.25rem;
    border: 1px solid #e2e8f0;
    text-align: left;
}

.game-instructions h3 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-size: 1rem;
    color: #1e293b;
    font-weight: 700;
}

.game-instructions p {
    margin: 0;
    font-size: 0.85rem !important;
    color: #64748b !important;
    line-height: 1.6 !important;
}

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

/* Result Overlay */
.result-box {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

.result-content {
    background: white;
    border-radius: 24px;
    padding: 2.5rem 2rem;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 
                0 0 40px rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.1);
    animation: slideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.trophy-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    color: white;
    margin: 0 auto 1.25rem auto;
    box-shadow: 0 8px 16px rgba(245, 158, 11, 0.3);
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.result-content h2 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-top: 0;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.result-content p {
    color: #64748b;
    margin-bottom: 1.5rem;
    font-size: 1.05rem;
}

.result-stats {
    display: flex;
    justify-content: space-around;
    background: #f8fafc;
    border-radius: 16px;
    padding: 1rem;
    margin-bottom: 2rem;
    border: 1px solid #e2e8f0;
}

.r-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.r-label {
    font-size: 0.7rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.r-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1e293b;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(40px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Responsiveness adjustments */
@media(max-width: 480px) {
    .game-container {
        padding: 1.5rem 1rem !important;
        margin: 15px 10px !important;
    }
    
    .game-title {
        font-size: 1.9rem !important;
    }
    
    .board {
        padding: 6px;
        border-radius: 16px;
        border-width: 3px;
    }
    
    .tile {
        padding: 4px;
    }
    
    .tile-content {
        border-radius: 8px;
        font-size: 1.4rem;
    }
    
    .board[data-grid="4"] .tile-content {
        font-size: 1.15rem;
        border-radius: 6px;
    }
    
    .stat-box {
        min-width: 80px;
        padding: 6px 10px;
    }
    
    .stat-value {
        font-size: 1.1rem;
    }
}
