@keyframes pulse-green {
    0% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.1); }
    100% { transform: translate(-50%, -50%) scale(1); }
}
@keyframes glow {
    from { filter: drop-shadow(0 0 2px rgba(34, 197, 94, 0.4)); }
    to { filter: drop-shadow(0 0 8px rgba(34, 197, 94, 0.8)); }
}
/* Mobile */
@media screen and (max-width: 1024px) {
    .card {
        margin-bottom: 0;
    }
    .builder-layout {
        flex-direction: column; /* Chuyển thành hàng dọc */
    }

    .formation-section, .inventory-section {
        flex: unset;
        width: 100%;
        min-width: unset;
    }

    .inventory-section {
        max-height: 500px; /* Thu gọn kho cầu thủ */
        margin-top: 0;
    }

    .inventory-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr) !important; 
        gap: 12px; 
        padding: 10px;
    }

    .pitch-container {
        height: 480px; /* Thu nhỏ sân một chút */
    }

    .pitch-slot {
        width: 55px;
        height: 55px;
    }

    .pitch-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    .pitch-info-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

@media screen and (max-width: 480px) {
    .inventory-grid {
        grid-template-columns: repeat(3, 1fr); /* 3 cột card nhỏ trên điện thoại đứng */
    }
    
    .inventory-card .name {
        font-size: 0.7rem;
    }
}

/* --- RESPONSIVE CHO MOBILE --- */
@media screen and (max-width: 768px) {
    .pitch-header {
        padding: 12px;
        margin: -15px -15px 15px -15px; /* Điều chỉnh lại margin cho khớp card mobile */
        flex-direction: column; /* Xếp chồng theo chiều dọc */
        align-items: stretch; /* Dãn đều các phần tử */
        gap: 12px;
    }

    .pitch-info-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .pitch-title {
        width: 100%;
        justify-content: center; /* Căn giữa tiêu đề trên mobile */
    }

    /* Team Stats Summary: Dàn hàng ngang đều nhau trên mobile */
    .team-stats-summary {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr; /* Chia đôi OVR và Cost */
        gap: 10px;
        background: #f8fafc;
        padding: 10px;
        border-radius: 8px;
    }

    .stat-item {
        text-align: center;
        border-right: 1px solid #e2e8f0;
    }

    .stat-item:last-child {
        border-right: none;
    }

    /* Bộ chọn sơ đồ dãn 100% width trên mobile */
    .pitch-controls {
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: #f1f5f9;
        padding: 8px 12px;
        border-radius: 8px;
    }

    .custom-select {
        flex: 1;
        margin-left: 10px;
        max-width: 150px; /* Tránh select quá dài lấn át label */
    }
    .pitch-wrapper {
        padding: 0;
    }
}

/* Đặc trị cho màn hình cực hẹp (Z Fold / iPhone SE) */
@media screen and (max-width: 350px) {
    .pitch-title h2 {
        font-size: 0.9rem;
    }
    
    .team-stats-summary .value {
        font-size: 0.9rem;
    }
    
    .stat-item .label {
        font-size: 0.6rem;
    }
}