/* ============================================
   OYUN BAHÇESİ - Responsive Tasarım
   ============================================ */

/* Büyük tablet / Desktop */
@media (min-width: 1024px) {
    .hub-grid {
        grid-template-columns: repeat(4, 1fr);
        max-width: 960px;
        gap: var(--space-xl);
        padding: var(--space-2xl) var(--space-xl);
    }

    .card-icon {
        width: 100px;
        height: 100px;
        font-size: 3.5rem;
    }

    .memory-grid.grid-2x2 { grid-template-columns: repeat(2, 120px); }
    .memory-grid.grid-3x4 { grid-template-columns: repeat(4, 110px); }
    .memory-grid.grid-4x4 { grid-template-columns: repeat(4, 110px); }
}

/* Tablet dikey */
@media (min-width: 768px) and (max-width: 1023px) {
    .hub-grid {
        grid-template-columns: repeat(3, 1fr);
        max-width: 720px;
        gap: var(--space-lg);
    }

    .memory-grid.grid-2x2 { grid-template-columns: repeat(2, 110px); }
    .memory-grid.grid-3x4 { grid-template-columns: repeat(4, 100px); }
    .memory-grid.grid-4x4 { grid-template-columns: repeat(4, 95px); }
}

/* Büyük telefon */
@media (min-width: 480px) and (max-width: 767px) {
    .hub-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-md);
        padding: var(--space-lg) var(--space-md);
    }

    .card-icon {
        width: 72px;
        height: 72px;
        font-size: 2.5rem;
    }

    .card-title { font-size: 0.9rem; }

    .sun { width: 60px; height: 60px; }

    .memory-grid.grid-2x2 { grid-template-columns: repeat(2, 100px); }
    .memory-grid.grid-3x4 { grid-template-columns: repeat(4, 80px); }
    .memory-grid.grid-4x4 { grid-template-columns: repeat(4, 75px); }

    .game-instruction { font-size: 1rem; }

    .letter-display { font-size: 4rem; }
}

/* Küçük telefon */
@media (max-width: 479px) {
    .hub-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-sm);
        padding: var(--space-md) var(--space-sm);
    }

    .game-card {
        padding: var(--space-md) var(--space-sm) var(--space-sm);
        border-radius: var(--radius-md);
    }

    .card-icon {
        width: 60px;
        height: 60px;
        font-size: 2rem;
        border-radius: var(--radius-sm);
    }

    .card-title { font-size: 0.95rem; }
    .card-stars svg { width: 18px; height: 18px; }

    .top-title { font-size: 1.1rem; }
    .star-counter { padding: 6px 10px; font-size: 0.95rem; }

    .sun { width: 50px; height: 50px; top: 5%; right: 5%; }

    .memory-grid.grid-2x2 { grid-template-columns: repeat(2, 80px); }
    .memory-grid.grid-3x4 { grid-template-columns: repeat(4, 65px); }
    .memory-grid.grid-4x4 { grid-template-columns: repeat(4, 60px); }

    .game-instruction {
        font-size: 0.9rem;
        padding: var(--space-xs) var(--space-md);
    }

    .letter-display { font-size: 3.5rem; }

    .color-swatch { width: 40px; height: 40px; }

    .number-btn { width: 52px; height: 52px; font-size: 1.3rem; }

    .complete-card { padding: var(--space-lg); }
    .complete-stars .star { width: 45px; height: 45px; }
    .complete-btn { font-size: 0.95rem; padding: 10px 20px; min-width: 110px; }

    .sorting-slot { min-width: 60px; min-height: 60px; font-size: 1.5rem; }
}

/* Landscape küçük cihaz */
@media (max-height: 500px) and (orientation: landscape) {
    .hub { padding-top: 54px; }
    .top-bar { height: 54px; }
    .game-toolbar { height: 46px; }
    .game-area { top: 46px; padding: var(--space-sm); }

    .hub-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: var(--space-sm);
        padding: var(--space-md);
    }

    .card-icon { width: 50px; height: 50px; font-size: 1.8rem; }
    .card-title { font-size: 0.8rem; }
    .game-card { padding: var(--space-sm); }

    .game-instruction { margin-bottom: var(--space-sm); font-size: 0.9rem; }
    .letter-display { font-size: 3rem; }
    .color-target { width: 60px; height: 60px; }

    .complete-card { padding: var(--space-md) var(--space-lg); }
    .complete-title { font-size: 1.5rem; margin-bottom: var(--space-sm); }
    .complete-stars { margin-bottom: var(--space-md); }
    .complete-stars .star { width: 40px; height: 40px; }
}

/* ── Yeni Oyunlar Mobil Uyumluluk ── */

/* Kod Macerası MP: mobilde yan yana yerine üst-alt stack */
@media (max-width: 550px) {
    .kod-mp-row {
        flex-direction: column;
        gap: 0.3rem;
    }
    .kod-mp-left, .kod-mp-right {
        width: 100%;
        max-width: 100%;
    }
    .kod-mp-left .kod-block-btn { width: 38px; height: 38px; }
    .kod-mp-left .kod-palette { gap: 5px; }
    .kod-mp-row .kod-cell {
        width: clamp(28px, 12vw, 48px);
        height: clamp(28px, 12vw, 48px);
        font-size: 0.9rem;
    }
}

/* Satranç: küçük ekranlar */
@media (max-width: 400px) {
    .chess-board { width: clamp(260px, 92vw, 360px); }
    .chess-undo-btn { font-size: 0.75rem; padding: 5px 14px; }
    .chess-piece { width: 80%; height: 80%; }
}

/* Penaltı: mobil */
@media (max-width: 480px) {
    .pen-topbar { padding: 0.3rem 0.5rem; }
    .pen-shot-info { font-size: 0.85rem; padding: 4px 10px; }
    .pen-score-info { font-size: 0.9rem; padding: 4px 12px; }
}

/* Tuval: küçük ekranlar */
@media (max-width: 400px) {
    .tuval-swatch { width: 26px; height: 26px; border-radius: 6px; }
    .tuval-palette { gap: 4px; }
    .tuval-tool-btn { font-size: 0.7rem; padding: 6px 10px; }
    .tuval-lv-btn { padding: 4px 12px; font-size: 0.75rem; }
    .tuval-10 { width: 92vw; height: 92vw; }
    .tuval-15 { width: 94vw; height: 94vw; }
    .tuval-20 { width: 96vw; height: 96vw; }
}

/* Boyama galeri: küçük ekranlar */
@media (max-width: 380px) {
    .boyama-gallery { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .boyama-gallery-emoji { font-size: 1.6rem; }
    .boyama-gallery-name { font-size: 0.65rem; }
    .boyama-gallery-card { padding: 8px 4px; }
}

/* Genel mobil: game area overflow korunma */
@media (max-width: 480px) {
    .game-area { overflow-x: hidden; }
    .game-instruction { font-size: 0.85rem; padding: 0.3rem 0.5rem; }
    .kod-gameover-card { padding: 1.5rem 1rem; }
    .kod-gameover-title { font-size: 1.4rem; }
    .kod-gameover-pts { font-size: 1.6rem; }
    .kod-round-card { padding: 1.5rem; }
    .kod-round-card h2 { font-size: 1.2rem; }
    .kod-round-score { font-size: 1.8rem; }
}

/* Çok küçük ekran (iPhone SE 320px) */
@media (max-width: 340px) {
    .hub-grid { gap: 6px; padding: 0.5rem; }
    .game-card { padding: 0.6rem 0.4rem; }
    .card-icon { width: 50px; height: 50px; }
    .card-title { font-size: 0.75rem; }
    .chess-board { width: 95vw; }
    .kod-block-btn { width: 36px; height: 36px; }
    .kod-cell { font-size: 0.7rem; }
    .penalti-scene { border-radius: 8px; }
}

/* Safe area (notch desteği) */
@supports (padding-top: env(safe-area-inset-top)) {
    .top-bar {
        padding-top: env(safe-area-inset-top);
        height: calc(64px + env(safe-area-inset-top));
    }
    .hub { padding-top: calc(130px + env(safe-area-inset-top)); }
    .game-area { bottom: env(safe-area-inset-bottom); }
}
